| 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_manager.h" | 5 #include "components/search_engines/default_search_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 // static | 103 // static |
| 104 void DefaultSearchManager::RegisterProfilePrefs( | 104 void DefaultSearchManager::RegisterProfilePrefs( |
| 105 user_prefs::PrefRegistrySyncable* registry) { | 105 user_prefs::PrefRegistrySyncable* registry) { |
| 106 registry->RegisterDictionaryPref(kDefaultSearchProviderDataPrefName); | 106 registry->RegisterDictionaryPref(kDefaultSearchProviderDataPrefName); |
| 107 } | 107 } |
| 108 | 108 |
| 109 // static | 109 // static |
| 110 void DefaultSearchManager::AddPrefValueToMap( | 110 void DefaultSearchManager::AddPrefValueToMap( |
| 111 scoped_ptr<base::DictionaryValue> value, | 111 scoped_ptr<base::DictionaryValue> value, |
| 112 PrefValueMap* pref_value_map) { | 112 PrefValueMap* pref_value_map) { |
| 113 pref_value_map->SetValue(kDefaultSearchProviderDataPrefName, value.Pass()); | 113 pref_value_map->SetValue(kDefaultSearchProviderDataPrefName, |
| 114 std::move(value)); |
| 114 } | 115 } |
| 115 | 116 |
| 116 // static | 117 // static |
| 117 void DefaultSearchManager::SetFallbackSearchEnginesDisabledForTesting( | 118 void DefaultSearchManager::SetFallbackSearchEnginesDisabledForTesting( |
| 118 bool disabled) { | 119 bool disabled) { |
| 119 g_fallback_search_engines_disabled = disabled; | 120 g_fallback_search_engines_disabled = disabled; |
| 120 } | 121 } |
| 121 | 122 |
| 122 TemplateURLData* DefaultSearchManager::GetDefaultSearchEngine( | 123 TemplateURLData* DefaultSearchManager::GetDefaultSearchEngine( |
| 123 Source* source) const { | 124 Source* source) const { |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 url_dict->GetBoolean(kCreatedByPolicy, | 400 url_dict->GetBoolean(kCreatedByPolicy, |
| 400 &prefs_default_search_->created_by_policy); | 401 &prefs_default_search_->created_by_policy); |
| 401 | 402 |
| 402 prefs_default_search_->show_in_default_list = true; | 403 prefs_default_search_->show_in_default_list = true; |
| 403 MergePrefsDataWithPrepopulated(); | 404 MergePrefsDataWithPrepopulated(); |
| 404 } | 405 } |
| 405 | 406 |
| 406 void DefaultSearchManager::LoadPrepopulatedDefaultSearch() { | 407 void DefaultSearchManager::LoadPrepopulatedDefaultSearch() { |
| 407 scoped_ptr<TemplateURLData> data = | 408 scoped_ptr<TemplateURLData> data = |
| 408 TemplateURLPrepopulateData::GetPrepopulatedDefaultSearch(pref_service_); | 409 TemplateURLPrepopulateData::GetPrepopulatedDefaultSearch(pref_service_); |
| 409 fallback_default_search_ = data.Pass(); | 410 fallback_default_search_ = std::move(data); |
| 410 MergePrefsDataWithPrepopulated(); | 411 MergePrefsDataWithPrepopulated(); |
| 411 } | 412 } |
| 412 | 413 |
| 413 void DefaultSearchManager::NotifyObserver() { | 414 void DefaultSearchManager::NotifyObserver() { |
| 414 if (!change_observer_.is_null()) { | 415 if (!change_observer_.is_null()) { |
| 415 Source source = FROM_FALLBACK; | 416 Source source = FROM_FALLBACK; |
| 416 TemplateURLData* data = GetDefaultSearchEngine(&source); | 417 TemplateURLData* data = GetDefaultSearchEngine(&source); |
| 417 change_observer_.Run(data, source); | 418 change_observer_.Run(data, source); |
| 418 } | 419 } |
| 419 } | 420 } |
| OLD | NEW |