OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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/search/google_search_provider_service_factory.h" |
| 6 |
| 7 #include "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/browser/search/google_search_provider_service.h" |
| 9 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 10 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 11 #include "content/public/browser/browser_context.h" |
| 12 |
| 13 // static |
| 14 GoogleSearchProviderService* GoogleSearchProviderServiceFactory::GetForProfile( |
| 15 Profile* profile) { |
| 16 return static_cast<GoogleSearchProviderService*>( |
| 17 GetInstance()->GetServiceForBrowserContext(profile, true)); |
| 18 } |
| 19 |
| 20 // static |
| 21 GoogleSearchProviderServiceFactory* |
| 22 GoogleSearchProviderServiceFactory::GetInstance() { |
| 23 return base::Singleton<GoogleSearchProviderServiceFactory>::get(); |
| 24 } |
| 25 |
| 26 GoogleSearchProviderServiceFactory::GoogleSearchProviderServiceFactory() |
| 27 : BrowserContextKeyedServiceFactory( |
| 28 "GoogleSearchProviderService", |
| 29 BrowserContextDependencyManager::GetInstance()) { |
| 30 DependsOn(TemplateURLServiceFactory::GetInstance()); |
| 31 } |
| 32 |
| 33 GoogleSearchProviderServiceFactory::~GoogleSearchProviderServiceFactory() = |
| 34 default; |
| 35 |
| 36 KeyedService* GoogleSearchProviderServiceFactory::BuildServiceInstanceFor( |
| 37 content::BrowserContext* context) const { |
| 38 Profile* profile = Profile::FromBrowserContext(context); |
| 39 return new GoogleSearchProviderService( |
| 40 TemplateURLServiceFactory::GetForProfile(profile)); |
| 41 } |
OLD | NEW |