| 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 "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "chrome/browser/google/google_url_tracker_factory.h" | 8 #include "chrome/browser/google/google_url_tracker_factory.h" |
| 9 #include "chrome/browser/history/history_service_factory.h" | 9 #include "chrome/browser/history/history_service_factory.h" |
| 10 #include "chrome/browser/profiles/profile_dependency_manager.h" | 10 #include "chrome/browser/profiles/profile_dependency_manager.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 : ProfileKeyedServiceFactory("TemplateURLServiceFactory", | 34 : ProfileKeyedServiceFactory("TemplateURLServiceFactory", |
| 35 ProfileDependencyManager::GetInstance()) { | 35 ProfileDependencyManager::GetInstance()) { |
| 36 DependsOn(GoogleURLTrackerFactory::GetInstance()); | 36 DependsOn(GoogleURLTrackerFactory::GetInstance()); |
| 37 DependsOn(HistoryServiceFactory::GetInstance()); | 37 DependsOn(HistoryServiceFactory::GetInstance()); |
| 38 DependsOn(WebDataServiceFactory::GetInstance()); | 38 DependsOn(WebDataServiceFactory::GetInstance()); |
| 39 } | 39 } |
| 40 | 40 |
| 41 TemplateURLServiceFactory::~TemplateURLServiceFactory() {} | 41 TemplateURLServiceFactory::~TemplateURLServiceFactory() {} |
| 42 | 42 |
| 43 ProfileKeyedService* TemplateURLServiceFactory::BuildServiceInstanceFor( | 43 ProfileKeyedService* TemplateURLServiceFactory::BuildServiceInstanceFor( |
| 44 Profile* profile) const { | 44 content::BrowserContext* profile) const { |
| 45 return BuildInstanceFor(profile); | 45 return BuildInstanceFor(static_cast<Profile*>(profile)); |
| 46 } | 46 } |
| 47 | 47 |
| 48 void TemplateURLServiceFactory::RegisterUserPrefs( | 48 void TemplateURLServiceFactory::RegisterUserPrefs( |
| 49 PrefRegistrySyncable* registry) { | 49 PrefRegistrySyncable* registry) { |
| 50 registry->RegisterStringPref(prefs::kSyncedDefaultSearchProviderGUID, | 50 registry->RegisterStringPref(prefs::kSyncedDefaultSearchProviderGUID, |
| 51 std::string(), | 51 std::string(), |
| 52 PrefRegistrySyncable::SYNCABLE_PREF); | 52 PrefRegistrySyncable::SYNCABLE_PREF); |
| 53 registry->RegisterBooleanPref(prefs::kDefaultSearchProviderEnabled, | 53 registry->RegisterBooleanPref(prefs::kDefaultSearchProviderEnabled, |
| 54 true, | 54 true, |
| 55 PrefRegistrySyncable::UNSYNCABLE_PREF); | 55 PrefRegistrySyncable::UNSYNCABLE_PREF); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 } | 89 } |
| 90 | 90 |
| 91 bool TemplateURLServiceFactory::ServiceRedirectedInIncognito() const { | 91 bool TemplateURLServiceFactory::ServiceRedirectedInIncognito() const { |
| 92 return true; | 92 return true; |
| 93 } | 93 } |
| 94 | 94 |
| 95 bool TemplateURLServiceFactory::ServiceIsNULLWhileTesting() const { | 95 bool TemplateURLServiceFactory::ServiceIsNULLWhileTesting() const { |
| 96 return true; | 96 return true; |
| 97 } | 97 } |
| 98 | 98 |
| 99 void TemplateURLServiceFactory::ProfileShutdown(Profile* profile) { | 99 void TemplateURLServiceFactory::ProfileShutdown(content::BrowserContext* profile
) { |
| 100 // We shutdown AND destroy the TemplateURLService during this pass. | 100 // We shutdown AND destroy the TemplateURLService during this pass. |
| 101 // TemplateURLService schedules a task on the WebDataService from its | 101 // TemplateURLService schedules a task on the WebDataService from its |
| 102 // destructor. Delete it first to ensure the task gets scheduled before we | 102 // destructor. Delete it first to ensure the task gets scheduled before we |
| 103 // shut down the database. | 103 // shut down the database. |
| 104 ProfileKeyedServiceFactory::ProfileShutdown(profile); | 104 ProfileKeyedServiceFactory::ProfileShutdown(profile); |
| 105 ProfileKeyedServiceFactory::ProfileDestroyed(profile); | 105 ProfileKeyedServiceFactory::ProfileDestroyed(profile); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void TemplateURLServiceFactory::ProfileDestroyed(Profile* profile) { | 108 void TemplateURLServiceFactory::ProfileDestroyed(content::BrowserContext* profil
e) { |
| 109 // Don't double delete. | 109 // Don't double delete. |
| 110 } | 110 } |
| OLD | NEW |