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 10 matching lines...) Expand all Loading... |
21 #include "base/files/file_path.h" | 21 #include "base/files/file_path.h" |
22 #include "base/gtest_prod_util.h" | 22 #include "base/gtest_prod_util.h" |
23 #include "base/macros.h" | 23 #include "base/macros.h" |
24 #include "base/memory/ref_counted.h" | 24 #include "base/memory/ref_counted.h" |
25 #include "base/supports_user_data.h" | 25 #include "base/supports_user_data.h" |
26 #include "chrome/browser/safe_browsing/ui_manager.h" | 26 #include "chrome/browser/safe_browsing/ui_manager.h" |
27 #include "components/safe_browsing_db/database_manager.h" | 27 #include "components/safe_browsing_db/database_manager.h" |
28 #include "net/url_request/url_request_context_getter.h" | 28 #include "net/url_request/url_request_context_getter.h" |
29 #include "url/gurl.h" | 29 #include "url/gurl.h" |
30 | 30 |
| 31 |
31 namespace content { | 32 namespace content { |
32 class DownloadItem; | 33 class DownloadItem; |
33 class PageNavigator; | 34 class PageNavigator; |
34 } | 35 } |
35 | 36 |
36 namespace net { | 37 namespace net { |
37 class X509Certificate; | 38 class X509Certificate; |
38 } // namespace net | 39 } // namespace net |
39 | 40 |
40 class Profile; | |
41 | |
42 namespace safe_browsing { | 41 namespace safe_browsing { |
43 class BinaryFeatureExtractor; | 42 class BinaryFeatureExtractor; |
44 class ClientDownloadRequest; | 43 class ClientDownloadRequest; |
45 class DownloadFeedbackService; | 44 class DownloadFeedbackService; |
46 | 45 |
47 // This class provides an asynchronous API to check whether a particular | 46 // This class provides an asynchronous API to check whether a particular |
48 // client download is malicious or not. | 47 // client download is malicious or not. |
49 class DownloadProtectionService { | 48 class DownloadProtectionService { |
50 public: | 49 public: |
51 enum DownloadCheckResult { | 50 enum DownloadCheckResult { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 // Returns true iff the download specified by |info| should be scanned by | 108 // Returns true iff the download specified by |info| should be scanned by |
110 // CheckClientDownload() for malicious content. | 109 // CheckClientDownload() for malicious content. |
111 virtual bool IsSupportedDownload( | 110 virtual bool IsSupportedDownload( |
112 const content::DownloadItem& item, | 111 const content::DownloadItem& item, |
113 const base::FilePath& target_path) const; | 112 const base::FilePath& target_path) const; |
114 | 113 |
115 virtual void CheckPPAPIDownloadRequest( | 114 virtual void CheckPPAPIDownloadRequest( |
116 const GURL& requestor_url, | 115 const GURL& requestor_url, |
117 const base::FilePath& default_file_path, | 116 const base::FilePath& default_file_path, |
118 const std::vector<base::FilePath::StringType>& alternate_extensions, | 117 const std::vector<base::FilePath::StringType>& alternate_extensions, |
119 Profile* profile, | |
120 const CheckDownloadCallback& callback); | 118 const CheckDownloadCallback& callback); |
121 | 119 |
122 // Display more information to the user regarding the download specified by | 120 // Display more information to the user regarding the download specified by |
123 // |info|. This method is invoked when the user requests more information | 121 // |info|. This method is invoked when the user requests more information |
124 // about a download that was marked as malicious. | 122 // about a download that was marked as malicious. |
125 void ShowDetailsForDownload(const content::DownloadItem& item, | 123 void ShowDetailsForDownload(const content::DownloadItem& item, |
126 content::PageNavigator* navigator); | 124 content::PageNavigator* navigator); |
127 | 125 |
128 // Enables or disables the service. This is usually called by the | 126 // Enables or disables the service. This is usually called by the |
129 // SafeBrowsingService, which tracks whether any profile uses these services | 127 // SafeBrowsingService, which tracks whether any profile uses these services |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 std::set<std::string> manual_blacklist_hashes_; | 301 std::set<std::string> manual_blacklist_hashes_; |
304 | 302 |
305 // Rate of whitelisted downloads we sample to send out download ping. | 303 // Rate of whitelisted downloads we sample to send out download ping. |
306 double whitelist_sample_rate_; | 304 double whitelist_sample_rate_; |
307 | 305 |
308 DISALLOW_COPY_AND_ASSIGN(DownloadProtectionService); | 306 DISALLOW_COPY_AND_ASSIGN(DownloadProtectionService); |
309 }; | 307 }; |
310 } // namespace safe_browsing | 308 } // namespace safe_browsing |
311 | 309 |
312 #endif // CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_SERVICE_H_ | 310 #endif // CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_SERVICE_H_ |
OLD | NEW |