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