| 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/policy/profile_policy_connector_factory.h" | 7 #include "chrome/browser/policy/profile_policy_connector_factory.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 9 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
| 10 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" | 10 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 return static_cast<ExtensionSystem*>( | 66 return static_cast<ExtensionSystem*>( |
| 67 GetInstance()->GetServiceForBrowserContext(context, true)); | 67 GetInstance()->GetServiceForBrowserContext(context, true)); |
| 68 } | 68 } |
| 69 | 69 |
| 70 // static | 70 // static |
| 71 ExtensionSystemFactory* ExtensionSystemFactory::GetInstance() { | 71 ExtensionSystemFactory* ExtensionSystemFactory::GetInstance() { |
| 72 return Singleton<ExtensionSystemFactory>::get(); | 72 return Singleton<ExtensionSystemFactory>::get(); |
| 73 } | 73 } |
| 74 | 74 |
| 75 ExtensionSystemFactory::ExtensionSystemFactory() | 75 ExtensionSystemFactory::ExtensionSystemFactory() |
| 76 : BrowserContextKeyedServiceFactory( | 76 : ExtensionSystemProvider("ExtensionSystem", |
| 77 "ExtensionSystem", | 77 BrowserContextDependencyManager::GetInstance()) { |
| 78 BrowserContextDependencyManager::GetInstance()) { | |
| 79 DCHECK(ExtensionsBrowserClient::Get()) | 78 DCHECK(ExtensionsBrowserClient::Get()) |
| 80 << "ExtensionSystemFactory must be initialized after BrowserProcess"; | 79 << "ExtensionSystemFactory must be initialized after BrowserProcess"; |
| 81 std::vector<BrowserContextKeyedServiceFactory*> dependencies = | 80 DependsOn(ExtensionSystemSharedFactory::GetInstance()); |
| 82 ExtensionsBrowserClient::Get()->GetExtensionSystemDependencies(); | |
| 83 for (size_t i = 0; i < dependencies.size(); ++i) | |
| 84 DependsOn(dependencies[i]); | |
| 85 } | 81 } |
| 86 | 82 |
| 87 ExtensionSystemFactory::~ExtensionSystemFactory() { | 83 ExtensionSystemFactory::~ExtensionSystemFactory() { |
| 88 } | 84 } |
| 89 | 85 |
| 90 BrowserContextKeyedService* ExtensionSystemFactory::BuildServiceInstanceFor( | 86 BrowserContextKeyedService* ExtensionSystemFactory::BuildServiceInstanceFor( |
| 91 content::BrowserContext* context) const { | 87 content::BrowserContext* context) const { |
| 92 return ExtensionsBrowserClient::Get()->CreateExtensionSystem(context); | 88 return new ExtensionSystemImpl(static_cast<Profile*>(context)); |
| 93 } | 89 } |
| 94 | 90 |
| 95 content::BrowserContext* ExtensionSystemFactory::GetBrowserContextToUse( | 91 content::BrowserContext* ExtensionSystemFactory::GetBrowserContextToUse( |
| 96 content::BrowserContext* context) const { | 92 content::BrowserContext* context) const { |
| 97 // Separate instance in incognito. | 93 // Separate instance in incognito. |
| 98 return context; | 94 return context; |
| 99 } | 95 } |
| 100 | 96 |
| 101 bool ExtensionSystemFactory::ServiceIsCreatedWithBrowserContext() const { | 97 bool ExtensionSystemFactory::ServiceIsCreatedWithBrowserContext() const { |
| 102 return true; | 98 return true; |
| 103 } | 99 } |
| 104 | 100 |
| 105 } // namespace extensions | 101 } // namespace extensions |
| OLD | NEW |