| 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 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 class SafeBrowsingServiceFactory; | 33 class SafeBrowsingServiceFactory; |
| 34 class SafeBrowsingUIManager; | 34 class SafeBrowsingUIManager; |
| 35 class SafeBrowsingURLRequestContextGetter; | 35 class SafeBrowsingURLRequestContextGetter; |
| 36 class TrackedPreferenceValidationDelegate; | 36 class TrackedPreferenceValidationDelegate; |
| 37 | 37 |
| 38 namespace base { | 38 namespace base { |
| 39 class Thread; | 39 class Thread; |
| 40 } | 40 } |
| 41 | 41 |
| 42 namespace net { | 42 namespace net { |
| 43 class URLRequest; |
| 43 class URLRequestContext; | 44 class URLRequestContext; |
| 44 class URLRequestContextGetter; | 45 class URLRequestContextGetter; |
| 45 } | 46 } |
| 46 | 47 |
| 47 namespace safe_browsing { | 48 namespace safe_browsing { |
| 48 class ClientSideDetectionService; | 49 class ClientSideDetectionService; |
| 49 class DownloadProtectionService; | 50 class DownloadProtectionService; |
| 50 class IncidentReportingService; | 51 class IncidentReportingService; |
| 52 class OffDomainInclusionDetector; |
| 51 } | 53 } |
| 52 | 54 |
| 53 // Construction needs to happen on the main thread. | 55 // Construction needs to happen on the main thread. |
| 54 // The SafeBrowsingService owns both the UI and Database managers which do | 56 // The SafeBrowsingService owns both the UI and Database managers which do |
| 55 // the heavylifting of safebrowsing service. Both of these managers stay | 57 // the heavylifting of safebrowsing service. Both of these managers stay |
| 56 // alive until SafeBrowsingService is destroyed, however, they are disabled | 58 // alive until SafeBrowsingService is destroyed, however, they are disabled |
| 57 // permanently when Shutdown method is called. | 59 // permanently when Shutdown method is called. |
| 58 class SafeBrowsingService | 60 class SafeBrowsingService |
| 59 : public base::RefCountedThreadSafe< | 61 : public base::RefCountedThreadSafe< |
| 60 SafeBrowsingService, | 62 SafeBrowsingService, |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 // service is not applicable for the given profile. | 126 // service is not applicable for the given profile. |
| 125 scoped_ptr<TrackedPreferenceValidationDelegate> | 127 scoped_ptr<TrackedPreferenceValidationDelegate> |
| 126 CreatePreferenceValidationDelegate(Profile* profile) const; | 128 CreatePreferenceValidationDelegate(Profile* profile) const; |
| 127 | 129 |
| 128 // Registers |callback| to be run after some delay following process launch. | 130 // Registers |callback| to be run after some delay following process launch. |
| 129 // |callback| will be dropped if the service is not applicable for the | 131 // |callback| will be dropped if the service is not applicable for the |
| 130 // process. | 132 // process. |
| 131 void RegisterDelayedAnalysisCallback( | 133 void RegisterDelayedAnalysisCallback( |
| 132 const safe_browsing::DelayedAnalysisCallback& callback); | 134 const safe_browsing::DelayedAnalysisCallback& callback); |
| 133 | 135 |
| 136 // Observes resource requests made by the renderer and reports suspicious |
| 137 // activity. |
| 138 void OnResourceRequest(const net::URLRequest* request); |
| 139 |
| 134 protected: | 140 protected: |
| 135 // Creates the safe browsing service. Need to initialize before using. | 141 // Creates the safe browsing service. Need to initialize before using. |
| 136 SafeBrowsingService(); | 142 SafeBrowsingService(); |
| 137 | 143 |
| 138 ~SafeBrowsingService() override; | 144 ~SafeBrowsingService() override; |
| 139 | 145 |
| 140 virtual SafeBrowsingDatabaseManager* CreateDatabaseManager(); | 146 virtual SafeBrowsingDatabaseManager* CreateDatabaseManager(); |
| 141 | 147 |
| 142 virtual SafeBrowsingUIManager* CreateUIManager(); | 148 virtual SafeBrowsingUIManager* CreateUIManager(); |
| 143 | 149 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 scoped_ptr<safe_browsing::IncidentReportingService> incident_service_; | 246 scoped_ptr<safe_browsing::IncidentReportingService> incident_service_; |
| 241 | 247 |
| 242 // The UI manager handles showing interstitials. Accessed on both UI and IO | 248 // The UI manager handles showing interstitials. Accessed on both UI and IO |
| 243 // thread. | 249 // thread. |
| 244 scoped_refptr<SafeBrowsingUIManager> ui_manager_; | 250 scoped_refptr<SafeBrowsingUIManager> ui_manager_; |
| 245 | 251 |
| 246 // The database manager handles the database and download logic. Accessed on | 252 // The database manager handles the database and download logic. Accessed on |
| 247 // both UI and IO thread. | 253 // both UI and IO thread. |
| 248 scoped_refptr<SafeBrowsingDatabaseManager> database_manager_; | 254 scoped_refptr<SafeBrowsingDatabaseManager> database_manager_; |
| 249 | 255 |
| 256 scoped_ptr<safe_browsing::OffDomainInclusionDetector> |
| 257 off_domain_inclusion_detector_; |
| 258 |
| 250 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingService); | 259 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingService); |
| 251 }; | 260 }; |
| 252 | 261 |
| 253 // Factory for creating SafeBrowsingService. Useful for tests. | 262 // Factory for creating SafeBrowsingService. Useful for tests. |
| 254 class SafeBrowsingServiceFactory { | 263 class SafeBrowsingServiceFactory { |
| 255 public: | 264 public: |
| 256 SafeBrowsingServiceFactory() { } | 265 SafeBrowsingServiceFactory() { } |
| 257 virtual ~SafeBrowsingServiceFactory() { } | 266 virtual ~SafeBrowsingServiceFactory() { } |
| 258 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; | 267 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; |
| 259 private: | 268 private: |
| 260 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); | 269 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); |
| 261 }; | 270 }; |
| 262 | 271 |
| 263 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ | 272 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ |
| OLD | NEW |