| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_service.h" | 5 #include "chrome/browser/search_engines/template_url_service.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.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/i18n/case_conversion.h" | 10 #include "base/i18n/case_conversion.h" |
| (...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1088 prefs->SetBoolean(prefs::kDefaultSearchProviderEnabled, enabled); | 1088 prefs->SetBoolean(prefs::kDefaultSearchProviderEnabled, enabled); |
| 1089 prefs->SetString(prefs::kDefaultSearchProviderSearchURL, search_url); | 1089 prefs->SetString(prefs::kDefaultSearchProviderSearchURL, search_url); |
| 1090 prefs->SetString(prefs::kDefaultSearchProviderSuggestURL, suggest_url); | 1090 prefs->SetString(prefs::kDefaultSearchProviderSuggestURL, suggest_url); |
| 1091 prefs->SetString(prefs::kDefaultSearchProviderInstantURL, instant_url); | 1091 prefs->SetString(prefs::kDefaultSearchProviderInstantURL, instant_url); |
| 1092 prefs->SetString(prefs::kDefaultSearchProviderIconURL, icon_url); | 1092 prefs->SetString(prefs::kDefaultSearchProviderIconURL, icon_url); |
| 1093 prefs->SetString(prefs::kDefaultSearchProviderEncodings, encodings); | 1093 prefs->SetString(prefs::kDefaultSearchProviderEncodings, encodings); |
| 1094 prefs->SetString(prefs::kDefaultSearchProviderName, short_name); | 1094 prefs->SetString(prefs::kDefaultSearchProviderName, short_name); |
| 1095 prefs->SetString(prefs::kDefaultSearchProviderKeyword, keyword); | 1095 prefs->SetString(prefs::kDefaultSearchProviderKeyword, keyword); |
| 1096 prefs->SetString(prefs::kDefaultSearchProviderID, id_string); | 1096 prefs->SetString(prefs::kDefaultSearchProviderID, id_string); |
| 1097 prefs->SetString(prefs::kDefaultSearchProviderPrepopulateID, prepopulate_id); | 1097 prefs->SetString(prefs::kDefaultSearchProviderPrepopulateID, prepopulate_id); |
| 1098 | |
| 1099 prefs->ScheduleSavePersistentPrefs(); | |
| 1100 } | 1098 } |
| 1101 | 1099 |
| 1102 bool TemplateURLService::LoadDefaultSearchProviderFromPrefs( | 1100 bool TemplateURLService::LoadDefaultSearchProviderFromPrefs( |
| 1103 scoped_ptr<TemplateURL>* default_provider, | 1101 scoped_ptr<TemplateURL>* default_provider, |
| 1104 bool* is_managed) { | 1102 bool* is_managed) { |
| 1105 PrefService* prefs = GetPrefs(); | 1103 PrefService* prefs = GetPrefs(); |
| 1106 if (!prefs || !prefs->HasPrefPath(prefs::kDefaultSearchProviderSearchURL)) | 1104 if (!prefs || !prefs->HasPrefPath(prefs::kDefaultSearchProviderSearchURL)) |
| 1107 return false; | 1105 return false; |
| 1108 | 1106 |
| 1109 const PrefService::Preference* pref = | 1107 const PrefService::Preference* pref = |
| (...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1708 } else { | 1706 } else { |
| 1709 // Change the local TURL's GUID to the server's GUID and push an update to | 1707 // Change the local TURL's GUID to the server's GUID and push an update to |
| 1710 // Sync. This ensures that the rest of local_url's fields are sync'd up to | 1708 // Sync. This ensures that the rest of local_url's fields are sync'd up to |
| 1711 // the server, and the next time local_url is synced, it is recognized by | 1709 // the server, and the next time local_url is synced, it is recognized by |
| 1712 // having the same GUID. | 1710 // having the same GUID. |
| 1713 ResetTemplateURLGUID(local_turl, sync_turl->sync_guid()); | 1711 ResetTemplateURLGUID(local_turl, sync_turl->sync_guid()); |
| 1714 SyncData sync_data = CreateSyncDataFromTemplateURL(*local_turl); | 1712 SyncData sync_data = CreateSyncDataFromTemplateURL(*local_turl); |
| 1715 change_list->push_back(SyncChange(SyncChange::ACTION_UPDATE, sync_data)); | 1713 change_list->push_back(SyncChange(SyncChange::ACTION_UPDATE, sync_data)); |
| 1716 } | 1714 } |
| 1717 } | 1715 } |
| OLD | NEW |