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