Chromium Code Reviews| 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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 240 // Log the user perceived delay caused by SafeBrowsing. This delay is the time | 240 // Log the user perceived delay caused by SafeBrowsing. This delay is the time |
| 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) to the server. Can |
| 251 // to the server. Can only be called on UI thread. | 251 // only be called on UI thread. |
| 252 void ReportSafeBrowsingHit(const GURL& malicious_url, | 252 void ReportSafeBrowsingHit(const GURL& malicious_url, |
| 253 const GURL& page_url, | 253 const GURL& page_url, |
| 254 const GURL& referrer_url, | 254 const GURL& referrer_url, |
| 255 bool is_subresource, | 255 bool is_subresource, |
| 256 UrlCheckResult threat_type); | 256 UrlCheckResult threat_type); |
|
noelutz
2011/05/06 04:24:12
Have you considered renaming this method to someth
mattm
2011/05/10 02:26:09
I like it. done.
| |
| 257 | 257 |
| 258 // Report hits to unsafe downloads to the server. Can only be called on UI | |
| 259 // thread. | |
| 260 void ReportSafeBrowsingHitWithChain(const std::vector<GURL>& url_chain, | |
| 261 const GURL& referrer_url, | |
| 262 bool is_subresource, | |
| 263 UrlCheckResult threat_type); | |
| 264 | |
| 258 protected: | 265 protected: |
| 259 // Creates the safe browsing service. Need to initialize before using. | 266 // Creates the safe browsing service. Need to initialize before using. |
| 260 SafeBrowsingService(); | 267 SafeBrowsingService(); |
| 261 | 268 |
| 262 virtual ~SafeBrowsingService(); | 269 virtual ~SafeBrowsingService(); |
| 263 | 270 |
| 264 private: | 271 private: |
| 265 friend class SafeBrowsingServiceFactoryImpl; | 272 friend class SafeBrowsingServiceFactoryImpl; |
| 266 | 273 |
| 267 typedef std::set<SafeBrowsingCheck*> CurrentChecks; | 274 typedef std::set<SafeBrowsingCheck*> CurrentChecks; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 362 // Invoked on the UI thread to show the blocking page. | 369 // Invoked on the UI thread to show the blocking page. |
| 363 void DoDisplayBlockingPage(const UnsafeResource& resource); | 370 void DoDisplayBlockingPage(const UnsafeResource& resource); |
| 364 | 371 |
| 365 // Call protocol manager on IO thread to report hits of unsafe contents. | 372 // Call protocol manager on IO thread to report hits of unsafe contents. |
| 366 void ReportSafeBrowsingHitOnIOThread(const GURL& malicious_url, | 373 void ReportSafeBrowsingHitOnIOThread(const GURL& malicious_url, |
| 367 const GURL& page_url, | 374 const GURL& page_url, |
| 368 const GURL& referrer_url, | 375 const GURL& referrer_url, |
| 369 bool is_subresource, | 376 bool is_subresource, |
| 370 UrlCheckResult threat_type); | 377 UrlCheckResult threat_type); |
| 371 | 378 |
| 379 // Call protocol manager on IO thread to report hits of unsafe contents. | |
| 380 void ReportSafeBrowsingHitWithChainOnIOThread( | |
| 381 const std::vector<GURL>& url_chain, | |
| 382 const GURL& referrer_url, | |
| 383 bool is_subresource, | |
| 384 SafeBrowsingService::UrlCheckResult threat_type); | |
| 385 | |
| 372 // Checks the download hash on safe_browsing_thread_. | 386 // Checks the download hash on safe_browsing_thread_. |
| 373 void CheckDownloadHashOnSBThread(SafeBrowsingCheck* check); | 387 void CheckDownloadHashOnSBThread(SafeBrowsingCheck* check); |
| 374 | 388 |
| 375 // Invoked by CheckDownloadUrl. It checks the download URL on | 389 // Invoked by CheckDownloadUrl. It checks the download URL on |
| 376 // safe_browsing_thread_. | 390 // safe_browsing_thread_. |
| 377 void CheckDownloadUrlOnSBThread(SafeBrowsingCheck* check); | 391 void CheckDownloadUrlOnSBThread(SafeBrowsingCheck* check); |
| 378 | 392 |
| 379 // The callback function when a safebrowsing check is timed out. Client will | 393 // The callback function when a safebrowsing check is timed out. Client will |
| 380 // be notified that the safebrowsing check is SAFE when this happens. | 394 // be notified that the safebrowsing check is SAFE when this happens. |
| 381 void TimeoutCallback(SafeBrowsingCheck* check); | 395 void TimeoutCallback(SafeBrowsingCheck* check); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 465 class SafeBrowsingServiceFactory { | 479 class SafeBrowsingServiceFactory { |
| 466 public: | 480 public: |
| 467 SafeBrowsingServiceFactory() { } | 481 SafeBrowsingServiceFactory() { } |
| 468 virtual ~SafeBrowsingServiceFactory() { } | 482 virtual ~SafeBrowsingServiceFactory() { } |
| 469 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; | 483 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; |
| 470 private: | 484 private: |
| 471 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); | 485 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); |
| 472 }; | 486 }; |
| 473 | 487 |
| 474 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ | 488 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ |
| OLD | NEW |