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 <stdint.h> |
| 9 |
8 #include <string> | 10 #include <string> |
9 | 11 |
10 #include "base/callback.h" | 12 #include "base/callback.h" |
11 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
12 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
13 #include "base/threading/non_thread_safe.h" | 15 #include "base/threading/non_thread_safe.h" |
14 #include "net/url_request/url_request_context_getter.h" | 16 #include "net/url_request/url_request_context_getter.h" |
15 #include "url/gurl.h" | 17 #include "url/gurl.h" |
16 | 18 |
17 namespace base { | 19 namespace base { |
(...skipping 14 matching lines...) Expand all Loading... |
32 // api-version and authorization headers. | 34 // api-version and authorization headers. |
33 // TODO(mattm): support retry / resume. | 35 // TODO(mattm): support retry / resume. |
34 class TwoPhaseUploader : public base::NonThreadSafe { | 36 class TwoPhaseUploader : public base::NonThreadSafe { |
35 public: | 37 public: |
36 enum State { | 38 enum State { |
37 STATE_NONE, | 39 STATE_NONE, |
38 UPLOAD_METADATA, | 40 UPLOAD_METADATA, |
39 UPLOAD_FILE, | 41 UPLOAD_FILE, |
40 STATE_SUCCESS, | 42 STATE_SUCCESS, |
41 }; | 43 }; |
42 typedef base::Callback<void(int64 sent, int64 total)> ProgressCallback; | 44 typedef base::Callback<void(int64_t sent, int64_t total)> ProgressCallback; |
43 typedef base::Callback<void(State state, | 45 typedef base::Callback<void(State state, |
44 int net_error, | 46 int net_error, |
45 int response_code, | 47 int response_code, |
46 const std::string& response_data)> FinishCallback; | 48 const std::string& response_data)> FinishCallback; |
47 | 49 |
48 virtual ~TwoPhaseUploader() {} | 50 virtual ~TwoPhaseUploader() {} |
49 | 51 |
50 // Create the uploader. The Start method must be called to begin the upload. | 52 // Create the uploader. The Start method must be called to begin the upload. |
51 // Network processing will use |url_request_context_getter|. | 53 // Network processing will use |url_request_context_getter|. |
52 // The uploaded |file_path| will be read on |file_task_runner|. | 54 // The uploaded |file_path| will be read on |file_task_runner|. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 net::URLRequestContextGetter* url_request_context_getter, | 94 net::URLRequestContextGetter* url_request_context_getter, |
93 base::TaskRunner* file_task_runner, | 95 base::TaskRunner* file_task_runner, |
94 const GURL& base_url, | 96 const GURL& base_url, |
95 const std::string& metadata, | 97 const std::string& metadata, |
96 const base::FilePath& file_path, | 98 const base::FilePath& file_path, |
97 const TwoPhaseUploader::ProgressCallback& progress_callback, | 99 const TwoPhaseUploader::ProgressCallback& progress_callback, |
98 const TwoPhaseUploader::FinishCallback& finish_callback) = 0; | 100 const TwoPhaseUploader::FinishCallback& finish_callback) = 0; |
99 }; | 101 }; |
100 | 102 |
101 #endif // CHROME_BROWSER_SAFE_BROWSING_TWO_PHASE_UPLOADER_H_ | 103 #endif // CHROME_BROWSER_SAFE_BROWSING_TWO_PHASE_UPLOADER_H_ |
OLD | NEW |