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