OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chromeos/platform_keys/platform_keys_service_factory.h" | 5 #include "chrome/browser/net/cert_database_service_factory.h" |
6 | 6 |
7 #include "base/logging.h" | |
8 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
9 #include "chrome/browser/chromeos/platform_keys/platform_keys_service.h" | |
10 #include "chrome/browser/extensions/extension_system_factory.h" | |
11 #include "chrome/browser/profiles/incognito_helpers.h" | 8 #include "chrome/browser/profiles/incognito_helpers.h" |
| 9 #include "components/cert_database/public/cert_database_service.h" |
12 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 10 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
13 | 11 |
14 namespace chromeos { | 12 namespace cert_database { |
15 | 13 |
16 // static | 14 // static |
17 PlatformKeysService* PlatformKeysServiceFactory::GetForBrowserContext( | 15 CertDatabaseService* CertDatabaseServiceFactory::GetForBrowserContext( |
18 content::BrowserContext* context) { | 16 content::BrowserContext* context) { |
19 return static_cast<PlatformKeysService*>( | 17 return static_cast<CertDatabaseService*>( |
20 GetInstance()->GetServiceForBrowserContext(context, true)); | 18 GetInstance()->GetServiceForBrowserContext(context, true)); |
21 } | 19 } |
22 | 20 |
23 // static | 21 // static |
24 PlatformKeysServiceFactory* PlatformKeysServiceFactory::GetInstance() { | 22 CertDatabaseServiceFactory* CertDatabaseServiceFactory::GetInstance() { |
25 return Singleton<PlatformKeysServiceFactory>::get(); | 23 return Singleton<CertDatabaseServiceFactory>::get(); |
26 } | 24 } |
27 | 25 |
28 PlatformKeysServiceFactory::PlatformKeysServiceFactory() | 26 CertDatabaseServiceFactory::CertDatabaseServiceFactory() |
29 : BrowserContextKeyedServiceFactory( | 27 : BrowserContextKeyedServiceFactory( |
30 "PlatformKeysService", | 28 "CertDatabaseService", |
31 BrowserContextDependencyManager::GetInstance()) { | 29 BrowserContextDependencyManager::GetInstance()) { |
32 DependsOn(extensions::ExtensionSystemFactory::GetInstance()); | |
33 } | 30 } |
34 | 31 |
35 PlatformKeysServiceFactory::~PlatformKeysServiceFactory() { | 32 CertDatabaseServiceFactory::~CertDatabaseServiceFactory() { |
36 } | 33 } |
37 | 34 |
38 content::BrowserContext* PlatformKeysServiceFactory::GetBrowserContextToUse( | 35 content::BrowserContext* CertDatabaseServiceFactory::GetBrowserContextToUse( |
39 content::BrowserContext* context) const { | 36 content::BrowserContext* context) const { |
40 return chrome::GetBrowserContextRedirectedInIncognito(context); | 37 return chrome::GetBrowserContextRedirectedInIncognito(context); |
41 } | 38 } |
42 | 39 |
43 KeyedService* PlatformKeysServiceFactory::BuildServiceInstanceFor( | 40 bool CertDatabaseServiceFactory::ServiceIsCreatedWithBrowserContext() const { |
44 content::BrowserContext* context) const { | 41 // TODO(pneubeck): Once CertLoader is not a separate singleton anymore, we can |
45 extensions::StateStore* store = | 42 // consider creating the CertDatabaseService on demand. But for now it's |
46 extensions::ExtensionSystem::Get(context)->state_store(); | 43 // important that the NSS initialization is always triggered on browser |
47 DCHECK(store); | 44 // startup. |
48 return new PlatformKeysService(context, store); | 45 return true; |
49 } | 46 } |
50 | 47 |
51 } // namespace chromeos | 48 } // namespace cert_database |
OLD | NEW |