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