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