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

Unified Diff: chrome/browser/protector/default_search_provider_change.cc

Issue 8954014: Protector: separate handling for several cases. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/protector/default_search_provider_change.cc
diff --git a/chrome/browser/protector/default_search_provider_change.cc b/chrome/browser/protector/default_search_provider_change.cc
index b3c047f4884d5e62fd481a65814a85967d85bb4a..6da1effb40720c3397f068c9723d0fd9c3d52684 100644
--- a/chrome/browser/protector/default_search_provider_change.cc
+++ b/chrome/browser/protector/default_search_provider_change.cc
@@ -68,7 +68,6 @@ class TemplateURLIsSame {
url->safe_for_autoreplace() == other_->safe_for_autoreplace() &&
url->show_in_default_list() == other_->show_in_default_list() &&
url->input_encodings() == other_->input_encodings() &&
- url->logo_id() == other_->logo_id() &&
url->prepopulate_id() == other_->prepopulate_id();
}
@@ -157,6 +156,13 @@ DefaultSearchProviderChange::DefaultSearchProviderChange(
old_id_ = old_url->id();
old_name_ = old_url->short_name();
}
+ if (old_id_ == new_id_) {
+ // This means someone has tampered with the search providers list but not
+ // with the ID. Old ID is useless in this case so the prepopulated default
+ // search provider will be used.
+ old_id_ = 0;
+ // TODO(ivankr): restore the default search provider from the backup table.
+ }
}
DefaultSearchProviderChange::~DefaultSearchProviderChange() {
@@ -272,6 +278,13 @@ string16 DefaultSearchProviderChange::GetApplyButtonText() const {
// the new one so no need to show this button.
return string16();
}
+ if (!new_name_.empty() &&
+ new_name_ == fallback_name_) {
+ // The fallback and new search engines have the same name but different
+ // IDs, which most likely is some fraud attempt, so don't suggest to
+ // apply the new setting.
+ return string16();
+ }
if (new_name_.length() > kMaxDisplayedNameLength)
return l10n_util::GetStringUTF16(IDS_CHANGE_SEARCH_ENGINE_NO_NAME);
else
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698