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