| 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 24 matching lines...) Expand all Loading... |
| 35 class SafeBrowsingServiceFactory; | 35 class SafeBrowsingServiceFactory; |
| 36 | 36 |
| 37 namespace base { | 37 namespace base { |
| 38 class Thread; | 38 class Thread; |
| 39 } | 39 } |
| 40 | 40 |
| 41 namespace net { | 41 namespace net { |
| 42 class URLRequestContextGetter; | 42 class URLRequestContextGetter; |
| 43 } | 43 } |
| 44 | 44 |
| 45 namespace safe_browsing { |
| 46 class ClientSideDetectionService; |
| 47 } |
| 48 |
| 45 // Construction needs to happen on the main thread. | 49 // Construction needs to happen on the main thread. |
| 46 class SafeBrowsingService | 50 class SafeBrowsingService |
| 47 : public base::RefCountedThreadSafe<SafeBrowsingService>, | 51 : public base::RefCountedThreadSafe<SafeBrowsingService>, |
| 48 public NotificationObserver { | 52 public NotificationObserver { |
| 49 public: | 53 public: |
| 50 class Client; | 54 class Client; |
| 51 // Users of this service implement this interface to be notified | 55 // Users of this service implement this interface to be notified |
| 52 // asynchronously of the result. | 56 // asynchronously of the result. |
| 53 enum UrlCheckResult { | 57 enum UrlCheckResult { |
| 54 SAFE, | 58 SAFE, |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 NotificationRegistrar registrar_; | 519 NotificationRegistrar registrar_; |
| 516 | 520 |
| 517 // Tracks existing PrefServices, and the safe browsing preference on each. | 521 // Tracks existing PrefServices, and the safe browsing preference on each. |
| 518 // This is used to determine if any profile is currently using the safe | 522 // This is used to determine if any profile is currently using the safe |
| 519 // browsing service, and to start it up or shut it down accordingly. | 523 // browsing service, and to start it up or shut it down accordingly. |
| 520 std::map<PrefService*, PrefChangeRegistrar*> prefs_map_; | 524 std::map<PrefService*, PrefChangeRegistrar*> prefs_map_; |
| 521 | 525 |
| 522 // Used to track creation and destruction of profiles on the UI thread. | 526 // Used to track creation and destruction of profiles on the UI thread. |
| 523 NotificationRegistrar prefs_registrar_; | 527 NotificationRegistrar prefs_registrar_; |
| 524 | 528 |
| 529 // The ClientSideDetectionService depends on the same preference as the |
| 530 // SafeBrowsingService. So the SafeBrowsingService updates the state of |
| 531 // the ClientSideDetectionService when its own state changes. |
| 532 safe_browsing::ClientSideDetectionService* csd_service_; |
| 533 |
| 525 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingService); | 534 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingService); |
| 526 }; | 535 }; |
| 527 | 536 |
| 528 // Factory for creating SafeBrowsingService. Useful for tests. | 537 // Factory for creating SafeBrowsingService. Useful for tests. |
| 529 class SafeBrowsingServiceFactory { | 538 class SafeBrowsingServiceFactory { |
| 530 public: | 539 public: |
| 531 SafeBrowsingServiceFactory() { } | 540 SafeBrowsingServiceFactory() { } |
| 532 virtual ~SafeBrowsingServiceFactory() { } | 541 virtual ~SafeBrowsingServiceFactory() { } |
| 533 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; | 542 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; |
| 534 private: | 543 private: |
| 535 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); | 544 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); |
| 536 }; | 545 }; |
| 537 | 546 |
| 538 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ | 547 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ |
| OLD | NEW |