OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_SAFE_BROWSING_TWO_PHASE_UPLOADER_H_ | 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_TWO_PHASE_UPLOADER_H_ |
6 #define CHROME_BROWSER_SAFE_BROWSING_TWO_PHASE_UPLOADER_H_ | 6 #define CHROME_BROWSER_SAFE_BROWSING_TWO_PHASE_UPLOADER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 const std::string& response_data)> FinishCallback; | 47 const std::string& response_data)> FinishCallback; |
48 | 48 |
49 virtual ~TwoPhaseUploader() {} | 49 virtual ~TwoPhaseUploader() {} |
50 | 50 |
51 // Create the uploader. The Start method must be called to begin the upload. | 51 // Create the uploader. The Start method must be called to begin the upload. |
52 // Network processing will use |url_request_context_getter|. | 52 // Network processing will use |url_request_context_getter|. |
53 // The uploaded |file_path| will be read on |file_task_runner|. | 53 // The uploaded |file_path| will be read on |file_task_runner|. |
54 // The first phase request will be sent to |base_url|, with |metadata| | 54 // The first phase request will be sent to |base_url|, with |metadata| |
55 // included. | 55 // included. |
56 // |progress_callback| will be called periodically as the second phase | 56 // |progress_callback| will be called periodically as the second phase |
57 // progresses. | 57 // progresses, if it is non-null. |
58 // On success |finish_callback| will be called with state = STATE_SUCCESS and | 58 // On success |finish_callback| will be called with state = STATE_SUCCESS and |
59 // the server response in response_data. On failure, state will specify | 59 // the server response in response_data. On failure, state will specify |
60 // which step the failure occurred in, and net_error, response_code, and | 60 // which step the failure occurred in, and net_error, response_code, and |
61 // response_data will specify information about the error. |finish_callback| | 61 // response_data will specify information about the error. |finish_callback| |
62 // will not be called if the upload is cancelled by destructing the | 62 // will not be called if the upload is cancelled by destructing the |
63 // TwoPhaseUploader object before completion. | 63 // TwoPhaseUploader object before completion. |
64 static TwoPhaseUploader* Create( | 64 static TwoPhaseUploader* Create( |
65 net::URLRequestContextGetter* url_request_context_getter, | 65 net::URLRequestContextGetter* url_request_context_getter, |
66 base::TaskRunner* file_task_runner, | 66 base::TaskRunner* file_task_runner, |
67 const GURL& base_url, | 67 const GURL& base_url, |
(...skipping 25 matching lines...) Expand all Loading... |
93 net::URLRequestContextGetter* url_request_context_getter, | 93 net::URLRequestContextGetter* url_request_context_getter, |
94 base::TaskRunner* file_task_runner, | 94 base::TaskRunner* file_task_runner, |
95 const GURL& base_url, | 95 const GURL& base_url, |
96 const std::string& metadata, | 96 const std::string& metadata, |
97 const base::FilePath& file_path, | 97 const base::FilePath& file_path, |
98 const TwoPhaseUploader::ProgressCallback& progress_callback, | 98 const TwoPhaseUploader::ProgressCallback& progress_callback, |
99 const TwoPhaseUploader::FinishCallback& finish_callback) = 0; | 99 const TwoPhaseUploader::FinishCallback& finish_callback) = 0; |
100 }; | 100 }; |
101 | 101 |
102 #endif // CHROME_BROWSER_SAFE_BROWSING_TWO_PHASE_UPLOADER_H_ | 102 #endif // CHROME_BROWSER_SAFE_BROWSING_TWO_PHASE_UPLOADER_H_ |
OLD | NEW |