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_manager.h" | 5 #include "chrome/browser/search_engines/default_search_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
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/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/i18n/case_conversion.h" | 13 #include "base/i18n/case_conversion.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/prefs/pref_service.h" | 15 #include "base/prefs/pref_service.h" |
16 #include "base/prefs/pref_value_map.h" | 16 #include "base/prefs/pref_value_map.h" |
17 #include "base/stl_util.h" | 17 #include "base/stl_util.h" |
18 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
19 #include "base/strings/string_split.h" | 19 #include "base/strings/string_split.h" |
20 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
21 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
22 #include "base/time/time.h" | 22 #include "base/time/time.h" |
23 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
24 #include "chrome/browser/search_engines/template_url.h" | 24 #include "chrome/browser/search_engines/template_url.h" |
25 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" | 25 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" |
26 #include "chrome/browser/search_engines/template_url_service.h" | 26 #include "chrome/browser/search_engines/template_url_service.h" |
27 #include "chrome/browser/search_engines/util.h" | 27 #include "chrome/browser/search_engines/util.h" |
28 #include "chrome/common/pref_names.h" | 28 #include "chrome/common/pref_names.h" |
29 #include "components/user_prefs/pref_registry_syncable.h" | 29 #include "components/pref_registry/pref_registry_syncable.h" |
30 | 30 |
31 // A dictionary to hold all data related to the Default Search Engine. | 31 // A dictionary to hold all data related to the Default Search Engine. |
32 // Eventually, this should replace all the data stored in the | 32 // Eventually, this should replace all the data stored in the |
33 // default_search_provider.* prefs. | 33 // default_search_provider.* prefs. |
34 const char DefaultSearchManager::kDefaultSearchProviderDataPrefName[] = | 34 const char DefaultSearchManager::kDefaultSearchProviderDataPrefName[] = |
35 "default_search_provider_data.template_url_data"; | 35 "default_search_provider_data.template_url_data"; |
36 | 36 |
37 const char DefaultSearchManager::kID[] = "id"; | 37 const char DefaultSearchManager::kID[] = "id"; |
38 const char DefaultSearchManager::kShortName[] = "short_name"; | 38 const char DefaultSearchManager::kShortName[] = "short_name"; |
39 const char DefaultSearchManager::kKeyword[] = "keyword"; | 39 const char DefaultSearchManager::kKeyword[] = "keyword"; |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 MergePrefsDataWithPrepopulated(); | 397 MergePrefsDataWithPrepopulated(); |
398 } | 398 } |
399 | 399 |
400 void DefaultSearchManager::NotifyObserver() { | 400 void DefaultSearchManager::NotifyObserver() { |
401 if (!change_observer_.is_null()) { | 401 if (!change_observer_.is_null()) { |
402 Source source = FROM_FALLBACK; | 402 Source source = FROM_FALLBACK; |
403 TemplateURLData* data = GetDefaultSearchEngine(&source); | 403 TemplateURLData* data = GetDefaultSearchEngine(&source); |
404 change_observer_.Run(data, source); | 404 change_observer_.Run(data, source); |
405 } | 405 } |
406 } | 406 } |
OLD | NEW |