| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 // Update management. Called on the IO thread. | 256 // Update management. Called on the IO thread. |
| 257 void UpdateStarted(); | 257 void UpdateStarted(); |
| 258 void UpdateFinished(bool update_succeeded); | 258 void UpdateFinished(bool update_succeeded); |
| 259 // Whether there is an update in progress. Called on the IO thread. | 259 // Whether there is an update in progress. Called on the IO thread. |
| 260 bool IsUpdateInProgress() const; | 260 bool IsUpdateInProgress() const; |
| 261 | 261 |
| 262 // The blocking page on the UI thread has completed. | 262 // The blocking page on the UI thread has completed. |
| 263 void OnBlockingPageDone(const std::vector<UnsafeResource>& resources, | 263 void OnBlockingPageDone(const std::vector<UnsafeResource>& resources, |
| 264 bool proceed); | 264 bool proceed); |
| 265 | 265 |
| 266 // Called on the UI thread when the SafeBrowsingProtocolManager has received | |
| 267 // updated MAC keys. | |
| 268 void OnNewMacKeys(const std::string& client_key, | |
| 269 const std::string& wrapped_key); | |
| 270 | |
| 271 bool enabled() const { return enabled_; } | 266 bool enabled() const { return enabled_; } |
| 272 | 267 |
| 273 bool download_protection_enabled() const { | 268 bool download_protection_enabled() const { |
| 274 return enabled_ && enable_download_protection_; | 269 return enabled_ && enable_download_protection_; |
| 275 } | 270 } |
| 276 | 271 |
| 277 safe_browsing::ClientSideDetectionService* | 272 safe_browsing::ClientSideDetectionService* |
| 278 safe_browsing_detection_service() const { | 273 safe_browsing_detection_service() const { |
| 279 return csd_service_.get(); | 274 return csd_service_.get(); |
| 280 } | 275 } |
| 281 | 276 |
| 282 // The DownloadProtectionService is not valid after the SafeBrowsingService | 277 // The DownloadProtectionService is not valid after the SafeBrowsingService |
| 283 // is destroyed. | 278 // is destroyed. |
| 284 safe_browsing::DownloadProtectionService* | 279 safe_browsing::DownloadProtectionService* |
| 285 download_protection_service() const { | 280 download_protection_service() const { |
| 286 return download_service_.get(); | 281 return download_service_.get(); |
| 287 } | 282 } |
| 288 | 283 |
| 289 net::URLRequestContextGetter* url_request_context(); | 284 net::URLRequestContextGetter* url_request_context(); |
| 290 | 285 |
| 291 // Preference handling. | |
| 292 static void RegisterPrefs(PrefService* prefs); | |
| 293 | |
| 294 // Called on the IO thread to reset the database. | 286 // Called on the IO thread to reset the database. |
| 295 void ResetDatabase(); | 287 void ResetDatabase(); |
| 296 | 288 |
| 297 // Called on the IO thread to release memory. | 289 // Called on the IO thread to release memory. |
| 298 void PurgeMemory(); | 290 void PurgeMemory(); |
| 299 | 291 |
| 300 // Log the user perceived delay caused by SafeBrowsing. This delay is the time | 292 // Log the user perceived delay caused by SafeBrowsing. This delay is the time |
| 301 // delta starting from when we would have started reading data from the | 293 // delta starting from when we would have started reading data from the |
| 302 // network, and ending when the SafeBrowsing check completes indicating that | 294 // network, and ending when the SafeBrowsing check completes indicating that |
| 303 // the current page is 'safe'. | 295 // the current page is 'safe'. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 friend class SafeBrowsingServiceTest; | 342 friend class SafeBrowsingServiceTest; |
| 351 friend class SafeBrowsingURLRequestContextGetter; | 343 friend class SafeBrowsingURLRequestContextGetter; |
| 352 | 344 |
| 353 void InitURLRequestContextOnIOThread( | 345 void InitURLRequestContextOnIOThread( |
| 354 net::URLRequestContextGetter* system_url_request_context_getter); | 346 net::URLRequestContextGetter* system_url_request_context_getter); |
| 355 | 347 |
| 356 void DestroyURLRequestContextOnIOThread(); | 348 void DestroyURLRequestContextOnIOThread(); |
| 357 | 349 |
| 358 // Called to initialize objects that are used on the io_thread. This may be | 350 // Called to initialize objects that are used on the io_thread. This may be |
| 359 // called multiple times during the life of the SafeBrowsingService. | 351 // called multiple times during the life of the SafeBrowsingService. |
| 360 void StartOnIOThread(const std::string& client_key, | 352 void StartOnIOThread(); |
| 361 const std::string& wrapped_key); | |
| 362 | 353 |
| 363 // Called to shutdown operations on the io_thread. This may be called multiple | 354 // Called to shutdown operations on the io_thread. This may be called multiple |
| 364 // times during the life of the SafeBrowsingService. | 355 // times during the life of the SafeBrowsingService. |
| 365 void StopOnIOThread(); | 356 void StopOnIOThread(); |
| 366 | 357 |
| 367 // Returns whether |database_| exists and is accessible. | 358 // Returns whether |database_| exists and is accessible. |
| 368 bool DatabaseAvailable() const; | 359 bool DatabaseAvailable() const; |
| 369 | 360 |
| 370 // Called on the IO thread. If the database does not exist, queues up a call | 361 // Called on the IO thread. If the database does not exist, queues up a call |
| 371 // on the db thread to create it. Returns whether the database is available. | 362 // on the db thread to create it. Returns whether the database is available. |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 class SafeBrowsingServiceFactory { | 592 class SafeBrowsingServiceFactory { |
| 602 public: | 593 public: |
| 603 SafeBrowsingServiceFactory() { } | 594 SafeBrowsingServiceFactory() { } |
| 604 virtual ~SafeBrowsingServiceFactory() { } | 595 virtual ~SafeBrowsingServiceFactory() { } |
| 605 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; | 596 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; |
| 606 private: | 597 private: |
| 607 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); | 598 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); |
| 608 }; | 599 }; |
| 609 | 600 |
| 610 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ | 601 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ |
| OLD | NEW |