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 // 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 | 137 |
138 // Called on the UI thread to initialize the service. | 138 // Called on the UI thread to initialize the service. |
139 void Initialize(); | 139 void Initialize(); |
140 | 140 |
141 // Called on the main thread to let us know that the io_thread is going away. | 141 // Called on the main thread to let us know that the io_thread is going away. |
142 void ShutDown(); | 142 void ShutDown(); |
143 | 143 |
144 // Returns true if the url's scheme can be checked. | 144 // Returns true if the url's scheme can be checked. |
145 bool CanCheckUrl(const GURL& url) const; | 145 bool CanCheckUrl(const GURL& url) const; |
146 | 146 |
147 // Called on UI thread to decide if safe browsing related stats | 147 // Called on UI thread to decide if safe browsing related stats should be |
148 // could be reported. | 148 // reported. |
149 bool CanReportStats() const; | 149 bool CanReportStats() const; |
150 | 150 |
151 // Called on UI thread to decide if the download file's sha256 hash | 151 // Called on UI thread to decide if the download file's sha256 hash should be |
152 // should be calculated for safebrowsing. | 152 // calculated for safebrowsing. |
153 bool DownloadBinHashNeeded() const; | 153 bool DownloadBinHashNeeded(bool safe_browsing_enabled) const; |
154 | 154 |
155 // Called on the IO thread to check if the given url is safe or not. If we | 155 // Called on the IO thread to check if the given url is safe or not. If we |
156 // can synchronously determine that the url is safe, CheckUrl returns true. | 156 // can synchronously determine that the url is safe, CheckUrl returns true. |
157 // Otherwise it returns false, and "client" is called asynchronously with the | 157 // Otherwise it returns false, and "client" is called asynchronously with the |
158 // result when it is ready. | 158 // result when it is ready. |
159 virtual bool CheckBrowseUrl(const GURL& url, Client* client); | 159 virtual bool CheckBrowseUrl(const GURL& url, Client* client); |
160 | 160 |
161 // Check if the prefix for |url| is in safebrowsing download add lists. | 161 // Check if the prefix for |url| is in safebrowsing download add lists. |
162 // Result will be passed to callback in |client|. | 162 // Result will be passed to callback in |client|. |
163 bool CheckDownloadUrl(const std::vector<GURL>& url_chain, Client* client); | 163 bool CheckDownloadUrl(const std::vector<GURL>& url_chain, Client* client); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 virtual void SendSerializedMalwareDetails(const std::string& serialized); | 258 virtual void SendSerializedMalwareDetails(const std::string& serialized); |
259 | 259 |
260 // Report hits to the unsafe contents (malware, phishing, unsafe download URL) | 260 // Report hits to the unsafe contents (malware, phishing, unsafe download URL) |
261 // to the server. Can only be called on UI thread. If |post_data| is | 261 // to the server. Can only be called on UI thread. If |post_data| is |
262 // non-empty, the request will be sent as a POST instead of a GET. | 262 // non-empty, the request will be sent as a POST instead of a GET. |
263 virtual void ReportSafeBrowsingHit(const GURL& malicious_url, | 263 virtual void ReportSafeBrowsingHit(const GURL& malicious_url, |
264 const GURL& page_url, | 264 const GURL& page_url, |
265 const GURL& referrer_url, | 265 const GURL& referrer_url, |
266 bool is_subresource, | 266 bool is_subresource, |
267 UrlCheckResult threat_type, | 267 UrlCheckResult threat_type, |
268 const std::string& post_data); | 268 const std::string& post_data, |
| 269 bool safe_browsing_enabled); |
269 | 270 |
270 protected: | 271 protected: |
271 // Creates the safe browsing service. Need to initialize before using. | 272 // Creates the safe browsing service. Need to initialize before using. |
272 SafeBrowsingService(); | 273 SafeBrowsingService(); |
273 | 274 |
274 virtual ~SafeBrowsingService(); | 275 virtual ~SafeBrowsingService(); |
275 | 276 |
276 private: | 277 private: |
277 friend class SafeBrowsingServiceFactoryImpl; | 278 friend class SafeBrowsingServiceFactoryImpl; |
278 | 279 |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 class SafeBrowsingServiceFactory { | 480 class SafeBrowsingServiceFactory { |
480 public: | 481 public: |
481 SafeBrowsingServiceFactory() { } | 482 SafeBrowsingServiceFactory() { } |
482 virtual ~SafeBrowsingServiceFactory() { } | 483 virtual ~SafeBrowsingServiceFactory() { } |
483 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; | 484 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; |
484 private: | 485 private: |
485 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); | 486 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); |
486 }; | 487 }; |
487 | 488 |
488 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ | 489 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ |
OLD | NEW |