| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_system_factory.h" | 5 #include "chrome/browser/extensions/extension_system_factory.h" |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/extension_prefs_factory.h" | 7 #include "chrome/browser/extensions/extension_prefs_factory.h" |
| 8 #include "chrome/browser/extensions/extension_system.h" | 8 #include "chrome/browser/extensions/extension_system.h" |
| 9 #include "chrome/browser/policy/profile_policy_connector_factory.h" | 9 #include "chrome/browser/policy/profile_policy_connector_factory.h" |
| 10 #include "chrome/browser/profiles/incognito_helpers.h" | 10 #include "chrome/browser/profiles/incognito_helpers.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/themes/theme_service_factory.h" | 12 #include "chrome/browser/themes/theme_service_factory.h" |
| 13 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 13 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
| 14 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" | 14 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" |
| 15 | 15 |
| 16 namespace extensions { | 16 namespace extensions { |
| 17 | 17 |
| 18 // ExtensionSystemSharedFactory | 18 // ExtensionSystemSharedFactory |
| 19 | 19 |
| 20 // static | 20 // static |
| 21 ExtensionSystemImpl::Shared* | 21 ExtensionSystemImpl::Shared* |
| 22 ExtensionSystemSharedFactory::GetForProfile(Profile* profile) { | 22 ExtensionSystemSharedFactory::GetForProfile(Profile* profile) { |
| 23 return static_cast<ExtensionSystemImpl::Shared*>( | 23 return static_cast<ExtensionSystemImpl::Shared*>( |
| 24 GetInstance()->GetServiceForProfile(profile, true)); | 24 GetInstance()->GetServiceForBrowserContext(profile, true)); |
| 25 } | 25 } |
| 26 | 26 |
| 27 // static | 27 // static |
| 28 ExtensionSystemSharedFactory* ExtensionSystemSharedFactory::GetInstance() { | 28 ExtensionSystemSharedFactory* ExtensionSystemSharedFactory::GetInstance() { |
| 29 return Singleton<ExtensionSystemSharedFactory>::get(); | 29 return Singleton<ExtensionSystemSharedFactory>::get(); |
| 30 } | 30 } |
| 31 | 31 |
| 32 ExtensionSystemSharedFactory::ExtensionSystemSharedFactory() | 32 ExtensionSystemSharedFactory::ExtensionSystemSharedFactory() |
| 33 : ProfileKeyedServiceFactory( | 33 : BrowserContextKeyedServiceFactory( |
| 34 "ExtensionSystemShared", | 34 "ExtensionSystemShared", |
| 35 ProfileDependencyManager::GetInstance()) { | 35 BrowserContextDependencyManager::GetInstance()) { |
| 36 DependsOn(ExtensionPrefsFactory::GetInstance()); | 36 DependsOn(ExtensionPrefsFactory::GetInstance()); |
| 37 DependsOn(GlobalErrorServiceFactory::GetInstance()); | 37 DependsOn(GlobalErrorServiceFactory::GetInstance()); |
| 38 #if defined(ENABLE_THEMES) | 38 #if defined(ENABLE_THEMES) |
| 39 DependsOn(ThemeServiceFactory::GetInstance()); | 39 DependsOn(ThemeServiceFactory::GetInstance()); |
| 40 #endif | 40 #endif |
| 41 DependsOn(policy::ProfilePolicyConnectorFactory::GetInstance()); | 41 DependsOn(policy::ProfilePolicyConnectorFactory::GetInstance()); |
| 42 } | 42 } |
| 43 | 43 |
| 44 ExtensionSystemSharedFactory::~ExtensionSystemSharedFactory() { | 44 ExtensionSystemSharedFactory::~ExtensionSystemSharedFactory() { |
| 45 } | 45 } |
| 46 | 46 |
| 47 ProfileKeyedService* ExtensionSystemSharedFactory::BuildServiceInstanceFor( | 47 BrowserContextKeyedService* ExtensionSystemSharedFactory::BuildServiceInstanceFo
r( |
| 48 content::BrowserContext* profile) const { | 48 content::BrowserContext* profile) const { |
| 49 return new ExtensionSystemImpl::Shared(static_cast<Profile*>(profile)); | 49 return new ExtensionSystemImpl::Shared(static_cast<Profile*>(profile)); |
| 50 } | 50 } |
| 51 | 51 |
| 52 content::BrowserContext* ExtensionSystemSharedFactory::GetBrowserContextToUse( | 52 content::BrowserContext* ExtensionSystemSharedFactory::GetBrowserContextToUse( |
| 53 content::BrowserContext* context) const { | 53 content::BrowserContext* context) const { |
| 54 return chrome::GetBrowserContextRedirectedInIncognito(context); | 54 return chrome::GetBrowserContextRedirectedInIncognito(context); |
| 55 } | 55 } |
| 56 | 56 |
| 57 // ExtensionSystemFactory | 57 // ExtensionSystemFactory |
| 58 | 58 |
| 59 // static | 59 // static |
| 60 ExtensionSystem* ExtensionSystemFactory::GetForProfile(Profile* profile) { | 60 ExtensionSystem* ExtensionSystemFactory::GetForProfile(Profile* profile) { |
| 61 return static_cast<ExtensionSystem*>( | 61 return static_cast<ExtensionSystem*>( |
| 62 GetInstance()->GetServiceForProfile(profile, true)); | 62 GetInstance()->GetServiceForBrowserContext(profile, true)); |
| 63 } | 63 } |
| 64 | 64 |
| 65 // static | 65 // static |
| 66 ExtensionSystemFactory* ExtensionSystemFactory::GetInstance() { | 66 ExtensionSystemFactory* ExtensionSystemFactory::GetInstance() { |
| 67 return Singleton<ExtensionSystemFactory>::get(); | 67 return Singleton<ExtensionSystemFactory>::get(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 ExtensionSystemFactory::ExtensionSystemFactory() | 70 ExtensionSystemFactory::ExtensionSystemFactory() |
| 71 : ProfileKeyedServiceFactory( | 71 : BrowserContextKeyedServiceFactory( |
| 72 "ExtensionSystem", | 72 "ExtensionSystem", |
| 73 ProfileDependencyManager::GetInstance()) { | 73 BrowserContextDependencyManager::GetInstance()) { |
| 74 DependsOn(ExtensionSystemSharedFactory::GetInstance()); | 74 DependsOn(ExtensionSystemSharedFactory::GetInstance()); |
| 75 } | 75 } |
| 76 | 76 |
| 77 ExtensionSystemFactory::~ExtensionSystemFactory() { | 77 ExtensionSystemFactory::~ExtensionSystemFactory() { |
| 78 } | 78 } |
| 79 | 79 |
| 80 ProfileKeyedService* ExtensionSystemFactory::BuildServiceInstanceFor( | 80 BrowserContextKeyedService* ExtensionSystemFactory::BuildServiceInstanceFor( |
| 81 content::BrowserContext* profile) const { | 81 content::BrowserContext* profile) const { |
| 82 return new ExtensionSystemImpl(static_cast<Profile*>(profile)); | 82 return new ExtensionSystemImpl(static_cast<Profile*>(profile)); |
| 83 } | 83 } |
| 84 | 84 |
| 85 content::BrowserContext* ExtensionSystemFactory::GetBrowserContextToUse( | 85 content::BrowserContext* ExtensionSystemFactory::GetBrowserContextToUse( |
| 86 content::BrowserContext* context) const { | 86 content::BrowserContext* context) const { |
| 87 return chrome::GetBrowserContextOwnInstanceInIncognito(context); | 87 return chrome::GetBrowserContextOwnInstanceInIncognito(context); |
| 88 } | 88 } |
| 89 | 89 |
| 90 bool ExtensionSystemFactory::ServiceIsCreatedWithProfile() const { | 90 bool ExtensionSystemFactory::ServiceIsCreatedWithBrowserContext() const { |
| 91 return true; | 91 return true; |
| 92 } | 92 } |
| 93 | 93 |
| 94 } // namespace extensions | 94 } // namespace extensions |
| OLD | NEW |