Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3388)

Unified Diff: chrome/browser/search_engines/template_url_service.cc

Issue 10676012: De-dupe input encodings in TemplateURLs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/search_engines/template_url_service_sync_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/search_engines/template_url_service.cc
===================================================================
--- chrome/browser/search_engines/template_url_service.cc (revision 144319)
+++ chrome/browser/search_engines/template_url_service.cc (working copy)
@@ -1250,6 +1250,11 @@
data.show_in_default_list = specifics.show_in_default_list();
data.safe_for_autoreplace = specifics.safe_for_autoreplace();
base::SplitString(specifics.input_encodings(), ';', &data.input_encodings);
+ // If the server data has duplicate encodings, we'll want to push an update
+ // below to correct it. Note that we also fix this in
+ // GetSearchProvidersUsingKeywordResult(), since otherwise we'd never correct
+ // local problems for clients which have disabled search engine sync.
+ bool deduped = DeDupeEncodings(&data.input_encodings);
data.date_created = base::Time::FromInternalValue(specifics.date_created());
data.last_modified = base::Time::FromInternalValue(specifics.last_modified());
data.prepopulate_id = specifics.prepopulate_id();
@@ -1257,8 +1262,9 @@
TemplateURL* turl = new TemplateURL(profile, data);
DCHECK(!turl->IsExtensionKeyword());
- if (reset_keyword) {
- turl->ResetKeywordIfNecessary(true);
+ if (reset_keyword || deduped) {
+ if (reset_keyword)
+ turl->ResetKeywordIfNecessary(true);
SyncData sync_data = CreateSyncDataFromTemplateURL(*turl);
change_list->push_back(SyncChange(SyncChange::ACTION_UPDATE, sync_data));
} else if (turl->IsGoogleSearchURLWithReplaceableKeyword()) {
« no previous file with comments | « no previous file | chrome/browser/search_engines/template_url_service_sync_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698