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 "chrome/browser/search_engines/default_search_pref_migration.h" | 5 #include "chrome/browser/search_engines/default_search_pref_migration.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
12 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
13 #include "chrome/browser/search_engines/default_search_manager.h" | |
14 #include "chrome/browser/search_engines/template_url_service.h" | 13 #include "chrome/browser/search_engines/template_url_service.h" |
| 14 #include "components/search_engines/default_search_manager.h" |
15 #include "components/search_engines/search_engines_pref_names.h" | 15 #include "components/search_engines/search_engines_pref_names.h" |
16 #include "components/search_engines/template_url_data.h" | 16 #include "components/search_engines/template_url_data.h" |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 // Loads the user-selected DSE (if there is one, and it's not masked by policy | 20 // Loads the user-selected DSE (if there is one, and it's not masked by policy |
21 // or an extension) from legacy preferences. | 21 // or an extension) from legacy preferences. |
22 scoped_ptr<TemplateURLData> LoadDefaultSearchProviderFromPrefs( | 22 scoped_ptr<TemplateURLData> LoadDefaultSearchProviderFromPrefs( |
23 PrefService* pref_service) { | 23 PrefService* pref_service) { |
24 scoped_ptr<TemplateURLData> legacy_dse_from_prefs; | 24 scoped_ptr<TemplateURLData> legacy_dse_from_prefs; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 void ConfigureDefaultSearchPrefMigrationToDictionaryValue( | 88 void ConfigureDefaultSearchPrefMigrationToDictionaryValue( |
89 PrefService* pref_service) { | 89 PrefService* pref_service) { |
90 if (pref_service->GetInitializationStatus() == | 90 if (pref_service->GetInitializationStatus() == |
91 PrefService::INITIALIZATION_STATUS_WAITING) { | 91 PrefService::INITIALIZATION_STATUS_WAITING) { |
92 pref_service->AddPrefInitObserver( | 92 pref_service->AddPrefInitObserver( |
93 base::Bind(&OnPrefsInitialized, base::Unretained(pref_service))); | 93 base::Bind(&OnPrefsInitialized, base::Unretained(pref_service))); |
94 } else { | 94 } else { |
95 MigrateDefaultSearchPref(pref_service); | 95 MigrateDefaultSearchPref(pref_service); |
96 } | 96 } |
97 } | 97 } |
OLD | NEW |