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

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

Issue 9968007: [protector] Support for collapsing multiple changes into a single one. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge Created 8 years, 8 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
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 28df6ed671bb5cd055402ef0927a984a5bb3c2e7..774655a3a5e9708d58339824a1bd7bc1e1ef402e 100644
--- a/chrome/browser/protector/default_search_provider_change.cc
+++ b/chrome/browser/protector/default_search_provider_change.cc
@@ -97,6 +97,8 @@ class DefaultSearchProviderChange : public BaseSettingChange,
virtual string16 GetBubbleMessage() const OVERRIDE;
virtual string16 GetApplyButtonText() const OVERRIDE;
virtual string16 GetDiscardButtonText() const OVERRIDE;
+ virtual DisplayName GetApplyDisplayName() const OVERRIDE;
+ virtual GURL GetNewSettingURL() const OVERRIDE;
private:
virtual ~DefaultSearchProviderChange();
@@ -322,6 +324,28 @@ string16 DefaultSearchProviderChange::GetDiscardButtonText() const {
return l10n_util::GetStringUTF16(IDS_SELECT_SEARCH_ENGINE);
}
+BaseSettingChange::DisplayName
+DefaultSearchProviderChange::GetApplyDisplayName() const {
+ if (new_search_provider_ &&
+ new_search_provider_->short_name().length() <= kMaxDisplayedNameLength) {
+ return DisplayName(kDefaultSearchProviderChangeNamePriority,
+ new_search_provider_->short_name());
+ }
+ // Return the default empty name.
+ return BaseSettingChange::GetApplyDisplayName();
+}
+
+GURL DefaultSearchProviderChange::GetNewSettingURL() const {
+ if (is_fallback_) {
+ // Do not collide this change when fallback was made, since the message
+ // and Discard behaviour is pretty different.
+ return GURL();
+ }
+ if (!new_search_provider_)
+ return GURL();
+ return TemplateURLService::GenerateSearchURL(new_search_provider_);
+}
+
void DefaultSearchProviderChange::OnTemplateURLServiceChanged() {
TemplateURLService* url_service = GetTemplateURLService();
if (url_service->GetDefaultSearchProvider() != default_search_provider_) {

Powered by Google App Engine
This is Rietveld 408576698