Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: chrome/browser/net/cert_database_service_factory.cc

Issue 419013003: Replace c/b/nss_context by a KeyedService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Separated out ClientCertStoreChromeOS change. Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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);
Joao da Silva 2014/10/30 09:48:01 Is this a good idea? Should the CertDatabaseServic
pneubeck (no reviews) 2014/11/05 14:53:36 My understanding is that although we created a sep
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698