| 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_IMPL_H_ | 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_SERVICES_DELEGATE_IMPL_H_ |
| 6 #define CHROME_BROWSER_SAFE_BROWSING_SERVICES_DELEGATE_IMPL_H_ | 6 #define CHROME_BROWSER_SAFE_BROWSING_SERVICES_DELEGATE_IMPL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "chrome/browser/safe_browsing/client_side_detection_service.h" | 11 #include "chrome/browser/safe_browsing/client_side_detection_service.h" |
| 12 #include "chrome/browser/safe_browsing/download_protection_service.h" | 12 #include "chrome/browser/safe_browsing/download_protection_service.h" |
| 13 #include "chrome/browser/safe_browsing/incident_reporting/incident_reporting_ser
vice.h" | 13 #include "chrome/browser/safe_browsing/incident_reporting/incident_reporting_ser
vice.h" |
| 14 #include "chrome/browser/safe_browsing/incident_reporting/resource_request_detec
tor.h" | 14 #include "chrome/browser/safe_browsing/incident_reporting/resource_request_detec
tor.h" |
| 15 #include "chrome/browser/safe_browsing/services_delegate.h" | 15 #include "chrome/browser/safe_browsing/services_delegate.h" |
| 16 | 16 |
| 17 namespace safe_browsing { | 17 namespace safe_browsing { |
| 18 | 18 |
| 19 class V4LocalDatabaseManager; |
| 20 |
| 19 // Actual ServicesDelegate implementation. Create via | 21 // Actual ServicesDelegate implementation. Create via |
| 20 // ServicesDelegate::Create(). | 22 // ServicesDelegate::Create(). |
| 21 class ServicesDelegateImpl : public ServicesDelegate { | 23 class ServicesDelegateImpl : public ServicesDelegate { |
| 22 public: | 24 public: |
| 23 ServicesDelegateImpl(SafeBrowsingService* safe_browsing_service, | 25 ServicesDelegateImpl(SafeBrowsingService* safe_browsing_service, |
| 24 ServicesDelegate::ServicesCreator* services_creator); | 26 ServicesDelegate::ServicesCreator* services_creator); |
| 25 ~ServicesDelegateImpl() override; | 27 ~ServicesDelegateImpl() override; |
| 26 | 28 |
| 27 private: | 29 private: |
| 28 // ServicesDelegate: | 30 // ServicesDelegate: |
| 31 void Initialize() override; |
| 29 void InitializeCsdService( | 32 void InitializeCsdService( |
| 30 net::URLRequestContextGetter* context_getter) override; | 33 net::URLRequestContextGetter* context_getter) override; |
| 31 void InitializeServices() override; | |
| 32 void ShutdownServices() override; | 34 void ShutdownServices() override; |
| 33 void RefreshState(bool enable) override; | 35 void RefreshState(bool enable) override; |
| 34 void ProcessResourceRequest(const ResourceRequestInfo* request) override; | 36 void ProcessResourceRequest(const ResourceRequestInfo* request) override; |
| 35 std::unique_ptr<TrackedPreferenceValidationDelegate> | 37 std::unique_ptr<TrackedPreferenceValidationDelegate> |
| 36 CreatePreferenceValidationDelegate(Profile* profile) override; | 38 CreatePreferenceValidationDelegate(Profile* profile) override; |
| 37 void RegisterDelayedAnalysisCallback( | 39 void RegisterDelayedAnalysisCallback( |
| 38 const DelayedAnalysisCallback& callback) override; | 40 const DelayedAnalysisCallback& callback) override; |
| 39 void RegisterExtendedReportingOnlyDelayedAnalysisCallback( | 41 void RegisterExtendedReportingOnlyDelayedAnalysisCallback( |
| 40 const DelayedAnalysisCallback& callback) override; | 42 const DelayedAnalysisCallback& callback) override; |
| 41 void AddDownloadManager(content::DownloadManager* download_manager) override; | 43 void AddDownloadManager(content::DownloadManager* download_manager) override; |
| 42 ClientSideDetectionService* GetCsdService() override; | 44 ClientSideDetectionService* GetCsdService() override; |
| 43 DownloadProtectionService* GetDownloadService() override; | 45 DownloadProtectionService* GetDownloadService() override; |
| 44 | 46 |
| 47 void StartOnIOThread( |
| 48 net::URLRequestContextGetter* url_request_context_getter, |
| 49 const V4ProtocolConfig& v4_config) override; |
| 50 void StopOnIOThread(bool shutdown) override; |
| 51 |
| 52 // Is the Pver4 database manager enabled? Controlled by Finch. |
| 53 bool IsV4LocalDatabaseManagerEnabled(); |
| 54 |
| 55 V4LocalDatabaseManager* CreateV4LocalDatabaseManager(); |
| 56 |
| 45 DownloadProtectionService* CreateDownloadProtectionService(); | 57 DownloadProtectionService* CreateDownloadProtectionService(); |
| 46 IncidentReportingService* CreateIncidentReportingService(); | 58 IncidentReportingService* CreateIncidentReportingService(); |
| 47 ResourceRequestDetector* CreateResourceRequestDetector(); | 59 ResourceRequestDetector* CreateResourceRequestDetector(); |
| 48 | 60 |
| 49 std::unique_ptr<ClientSideDetectionService> csd_service_; | 61 std::unique_ptr<ClientSideDetectionService> csd_service_; |
| 50 std::unique_ptr<DownloadProtectionService> download_service_; | 62 std::unique_ptr<DownloadProtectionService> download_service_; |
| 51 std::unique_ptr<IncidentReportingService> incident_service_; | 63 std::unique_ptr<IncidentReportingService> incident_service_; |
| 52 std::unique_ptr<ResourceRequestDetector> resource_request_detector_; | 64 std::unique_ptr<ResourceRequestDetector> resource_request_detector_; |
| 53 | 65 |
| 54 SafeBrowsingService* const safe_browsing_service_; | 66 SafeBrowsingService* const safe_browsing_service_; |
| 55 ServicesDelegate::ServicesCreator* const services_creator_; | 67 ServicesDelegate::ServicesCreator* const services_creator_; |
| 56 | 68 |
| 69 // The Pver4 local database manager handles the database and download logic |
| 70 // Accessed on both UI and IO thread. |
| 71 scoped_refptr<V4LocalDatabaseManager> v4_local_database_manager_; |
| 72 |
| 57 DISALLOW_COPY_AND_ASSIGN(ServicesDelegateImpl); | 73 DISALLOW_COPY_AND_ASSIGN(ServicesDelegateImpl); |
| 58 }; | 74 }; |
| 59 | 75 |
| 60 } // namespace safe_browsing | 76 } // namespace safe_browsing |
| 61 | 77 |
| 62 #endif // CHROME_BROWSER_SAFE_BROWSING_SERVICES_DELEGATE_IMPL_H_ | 78 #endif // CHROME_BROWSER_SAFE_BROWSING_SERVICES_DELEGATE_IMPL_H_ |
| OLD | NEW |