| 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/history/history_service_factory.h" |
| 9 #include "chrome/browser/prefs/pref_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
| 10 #include "chrome/browser/profiles/profile_dependency_manager.h" | 10 #include "chrome/browser/profiles/profile_dependency_manager.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 DependsOn(WebDataServiceFactory::GetInstance()); | 37 DependsOn(WebDataServiceFactory::GetInstance()); |
| 38 } | 38 } |
| 39 | 39 |
| 40 TemplateURLServiceFactory::~TemplateURLServiceFactory() {} | 40 TemplateURLServiceFactory::~TemplateURLServiceFactory() {} |
| 41 | 41 |
| 42 ProfileKeyedService* TemplateURLServiceFactory::BuildServiceInstanceFor( | 42 ProfileKeyedService* TemplateURLServiceFactory::BuildServiceInstanceFor( |
| 43 Profile* profile) const { | 43 Profile* profile) const { |
| 44 return BuildInstanceFor(profile); | 44 return BuildInstanceFor(profile); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void TemplateURLServiceFactory::RegisterUserPrefs(PrefService* prefs) { | 47 void TemplateURLServiceFactory::RegisterUserPrefs(PrefServiceSyncable* prefs) { |
| 48 prefs->RegisterStringPref(prefs::kSyncedDefaultSearchProviderGUID, | 48 prefs->RegisterStringPref(prefs::kSyncedDefaultSearchProviderGUID, |
| 49 std::string(), | 49 std::string(), |
| 50 PrefService::SYNCABLE_PREF); | 50 PrefServiceSyncable::SYNCABLE_PREF); |
| 51 prefs->RegisterBooleanPref(prefs::kDefaultSearchProviderEnabled, | 51 prefs->RegisterBooleanPref(prefs::kDefaultSearchProviderEnabled, |
| 52 true, | 52 true, |
| 53 PrefService::UNSYNCABLE_PREF); | 53 PrefServiceSyncable::UNSYNCABLE_PREF); |
| 54 prefs->RegisterStringPref(prefs::kDefaultSearchProviderName, | 54 prefs->RegisterStringPref(prefs::kDefaultSearchProviderName, |
| 55 std::string(), | 55 std::string(), |
| 56 PrefService::UNSYNCABLE_PREF); | 56 PrefServiceSyncable::UNSYNCABLE_PREF); |
| 57 prefs->RegisterStringPref(prefs::kDefaultSearchProviderID, | 57 prefs->RegisterStringPref(prefs::kDefaultSearchProviderID, |
| 58 std::string(), | 58 std::string(), |
| 59 PrefService::UNSYNCABLE_PREF); | 59 PrefServiceSyncable::UNSYNCABLE_PREF); |
| 60 prefs->RegisterStringPref(prefs::kDefaultSearchProviderPrepopulateID, | 60 prefs->RegisterStringPref(prefs::kDefaultSearchProviderPrepopulateID, |
| 61 std::string(), | 61 std::string(), |
| 62 PrefService::UNSYNCABLE_PREF); | 62 PrefServiceSyncable::UNSYNCABLE_PREF); |
| 63 prefs->RegisterStringPref(prefs::kDefaultSearchProviderSuggestURL, | 63 prefs->RegisterStringPref(prefs::kDefaultSearchProviderSuggestURL, |
| 64 std::string(), | 64 std::string(), |
| 65 PrefService::UNSYNCABLE_PREF); | 65 PrefServiceSyncable::UNSYNCABLE_PREF); |
| 66 prefs->RegisterStringPref(prefs::kDefaultSearchProviderSearchURL, | 66 prefs->RegisterStringPref(prefs::kDefaultSearchProviderSearchURL, |
| 67 std::string(), | 67 std::string(), |
| 68 PrefService::UNSYNCABLE_PREF); | 68 PrefServiceSyncable::UNSYNCABLE_PREF); |
| 69 prefs->RegisterStringPref(prefs::kDefaultSearchProviderInstantURL, | 69 prefs->RegisterStringPref(prefs::kDefaultSearchProviderInstantURL, |
| 70 std::string(), | 70 std::string(), |
| 71 PrefService::UNSYNCABLE_PREF); | 71 PrefServiceSyncable::UNSYNCABLE_PREF); |
| 72 prefs->RegisterStringPref(prefs::kDefaultSearchProviderKeyword, | 72 prefs->RegisterStringPref(prefs::kDefaultSearchProviderKeyword, |
| 73 std::string(), | 73 std::string(), |
| 74 PrefService::UNSYNCABLE_PREF); | 74 PrefServiceSyncable::UNSYNCABLE_PREF); |
| 75 prefs->RegisterStringPref(prefs::kDefaultSearchProviderIconURL, | 75 prefs->RegisterStringPref(prefs::kDefaultSearchProviderIconURL, |
| 76 std::string(), | 76 std::string(), |
| 77 PrefService::UNSYNCABLE_PREF); | 77 PrefServiceSyncable::UNSYNCABLE_PREF); |
| 78 prefs->RegisterStringPref(prefs::kDefaultSearchProviderEncodings, | 78 prefs->RegisterStringPref(prefs::kDefaultSearchProviderEncodings, |
| 79 std::string(), | 79 std::string(), |
| 80 PrefService::UNSYNCABLE_PREF); | 80 PrefServiceSyncable::UNSYNCABLE_PREF); |
| 81 prefs->RegisterListPref(prefs::kDefaultSearchProviderAlternateURLs, | 81 prefs->RegisterListPref(prefs::kDefaultSearchProviderAlternateURLs, |
| 82 PrefService::UNSYNCABLE_PREF); | 82 PrefServiceSyncable::UNSYNCABLE_PREF); |
| 83 } | 83 } |
| 84 | 84 |
| 85 bool TemplateURLServiceFactory::ServiceRedirectedInIncognito() const { | 85 bool TemplateURLServiceFactory::ServiceRedirectedInIncognito() const { |
| 86 return true; | 86 return true; |
| 87 } | 87 } |
| 88 | 88 |
| 89 bool TemplateURLServiceFactory::ServiceIsNULLWhileTesting() const { | 89 bool TemplateURLServiceFactory::ServiceIsNULLWhileTesting() const { |
| 90 return true; | 90 return true; |
| 91 } | 91 } |
| 92 | 92 |
| 93 void TemplateURLServiceFactory::ProfileShutdown(Profile* profile) { | 93 void TemplateURLServiceFactory::ProfileShutdown(Profile* profile) { |
| 94 // We shutdown AND destroy the TemplateURLService during this pass. | 94 // We shutdown AND destroy the TemplateURLService during this pass. |
| 95 // TemplateURLService schedules a task on the WebDataService from its | 95 // TemplateURLService schedules a task on the WebDataService from its |
| 96 // destructor. Delete it first to ensure the task gets scheduled before we | 96 // destructor. Delete it first to ensure the task gets scheduled before we |
| 97 // shut down the database. | 97 // shut down the database. |
| 98 ProfileKeyedServiceFactory::ProfileShutdown(profile); | 98 ProfileKeyedServiceFactory::ProfileShutdown(profile); |
| 99 ProfileKeyedServiceFactory::ProfileDestroyed(profile); | 99 ProfileKeyedServiceFactory::ProfileDestroyed(profile); |
| 100 } | 100 } |
| 101 | 101 |
| 102 void TemplateURLServiceFactory::ProfileDestroyed(Profile* profile) { | 102 void TemplateURLServiceFactory::ProfileDestroyed(Profile* profile) { |
| 103 // Don't double delete. | 103 // Don't double delete. |
| 104 } | 104 } |
| OLD | NEW |