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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 ~DownloadInfo(); | 55 ~DownloadInfo(); |
56 std::string DebugString() const; | 56 std::string DebugString() const; |
57 // Creates a DownloadInfo from a DownloadItem object. | 57 // Creates a DownloadInfo from a DownloadItem object. |
58 static DownloadInfo FromDownloadItem(const content::DownloadItem& item); | 58 static DownloadInfo FromDownloadItem(const content::DownloadItem& item); |
59 }; | 59 }; |
60 | 60 |
61 enum DownloadCheckResult { | 61 enum DownloadCheckResult { |
62 SAFE, | 62 SAFE, |
63 DANGEROUS, | 63 DANGEROUS, |
64 UNCOMMON, | 64 UNCOMMON, |
| 65 DANGEROUS_HOST, |
65 }; | 66 }; |
66 | 67 |
67 // Callback type which is invoked once the download request is done. | 68 // Callback type which is invoked once the download request is done. |
68 typedef base::Callback<void(DownloadCheckResult)> CheckDownloadCallback; | 69 typedef base::Callback<void(DownloadCheckResult)> CheckDownloadCallback; |
69 | 70 |
70 // Creates a download service. The service is initially disabled. You need | 71 // Creates a download service. The service is initially disabled. You need |
71 // to call SetEnabled() to start it. |sb_service| owns this object; we | 72 // to call SetEnabled() to start it. |sb_service| owns this object; we |
72 // keep a reference to |request_context_getter|. | 73 // keep a reference to |request_context_getter|. |
73 DownloadProtectionService( | 74 DownloadProtectionService( |
74 SafeBrowsingService* sb_service, | 75 SafeBrowsingService* sb_service, |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 REASON_DOWNLOAD_SAFE, | 135 REASON_DOWNLOAD_SAFE, |
135 REASON_EMPTY_URL_CHAIN, | 136 REASON_EMPTY_URL_CHAIN, |
136 DEPRECATED_REASON_HTTPS_URL, | 137 DEPRECATED_REASON_HTTPS_URL, |
137 REASON_PING_DISABLED, | 138 REASON_PING_DISABLED, |
138 REASON_TRUSTED_EXECUTABLE, | 139 REASON_TRUSTED_EXECUTABLE, |
139 REASON_OS_NOT_SUPPORTED, | 140 REASON_OS_NOT_SUPPORTED, |
140 REASON_DOWNLOAD_UNCOMMON, | 141 REASON_DOWNLOAD_UNCOMMON, |
141 REASON_DOWNLOAD_NOT_SUPPORTED, | 142 REASON_DOWNLOAD_NOT_SUPPORTED, |
142 REASON_INVALID_RESPONSE_VERDICT, | 143 REASON_INVALID_RESPONSE_VERDICT, |
143 REASON_ARCHIVE_WITHOUT_BINARIES, | 144 REASON_ARCHIVE_WITHOUT_BINARIES, |
| 145 REASON_DOWNLOAD_DANGEROUS_HOST, |
144 REASON_MAX // Always add new values before this one. | 146 REASON_MAX // Always add new values before this one. |
145 }; | 147 }; |
146 | 148 |
147 private: | 149 private: |
148 class CheckClientDownloadRequest; // Per-request state | 150 class CheckClientDownloadRequest; // Per-request state |
149 friend class DownloadProtectionServiceTest; | 151 friend class DownloadProtectionServiceTest; |
150 FRIEND_TEST_ALL_PREFIXES(DownloadProtectionServiceTest, | 152 FRIEND_TEST_ALL_PREFIXES(DownloadProtectionServiceTest, |
151 CheckClientDownloadValidateRequest); | 153 CheckClientDownloadValidateRequest); |
152 FRIEND_TEST_ALL_PREFIXES(DownloadProtectionServiceTest, | 154 FRIEND_TEST_ALL_PREFIXES(DownloadProtectionServiceTest, |
153 CheckClientDownloadSuccess); | 155 CheckClientDownloadSuccess); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 // SignatureUtil object, may be overridden for testing. | 202 // SignatureUtil object, may be overridden for testing. |
201 scoped_refptr<SignatureUtil> signature_util_; | 203 scoped_refptr<SignatureUtil> signature_util_; |
202 | 204 |
203 int64 download_request_timeout_ms_; | 205 int64 download_request_timeout_ms_; |
204 | 206 |
205 DISALLOW_COPY_AND_ASSIGN(DownloadProtectionService); | 207 DISALLOW_COPY_AND_ASSIGN(DownloadProtectionService); |
206 }; | 208 }; |
207 } // namespace safe_browsing | 209 } // namespace safe_browsing |
208 | 210 |
209 #endif // CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_SERVICE_H_ | 211 #endif // CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_SERVICE_H_ |
OLD | NEW |