| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/files/file_util_proxy.h" | 9 #include "base/files/file_util_proxy.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| 11 #include "base/supports_user_data.h" | 11 #include "base/supports_user_data.h" |
| 12 #include "base/task_runner.h" | 12 #include "base/task_runner.h" |
| 13 #include "chrome/browser/safe_browsing/download_feedback.h" | 13 #include "chrome/browser/safe_browsing/download_feedback.h" |
| 14 #include "content/public/browser/download_danger_type.h" | 14 #include "content/public/browser/download_danger_type.h" |
| 15 #include "content/public/browser/download_item.h" | 15 #include "content/public/browser/download_item.h" |
| 16 | 16 |
| 17 namespace safe_browsing { | 17 namespace safe_browsing { |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 const void* kPingKey = &kPingKey; | 21 const void* const kPingKey = &kPingKey; |
| 22 | 22 |
| 23 class DownloadFeedbackPings : public base::SupportsUserData::Data { | 23 class DownloadFeedbackPings : public base::SupportsUserData::Data { |
| 24 public: | 24 public: |
| 25 DownloadFeedbackPings(const std::string& ping_request, | 25 DownloadFeedbackPings(const std::string& ping_request, |
| 26 const std::string& ping_response); | 26 const std::string& ping_response); |
| 27 | 27 |
| 28 // Stores the ping data in the given |download|. | 28 // Stores the ping data in the given |download|. |
| 29 static void CreateForDownload(content::DownloadItem* download, | 29 static void CreateForDownload(content::DownloadItem* download, |
| 30 const std::string& ping_request, | 30 const std::string& ping_request, |
| 31 const std::string& ping_response); | 31 const std::string& ping_response); |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 void DownloadFeedbackService::FeedbackComplete() { | 195 void DownloadFeedbackService::FeedbackComplete() { |
| 196 DVLOG(1) << __FUNCTION__; | 196 DVLOG(1) << __FUNCTION__; |
| 197 DCHECK(CalledOnValidThread()); | 197 DCHECK(CalledOnValidThread()); |
| 198 DCHECK(!active_feedback_.empty()); | 198 DCHECK(!active_feedback_.empty()); |
| 199 active_feedback_.erase(active_feedback_.begin()); | 199 active_feedback_.erase(active_feedback_.begin()); |
| 200 if (!active_feedback_.empty()) | 200 if (!active_feedback_.empty()) |
| 201 StartPendingFeedback(); | 201 StartPendingFeedback(); |
| 202 } | 202 } |
| 203 | 203 |
| 204 } // namespace safe_browsing | 204 } // namespace safe_browsing |
| OLD | NEW |