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

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

Issue 565053002: [Downloads] Gracefully handle SafeBrowsing check failures. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
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 10
(...skipping 23 matching lines...) Expand all
34 34
35 namespace safe_browsing { 35 namespace safe_browsing {
36 class DownloadFeedbackService; 36 class DownloadFeedbackService;
37 class BinaryFeatureExtractor; 37 class BinaryFeatureExtractor;
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 UNKNOWN,
44 SAFE, 45 SAFE,
45 DANGEROUS, 46 DANGEROUS,
46 UNCOMMON, 47 UNCOMMON,
47 DANGEROUS_HOST, 48 DANGEROUS_HOST,
48 POTENTIALLY_UNWANTED 49 POTENTIALLY_UNWANTED
49 }; 50 };
50 51
51 // Callback type which is invoked once the download request is done. 52 // Callback type which is invoked once the download request is done.
52 typedef base::Callback<void(DownloadCheckResult)> CheckDownloadCallback; 53 typedef base::Callback<void(DownloadCheckResult)> CheckDownloadCallback;
53 54
(...skipping 29 matching lines...) Expand all
83 84
84 // Display more information to the user regarding the download specified by 85 // Display more information to the user regarding the download specified by
85 // |info|. This method is invoked when the user requests more information 86 // |info|. This method is invoked when the user requests more information
86 // about a download that was marked as malicious. 87 // about a download that was marked as malicious.
87 void ShowDetailsForDownload(const content::DownloadItem& item, 88 void ShowDetailsForDownload(const content::DownloadItem& item,
88 content::PageNavigator* navigator); 89 content::PageNavigator* navigator);
89 90
90 // Enables or disables the service. This is usually called by the 91 // Enables or disables the service. This is usually called by the
91 // SafeBrowsingService, which tracks whether any profile uses these services 92 // SafeBrowsingService, which tracks whether any profile uses these services
92 // at all. Disabling causes any pending and future requests to have their 93 // at all. Disabling causes any pending and future requests to have their
93 // callbacks called with "SAFE" results. 94 // callbacks called with "UNKNOWN" results.
94 void SetEnabled(bool enabled); 95 void SetEnabled(bool enabled);
95 96
96 bool enabled() const { 97 bool enabled() const {
97 return enabled_; 98 return enabled_;
98 } 99 }
99 100
100 // Returns the timeout that is used by CheckClientDownload(). 101 // Returns the timeout that is used by CheckClientDownload().
101 int64 download_request_timeout_ms() const { 102 int64 download_request_timeout_ms() const {
102 return download_request_timeout_ms_; 103 return download_request_timeout_ms_;
103 } 104 }
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 196
196 int64 download_request_timeout_ms_; 197 int64 download_request_timeout_ms_;
197 198
198 scoped_ptr<DownloadFeedbackService> feedback_service_; 199 scoped_ptr<DownloadFeedbackService> feedback_service_;
199 200
200 DISALLOW_COPY_AND_ASSIGN(DownloadProtectionService); 201 DISALLOW_COPY_AND_ASSIGN(DownloadProtectionService);
201 }; 202 };
202 } // namespace safe_browsing 203 } // namespace safe_browsing
203 204
204 #endif // CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_SERVICE_H_ 205 #endif // CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/download/download_target_info.h ('k') | chrome/browser/safe_browsing/download_protection_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698