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" |
11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
15 #include "base/prefs/pref_service.h" | |
16 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
17 #include "base/strings/string_split.h" | 16 #include "base/strings/string_split.h" |
18 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 18 #include "components/prefs/pref_service.h" |
19 #include "components/search_engines/default_search_manager.h" | 19 #include "components/search_engines/default_search_manager.h" |
20 #include "components/search_engines/search_engines_pref_names.h" | 20 #include "components/search_engines/search_engines_pref_names.h" |
21 #include "components/search_engines/template_url_data.h" | 21 #include "components/search_engines/template_url_data.h" |
22 #include "components/search_engines/template_url_service.h" | 22 #include "components/search_engines/template_url_service.h" |
23 #include "url/gurl.h" | 23 #include "url/gurl.h" |
24 | 24 |
25 namespace { | 25 namespace { |
26 | 26 |
27 // Loads the user-selected DSE (if there is one) from legacy preferences. | 27 // Loads the user-selected DSE (if there is one) from legacy preferences. |
28 scoped_ptr<TemplateURLData> LoadDefaultSearchProviderFromLegacyPrefs( | 28 scoped_ptr<TemplateURLData> LoadDefaultSearchProviderFromLegacyPrefs( |
(...skipping 131 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 |