[email protected] | 810ffba | 2012-06-12 01:07:48 | [diff] [blame^] | 1 | // Copyright (c) 2012 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/autocomplete/autocomplete_classifier_factory.h" |
| 6 | |
| 7 | #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
| 8 | #include "chrome/browser/extensions/extension_system_factory.h" |
| 9 | #include "chrome/browser/profiles/profile_dependency_manager.h" |
| 10 | #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 11 | |
| 12 | |
| 13 | // static |
| 14 | AutocompleteClassifier* AutocompleteClassifierFactory::GetForProfile( |
| 15 | Profile* profile) { |
| 16 | return static_cast<AutocompleteClassifier*>( |
| 17 | GetInstance()->GetServiceForProfile(profile, true)); |
| 18 | } |
| 19 | |
| 20 | // static |
| 21 | AutocompleteClassifierFactory* AutocompleteClassifierFactory::GetInstance() { |
| 22 | return Singleton<AutocompleteClassifierFactory>::get(); |
| 23 | } |
| 24 | |
| 25 | // static |
| 26 | ProfileKeyedService* AutocompleteClassifierFactory::BuildInstanceFor( |
| 27 | Profile* profile) { |
| 28 | return new AutocompleteClassifier(profile); |
| 29 | } |
| 30 | |
| 31 | AutocompleteClassifierFactory::AutocompleteClassifierFactory() |
| 32 | : ProfileKeyedServiceFactory("AutocompleteClassifier", |
| 33 | ProfileDependencyManager::GetInstance()) { |
| 34 | DependsOn(ExtensionSystemFactory::GetInstance()); |
| 35 | DependsOn(TemplateURLServiceFactory::GetInstance()); |
| 36 | // TODO(pkasting): Uncomment these once they exist. |
| 37 | // DependsOn(PrefServiceFactory::GetInstance()); |
| 38 | // DependsOn(ShortcutsBackendFactory::GetInstance()); |
| 39 | } |
| 40 | |
| 41 | AutocompleteClassifierFactory::~AutocompleteClassifierFactory() { |
| 42 | } |
| 43 | |
| 44 | bool AutocompleteClassifierFactory::ServiceRedirectedInIncognito() { |
| 45 | return true; |
| 46 | } |
| 47 | |
| 48 | bool AutocompleteClassifierFactory::ServiceIsNULLWhileTesting() { |
| 49 | return true; |
| 50 | } |
| 51 | |
| 52 | ProfileKeyedService* AutocompleteClassifierFactory::BuildServiceInstanceFor( |
| 53 | Profile* profile) const { |
| 54 | return BuildInstanceFor(profile); |
| 55 | } |