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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 // delta starting from when we would have started reading data from the | 241 // delta starting from when we would have started reading data from the |
242 // network, and ending when the SafeBrowsing check completes indicating that | 242 // network, and ending when the SafeBrowsing check completes indicating that |
243 // the current page is 'safe'. | 243 // the current page is 'safe'. |
244 void LogPauseDelay(base::TimeDelta time); | 244 void LogPauseDelay(base::TimeDelta time); |
245 | 245 |
246 // Called on the IO thread by the MalwareDetails with the serialized | 246 // Called on the IO thread by the MalwareDetails with the serialized |
247 // protocol buffer, so the service can send it over. | 247 // protocol buffer, so the service can send it over. |
248 virtual void SendSerializedMalwareDetails(const std::string& serialized); | 248 virtual void SendSerializedMalwareDetails(const std::string& serialized); |
249 | 249 |
250 // Report hits to the unsafe contents (malware, phishing, unsafe download URL) | 250 // Report hits to the unsafe contents (malware, phishing, unsafe download URL) |
251 // to the server. Can only be called on UI thread. | 251 // to the server. Can only be called on UI thread. If |post_data| is |
| 252 // non-empty, the request will be sent as a POST instead of a GET. |
252 void ReportSafeBrowsingHit(const GURL& malicious_url, | 253 void ReportSafeBrowsingHit(const GURL& malicious_url, |
253 const GURL& page_url, | 254 const GURL& page_url, |
254 const GURL& referrer_url, | 255 const GURL& referrer_url, |
255 bool is_subresource, | 256 bool is_subresource, |
256 UrlCheckResult threat_type); | 257 UrlCheckResult threat_type, |
| 258 const std::string& post_data); |
257 | 259 |
258 protected: | 260 protected: |
259 // Creates the safe browsing service. Need to initialize before using. | 261 // Creates the safe browsing service. Need to initialize before using. |
260 SafeBrowsingService(); | 262 SafeBrowsingService(); |
261 | 263 |
262 virtual ~SafeBrowsingService(); | 264 virtual ~SafeBrowsingService(); |
263 | 265 |
264 private: | 266 private: |
265 friend class SafeBrowsingServiceFactoryImpl; | 267 friend class SafeBrowsingServiceFactoryImpl; |
266 | 268 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 const std::vector<SBFullHashResult>& full_hashes); | 362 const std::vector<SBFullHashResult>& full_hashes); |
361 | 363 |
362 // Invoked on the UI thread to show the blocking page. | 364 // Invoked on the UI thread to show the blocking page. |
363 void DoDisplayBlockingPage(const UnsafeResource& resource); | 365 void DoDisplayBlockingPage(const UnsafeResource& resource); |
364 | 366 |
365 // Call protocol manager on IO thread to report hits of unsafe contents. | 367 // Call protocol manager on IO thread to report hits of unsafe contents. |
366 void ReportSafeBrowsingHitOnIOThread(const GURL& malicious_url, | 368 void ReportSafeBrowsingHitOnIOThread(const GURL& malicious_url, |
367 const GURL& page_url, | 369 const GURL& page_url, |
368 const GURL& referrer_url, | 370 const GURL& referrer_url, |
369 bool is_subresource, | 371 bool is_subresource, |
370 UrlCheckResult threat_type); | 372 UrlCheckResult threat_type, |
| 373 const std::string& post_data); |
371 | 374 |
372 // Checks the download hash on safe_browsing_thread_. | 375 // Checks the download hash on safe_browsing_thread_. |
373 void CheckDownloadHashOnSBThread(SafeBrowsingCheck* check); | 376 void CheckDownloadHashOnSBThread(SafeBrowsingCheck* check); |
374 | 377 |
375 // Invoked by CheckDownloadUrl. It checks the download URL on | 378 // Invoked by CheckDownloadUrl. It checks the download URL on |
376 // safe_browsing_thread_. | 379 // safe_browsing_thread_. |
377 void CheckDownloadUrlOnSBThread(SafeBrowsingCheck* check); | 380 void CheckDownloadUrlOnSBThread(SafeBrowsingCheck* check); |
378 | 381 |
379 // The callback function when a safebrowsing check is timed out. Client will | 382 // The callback function when a safebrowsing check is timed out. Client will |
380 // be notified that the safebrowsing check is SAFE when this happens. | 383 // be notified that the safebrowsing check is SAFE when this happens. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 class SafeBrowsingServiceFactory { | 468 class SafeBrowsingServiceFactory { |
466 public: | 469 public: |
467 SafeBrowsingServiceFactory() { } | 470 SafeBrowsingServiceFactory() { } |
468 virtual ~SafeBrowsingServiceFactory() { } | 471 virtual ~SafeBrowsingServiceFactory() { } |
469 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; | 472 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; |
470 private: | 473 private: |
471 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); | 474 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); |
472 }; | 475 }; |
473 | 476 |
474 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ | 477 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ |
OLD | NEW |