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 #pragma once | 10 #pragma once |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 // tab URL redirect chain, ... | 42 // tab URL redirect chain, ... |
43 struct DownloadInfo { | 43 struct DownloadInfo { |
44 FilePath local_file; // Where the download is currently stored. | 44 FilePath local_file; // Where the download is currently stored. |
45 FilePath target_file; // Where the download will eventually be stored. | 45 FilePath target_file; // Where the download will eventually be stored. |
46 std::vector<GURL> download_url_chain; | 46 std::vector<GURL> download_url_chain; |
47 GURL referrer_url; | 47 GURL referrer_url; |
48 std::string sha256_hash; | 48 std::string sha256_hash; |
49 int64 total_bytes; | 49 int64 total_bytes; |
50 bool user_initiated; | 50 bool user_initiated; |
51 std::string remote_address; | 51 std::string remote_address; |
| 52 bool zipped_executable; |
52 DownloadInfo(); | 53 DownloadInfo(); |
53 ~DownloadInfo(); | 54 ~DownloadInfo(); |
54 std::string DebugString() const; | 55 std::string DebugString() const; |
55 // Creates a DownloadInfo from a DownloadItem object. | 56 // Creates a DownloadInfo from a DownloadItem object. |
56 static DownloadInfo FromDownloadItem(const content::DownloadItem& item); | 57 static DownloadInfo FromDownloadItem(const content::DownloadItem& item); |
57 }; | 58 }; |
58 | 59 |
59 enum DownloadCheckResult { | 60 enum DownloadCheckResult { |
60 SAFE, | 61 SAFE, |
61 DANGEROUS, | 62 DANGEROUS, |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 REASON_DOWNLOAD_DANGEROUS, | 131 REASON_DOWNLOAD_DANGEROUS, |
131 REASON_DOWNLOAD_SAFE, | 132 REASON_DOWNLOAD_SAFE, |
132 REASON_EMPTY_URL_CHAIN, | 133 REASON_EMPTY_URL_CHAIN, |
133 REASON_HTTPS_URL, | 134 REASON_HTTPS_URL, |
134 REASON_PING_DISABLED, | 135 REASON_PING_DISABLED, |
135 REASON_TRUSTED_EXECUTABLE, | 136 REASON_TRUSTED_EXECUTABLE, |
136 REASON_OS_NOT_SUPPORTED, | 137 REASON_OS_NOT_SUPPORTED, |
137 REASON_DOWNLOAD_UNCOMMON, | 138 REASON_DOWNLOAD_UNCOMMON, |
138 REASON_DOWNLOAD_NOT_SUPPORTED, | 139 REASON_DOWNLOAD_NOT_SUPPORTED, |
139 REASON_INVALID_RESPONSE_VERDICT, | 140 REASON_INVALID_RESPONSE_VERDICT, |
| 141 REASON_ARCHIVE_WITHOUT_BINARIES, |
140 REASON_MAX // Always add new values before this one. | 142 REASON_MAX // Always add new values before this one. |
141 }; | 143 }; |
142 | 144 |
143 private: | 145 private: |
144 class CheckClientDownloadRequest; // Per-request state | 146 class CheckClientDownloadRequest; // Per-request state |
145 friend class DownloadProtectionServiceTest; | 147 friend class DownloadProtectionServiceTest; |
146 FRIEND_TEST_ALL_PREFIXES(DownloadProtectionServiceTest, | 148 FRIEND_TEST_ALL_PREFIXES(DownloadProtectionServiceTest, |
147 CheckClientDownloadValidateRequest); | 149 CheckClientDownloadValidateRequest); |
148 FRIEND_TEST_ALL_PREFIXES(DownloadProtectionServiceTest, | 150 FRIEND_TEST_ALL_PREFIXES(DownloadProtectionServiceTest, |
149 CheckClientDownloadSuccess); | 151 CheckClientDownloadSuccess); |
150 FRIEND_TEST_ALL_PREFIXES(DownloadProtectionServiceTest, | 152 FRIEND_TEST_ALL_PREFIXES(DownloadProtectionServiceTest, |
| 153 CheckClientDownloadZip); |
| 154 FRIEND_TEST_ALL_PREFIXES(DownloadProtectionServiceTest, |
151 CheckClientDownloadFetchFailed); | 155 CheckClientDownloadFetchFailed); |
152 FRIEND_TEST_ALL_PREFIXES(DownloadProtectionServiceTest, | 156 FRIEND_TEST_ALL_PREFIXES(DownloadProtectionServiceTest, |
153 TestDownloadRequestTimeout); | 157 TestDownloadRequestTimeout); |
154 FRIEND_TEST_ALL_PREFIXES(DownloadProtectionServiceTest, | 158 FRIEND_TEST_ALL_PREFIXES(DownloadProtectionServiceTest, |
155 CheckClientCrxDownloadSuccess); | 159 CheckClientCrxDownloadSuccess); |
156 static const char kDownloadRequestUrl[]; | 160 static const char kDownloadRequestUrl[]; |
157 | 161 |
158 // Cancels all requests in |download_requests_|, and empties it, releasing | 162 // Cancels all requests in |download_requests_|, and empties it, releasing |
159 // the references to the requests. | 163 // the references to the requests. |
160 void CancelPendingRequests(); | 164 void CancelPendingRequests(); |
(...skipping 28 matching lines...) Expand all Loading... |
189 // SignatureUtil object, may be overridden for testing. | 193 // SignatureUtil object, may be overridden for testing. |
190 scoped_refptr<SignatureUtil> signature_util_; | 194 scoped_refptr<SignatureUtil> signature_util_; |
191 | 195 |
192 int64 download_request_timeout_ms_; | 196 int64 download_request_timeout_ms_; |
193 | 197 |
194 DISALLOW_COPY_AND_ASSIGN(DownloadProtectionService); | 198 DISALLOW_COPY_AND_ASSIGN(DownloadProtectionService); |
195 }; | 199 }; |
196 } // namespace safe_browsing | 200 } // namespace safe_browsing |
197 | 201 |
198 #endif // CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_SERVICE_H_ | 202 #endif // CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_SERVICE_H_ |
OLD | NEW |