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