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_system.h" | |
8 #include "chrome/browser/policy/profile_policy_connector_factory.h" | 7 #include "chrome/browser/policy/profile_policy_connector_factory.h" |
9 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 9 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
11 #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" |
12 #include "extensions/browser/extension_prefs_factory.h" | 11 #include "extensions/browser/extension_prefs_factory.h" |
13 #include "extensions/browser/extension_registry_factory.h" | 12 #include "extensions/browser/extension_registry_factory.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 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::GetForBrowserContext( |
| 23 content::BrowserContext* context) { |
23 return static_cast<ExtensionSystemImpl::Shared*>( | 24 return static_cast<ExtensionSystemImpl::Shared*>( |
24 GetInstance()->GetServiceForBrowserContext(profile, true)); | 25 GetInstance()->GetServiceForBrowserContext(context, true)); |
25 } | 26 } |
26 | 27 |
27 // static | 28 // static |
28 ExtensionSystemSharedFactory* ExtensionSystemSharedFactory::GetInstance() { | 29 ExtensionSystemSharedFactory* ExtensionSystemSharedFactory::GetInstance() { |
29 return Singleton<ExtensionSystemSharedFactory>::get(); | 30 return Singleton<ExtensionSystemSharedFactory>::get(); |
30 } | 31 } |
31 | 32 |
32 ExtensionSystemSharedFactory::ExtensionSystemSharedFactory() | 33 ExtensionSystemSharedFactory::ExtensionSystemSharedFactory() |
33 : BrowserContextKeyedServiceFactory( | 34 : BrowserContextKeyedServiceFactory( |
34 "ExtensionSystemShared", | 35 "ExtensionSystemShared", |
35 BrowserContextDependencyManager::GetInstance()) { | 36 BrowserContextDependencyManager::GetInstance()) { |
36 DependsOn(ExtensionPrefsFactory::GetInstance()); | 37 DependsOn(ExtensionPrefsFactory::GetInstance()); |
37 // This depends on ExtensionService which depends on ExtensionRegistry. | 38 // This depends on ExtensionService which depends on ExtensionRegistry. |
38 DependsOn(ExtensionRegistryFactory::GetInstance()); | 39 DependsOn(ExtensionRegistryFactory::GetInstance()); |
39 DependsOn(GlobalErrorServiceFactory::GetInstance()); | 40 DependsOn(GlobalErrorServiceFactory::GetInstance()); |
40 DependsOn(policy::ProfilePolicyConnectorFactory::GetInstance()); | 41 DependsOn(policy::ProfilePolicyConnectorFactory::GetInstance()); |
41 } | 42 } |
42 | 43 |
43 ExtensionSystemSharedFactory::~ExtensionSystemSharedFactory() { | 44 ExtensionSystemSharedFactory::~ExtensionSystemSharedFactory() { |
44 } | 45 } |
45 | 46 |
46 BrowserContextKeyedService* | 47 BrowserContextKeyedService* |
47 ExtensionSystemSharedFactory::BuildServiceInstanceFor( | 48 ExtensionSystemSharedFactory::BuildServiceInstanceFor( |
48 content::BrowserContext* profile) const { | 49 content::BrowserContext* context) const { |
49 return new ExtensionSystemImpl::Shared(static_cast<Profile*>(profile)); | 50 return new ExtensionSystemImpl::Shared(static_cast<Profile*>(context)); |
50 } | 51 } |
51 | 52 |
52 content::BrowserContext* ExtensionSystemSharedFactory::GetBrowserContextToUse( | 53 content::BrowserContext* ExtensionSystemSharedFactory::GetBrowserContextToUse( |
53 content::BrowserContext* context) const { | 54 content::BrowserContext* context) const { |
54 // Redirected in incognito. | 55 // Redirected in incognito. |
55 return ExtensionsBrowserClient::Get()->GetOriginalContext(context); | 56 return ExtensionsBrowserClient::Get()->GetOriginalContext(context); |
56 } | 57 } |
57 | 58 |
58 // ExtensionSystemFactory | 59 // ExtensionSystemFactory |
59 | 60 |
60 // static | 61 // static |
61 ExtensionSystem* ExtensionSystemFactory::GetForProfile(Profile* profile) { | 62 ExtensionSystem* ExtensionSystemFactory::GetForBrowserContext( |
| 63 content::BrowserContext* context) { |
62 return static_cast<ExtensionSystem*>( | 64 return static_cast<ExtensionSystem*>( |
63 GetInstance()->GetServiceForBrowserContext(profile, true)); | 65 GetInstance()->GetServiceForBrowserContext(context, true)); |
64 } | 66 } |
65 | 67 |
66 // static | 68 // static |
67 ExtensionSystemFactory* ExtensionSystemFactory::GetInstance() { | 69 ExtensionSystemFactory* ExtensionSystemFactory::GetInstance() { |
68 return Singleton<ExtensionSystemFactory>::get(); | 70 return Singleton<ExtensionSystemFactory>::get(); |
69 } | 71 } |
70 | 72 |
71 ExtensionSystemFactory::ExtensionSystemFactory() | 73 ExtensionSystemFactory::ExtensionSystemFactory() |
72 : BrowserContextKeyedServiceFactory( | 74 : BrowserContextKeyedServiceFactory( |
73 "ExtensionSystem", | 75 "ExtensionSystem", |
(...skipping 18 matching lines...) Expand all Loading... |
92 content::BrowserContext* context) const { | 94 content::BrowserContext* context) const { |
93 // Separate instance in incognito. | 95 // Separate instance in incognito. |
94 return context; | 96 return context; |
95 } | 97 } |
96 | 98 |
97 bool ExtensionSystemFactory::ServiceIsCreatedWithBrowserContext() const { | 99 bool ExtensionSystemFactory::ServiceIsCreatedWithBrowserContext() const { |
98 return true; | 100 return true; |
99 } | 101 } |
100 | 102 |
101 } // namespace extensions | 103 } // namespace extensions |
OLD | NEW |