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

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

Issue 8438012: Parse the download server response. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove DCHECK bug Created 9 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/download_protection_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 bool user_initiated; 44 bool user_initiated;
45 DownloadInfo(); 45 DownloadInfo();
46 ~DownloadInfo(); 46 ~DownloadInfo();
47 47
48 // Creates a DownloadInfo from a DownloadItem object. 48 // Creates a DownloadInfo from a DownloadItem object.
49 static DownloadInfo FromDownloadItem(const DownloadItem& item); 49 static DownloadInfo FromDownloadItem(const DownloadItem& item);
50 }; 50 };
51 51
52 enum DownloadCheckResult { 52 enum DownloadCheckResult {
53 SAFE, 53 SAFE,
54 MALICIOUS, 54 DANGEROUS,
55 // In the future we may introduce a third category which corresponds to 55 // In the future we may introduce a third category which corresponds to
56 // suspicious downloads that are not known to be malicious. 56 // suspicious downloads that are not known to be malicious.
57 }; 57 };
58 58
59 // Callback type which is invoked once the download request is done. 59 // Callback type which is invoked once the download request is done.
60 typedef base::Callback<void(DownloadCheckResult)> CheckDownloadCallback; 60 typedef base::Callback<void(DownloadCheckResult)> CheckDownloadCallback;
61 61
62 // Creates a download service. The service is initially disabled. You need 62 // Creates a download service. The service is initially disabled. You need
63 // to call SetEnabled() to start it. |sb_service| owns this object; we 63 // to call SetEnabled() to start it. |sb_service| owns this object; we
64 // keep a reference to |request_context_getter|. 64 // keep a reference to |request_context_getter|.
(...skipping 26 matching lines...) Expand all
91 enum DownloadCheckResultReason { 91 enum DownloadCheckResultReason {
92 REASON_INVALID_URL, 92 REASON_INVALID_URL,
93 REASON_SB_DISABLED, 93 REASON_SB_DISABLED,
94 REASON_WHITELISTED_URL, 94 REASON_WHITELISTED_URL,
95 REASON_WHITELISTED_REFERRER, 95 REASON_WHITELISTED_REFERRER,
96 REASON_INVALID_REQUEST_PROTO, 96 REASON_INVALID_REQUEST_PROTO,
97 REASON_SERVER_PING_FAILED, 97 REASON_SERVER_PING_FAILED,
98 REASON_INVALID_RESPONSE_PROTO, 98 REASON_INVALID_RESPONSE_PROTO,
99 REASON_NOT_BINARY_FILE, 99 REASON_NOT_BINARY_FILE,
100 REASON_REQUEST_CANCELED, 100 REASON_REQUEST_CANCELED,
101 REASON_DOWNLOAD_DANGEROUS,
102 REASON_DOWNLOAD_SAFE,
101 REASON_MAX // Always add new values before this one. 103 REASON_MAX // Always add new values before this one.
102 }; 104 };
103 105
104 private: 106 private:
105 class CheckClientDownloadRequest; // Per-request state 107 class CheckClientDownloadRequest; // Per-request state
106 friend class DownloadProtectionServiceTest; 108 friend class DownloadProtectionServiceTest;
107 FRIEND_TEST_ALL_PREFIXES(DownloadProtectionServiceTest, 109 FRIEND_TEST_ALL_PREFIXES(DownloadProtectionServiceTest,
108 CheckClientDownloadValidateRequest); 110 CheckClientDownloadValidateRequest);
109 FRIEND_TEST_ALL_PREFIXES(DownloadProtectionServiceTest, 111 FRIEND_TEST_ALL_PREFIXES(DownloadProtectionServiceTest,
110 CheckClientDownloadSuccess); 112 CheckClientDownloadSuccess);
(...skipping 26 matching lines...) Expand all
137 std::set<scoped_refptr<CheckClientDownloadRequest> > download_requests_; 139 std::set<scoped_refptr<CheckClientDownloadRequest> > download_requests_;
138 140
139 // Keeps track of the state of the service. 141 // Keeps track of the state of the service.
140 bool enabled_; 142 bool enabled_;
141 143
142 DISALLOW_COPY_AND_ASSIGN(DownloadProtectionService); 144 DISALLOW_COPY_AND_ASSIGN(DownloadProtectionService);
143 }; 145 };
144 } // namespace safe_browsing 146 } // namespace safe_browsing
145 147
146 #endif // CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_SERVICE_H_ 148 #endif // CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/download_protection_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698