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