| 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 #include "chrome/browser/browser_process.h" |
| 6 #include "chrome/browser/profiles/profile.h" |
| 5 #include "chrome/browser/safe_browsing/certificate_reporting_service.h" | 7 #include "chrome/browser/safe_browsing/certificate_reporting_service.h" |
| 6 #include "chrome/browser/safe_browsing/certificate_reporting_service_factory.h" | 8 #include "chrome/browser/safe_browsing/certificate_reporting_service_factory.h" |
| 9 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 7 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 10 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 8 | 11 |
| 9 // static | 12 // static |
| 10 CertificateReportingServiceFactory* | 13 CertificateReportingServiceFactory* |
| 11 CertificateReportingServiceFactory::GetInstance() { | 14 CertificateReportingServiceFactory::GetInstance() { |
| 12 return base::Singleton<CertificateReportingServiceFactory>::get(); | 15 return base::Singleton<CertificateReportingServiceFactory>::get(); |
| 13 } | 16 } |
| 14 | 17 |
| 15 // static | 18 // static |
| 16 CertificateReportingService* | 19 CertificateReportingService* |
| 17 CertificateReportingServiceFactory::GetForBrowserContext( | 20 CertificateReportingServiceFactory::GetForBrowserContext( |
| 18 content::BrowserContext* context) { | 21 content::BrowserContext* context) { |
| 19 return static_cast<CertificateReportingService*>( | 22 return static_cast<CertificateReportingService*>( |
| 20 GetInstance()->GetServiceForBrowserContext(context, true)); | 23 GetInstance()->GetServiceForBrowserContext(context, true)); |
| 21 } | 24 } |
| 22 | 25 |
| 23 CertificateReportingServiceFactory::CertificateReportingServiceFactory() | 26 CertificateReportingServiceFactory::CertificateReportingServiceFactory() |
| 24 : BrowserContextKeyedServiceFactory( | 27 : BrowserContextKeyedServiceFactory( |
| 25 "cert_reporting::Factory", | 28 "cert_reporting::Factory", |
| 26 BrowserContextDependencyManager::GetInstance()) {} | 29 BrowserContextDependencyManager::GetInstance()) {} |
| 27 | 30 |
| 28 CertificateReportingServiceFactory::~CertificateReportingServiceFactory() {} | 31 CertificateReportingServiceFactory::~CertificateReportingServiceFactory() {} |
| 29 | 32 |
| 30 KeyedService* CertificateReportingServiceFactory::BuildServiceInstanceFor( | 33 KeyedService* CertificateReportingServiceFactory::BuildServiceInstanceFor( |
| 31 content::BrowserContext* profile) const { | 34 content::BrowserContext* profile) const { |
| 32 return nullptr; | 35 safe_browsing::SafeBrowsingService* safe_browsing_service = |
| 36 g_browser_process->safe_browsing_service(); |
| 37 |
| 38 return CertificateReportingService::Create(safe_browsing_service, |
| 39 static_cast<Profile*>(profile)); |
| 33 } | 40 } |
| 34 | 41 |
| 35 content::BrowserContext* | 42 content::BrowserContext* |
| 36 CertificateReportingServiceFactory::GetBrowserContextToUse( | 43 CertificateReportingServiceFactory::GetBrowserContextToUse( |
| 37 content::BrowserContext* context) const { | 44 content::BrowserContext* context) const { |
| 38 return context; | 45 return context; |
| 39 } | 46 } |
| OLD | NEW |