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/search_engines/template_url_service_factory.h" | 5 #include "chrome/browser/search_engines/template_url_service_factory.h" |
6 | 6 |
7 #include "chrome/browser/google/google_url_tracker_factory.h" | 7 #include "chrome/browser/google/google_url_tracker_factory.h" |
| 8 #include "chrome/browser/history/history_service_factory.h" |
8 #include "chrome/browser/prefs/pref_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
9 #include "chrome/browser/profiles/profile_dependency_manager.h" | 10 #include "chrome/browser/profiles/profile_dependency_manager.h" |
10 #include "chrome/browser/search_engines/template_url_service.h" | 11 #include "chrome/browser/search_engines/template_url_service.h" |
11 #include "chrome/browser/webdata/web_data_service_factory.h" | 12 #include "chrome/browser/webdata/web_data_service_factory.h" |
12 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
13 | 14 |
14 TemplateURLService* TemplateURLServiceFactory::GetForProfile(Profile* profile) { | 15 TemplateURLService* TemplateURLServiceFactory::GetForProfile(Profile* profile) { |
15 return static_cast<TemplateURLService*>( | 16 return static_cast<TemplateURLService*>( |
16 GetInstance()->GetServiceForProfile(profile, true)); | 17 GetInstance()->GetServiceForProfile(profile, true)); |
17 } | 18 } |
18 | 19 |
19 TemplateURLServiceFactory* TemplateURLServiceFactory::GetInstance() { | 20 TemplateURLServiceFactory* TemplateURLServiceFactory::GetInstance() { |
20 return Singleton<TemplateURLServiceFactory>::get(); | 21 return Singleton<TemplateURLServiceFactory>::get(); |
21 } | 22 } |
22 | 23 |
23 TemplateURLServiceFactory::TemplateURLServiceFactory() | 24 TemplateURLServiceFactory::TemplateURLServiceFactory() |
24 : ProfileKeyedServiceFactory("TemplateURLServiceFactory", | 25 : ProfileKeyedServiceFactory("TemplateURLServiceFactory", |
25 ProfileDependencyManager::GetInstance()) { | 26 ProfileDependencyManager::GetInstance()) { |
26 DependsOn(GoogleURLTrackerFactory::GetInstance()); | 27 DependsOn(GoogleURLTrackerFactory::GetInstance()); |
| 28 DependsOn(HistoryServiceFactory::GetInstance()); |
27 DependsOn(WebDataServiceFactory::GetInstance()); | 29 DependsOn(WebDataServiceFactory::GetInstance()); |
28 // TODO(erg): For Shutdown() order, we need to: | |
29 // DependsOn(HistoryServiceFactory::GetInstance()); | |
30 } | 30 } |
31 | 31 |
32 TemplateURLServiceFactory::~TemplateURLServiceFactory() {} | 32 TemplateURLServiceFactory::~TemplateURLServiceFactory() {} |
33 | 33 |
34 ProfileKeyedService* TemplateURLServiceFactory::BuildServiceInstanceFor( | 34 ProfileKeyedService* TemplateURLServiceFactory::BuildServiceInstanceFor( |
35 Profile* profile) const { | 35 Profile* profile) const { |
36 return new TemplateURLService(profile); | 36 return new TemplateURLService(profile); |
37 } | 37 } |
38 | 38 |
39 void TemplateURLServiceFactory::RegisterUserPrefs(PrefService* prefs) { | 39 void TemplateURLServiceFactory::RegisterUserPrefs(PrefService* prefs) { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // TemplateURLService schedules a task on the WebDataService from its | 85 // TemplateURLService schedules a task on the WebDataService from its |
86 // destructor. Delete it first to ensure the task gets scheduled before we | 86 // destructor. Delete it first to ensure the task gets scheduled before we |
87 // shut down the database. | 87 // shut down the database. |
88 ProfileKeyedServiceFactory::ProfileShutdown(profile); | 88 ProfileKeyedServiceFactory::ProfileShutdown(profile); |
89 ProfileKeyedServiceFactory::ProfileDestroyed(profile); | 89 ProfileKeyedServiceFactory::ProfileDestroyed(profile); |
90 } | 90 } |
91 | 91 |
92 void TemplateURLServiceFactory::ProfileDestroyed(Profile* profile) { | 92 void TemplateURLServiceFactory::ProfileDestroyed(Profile* profile) { |
93 // Don't double delete. | 93 // Don't double delete. |
94 } | 94 } |
OLD | NEW |