Commit 112f03ff authored by ivankr@chromium.org's avatar ivankr@chromium.org

Protector: separate handling for several cases.

*) When old and new IDs are equal, ignores old ID (fallback to the prepopulated provider).
*) When new and fallback providers have the same name, doesn't suggest to 'Change to <new provider>'.
*) Ignores logo_id when comparing providers.


BUG=107516
TEST=Manual: see bug description


Review URL: http://codereview.chromium.org/8954014

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114659 0039d316-1c4b-4281-b951-d872f2087c98
parent 22f9d317
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment