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/apps/ephemeral_app_service_factory.h" | 5 #include "chrome/browser/apps/ephemeral_app_service_factory.h" |
6 | 6 |
7 #include "chrome/browser/apps/ephemeral_app_service.h" | 7 #include "chrome/browser/apps/ephemeral_app_service.h" |
8 #include "chrome/browser/extensions/extension_system_factory.h" | |
9 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
10 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" | 9 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" |
| 10 #include "extensions/browser/extension_system_provider.h" |
11 #include "extensions/browser/extensions_browser_client.h" | 11 #include "extensions/browser/extensions_browser_client.h" |
12 | 12 |
13 using extensions::ExtensionSystemFactory; | 13 using extensions::ExtensionsBrowserClient; |
14 | 14 |
15 // static | 15 // static |
16 EphemeralAppService* | 16 EphemeralAppService* |
17 EphemeralAppServiceFactory::GetForProfile(Profile* profile) { | 17 EphemeralAppServiceFactory::GetForProfile(Profile* profile) { |
18 return static_cast<EphemeralAppService*>( | 18 return static_cast<EphemeralAppService*>( |
19 GetInstance()->GetServiceForBrowserContext(profile, true)); | 19 GetInstance()->GetServiceForBrowserContext(profile, true)); |
20 } | 20 } |
21 | 21 |
22 // static | 22 // static |
23 EphemeralAppServiceFactory* EphemeralAppServiceFactory::GetInstance() { | 23 EphemeralAppServiceFactory* EphemeralAppServiceFactory::GetInstance() { |
24 return Singleton<EphemeralAppServiceFactory>::get(); | 24 return Singleton<EphemeralAppServiceFactory>::get(); |
25 } | 25 } |
26 | 26 |
27 EphemeralAppServiceFactory::EphemeralAppServiceFactory() | 27 EphemeralAppServiceFactory::EphemeralAppServiceFactory() |
28 : BrowserContextKeyedServiceFactory( | 28 : BrowserContextKeyedServiceFactory( |
29 "EphemeralAppService", | 29 "EphemeralAppService", |
30 BrowserContextDependencyManager::GetInstance()) { | 30 BrowserContextDependencyManager::GetInstance()) { |
31 DependsOn(ExtensionSystemFactory::GetInstance()); | 31 DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); |
32 } | 32 } |
33 | 33 |
34 EphemeralAppServiceFactory::~EphemeralAppServiceFactory() { | 34 EphemeralAppServiceFactory::~EphemeralAppServiceFactory() { |
35 } | 35 } |
36 | 36 |
37 BrowserContextKeyedService* EphemeralAppServiceFactory::BuildServiceInstanceFor( | 37 BrowserContextKeyedService* EphemeralAppServiceFactory::BuildServiceInstanceFor( |
38 content::BrowserContext* context) const { | 38 content::BrowserContext* context) const { |
39 return new EphemeralAppService(Profile::FromBrowserContext(context)); | 39 return new EphemeralAppService(Profile::FromBrowserContext(context)); |
40 } | 40 } |
41 | 41 |
42 content::BrowserContext* EphemeralAppServiceFactory::GetBrowserContextToUse( | 42 content::BrowserContext* EphemeralAppServiceFactory::GetBrowserContextToUse( |
43 content::BrowserContext* context) const { | 43 content::BrowserContext* context) const { |
44 return extensions::ExtensionsBrowserClient::Get()-> | 44 return ExtensionsBrowserClient::Get()->GetOriginalContext(context); |
45 GetOriginalContext(context); | |
46 } | 45 } |
47 | 46 |
48 bool EphemeralAppServiceFactory::ServiceIsCreatedWithBrowserContext() const { | 47 bool EphemeralAppServiceFactory::ServiceIsCreatedWithBrowserContext() const { |
49 return true; | 48 return true; |
50 } | 49 } |
51 | 50 |
52 bool EphemeralAppServiceFactory::ServiceIsNULLWhileTesting() const { | 51 bool EphemeralAppServiceFactory::ServiceIsNULLWhileTesting() const { |
53 return true; | 52 return true; |
54 } | 53 } |
OLD | NEW |