| 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_service.h" | 5 #include "chrome/browser/safe_browsing/download_feedback_service.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 9 #include "base/files/file_util_proxy.h" | 11 #include "base/files/file_util_proxy.h" |
| 10 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
| 11 #include "base/supports_user_data.h" | 13 #include "base/supports_user_data.h" |
| 12 #include "base/task_runner.h" | 14 #include "base/task_runner.h" |
| 13 #include "chrome/browser/safe_browsing/download_feedback.h" | 15 #include "chrome/browser/safe_browsing/download_feedback.h" |
| 14 #include "content/public/browser/download_danger_type.h" | 16 #include "content/public/browser/download_danger_type.h" |
| 15 #include "content/public/browser/download_item.h" | 17 #include "content/public/browser/download_item.h" |
| 16 | 18 |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 const std::string& ping_request, | 186 const std::string& ping_request, |
| 185 const std::string& ping_response, | 187 const std::string& ping_response, |
| 186 const base::FilePath& path) { | 188 const base::FilePath& path) { |
| 187 DCHECK(CalledOnValidThread()); | 189 DCHECK(CalledOnValidThread()); |
| 188 scoped_ptr<DownloadFeedback> feedback( | 190 scoped_ptr<DownloadFeedback> feedback( |
| 189 DownloadFeedback::Create(request_context_getter_.get(), | 191 DownloadFeedback::Create(request_context_getter_.get(), |
| 190 file_task_runner_.get(), | 192 file_task_runner_.get(), |
| 191 path, | 193 path, |
| 192 ping_request, | 194 ping_request, |
| 193 ping_response)); | 195 ping_response)); |
| 194 active_feedback_.push_back(feedback.Pass()); | 196 active_feedback_.push_back(std::move(feedback)); |
| 195 UMA_HISTOGRAM_COUNTS_100("SBDownloadFeedback.ActiveFeedbacks", | 197 UMA_HISTOGRAM_COUNTS_100("SBDownloadFeedback.ActiveFeedbacks", |
| 196 active_feedback_.size()); | 198 active_feedback_.size()); |
| 197 | 199 |
| 198 if (active_feedback_.size() == 1) | 200 if (active_feedback_.size() == 1) |
| 199 StartPendingFeedback(); | 201 StartPendingFeedback(); |
| 200 } | 202 } |
| 201 | 203 |
| 202 void DownloadFeedbackService::FeedbackComplete() { | 204 void DownloadFeedbackService::FeedbackComplete() { |
| 203 DVLOG(1) << __FUNCTION__; | 205 DVLOG(1) << __FUNCTION__; |
| 204 DCHECK(CalledOnValidThread()); | 206 DCHECK(CalledOnValidThread()); |
| 205 DCHECK(!active_feedback_.empty()); | 207 DCHECK(!active_feedback_.empty()); |
| 206 active_feedback_.erase(active_feedback_.begin()); | 208 active_feedback_.erase(active_feedback_.begin()); |
| 207 if (!active_feedback_.empty()) | 209 if (!active_feedback_.empty()) |
| 208 StartPendingFeedback(); | 210 StartPendingFeedback(); |
| 209 } | 211 } |
| 210 | 212 |
| 211 } // namespace safe_browsing | 213 } // namespace safe_browsing |
| OLD | NEW |