OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/search_engines/default_search_pref_migration.h" | 5 #include "components/search_engines/default_search_pref_migration.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 } | 91 } |
92 | 92 |
93 std::string prepopulate_id = | 93 std::string prepopulate_id = |
94 prefs->GetString(prefs::kDefaultSearchProviderPrepopulateID); | 94 prefs->GetString(prefs::kDefaultSearchProviderPrepopulateID); |
95 if (!prepopulate_id.empty()) { | 95 if (!prepopulate_id.empty()) { |
96 int value; | 96 int value; |
97 base::StringToInt(prepopulate_id, &value); | 97 base::StringToInt(prepopulate_id, &value); |
98 default_provider_data->prepopulate_id = value; | 98 default_provider_data->prepopulate_id = value; |
99 } | 99 } |
100 | 100 |
101 return default_provider_data.Pass(); | 101 return default_provider_data; |
102 } | 102 } |
103 | 103 |
104 void ClearDefaultSearchProviderFromLegacyPrefs(PrefService* prefs) { | 104 void ClearDefaultSearchProviderFromLegacyPrefs(PrefService* prefs) { |
105 prefs->ClearPref(prefs::kDefaultSearchProviderName); | 105 prefs->ClearPref(prefs::kDefaultSearchProviderName); |
106 prefs->ClearPref(prefs::kDefaultSearchProviderKeyword); | 106 prefs->ClearPref(prefs::kDefaultSearchProviderKeyword); |
107 prefs->ClearPref(prefs::kDefaultSearchProviderSearchURL); | 107 prefs->ClearPref(prefs::kDefaultSearchProviderSearchURL); |
108 prefs->ClearPref(prefs::kDefaultSearchProviderSuggestURL); | 108 prefs->ClearPref(prefs::kDefaultSearchProviderSuggestURL); |
109 prefs->ClearPref(prefs::kDefaultSearchProviderInstantURL); | 109 prefs->ClearPref(prefs::kDefaultSearchProviderInstantURL); |
110 prefs->ClearPref(prefs::kDefaultSearchProviderImageURL); | 110 prefs->ClearPref(prefs::kDefaultSearchProviderImageURL); |
111 prefs->ClearPref(prefs::kDefaultSearchProviderNewTabURL); | 111 prefs->ClearPref(prefs::kDefaultSearchProviderNewTabURL); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 void ConfigureDefaultSearchPrefMigrationToDictionaryValue( | 160 void ConfigureDefaultSearchPrefMigrationToDictionaryValue( |
161 PrefService* pref_service) { | 161 PrefService* pref_service) { |
162 if (pref_service->GetInitializationStatus() == | 162 if (pref_service->GetInitializationStatus() == |
163 PrefService::INITIALIZATION_STATUS_WAITING) { | 163 PrefService::INITIALIZATION_STATUS_WAITING) { |
164 pref_service->AddPrefInitObserver( | 164 pref_service->AddPrefInitObserver( |
165 base::Bind(&OnPrefsInitialized, base::Unretained(pref_service))); | 165 base::Bind(&OnPrefsInitialized, base::Unretained(pref_service))); |
166 } else { | 166 } else { |
167 MigrateDefaultSearchPref(pref_service); | 167 MigrateDefaultSearchPref(pref_service); |
168 } | 168 } |
169 } | 169 } |
OLD | NEW |