OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chromeos/file_system_provider/service_factory.h" | 5 #include "chrome/browser/chromeos/file_system_provider/service_factory.h" |
6 | 6 |
7 #include "chrome/browser/chromeos/file_system_provider/service.h" | 7 #include "chrome/browser/chromeos/file_system_provider/service.h" |
8 #include "chrome/browser/extensions/extension_system_factory.h" | 8 #include "chrome/browser/extensions/extension_system_factory.h" |
9 #include "chrome/browser/profiles/incognito_helpers.h" | 9 #include "chrome/browser/profiles/incognito_helpers.h" |
10 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 10 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
11 #include "extensions/browser/extension_registry.h" | 11 #include "extensions/browser/extension_registry.h" |
12 #include "extensions/browser/extension_registry_factory.h" | 12 #include "extensions/browser/extension_registry_factory.h" |
13 | 13 |
14 namespace chromeos { | 14 namespace chromeos { |
15 namespace file_system_provider { | 15 namespace file_system_provider { |
16 | 16 |
17 // static | 17 // static |
18 Service* ServiceFactory::Get(content::BrowserContext* context) { | 18 Service* ServiceFactory::Get(content::BrowserContext* context) { |
19 return static_cast<Service*>( | 19 return static_cast<Service*>( |
20 GetInstance()->GetServiceForBrowserContext(context, true)); | 20 GetInstance()->GetServiceForBrowserContext(context, true)); |
21 } | 21 } |
22 | 22 |
23 // static | 23 // static |
24 Service* ServiceFactory::FindExisting(content::BrowserContext* context) { | 24 Service* ServiceFactory::FindExisting(content::BrowserContext* context) { |
25 return static_cast<Service*>( | 25 return static_cast<Service*>( |
26 GetInstance()->GetServiceForBrowserContext(context, false)); | 26 GetInstance()->GetServiceForBrowserContext(context, false)); |
27 } | 27 } |
28 | 28 |
29 ServiceFactory* ServiceFactory::GetInstance() { | 29 ServiceFactory* ServiceFactory::GetInstance() { |
30 return Singleton<ServiceFactory>::get(); | 30 return base::Singleton<ServiceFactory>::get(); |
31 } | 31 } |
32 | 32 |
33 ServiceFactory::ServiceFactory() | 33 ServiceFactory::ServiceFactory() |
34 : BrowserContextKeyedServiceFactory( | 34 : BrowserContextKeyedServiceFactory( |
35 "Service", | 35 "Service", |
36 BrowserContextDependencyManager::GetInstance()) { | 36 BrowserContextDependencyManager::GetInstance()) { |
37 DependsOn(extensions::ExtensionRegistryFactory::GetInstance()); | 37 DependsOn(extensions::ExtensionRegistryFactory::GetInstance()); |
38 DependsOn(extensions::ExtensionSystemFactory::GetInstance()); | 38 DependsOn(extensions::ExtensionSystemFactory::GetInstance()); |
39 } | 39 } |
40 | 40 |
41 ServiceFactory::~ServiceFactory() {} | 41 ServiceFactory::~ServiceFactory() {} |
42 | 42 |
43 KeyedService* ServiceFactory::BuildServiceInstanceFor( | 43 KeyedService* ServiceFactory::BuildServiceInstanceFor( |
44 content::BrowserContext* profile) const { | 44 content::BrowserContext* profile) const { |
45 return new Service(Profile::FromBrowserContext(profile), | 45 return new Service(Profile::FromBrowserContext(profile), |
46 extensions::ExtensionRegistry::Get(profile)); | 46 extensions::ExtensionRegistry::Get(profile)); |
47 } | 47 } |
48 | 48 |
49 bool ServiceFactory::ServiceIsCreatedWithBrowserContext() const { return true; } | 49 bool ServiceFactory::ServiceIsCreatedWithBrowserContext() const { return true; } |
50 | 50 |
51 content::BrowserContext* ServiceFactory::GetBrowserContextToUse( | 51 content::BrowserContext* ServiceFactory::GetBrowserContextToUse( |
52 content::BrowserContext* context) const { | 52 content::BrowserContext* context) const { |
53 return chrome::GetBrowserContextRedirectedInIncognito(context); | 53 return chrome::GetBrowserContextRedirectedInIncognito(context); |
54 } | 54 } |
55 | 55 |
56 } // namespace file_system_provider | 56 } // namespace file_system_provider |
57 } // namespace chromeos | 57 } // namespace chromeos |
OLD | NEW |