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_DOWNLOAD_FEEDBACK_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_FEEDBACK_SERVICE_H_ |
6 #define CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_FEEDBACK_SERVICE_H_ | 6 #define CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_FEEDBACK_SERVICE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <queue> | 9 #include <queue> |
10 #include <string> | 10 #include <string> |
(...skipping 25 matching lines...) Expand all Loading... | |
36 // Lives on the UI thread. | 36 // Lives on the UI thread. |
37 class DownloadFeedbackService { | 37 class DownloadFeedbackService { |
38 public: | 38 public: |
39 DownloadFeedbackService(net::URLRequestContextGetter* request_context_getter, | 39 DownloadFeedbackService(net::URLRequestContextGetter* request_context_getter, |
40 base::TaskRunner* file_task_runner); | 40 base::TaskRunner* file_task_runner); |
41 ~DownloadFeedbackService(); | 41 ~DownloadFeedbackService(); |
42 | 42 |
43 // Stores the request and response ping data from the download check, if the | 43 // Stores the request and response ping data from the download check, if the |
44 // check result and file size are eligible. This must be called after a | 44 // check result and file size are eligible. This must be called after a |
45 // download has been flagged as malicious in order for the download to be | 45 // download has been flagged as malicious in order for the download to be |
46 // enabled for uploading. | 46 // enabled for uploading. Some "unknown" verdict files can be marked for |
47 // upload by the server with |upload_requested| if it's needed for better | |
Jialiu Lin
2017/02/15 00:45:27
nit: Do we need to mention "Unknown" verdict in th
Nathan Parker
2017/02/15 01:38:04
good point. The plan is that the backend will onl
| |
48 // classification. | |
47 static void MaybeStorePingsForDownload( | 49 static void MaybeStorePingsForDownload( |
48 DownloadProtectionService::DownloadCheckResult result, | 50 DownloadProtectionService::DownloadCheckResult result, |
51 bool upload_requested, | |
49 content::DownloadItem* download, | 52 content::DownloadItem* download, |
50 const std::string& ping, | 53 const std::string& ping, |
51 const std::string& response); | 54 const std::string& response); |
52 | 55 |
53 // Test if pings have been stored for |download|. | 56 // Test if pings have been stored for |download|. |
54 static bool IsEnabledForDownload(const content::DownloadItem& download); | 57 static bool IsEnabledForDownload(const content::DownloadItem& download); |
55 | 58 |
56 // Get the ping values stored in |download|. Returns false if no ping values | 59 // Get the ping values stored in |download|. Returns false if no ping values |
57 // are present. | 60 // are present. |
58 static bool GetPingsForDownloadForTesting( | 61 static bool GetPingsForDownloadForTesting( |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
90 // items are pending. | 93 // items are pending. |
91 std::queue<std::unique_ptr<DownloadFeedback>> active_feedback_; | 94 std::queue<std::unique_ptr<DownloadFeedback>> active_feedback_; |
92 | 95 |
93 base::WeakPtrFactory<DownloadFeedbackService> weak_ptr_factory_; | 96 base::WeakPtrFactory<DownloadFeedbackService> weak_ptr_factory_; |
94 | 97 |
95 DISALLOW_COPY_AND_ASSIGN(DownloadFeedbackService); | 98 DISALLOW_COPY_AND_ASSIGN(DownloadFeedbackService); |
96 }; | 99 }; |
97 } // namespace safe_browsing | 100 } // namespace safe_browsing |
98 | 101 |
99 #endif // CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_FEEDBACK_SERVICE_H_ | 102 #endif // CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_FEEDBACK_SERVICE_H_ |
OLD | NEW |