| 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/download_feedback.h" | 5 #include "chrome/browser/safe_browsing/download_feedback.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_util_proxy.h" | 8 #include "base/files/file_util_proxy.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/task_runner.h" | 10 #include "base/task_runner.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 // Handles the uploading of a single downloaded binary to the safebrowsing | 32 // Handles the uploading of a single downloaded binary to the safebrowsing |
| 33 // download feedback service. | 33 // download feedback service. |
| 34 class DownloadFeedbackImpl : public DownloadFeedback { | 34 class DownloadFeedbackImpl : public DownloadFeedback { |
| 35 public: | 35 public: |
| 36 DownloadFeedbackImpl(net::URLRequestContextGetter* request_context_getter, | 36 DownloadFeedbackImpl(net::URLRequestContextGetter* request_context_getter, |
| 37 base::TaskRunner* file_task_runner, | 37 base::TaskRunner* file_task_runner, |
| 38 const base::FilePath& file_path, | 38 const base::FilePath& file_path, |
| 39 const std::string& ping_request, | 39 const std::string& ping_request, |
| 40 const std::string& ping_response); | 40 const std::string& ping_response); |
| 41 virtual ~DownloadFeedbackImpl(); | 41 ~DownloadFeedbackImpl() override; |
| 42 | 42 |
| 43 virtual void Start(const base::Closure& finish_callback) override; | 43 void Start(const base::Closure& finish_callback) override; |
| 44 | 44 |
| 45 virtual const std::string& GetPingRequestForTesting() const override { | 45 const std::string& GetPingRequestForTesting() const override { |
| 46 return ping_request_; | 46 return ping_request_; |
| 47 } | 47 } |
| 48 | 48 |
| 49 virtual const std::string& GetPingResponseForTesting() const override { | 49 const std::string& GetPingResponseForTesting() const override { |
| 50 return ping_response_; | 50 return ping_response_; |
| 51 } | 51 } |
| 52 | 52 |
| 53 private: | 53 private: |
| 54 // Callback for TwoPhaseUploader completion. Relays the result to the | 54 // Callback for TwoPhaseUploader completion. Relays the result to the |
| 55 // |finish_callback|. | 55 // |finish_callback|. |
| 56 void FinishedUpload(base::Closure finish_callback, | 56 void FinishedUpload(base::Closure finish_callback, |
| 57 TwoPhaseUploader::State state, | 57 TwoPhaseUploader::State state, |
| 58 int net_error, | 58 int net_error, |
| 59 int response_code, | 59 int response_code, |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 return new DownloadFeedbackImpl( | 212 return new DownloadFeedbackImpl( |
| 213 request_context_getter, file_task_runner, file_path, ping_request, | 213 request_context_getter, file_task_runner, file_path, ping_request, |
| 214 ping_response); | 214 ping_response); |
| 215 return DownloadFeedback::factory_->CreateDownloadFeedback( | 215 return DownloadFeedback::factory_->CreateDownloadFeedback( |
| 216 request_context_getter, file_task_runner, file_path, ping_request, | 216 request_context_getter, file_task_runner, file_path, ping_request, |
| 217 ping_response); | 217 ping_response); |
| 218 } | 218 } |
| 219 | 219 |
| 220 } // namespace safe_browsing | 220 } // namespace safe_browsing |
| 221 | 221 |
| OLD | NEW |