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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 struct ResourceRequestInfo; | 58 struct ResourceRequestInfo; |
59 struct SafeBrowsingProtocolConfig; | 59 struct SafeBrowsingProtocolConfig; |
60 class SafeBrowsingDatabaseManager; | 60 class SafeBrowsingDatabaseManager; |
61 class SafeBrowsingNavigationObserverManager; | 61 class SafeBrowsingNavigationObserverManager; |
62 class SafeBrowsingPingManager; | 62 class SafeBrowsingPingManager; |
63 class SafeBrowsingProtocolManager; | 63 class SafeBrowsingProtocolManager; |
64 class SafeBrowsingProtocolManagerDelegate; | 64 class SafeBrowsingProtocolManagerDelegate; |
65 class SafeBrowsingServiceFactory; | 65 class SafeBrowsingServiceFactory; |
66 class SafeBrowsingUIManager; | 66 class SafeBrowsingUIManager; |
67 class SafeBrowsingURLRequestContextGetter; | 67 class SafeBrowsingURLRequestContextGetter; |
| 68 class TriggerManager; |
68 struct V4ProtocolConfig; | 69 struct V4ProtocolConfig; |
69 | 70 |
70 // Construction needs to happen on the main thread. | 71 // Construction needs to happen on the main thread. |
71 // The SafeBrowsingService owns both the UI and Database managers which do | 72 // The SafeBrowsingService owns both the UI and Database managers which do |
72 // the heavylifting of safebrowsing service. Both of these managers stay | 73 // the heavylifting of safebrowsing service. Both of these managers stay |
73 // alive until SafeBrowsingService is destroyed, however, they are disabled | 74 // alive until SafeBrowsingService is destroyed, however, they are disabled |
74 // permanently when Shutdown method is called. | 75 // permanently when Shutdown method is called. |
75 class SafeBrowsingService : public base::RefCountedThreadSafe< | 76 class SafeBrowsingService : public base::RefCountedThreadSafe< |
76 SafeBrowsingService, | 77 SafeBrowsingService, |
77 content::BrowserThread::DeleteOnUIThread>, | 78 content::BrowserThread::DeleteOnUIThread>, |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 | 275 |
275 void OnSendSerializedDownloadReport(const std::string& report); | 276 void OnSendSerializedDownloadReport(const std::string& report); |
276 | 277 |
277 // Process the observed resource requests on the UI thread. | 278 // Process the observed resource requests on the UI thread. |
278 void ProcessResourceRequest(const ResourceRequestInfo& request); | 279 void ProcessResourceRequest(const ResourceRequestInfo& request); |
279 | 280 |
280 void CreatePasswordProtectionService(Profile* profile); | 281 void CreatePasswordProtectionService(Profile* profile); |
281 | 282 |
282 void RemovePasswordProtectionService(Profile* profile); | 283 void RemovePasswordProtectionService(Profile* profile); |
283 | 284 |
| 285 void CreateTriggerManager(); |
| 286 |
284 // The factory used to instantiate a SafeBrowsingService object. | 287 // The factory used to instantiate a SafeBrowsingService object. |
285 // Useful for tests, so they can provide their own implementation of | 288 // Useful for tests, so they can provide their own implementation of |
286 // SafeBrowsingService. | 289 // SafeBrowsingService. |
287 static SafeBrowsingServiceFactory* factory_; | 290 static SafeBrowsingServiceFactory* factory_; |
288 | 291 |
289 // The SafeBrowsingURLRequestContextGetter used to access | 292 // The SafeBrowsingURLRequestContextGetter used to access |
290 // |url_request_context_|. Accessed on UI thread. | 293 // |url_request_context_|. Accessed on UI thread. |
291 scoped_refptr<SafeBrowsingURLRequestContextGetter> | 294 scoped_refptr<SafeBrowsingURLRequestContextGetter> |
292 url_request_context_getter_; | 295 url_request_context_getter_; |
293 | 296 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 // events. | 352 // events. |
350 scoped_refptr<SafeBrowsingNavigationObserverManager> | 353 scoped_refptr<SafeBrowsingNavigationObserverManager> |
351 navigation_observer_manager_; | 354 navigation_observer_manager_; |
352 | 355 |
353 // Tracks existing Profiles, and their corresponding | 356 // Tracks existing Profiles, and their corresponding |
354 // ChromePasswordProtectionService instances. | 357 // ChromePasswordProtectionService instances. |
355 // Accessed on UI thread. | 358 // Accessed on UI thread. |
356 std::map<Profile*, std::unique_ptr<ChromePasswordProtectionService>> | 359 std::map<Profile*, std::unique_ptr<ChromePasswordProtectionService>> |
357 password_protection_service_map_; | 360 password_protection_service_map_; |
358 | 361 |
| 362 std::unique_ptr<TriggerManager> trigger_manager_; |
| 363 |
359 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingService); | 364 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingService); |
360 }; | 365 }; |
361 | 366 |
362 // Factory for creating SafeBrowsingService. Useful for tests. | 367 // Factory for creating SafeBrowsingService. Useful for tests. |
363 class SafeBrowsingServiceFactory { | 368 class SafeBrowsingServiceFactory { |
364 public: | 369 public: |
365 SafeBrowsingServiceFactory() { } | 370 SafeBrowsingServiceFactory() { } |
366 virtual ~SafeBrowsingServiceFactory() { } | 371 virtual ~SafeBrowsingServiceFactory() { } |
367 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; | 372 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; |
368 private: | 373 private: |
369 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); | 374 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); |
370 }; | 375 }; |
371 | 376 |
372 } // namespace safe_browsing | 377 } // namespace safe_browsing |
373 | 378 |
374 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ | 379 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ |
OLD | NEW |