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