OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/extensions/extension_sync_service_factory.h" | 5 #include "chrome/browser/extensions/extension_sync_service_factory.h" |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "chrome/browser/extensions/extension_sync_service.h" | 8 #include "chrome/browser/extensions/extension_sync_service.h" |
9 #include "chrome/browser/extensions/extension_system_factory.h" | 9 #include "chrome/browser/extensions/extension_system_factory.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
11 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" | 11 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
12 #include "extensions/browser/extension_prefs_factory.h" | 12 #include "extensions/browser/extension_prefs_factory.h" |
13 #include "extensions/browser/extension_system.h" | 13 #include "extensions/browser/extension_system.h" |
14 #include "extensions/browser/extensions_browser_client.h" | 14 #include "extensions/browser/extensions_browser_client.h" |
15 | 15 |
16 // static | 16 // static |
17 ExtensionSyncService* ExtensionSyncServiceFactory::GetForProfile( | 17 ExtensionSyncService* ExtensionSyncServiceFactory::GetForProfile( |
18 Profile* profile) { | 18 Profile* profile) { |
19 return static_cast<ExtensionSyncService*>( | 19 return static_cast<ExtensionSyncService*>( |
20 GetInstance()->GetServiceForBrowserContext(profile, true)); | 20 GetInstance()->GetServiceForBrowserContext(profile, true)); |
21 } | 21 } |
22 | 22 |
23 // static | 23 // static |
24 ExtensionSyncServiceFactory* ExtensionSyncServiceFactory::GetInstance() { | 24 ExtensionSyncServiceFactory* ExtensionSyncServiceFactory::GetInstance() { |
25 return Singleton<ExtensionSyncServiceFactory>::get(); | 25 return Singleton<ExtensionSyncServiceFactory>::get(); |
26 } | 26 } |
27 | 27 |
28 ExtensionSyncServiceFactory::ExtensionSyncServiceFactory() | 28 ExtensionSyncServiceFactory::ExtensionSyncServiceFactory() |
29 : BrowserContextKeyedServiceFactory( | 29 : BrowserContextKeyedServiceFactory( |
30 "ExtensionSyncService", | 30 "ExtensionSyncService", |
31 BrowserContextDependencyManager::GetInstance()) { | 31 BrowserContextDependencyManager::GetInstance()) { |
32 DependsOn(extensions::ExtensionPrefsFactory::GetInstance()); | 32 DependsOn(extensions::ExtensionPrefsFactory::GetInstance()); |
33 DependsOn(extensions::ExtensionSystemFactory::GetInstance()); | 33 DependsOn(extensions::ExtensionSystemFactory::GetInstance()); |
34 } | 34 } |
35 | 35 |
36 ExtensionSyncServiceFactory::~ExtensionSyncServiceFactory() {} | 36 ExtensionSyncServiceFactory::~ExtensionSyncServiceFactory() {} |
37 | 37 |
38 BrowserContextKeyedService* | 38 KeyedService* ExtensionSyncServiceFactory::BuildServiceInstanceFor( |
39 ExtensionSyncServiceFactory::BuildServiceInstanceFor( | 39 content::BrowserContext* context) const { |
40 content::BrowserContext* context) const { | |
41 Profile* profile = Profile::FromBrowserContext(context); | 40 Profile* profile = Profile::FromBrowserContext(context); |
42 return new ExtensionSyncService( | 41 return new ExtensionSyncService( |
43 profile, | 42 profile, |
44 extensions::ExtensionPrefsFactory::GetForBrowserContext(context), | 43 extensions::ExtensionPrefsFactory::GetForBrowserContext(context), |
45 extensions::ExtensionSystem::Get(profile)->extension_service()); | 44 extensions::ExtensionSystem::Get(profile)->extension_service()); |
46 } | 45 } |
47 | 46 |
48 content::BrowserContext* ExtensionSyncServiceFactory::GetBrowserContextToUse( | 47 content::BrowserContext* ExtensionSyncServiceFactory::GetBrowserContextToUse( |
49 content::BrowserContext* context) const { | 48 content::BrowserContext* context) const { |
50 return extensions::ExtensionsBrowserClient::Get()-> | 49 return extensions::ExtensionsBrowserClient::Get()-> |
51 GetOriginalContext(context); | 50 GetOriginalContext(context); |
52 } | 51 } |
OLD | NEW |