| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/template_url_model.h" | 5 #include "chrome/browser/search_engines/template_url_model.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/environment.h" | 9 #include "base/environment.h" |
| 10 #include "base/stl_util-inl.h" | 10 #include "base/stl_util-inl.h" |
| (...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 prefs->ScheduleSavePersistentPrefs(); | 796 prefs->ScheduleSavePersistentPrefs(); |
| 797 } | 797 } |
| 798 | 798 |
| 799 bool TemplateURLModel::LoadDefaultSearchProviderFromPrefs( | 799 bool TemplateURLModel::LoadDefaultSearchProviderFromPrefs( |
| 800 scoped_ptr<TemplateURL>* default_provider, | 800 scoped_ptr<TemplateURL>* default_provider, |
| 801 bool* is_managed) { | 801 bool* is_managed) { |
| 802 PrefService* prefs = GetPrefs(); | 802 PrefService* prefs = GetPrefs(); |
| 803 if (!prefs || !prefs->HasPrefPath(prefs::kDefaultSearchProviderSearchURL)) | 803 if (!prefs || !prefs->HasPrefPath(prefs::kDefaultSearchProviderSearchURL)) |
| 804 return false; | 804 return false; |
| 805 | 805 |
| 806 // By default, kDefaultSearchProviderEnabled is true. Users of previous | |
| 807 // versions will transition correctly. | |
| 808 const PrefService::Preference* pref = | 806 const PrefService::Preference* pref = |
| 809 prefs->FindPreference(prefs::kDefaultSearchProviderEnabled); | 807 prefs->FindPreference(prefs::kDefaultSearchProviderSearchURL); |
| 810 *is_managed = pref && pref->IsManaged(); | 808 *is_managed = pref && pref->IsManaged(); |
| 811 | 809 |
| 812 bool enabled = | 810 bool enabled = |
| 813 prefs->GetBoolean(prefs::kDefaultSearchProviderEnabled); | 811 prefs->GetBoolean(prefs::kDefaultSearchProviderEnabled); |
| 814 std::string suggest_url = | 812 std::string suggest_url = |
| 815 prefs->GetString(prefs::kDefaultSearchProviderSuggestURL); | 813 prefs->GetString(prefs::kDefaultSearchProviderSuggestURL); |
| 816 std::string search_url = | 814 std::string search_url = |
| 817 prefs->GetString(prefs::kDefaultSearchProviderSearchURL); | 815 prefs->GetString(prefs::kDefaultSearchProviderSearchURL); |
| 818 std::string instant_url = | 816 std::string instant_url = |
| 819 prefs->GetString(prefs::kDefaultSearchProviderInstantURL); | 817 prefs->GetString(prefs::kDefaultSearchProviderInstantURL); |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1252 } | 1250 } |
| 1253 | 1251 |
| 1254 void TemplateURLModel::NotifyObservers() { | 1252 void TemplateURLModel::NotifyObservers() { |
| 1255 if (!loaded_) | 1253 if (!loaded_) |
| 1256 return; | 1254 return; |
| 1257 | 1255 |
| 1258 FOR_EACH_OBSERVER(TemplateURLModelObserver, model_observers_, | 1256 FOR_EACH_OBSERVER(TemplateURLModelObserver, model_observers_, |
| 1259 OnTemplateURLModelChanged()); | 1257 OnTemplateURLModelChanged()); |
| 1260 } | 1258 } |
| 1261 | 1259 |
| OLD | NEW |