Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Side by Side Diff: chrome/browser/safe_browsing/download_protection_service.h

Issue 10382113: Add SafeBrowsing support for checking downloaded zip files that contain executables. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor cleanup Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 }; 142 };
142 143
143 private: 144 private:
144 class CheckClientDownloadRequest; // Per-request state 145 class CheckClientDownloadRequest; // Per-request state
145 friend class DownloadProtectionServiceTest; 146 friend class DownloadProtectionServiceTest;
146 FRIEND_TEST_ALL_PREFIXES(DownloadProtectionServiceTest, 147 FRIEND_TEST_ALL_PREFIXES(DownloadProtectionServiceTest,
147 CheckClientDownloadValidateRequest); 148 CheckClientDownloadValidateRequest);
148 FRIEND_TEST_ALL_PREFIXES(DownloadProtectionServiceTest, 149 FRIEND_TEST_ALL_PREFIXES(DownloadProtectionServiceTest,
149 CheckClientDownloadSuccess); 150 CheckClientDownloadSuccess);
150 FRIEND_TEST_ALL_PREFIXES(DownloadProtectionServiceTest, 151 FRIEND_TEST_ALL_PREFIXES(DownloadProtectionServiceTest,
152 CheckClientDownloadZip);
153 FRIEND_TEST_ALL_PREFIXES(DownloadProtectionServiceTest,
151 CheckClientDownloadFetchFailed); 154 CheckClientDownloadFetchFailed);
152 FRIEND_TEST_ALL_PREFIXES(DownloadProtectionServiceTest, 155 FRIEND_TEST_ALL_PREFIXES(DownloadProtectionServiceTest,
153 TestDownloadRequestTimeout); 156 TestDownloadRequestTimeout);
154 FRIEND_TEST_ALL_PREFIXES(DownloadProtectionServiceTest, 157 FRIEND_TEST_ALL_PREFIXES(DownloadProtectionServiceTest,
155 CheckClientCrxDownloadSuccess); 158 CheckClientCrxDownloadSuccess);
156 static const char kDownloadRequestUrl[]; 159 static const char kDownloadRequestUrl[];
157 160
158 // Cancels all requests in |download_requests_|, and empties it, releasing 161 // Cancels all requests in |download_requests_|, and empties it, releasing
159 // the references to the requests. 162 // the references to the requests.
160 void CancelPendingRequests(); 163 void CancelPendingRequests();
(...skipping 28 matching lines...) Expand all
189 // SignatureUtil object, may be overridden for testing. 192 // SignatureUtil object, may be overridden for testing.
190 scoped_refptr<SignatureUtil> signature_util_; 193 scoped_refptr<SignatureUtil> signature_util_;
191 194
192 int64 download_request_timeout_ms_; 195 int64 download_request_timeout_ms_;
193 196
194 DISALLOW_COPY_AND_ASSIGN(DownloadProtectionService); 197 DISALLOW_COPY_AND_ASSIGN(DownloadProtectionService);
195 }; 198 };
196 } // namespace safe_browsing 199 } // namespace safe_browsing
197 200
198 #endif // CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_SERVICE_H_ 201 #endif // CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698