| 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" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace safe_browsing { | 23 namespace safe_browsing { |
| 24 | 24 |
| 25 class ClientSideDetectionService; | 25 class ClientSideDetectionService; |
| 26 class DownloadProtectionService; | 26 class DownloadProtectionService; |
| 27 class IncidentReportingService; | 27 class IncidentReportingService; |
| 28 class ResourceRequestDetector; | 28 class ResourceRequestDetector; |
| 29 struct ResourceRequestInfo; | 29 struct ResourceRequestInfo; |
| 30 class SafeBrowsingService; | 30 class SafeBrowsingService; |
| 31 class V4LocalDatabaseManager; |
| 31 struct V4ProtocolConfig; | 32 struct V4ProtocolConfig; |
| 32 | 33 |
| 33 // Abstraction to help organize code for mobile vs full safe browsing modes. | 34 // Abstraction to help organize code for mobile vs full safe browsing modes. |
| 34 // This helper class should be owned by a SafeBrowsingService, and it handles | 35 // This helper class should be owned by a SafeBrowsingService, and it handles |
| 35 // responsibilities for safe browsing service classes that may or may not exist | 36 // responsibilities for safe browsing service classes that may or may not exist |
| 36 // for a given build config. e.g. No DownloadProtectionService on mobile. | 37 // for a given build config. e.g. No DownloadProtectionService on mobile. |
| 37 // ServicesDelegate lives on the UI thread. | 38 // ServicesDelegate lives on the UI thread. |
| 38 class ServicesDelegate { | 39 class ServicesDelegate { |
| 39 public: | 40 public: |
| 40 // Used for tests to override service creation. If CanCreateFooService() | 41 // Used for tests to override service creation. If CanCreateFooService() |
| (...skipping 18 matching lines...) Expand all Loading... |
| 59 static std::unique_ptr<ServicesDelegate> Create( | 60 static std::unique_ptr<ServicesDelegate> Create( |
| 60 SafeBrowsingService* safe_browsing_service); | 61 SafeBrowsingService* safe_browsing_service); |
| 61 | 62 |
| 62 // Creates the ServicesDelegate using a custom ServicesCreator, for testing. | 63 // Creates the ServicesDelegate using a custom ServicesCreator, for testing. |
| 63 static std::unique_ptr<ServicesDelegate> CreateForTest( | 64 static std::unique_ptr<ServicesDelegate> CreateForTest( |
| 64 SafeBrowsingService* safe_browsing_service, | 65 SafeBrowsingService* safe_browsing_service, |
| 65 ServicesDelegate::ServicesCreator* services_creator); | 66 ServicesDelegate::ServicesCreator* services_creator); |
| 66 | 67 |
| 67 virtual ~ServicesDelegate() {} | 68 virtual ~ServicesDelegate() {} |
| 68 | 69 |
| 70 virtual const scoped_refptr<V4LocalDatabaseManager>& |
| 71 v4_local_database_manager() const = 0; |
| 72 |
| 69 // Initializes internal state using the ServicesCreator. | 73 // Initializes internal state using the ServicesCreator. |
| 70 virtual void Initialize() = 0; | 74 virtual void Initialize() = 0; |
| 71 | 75 |
| 72 // Creates the CSD service for the given |context_getter|. | 76 // Creates the CSD service for the given |context_getter|. |
| 73 virtual void InitializeCsdService( | 77 virtual void InitializeCsdService( |
| 74 net::URLRequestContextGetter* context_getter) = 0; | 78 net::URLRequestContextGetter* context_getter) = 0; |
| 75 | 79 |
| 76 // Shuts down the download service. | 80 // Shuts down the download service. |
| 77 virtual void ShutdownServices() = 0; | 81 virtual void ShutdownServices() = 0; |
| 78 | 82 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 96 | 100 |
| 97 virtual void StartOnIOThread( | 101 virtual void StartOnIOThread( |
| 98 net::URLRequestContextGetter* url_request_context_getter, | 102 net::URLRequestContextGetter* url_request_context_getter, |
| 99 const V4ProtocolConfig& v4_config) = 0; | 103 const V4ProtocolConfig& v4_config) = 0; |
| 100 virtual void StopOnIOThread(bool shutdown) = 0; | 104 virtual void StopOnIOThread(bool shutdown) = 0; |
| 101 }; | 105 }; |
| 102 | 106 |
| 103 } // namespace safe_browsing | 107 } // namespace safe_browsing |
| 104 | 108 |
| 105 #endif // CHROME_BROWSER_SAFE_BROWSING_SERVICES_DELEGATE_H_ | 109 #endif // CHROME_BROWSER_SAFE_BROWSING_SERVICES_DELEGATE_H_ |
| OLD | NEW |