OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Helper class which handles communication with the SafeBrowsing servers for | 5 // Helper class which handles communication with the SafeBrowsing servers for |
6 // improved binary download protection. | 6 // improved binary download protection. |
7 | 7 |
8 #ifndef CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_SERVICE_H_ | 8 #ifndef CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_SERVICE_H_ |
9 #define CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_SERVICE_H_ | 9 #define CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_SERVICE_H_ |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 class DownloadItem; | 26 class DownloadItem; |
27 class PageNavigator; | 27 class PageNavigator; |
28 } | 28 } |
29 | 29 |
30 namespace net { | 30 namespace net { |
31 class URLRequestContextGetter; | 31 class URLRequestContextGetter; |
32 class X509Certificate; | 32 class X509Certificate; |
33 } // namespace net | 33 } // namespace net |
34 | 34 |
35 namespace safe_browsing { | 35 namespace safe_browsing { |
| 36 class DownloadFeedbackService; |
36 class SignatureUtil; | 37 class SignatureUtil; |
37 | 38 |
38 // This class provides an asynchronous API to check whether a particular | 39 // This class provides an asynchronous API to check whether a particular |
39 // client download is malicious or not. | 40 // client download is malicious or not. |
40 class DownloadProtectionService { | 41 class DownloadProtectionService { |
41 public: | 42 public: |
42 enum DownloadCheckResult { | 43 enum DownloadCheckResult { |
43 SAFE, | 44 SAFE, |
44 DANGEROUS, | 45 DANGEROUS, |
45 UNCOMMON, | 46 UNCOMMON, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 94 |
94 bool enabled() const { | 95 bool enabled() const { |
95 return enabled_; | 96 return enabled_; |
96 } | 97 } |
97 | 98 |
98 // Returns the timeout that is used by CheckClientDownload(). | 99 // Returns the timeout that is used by CheckClientDownload(). |
99 int64 download_request_timeout_ms() const { | 100 int64 download_request_timeout_ms() const { |
100 return download_request_timeout_ms_; | 101 return download_request_timeout_ms_; |
101 } | 102 } |
102 | 103 |
| 104 DownloadFeedbackService* feedback_service() { |
| 105 return feedback_service_.get(); |
| 106 } |
| 107 |
103 protected: | 108 protected: |
104 // Enum to keep track why a particular download verdict was chosen. | 109 // Enum to keep track why a particular download verdict was chosen. |
105 // This is used to keep some stats around. | 110 // This is used to keep some stats around. |
106 enum DownloadCheckResultReason { | 111 enum DownloadCheckResultReason { |
107 REASON_INVALID_URL, | 112 REASON_INVALID_URL, |
108 REASON_SB_DISABLED, | 113 REASON_SB_DISABLED, |
109 REASON_WHITELISTED_URL, | 114 REASON_WHITELISTED_URL, |
110 REASON_WHITELISTED_REFERRER, | 115 REASON_WHITELISTED_REFERRER, |
111 REASON_INVALID_REQUEST_PROTO, | 116 REASON_INVALID_REQUEST_PROTO, |
112 REASON_SERVER_PING_FAILED, | 117 REASON_SERVER_PING_FAILED, |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 std::set<scoped_refptr<CheckClientDownloadRequest> > download_requests_; | 184 std::set<scoped_refptr<CheckClientDownloadRequest> > download_requests_; |
180 | 185 |
181 // Keeps track of the state of the service. | 186 // Keeps track of the state of the service. |
182 bool enabled_; | 187 bool enabled_; |
183 | 188 |
184 // SignatureUtil object, may be overridden for testing. | 189 // SignatureUtil object, may be overridden for testing. |
185 scoped_refptr<SignatureUtil> signature_util_; | 190 scoped_refptr<SignatureUtil> signature_util_; |
186 | 191 |
187 int64 download_request_timeout_ms_; | 192 int64 download_request_timeout_ms_; |
188 | 193 |
| 194 scoped_ptr<DownloadFeedbackService> feedback_service_; |
| 195 |
189 DISALLOW_COPY_AND_ASSIGN(DownloadProtectionService); | 196 DISALLOW_COPY_AND_ASSIGN(DownloadProtectionService); |
190 }; | 197 }; |
191 } // namespace safe_browsing | 198 } // namespace safe_browsing |
192 | 199 |
193 #endif // CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_SERVICE_H_ | 200 #endif // CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_SERVICE_H_ |
OLD | NEW |