| 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/incognito_helpers.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.h" | 12 #include "chrome/browser/search_engines/template_url_service.h" |
| 12 #include "chrome/browser/webdata/web_data_service_factory.h" | 13 #include "chrome/browser/webdata/web_data_service_factory.h" |
| 13 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
| 14 #include "components/user_prefs/pref_registry_syncable.h" | 15 #include "components/user_prefs/pref_registry_syncable.h" |
| 15 | 16 |
| 16 // static | 17 // static |
| 17 TemplateURLService* TemplateURLServiceFactory::GetForProfile(Profile* profile) { | 18 TemplateURLService* TemplateURLServiceFactory::GetForProfile(Profile* profile) { |
| 18 return static_cast<TemplateURLService*>( | 19 return static_cast<TemplateURLService*>( |
| 19 GetInstance()->GetServiceForProfile(profile, true)); | 20 GetInstance()->GetServiceForProfile(profile, true)); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 std::string(), | 82 std::string(), |
| 82 PrefRegistrySyncable::UNSYNCABLE_PREF); | 83 PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 83 registry->RegisterListPref(prefs::kDefaultSearchProviderAlternateURLs, | 84 registry->RegisterListPref(prefs::kDefaultSearchProviderAlternateURLs, |
| 84 PrefRegistrySyncable::UNSYNCABLE_PREF); | 85 PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 85 registry->RegisterStringPref( | 86 registry->RegisterStringPref( |
| 86 prefs::kDefaultSearchProviderSearchTermsReplacementKey, | 87 prefs::kDefaultSearchProviderSearchTermsReplacementKey, |
| 87 std::string(), | 88 std::string(), |
| 88 PrefRegistrySyncable::UNSYNCABLE_PREF); | 89 PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 89 } | 90 } |
| 90 | 91 |
| 91 bool TemplateURLServiceFactory::ServiceRedirectedInIncognito() const { | 92 content::BrowserContext* TemplateURLServiceFactory::GetBrowserContextToUse( |
| 92 return true; | 93 content::BrowserContext* context) const { |
| 94 return chrome::GetBrowserContextRedirectedInIncognito(context); |
| 93 } | 95 } |
| 94 | 96 |
| 95 bool TemplateURLServiceFactory::ServiceIsNULLWhileTesting() const { | 97 bool TemplateURLServiceFactory::ServiceIsNULLWhileTesting() const { |
| 96 return true; | 98 return true; |
| 97 } | 99 } |
| 98 | 100 |
| 99 void TemplateURLServiceFactory::ProfileShutdown( | 101 void TemplateURLServiceFactory::ProfileShutdown( |
| 100 content::BrowserContext* profile) { | 102 content::BrowserContext* profile) { |
| 101 // We shutdown AND destroy the TemplateURLService during this pass. | 103 // We shutdown AND destroy the TemplateURLService during this pass. |
| 102 // TemplateURLService schedules a task on the WebDataService from its | 104 // TemplateURLService schedules a task on the WebDataService from its |
| 103 // destructor. Delete it first to ensure the task gets scheduled before we | 105 // destructor. Delete it first to ensure the task gets scheduled before we |
| 104 // shut down the database. | 106 // shut down the database. |
| 105 ProfileKeyedServiceFactory::ProfileShutdown(profile); | 107 ProfileKeyedServiceFactory::ProfileShutdown(profile); |
| 106 ProfileKeyedServiceFactory::ProfileDestroyed(profile); | 108 ProfileKeyedServiceFactory::ProfileDestroyed(profile); |
| 107 } | 109 } |
| 108 | 110 |
| 109 void TemplateURLServiceFactory::ProfileDestroyed( | 111 void TemplateURLServiceFactory::ProfileDestroyed( |
| 110 content::BrowserContext* profile) { | 112 content::BrowserContext* profile) { |
| 111 // Don't double delete. | 113 // Don't double delete. |
| 112 } | 114 } |
| OLD | NEW |