Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef CHROME_BROWSER_SAFE_BROWSING_SERVICES_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_SERVICES_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_SAFE_BROWSING_SERVICES_DELEGATE_H_ | 6 #define CHROME_BROWSER_SAFE_BROWSING_SERVICES_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "chrome/browser/safe_browsing/incident_reporting/delayed_analysis_callb ack.h" | 10 #include "chrome/browser/safe_browsing/incident_reporting/delayed_analysis_callb ack.h" |
| 11 #include "components/safe_browsing_db/v4_protocol_manager_util.h" | |
| 11 #include "components/user_prefs/tracked/tracked_preference_validation_delegate.h " | 12 #include "components/user_prefs/tracked/tracked_preference_validation_delegate.h " |
| 12 | 13 |
| 13 class Profile; | 14 class Profile; |
| 14 | 15 |
| 15 namespace content { | 16 namespace content { |
| 16 class DownloadManager; | 17 class DownloadManager; |
| 17 } | 18 } |
| 18 | 19 |
| 19 namespace net { | 20 namespace net { |
| 20 class URLRequestContextGetter; | 21 class URLRequestContextGetter; |
| 21 } | 22 } |
| 22 | 23 |
| 23 namespace safe_browsing { | 24 namespace safe_browsing { |
| 24 | 25 |
| 25 class ClientSideDetectionService; | 26 class ClientSideDetectionService; |
| 26 class DownloadProtectionService; | 27 class DownloadProtectionService; |
|
Nathan Parker
2016/04/30 00:22:29
add
class V4ProtocolConfig;
and then remove the
vakh (use Gerrit instead)
2016/04/30 00:51:50
Done.
| |
| 27 class IncidentReportingService; | 28 class IncidentReportingService; |
| 28 class ResourceRequestDetector; | 29 class ResourceRequestDetector; |
| 29 struct ResourceRequestInfo; | 30 struct ResourceRequestInfo; |
| 30 class SafeBrowsingService; | 31 class SafeBrowsingService; |
| 31 | 32 |
| 32 // Abstraction to help organize code for mobile vs full safe browsing modes. | 33 // Abstraction to help organize code for mobile vs full safe browsing modes. |
| 33 // This helper class should be owned by a SafeBrowsingService, and it handles | 34 // This helper class should be owned by a SafeBrowsingService, and it handles |
| 34 // responsibilities for safe browsing service classes that may or may not exist | 35 // responsibilities for safe browsing service classes that may or may not exist |
| 35 // for a given build config. e.g. No DownloadProtectionService on mobile. | 36 // for a given build config. e.g. No DownloadProtectionService on mobile. |
| 36 // ServicesDelegate lives on the UI thread. | 37 // ServicesDelegate lives on the UI thread. |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 58 static std::unique_ptr<ServicesDelegate> Create( | 59 static std::unique_ptr<ServicesDelegate> Create( |
| 59 SafeBrowsingService* safe_browsing_service); | 60 SafeBrowsingService* safe_browsing_service); |
| 60 | 61 |
| 61 // Creates the ServicesDelegate using a custom ServicesCreator, for testing. | 62 // Creates the ServicesDelegate using a custom ServicesCreator, for testing. |
| 62 static std::unique_ptr<ServicesDelegate> CreateForTest( | 63 static std::unique_ptr<ServicesDelegate> CreateForTest( |
| 63 SafeBrowsingService* safe_browsing_service, | 64 SafeBrowsingService* safe_browsing_service, |
| 64 ServicesDelegate::ServicesCreator* services_creator); | 65 ServicesDelegate::ServicesCreator* services_creator); |
| 65 | 66 |
| 66 virtual ~ServicesDelegate() {} | 67 virtual ~ServicesDelegate() {} |
| 67 | 68 |
| 69 // Initializes internal state using the ServicesCreator. | |
| 70 virtual void Initialize() = 0; | |
| 71 | |
| 68 // Creates the CSD service for the given |context_getter|. | 72 // Creates the CSD service for the given |context_getter|. |
| 69 virtual void InitializeCsdService( | 73 virtual void InitializeCsdService( |
| 70 net::URLRequestContextGetter* context_getter) = 0; | 74 net::URLRequestContextGetter* context_getter) = 0; |
| 71 | 75 |
| 72 // Initializes services using the ServicesCreator. | |
| 73 virtual void InitializeServices() = 0; | |
| 74 | |
| 75 // Shuts down the download service. | 76 // Shuts down the download service. |
| 76 virtual void ShutdownServices() = 0; | 77 virtual void ShutdownServices() = 0; |
| 77 | 78 |
| 78 // Handles SafeBrowsingService::RefreshState() for the provided services. | 79 // Handles SafeBrowsingService::RefreshState() for the provided services. |
| 79 virtual void RefreshState(bool enable) = 0; | 80 virtual void RefreshState(bool enable) = 0; |
| 80 | 81 |
| 81 // See the SafeBrowsingService methods of the same name. | 82 // See the SafeBrowsingService methods of the same name. |
| 82 virtual void ProcessResourceRequest(const ResourceRequestInfo* request) = 0; | 83 virtual void ProcessResourceRequest(const ResourceRequestInfo* request) = 0; |
| 83 virtual std::unique_ptr<TrackedPreferenceValidationDelegate> | 84 virtual std::unique_ptr<TrackedPreferenceValidationDelegate> |
| 84 CreatePreferenceValidationDelegate(Profile* profile) = 0; | 85 CreatePreferenceValidationDelegate(Profile* profile) = 0; |
| 85 virtual void RegisterDelayedAnalysisCallback( | 86 virtual void RegisterDelayedAnalysisCallback( |
| 86 const DelayedAnalysisCallback& callback) = 0; | 87 const DelayedAnalysisCallback& callback) = 0; |
| 87 virtual void RegisterExtendedReportingOnlyDelayedAnalysisCallback( | 88 virtual void RegisterExtendedReportingOnlyDelayedAnalysisCallback( |
| 88 const DelayedAnalysisCallback& callback) = 0; | 89 const DelayedAnalysisCallback& callback) = 0; |
| 89 virtual void AddDownloadManager( | 90 virtual void AddDownloadManager( |
| 90 content::DownloadManager* download_manager) = 0; | 91 content::DownloadManager* download_manager) = 0; |
| 91 | 92 |
| 92 // Returns nullptr for any service that is not available. | 93 // Returns nullptr for any service that is not available. |
| 93 virtual ClientSideDetectionService* GetCsdService() = 0; | 94 virtual ClientSideDetectionService* GetCsdService() = 0; |
| 94 virtual DownloadProtectionService* GetDownloadService() = 0; | 95 virtual DownloadProtectionService* GetDownloadService() = 0; |
| 96 | |
| 97 virtual void StartOnIOThread( | |
| 98 net::URLRequestContextGetter* url_request_context_getter, | |
| 99 const V4ProtocolConfig& v4_config) = 0; | |
| 100 virtual void StopOnIOThread(bool shutdown) = 0; | |
| 95 }; | 101 }; |
| 96 | 102 |
| 97 } // namespace safe_browsing | 103 } // namespace safe_browsing |
| 98 | 104 |
| 99 #endif // CHROME_BROWSER_SAFE_BROWSING_SERVICES_DELEGATE_H_ | 105 #endif // CHROME_BROWSER_SAFE_BROWSING_SERVICES_DELEGATE_H_ |
| OLD | NEW |