| 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 "base/memory/ref_counted.h" | |
| 11 #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" |
| 12 #include "components/user_prefs/tracked/tracked_preference_validation_delegate.h
" | 11 #include "components/user_prefs/tracked/tracked_preference_validation_delegate.h
" |
| 13 | 12 |
| 14 class Profile; | 13 class Profile; |
| 15 | 14 |
| 16 namespace content { | 15 namespace content { |
| 17 class DownloadManager; | 16 class DownloadManager; |
| 18 } | 17 } |
| 19 | 18 |
| 20 namespace net { | 19 namespace net { |
| 21 class URLRequestContextGetter; | 20 class URLRequestContextGetter; |
| 22 } | 21 } |
| 23 | 22 |
| 24 namespace safe_browsing { | 23 namespace safe_browsing { |
| 25 | 24 |
| 26 class ClientSideDetectionService; | 25 class ClientSideDetectionService; |
| 27 class DownloadProtectionService; | 26 class DownloadProtectionService; |
| 28 class IncidentReportingService; | 27 class IncidentReportingService; |
| 29 class ResourceRequestDetector; | 28 class ResourceRequestDetector; |
| 30 struct ResourceRequestInfo; | 29 struct ResourceRequestInfo; |
| 31 class SafeBrowsingService; | 30 class SafeBrowsingService; |
| 32 class V4LocalDatabaseManager; | |
| 33 struct V4ProtocolConfig; | 31 struct V4ProtocolConfig; |
| 34 | 32 |
| 35 // 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. |
| 36 // 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 |
| 37 // 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 |
| 38 // for a given build config. e.g. No DownloadProtectionService on mobile. | 36 // for a given build config. e.g. No DownloadProtectionService on mobile. |
| 39 // ServicesDelegate lives on the UI thread. | 37 // ServicesDelegate lives on the UI thread. |
| 40 class ServicesDelegate { | 38 class ServicesDelegate { |
| 41 public: | 39 public: |
| 42 // Used for tests to override service creation. If CanCreateFooService() | 40 // Used for tests to override service creation. If CanCreateFooService() |
| (...skipping 18 matching lines...) Expand all Loading... |
| 61 static std::unique_ptr<ServicesDelegate> Create( | 59 static std::unique_ptr<ServicesDelegate> Create( |
| 62 SafeBrowsingService* safe_browsing_service); | 60 SafeBrowsingService* safe_browsing_service); |
| 63 | 61 |
| 64 // Creates the ServicesDelegate using a custom ServicesCreator, for testing. | 62 // Creates the ServicesDelegate using a custom ServicesCreator, for testing. |
| 65 static std::unique_ptr<ServicesDelegate> CreateForTest( | 63 static std::unique_ptr<ServicesDelegate> CreateForTest( |
| 66 SafeBrowsingService* safe_browsing_service, | 64 SafeBrowsingService* safe_browsing_service, |
| 67 ServicesDelegate::ServicesCreator* services_creator); | 65 ServicesDelegate::ServicesCreator* services_creator); |
| 68 | 66 |
| 69 virtual ~ServicesDelegate() {} | 67 virtual ~ServicesDelegate() {} |
| 70 | 68 |
| 71 virtual const scoped_refptr<V4LocalDatabaseManager>& | |
| 72 v4_local_database_manager() const = 0; | |
| 73 | |
| 74 // Initializes internal state using the ServicesCreator. | 69 // Initializes internal state using the ServicesCreator. |
| 75 virtual void Initialize() = 0; | 70 virtual void Initialize() = 0; |
| 76 | 71 |
| 77 // Creates the CSD service for the given |context_getter|. | 72 // Creates the CSD service for the given |context_getter|. |
| 78 virtual void InitializeCsdService( | 73 virtual void InitializeCsdService( |
| 79 net::URLRequestContextGetter* context_getter) = 0; | 74 net::URLRequestContextGetter* context_getter) = 0; |
| 80 | 75 |
| 81 // Shuts down the download service. | 76 // Shuts down the download service. |
| 82 virtual void ShutdownServices() = 0; | 77 virtual void ShutdownServices() = 0; |
| 83 | 78 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 101 | 96 |
| 102 virtual void StartOnIOThread( | 97 virtual void StartOnIOThread( |
| 103 net::URLRequestContextGetter* url_request_context_getter, | 98 net::URLRequestContextGetter* url_request_context_getter, |
| 104 const V4ProtocolConfig& v4_config) = 0; | 99 const V4ProtocolConfig& v4_config) = 0; |
| 105 virtual void StopOnIOThread(bool shutdown) = 0; | 100 virtual void StopOnIOThread(bool shutdown) = 0; |
| 106 }; | 101 }; |
| 107 | 102 |
| 108 } // namespace safe_browsing | 103 } // namespace safe_browsing |
| 109 | 104 |
| 110 #endif // CHROME_BROWSER_SAFE_BROWSING_SERVICES_DELEGATE_H_ | 105 #endif // CHROME_BROWSER_SAFE_BROWSING_SERVICES_DELEGATE_H_ |
| OLD | NEW |