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 #include "chrome/browser/safe_browsing/two_phase_uploader.h" | 5 #include "chrome/browser/safe_browsing/two_phase_uploader.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/task_runner.h" | 9 #include "base/task_runner.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 TwoPhaseUploaderImpl(net::URLRequestContextGetter* url_request_context_getter, | 29 TwoPhaseUploaderImpl(net::URLRequestContextGetter* url_request_context_getter, |
30 base::TaskRunner* file_task_runner, | 30 base::TaskRunner* file_task_runner, |
31 const GURL& base_url, | 31 const GURL& base_url, |
32 const std::string& metadata, | 32 const std::string& metadata, |
33 const base::FilePath& file_path, | 33 const base::FilePath& file_path, |
34 const ProgressCallback& progress_callback, | 34 const ProgressCallback& progress_callback, |
35 const FinishCallback& finish_callback); | 35 const FinishCallback& finish_callback); |
36 virtual ~TwoPhaseUploaderImpl(); | 36 virtual ~TwoPhaseUploaderImpl(); |
37 | 37 |
38 // Begins the upload process. | 38 // Begins the upload process. |
39 virtual void Start() OVERRIDE; | 39 virtual void Start() override; |
40 | 40 |
41 // net::URLFetcherDelegate implementation: | 41 // net::URLFetcherDelegate implementation: |
42 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; | 42 virtual void OnURLFetchComplete(const net::URLFetcher* source) override; |
43 virtual void OnURLFetchUploadProgress(const net::URLFetcher* source, | 43 virtual void OnURLFetchUploadProgress(const net::URLFetcher* source, |
44 int64 current, | 44 int64 current, |
45 int64 total) OVERRIDE; | 45 int64 total) override; |
46 | 46 |
47 private: | 47 private: |
48 void UploadMetadata(); | 48 void UploadMetadata(); |
49 void UploadFile(); | 49 void UploadFile(); |
50 void Finish(int net_error, int response_code, const std::string& response); | 50 void Finish(int net_error, int response_code, const std::string& response); |
51 | 51 |
52 State state_; | 52 State state_; |
53 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; | 53 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; |
54 scoped_refptr<base::TaskRunner> file_task_runner_; | 54 scoped_refptr<base::TaskRunner> file_task_runner_; |
55 GURL base_url_; | 55 GURL base_url_; |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 const ProgressCallback& progress_callback, | 202 const ProgressCallback& progress_callback, |
203 const FinishCallback& finish_callback) { | 203 const FinishCallback& finish_callback) { |
204 if (!TwoPhaseUploader::factory_) | 204 if (!TwoPhaseUploader::factory_) |
205 return new TwoPhaseUploaderImpl( | 205 return new TwoPhaseUploaderImpl( |
206 url_request_context_getter, file_task_runner, base_url, metadata, | 206 url_request_context_getter, file_task_runner, base_url, metadata, |
207 file_path, progress_callback, finish_callback); | 207 file_path, progress_callback, finish_callback); |
208 return TwoPhaseUploader::factory_->CreateTwoPhaseUploader( | 208 return TwoPhaseUploader::factory_->CreateTwoPhaseUploader( |
209 url_request_context_getter, file_task_runner, base_url, metadata, | 209 url_request_context_getter, file_task_runner, base_url, metadata, |
210 file_path, progress_callback, finish_callback); | 210 file_path, progress_callback, finish_callback); |
211 } | 211 } |
OLD | NEW |