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 27 matching lines...) Expand all Loading... |
38 | 38 |
39 // This class provides an asynchronous API to check whether a particular | 39 // This class provides an asynchronous API to check whether a particular |
40 // client download is malicious or not. | 40 // client download is malicious or not. |
41 class DownloadProtectionService { | 41 class DownloadProtectionService { |
42 public: | 42 public: |
43 enum DownloadCheckResult { | 43 enum DownloadCheckResult { |
44 SAFE, | 44 SAFE, |
45 DANGEROUS, | 45 DANGEROUS, |
46 UNCOMMON, | 46 UNCOMMON, |
47 DANGEROUS_HOST, | 47 DANGEROUS_HOST, |
| 48 POTENTIALLY_UNWANTED |
48 }; | 49 }; |
49 | 50 |
50 // Callback type which is invoked once the download request is done. | 51 // Callback type which is invoked once the download request is done. |
51 typedef base::Callback<void(DownloadCheckResult)> CheckDownloadCallback; | 52 typedef base::Callback<void(DownloadCheckResult)> CheckDownloadCallback; |
52 | 53 |
53 // Creates a download service. The service is initially disabled. You need | 54 // Creates a download service. The service is initially disabled. You need |
54 // to call SetEnabled() to start it. |sb_service| owns this object; we | 55 // to call SetEnabled() to start it. |sb_service| owns this object; we |
55 // keep a reference to |request_context_getter|. | 56 // keep a reference to |request_context_getter|. |
56 DownloadProtectionService( | 57 DownloadProtectionService( |
57 SafeBrowsingService* sb_service, | 58 SafeBrowsingService* sb_service, |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 REASON_EMPTY_URL_CHAIN, | 124 REASON_EMPTY_URL_CHAIN, |
124 DEPRECATED_REASON_HTTPS_URL, | 125 DEPRECATED_REASON_HTTPS_URL, |
125 REASON_PING_DISABLED, | 126 REASON_PING_DISABLED, |
126 REASON_TRUSTED_EXECUTABLE, | 127 REASON_TRUSTED_EXECUTABLE, |
127 REASON_OS_NOT_SUPPORTED, | 128 REASON_OS_NOT_SUPPORTED, |
128 REASON_DOWNLOAD_UNCOMMON, | 129 REASON_DOWNLOAD_UNCOMMON, |
129 REASON_DOWNLOAD_NOT_SUPPORTED, | 130 REASON_DOWNLOAD_NOT_SUPPORTED, |
130 REASON_INVALID_RESPONSE_VERDICT, | 131 REASON_INVALID_RESPONSE_VERDICT, |
131 REASON_ARCHIVE_WITHOUT_BINARIES, | 132 REASON_ARCHIVE_WITHOUT_BINARIES, |
132 REASON_DOWNLOAD_DANGEROUS_HOST, | 133 REASON_DOWNLOAD_DANGEROUS_HOST, |
| 134 REASON_DOWNLOAD_POTENTIALLY_UNWANTED, |
133 REASON_MAX // Always add new values before this one. | 135 REASON_MAX // Always add new values before this one. |
134 }; | 136 }; |
135 | 137 |
136 private: | 138 private: |
137 class CheckClientDownloadRequest; // Per-request state | 139 class CheckClientDownloadRequest; // Per-request state |
138 friend class DownloadProtectionServiceTest; | 140 friend class DownloadProtectionServiceTest; |
139 FRIEND_TEST_ALL_PREFIXES(DownloadProtectionServiceTest, | 141 FRIEND_TEST_ALL_PREFIXES(DownloadProtectionServiceTest, |
140 CheckClientDownloadValidateRequest); | 142 CheckClientDownloadValidateRequest); |
141 FRIEND_TEST_ALL_PREFIXES(DownloadProtectionServiceTest, | 143 FRIEND_TEST_ALL_PREFIXES(DownloadProtectionServiceTest, |
142 CheckClientDownloadSuccess); | 144 CheckClientDownloadSuccess); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 | 193 |
192 int64 download_request_timeout_ms_; | 194 int64 download_request_timeout_ms_; |
193 | 195 |
194 scoped_ptr<DownloadFeedbackService> feedback_service_; | 196 scoped_ptr<DownloadFeedbackService> feedback_service_; |
195 | 197 |
196 DISALLOW_COPY_AND_ASSIGN(DownloadProtectionService); | 198 DISALLOW_COPY_AND_ASSIGN(DownloadProtectionService); |
197 }; | 199 }; |
198 } // namespace safe_browsing | 200 } // namespace safe_browsing |
199 | 201 |
200 #endif // CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_SERVICE_H_ | 202 #endif // CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_SERVICE_H_ |
OLD | NEW |