| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // The Safe Browsing service is responsible for downloading anti-phishing and | 5 // The Safe Browsing service is responsible for downloading anti-phishing and |
| 6 // anti-malware tables and checking urls against them. | 6 // anti-malware tables and checking urls against them. |
| 7 | 7 |
| 8 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ | 8 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ |
| 9 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ | 9 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ |
| 10 #pragma once | 10 #pragma once |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 | 110 |
| 111 // Makes the passed |factory| the factory used to instanciate | 111 // Makes the passed |factory| the factory used to instanciate |
| 112 // a SafeBrowsingService. Useful for tests. | 112 // a SafeBrowsingService. Useful for tests. |
| 113 static void RegisterFactory(SafeBrowsingServiceFactory* factory) { | 113 static void RegisterFactory(SafeBrowsingServiceFactory* factory) { |
| 114 factory_ = factory; | 114 factory_ = factory; |
| 115 } | 115 } |
| 116 | 116 |
| 117 // Create an instance of the safe browsing service. | 117 // Create an instance of the safe browsing service. |
| 118 static SafeBrowsingService* CreateSafeBrowsingService(); | 118 static SafeBrowsingService* CreateSafeBrowsingService(); |
| 119 | 119 |
| 120 // Called on UI thread to decide if safe browsing related stats |
| 121 // could be reported. |
| 122 bool CanReportStats() const; |
| 123 |
| 120 // Called on the UI thread to initialize the service. | 124 // Called on the UI thread to initialize the service. |
| 121 void Initialize(); | 125 void Initialize(); |
| 122 | 126 |
| 123 // Called on the main thread to let us know that the io_thread is going away. | 127 // Called on the main thread to let us know that the io_thread is going away. |
| 124 void ShutDown(); | 128 void ShutDown(); |
| 125 | 129 |
| 126 // Returns true if the url's scheme can be checked. | 130 // Returns true if the url's scheme can be checked. |
| 127 bool CanCheckUrl(const GURL& url) const; | 131 bool CanCheckUrl(const GURL& url) const; |
| 128 | 132 |
| 133 // Called on UI thread to decide if the download file's sha256 hash |
| 134 // should be calculated for safebrowsing. |
| 135 bool DownloadBinHashNeeded() const; |
| 136 |
| 129 // Called on the IO thread to check if the given url is safe or not. If we | 137 // Called on the IO thread to check if the given url is safe or not. If we |
| 130 // can synchronously determine that the url is safe, CheckUrl returns true. | 138 // can synchronously determine that the url is safe, CheckUrl returns true. |
| 131 // Otherwise it returns false, and "client" is called asynchronously with the | 139 // Otherwise it returns false, and "client" is called asynchronously with the |
| 132 // result when it is ready. | 140 // result when it is ready. |
| 133 virtual bool CheckBrowseUrl(const GURL& url, Client* client); | 141 virtual bool CheckBrowseUrl(const GURL& url, Client* client); |
| 134 | 142 |
| 135 // Check if the prefix for |url| is in safebrowsing download add lists. | 143 // Check if the prefix for |url| is in safebrowsing download add lists. |
| 136 // Result will be passed to callback in |client|. | 144 // Result will be passed to callback in |client|. |
| 137 bool CheckDownloadUrl(const GURL& url, Client* client); | 145 bool CheckDownloadUrl(const GURL& url, Client* client); |
| 138 | 146 |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 class SafeBrowsingServiceFactory { | 395 class SafeBrowsingServiceFactory { |
| 388 public: | 396 public: |
| 389 SafeBrowsingServiceFactory() { } | 397 SafeBrowsingServiceFactory() { } |
| 390 virtual ~SafeBrowsingServiceFactory() { } | 398 virtual ~SafeBrowsingServiceFactory() { } |
| 391 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; | 399 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; |
| 392 private: | 400 private: |
| 393 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); | 401 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); |
| 394 }; | 402 }; |
| 395 | 403 |
| 396 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ | 404 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ |
| OLD | NEW |