| OLD | NEW |
| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 const CheckDownloadCallback& callback); | 79 const CheckDownloadCallback& callback); |
| 80 | 80 |
| 81 // Checks whether any of the URLs in the redirect chain of the | 81 // Checks whether any of the URLs in the redirect chain of the |
| 82 // download match the SafeBrowsing bad binary URL list. The result is | 82 // download match the SafeBrowsing bad binary URL list. The result is |
| 83 // delivered asynchronously via the given callback. This method must be | 83 // delivered asynchronously via the given callback. This method must be |
| 84 // called on the UI thread, and the callback will also be invoked on the UI | 84 // called on the UI thread, and the callback will also be invoked on the UI |
| 85 // thread. Pre-condition: !info.download_url_chain.empty(). | 85 // thread. Pre-condition: !info.download_url_chain.empty(). |
| 86 virtual void CheckDownloadUrl(const DownloadInfo& info, | 86 virtual void CheckDownloadUrl(const DownloadInfo& info, |
| 87 const CheckDownloadCallback& callback); | 87 const CheckDownloadCallback& callback); |
| 88 | 88 |
| 89 // Returns true iff the given filename has an extension that is supported |
| 90 // by this service. In other words: this method returns true if it can |
| 91 // protect users against files with that particular extension. |
| 92 bool IsSupportedFileType(const FilePath& filename) const; |
| 93 |
| 89 // Enables or disables the service. This is usually called by the | 94 // Enables or disables the service. This is usually called by the |
| 90 // SafeBrowsingService, which tracks whether any profile uses these services | 95 // SafeBrowsingService, which tracks whether any profile uses these services |
| 91 // at all. Disabling causes any pending and future requests to have their | 96 // at all. Disabling causes any pending and future requests to have their |
| 92 // callbacks called with "SAFE" results. | 97 // callbacks called with "SAFE" results. |
| 93 void SetEnabled(bool enabled); | 98 void SetEnabled(bool enabled); |
| 94 | 99 |
| 95 bool enabled() const { | 100 bool enabled() const { |
| 96 return enabled_; | 101 return enabled_; |
| 97 } | 102 } |
| 98 | 103 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 bool enabled_; | 161 bool enabled_; |
| 157 | 162 |
| 158 // SignatureUtil object, may be overridden for testing. | 163 // SignatureUtil object, may be overridden for testing. |
| 159 scoped_refptr<SignatureUtil> signature_util_; | 164 scoped_refptr<SignatureUtil> signature_util_; |
| 160 | 165 |
| 161 DISALLOW_COPY_AND_ASSIGN(DownloadProtectionService); | 166 DISALLOW_COPY_AND_ASSIGN(DownloadProtectionService); |
| 162 }; | 167 }; |
| 163 } // namespace safe_browsing | 168 } // namespace safe_browsing |
| 164 | 169 |
| 165 #endif // CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_SERVICE_H_ | 170 #endif // CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_SERVICE_H_ |
| OLD | NEW |