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