summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorsail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-04 22:55:36 +0000
committersail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-04 22:55:36 +0000
commit5e120024c2c6a5fd30b082263ccf462901c11bca (patch)
treebab88f5e6dfec11c5c67b6443b5c90846c712c7f /chrome
parent920fb4b9d08547fbe25bb2544dfb47157db9fea1 (diff)
downloadchromium_src-5e120024c2c6a5fd30b082263ccf462901c11bca.zip
chromium_src-5e120024c2c6a5fd30b082263ccf462901c11bca.tar.gz
chromium_src-5e120024c2c6a5fd30b082263ccf462901c11bca.tar.bz2
Fix ordering of buttons in protector search bubble on Mac
The root problem was that the error bubble on Windows and GTK were placing the accept and cancel button in the wrong order. Fix was to correct the error bubble code and flip the protector labels. Windows: http://imgur.com/RBD5h,JEekA,F6Due#0 Cocoa: http://imgur.com/RBD5h,JEekA,F6Due#1 GTK: http://imgur.com/RBD5h,JEekA,F6Due#2 BUG=100854 TEST= Review URL: http://codereview.chromium.org/8458001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108735 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/protector/settings_change_global_error.cc20
-rw-r--r--chrome/browser/protector/settings_change_global_error.h1
-rw-r--r--chrome/browser/ui/global_error.cc4
-rw-r--r--chrome/browser/ui/global_error.h3
-rw-r--r--chrome/browser/ui/gtk/global_error_bubble.cc7
-rw-r--r--chrome/browser/ui/views/global_error_bubble_view.cc6
6 files changed, 11 insertions, 30 deletions
diff --git a/chrome/browser/protector/settings_change_global_error.cc b/chrome/browser/protector/settings_change_global_error.cc
index 037c095..9909cb3 100644
--- a/chrome/browser/protector/settings_change_global_error.cc
+++ b/chrome/browser/protector/settings_change_global_error.cc
@@ -134,12 +134,6 @@ string16 SettingsChangeGlobalError::GetBubbleViewMessage() {
string16 SettingsChangeGlobalError::GetBubbleViewAcceptButtonLabel() {
SettingChange* change = changes_.front();
- return l10n_util::GetStringFUTF16(kBubbleChangeSettingIDs[change->type()],
- change->GetNewSetting());
-}
-
-string16 SettingsChangeGlobalError::GetBubbleViewCancelButtonLabel() {
- SettingChange* change = changes_.front();
string16 old_setting = change->GetOldSetting();
if (old_setting.empty()) {
return l10n_util::GetStringUTF16(IDS_SETTINGS_CHANGE_OPEN_SETTINGS);
@@ -150,22 +144,24 @@ string16 SettingsChangeGlobalError::GetBubbleViewCancelButtonLabel() {
}
}
-bool SettingsChangeGlobalError::IsAcceptButtonDefault() {
- return false;
+string16 SettingsChangeGlobalError::GetBubbleViewCancelButtonLabel() {
+ SettingChange* change = changes_.front();
+ return l10n_util::GetStringFUTF16(kBubbleChangeSettingIDs[change->type()],
+ change->GetNewSetting());
}
void SettingsChangeGlobalError::BubbleViewAcceptButtonPressed() {
closed_by_button_ = true;
DCHECK(delegate_);
- VLOG(1) << "Apply changes";
- delegate_->OnApplyChanges();
+ VLOG(1) << "Discard changes";
+ delegate_->OnDiscardChanges();
}
void SettingsChangeGlobalError::BubbleViewCancelButtonPressed() {
closed_by_button_ = true;
DCHECK(delegate_);
- VLOG(1) << "Discard changes";
- delegate_->OnDiscardChanges();
+ VLOG(1) << "Apply changes";
+ delegate_->OnApplyChanges();
}
void SettingsChangeGlobalError::RemoveFromProfile() {
diff --git a/chrome/browser/protector/settings_change_global_error.h b/chrome/browser/protector/settings_change_global_error.h
index 6694fe8..ea41022 100644
--- a/chrome/browser/protector/settings_change_global_error.h
+++ b/chrome/browser/protector/settings_change_global_error.h
@@ -50,7 +50,6 @@ class SettingsChangeGlobalError : public GlobalError {
virtual string16 GetBubbleViewMessage() OVERRIDE;
virtual string16 GetBubbleViewAcceptButtonLabel() OVERRIDE;
virtual string16 GetBubbleViewCancelButtonLabel() OVERRIDE;
- virtual bool IsAcceptButtonDefault() OVERRIDE;
virtual void BubbleViewDidClose() OVERRIDE;
virtual void BubbleViewAcceptButtonPressed() OVERRIDE;
virtual void BubbleViewCancelButtonPressed() OVERRIDE;
diff --git a/chrome/browser/ui/global_error.cc b/chrome/browser/ui/global_error.cc
index bd817e5..f2cf17c 100644
--- a/chrome/browser/ui/global_error.cc
+++ b/chrome/browser/ui/global_error.cc
@@ -34,7 +34,3 @@ void GlobalError::ShowBubbleView(Browser* browser) {
int GlobalError::GetBubbleViewIconResourceID() {
return IDR_INPUT_ALERT;
}
-
-bool GlobalError::IsAcceptButtonDefault() {
- return true;
-}
diff --git a/chrome/browser/ui/global_error.h b/chrome/browser/ui/global_error.h
index 10594fc..ffac75e 100644
--- a/chrome/browser/ui/global_error.h
+++ b/chrome/browser/ui/global_error.h
@@ -50,9 +50,6 @@ class GlobalError {
// Returns the cancel button label for the bubble view. To hide the cancel
// button return an empty string.
virtual string16 GetBubbleViewCancelButtonLabel() = 0;
- // Returns true if the accept button should be the default one (activated by
- // Enter). Otherwise, the cancel button is default.
- virtual bool IsAcceptButtonDefault();
// Called when the bubble view is closed.
virtual void BubbleViewDidClose() = 0;
// Called when the user clicks on the accept button.
diff --git a/chrome/browser/ui/gtk/global_error_bubble.cc b/chrome/browser/ui/gtk/global_error_bubble.cc
index 0ff485f..5577aec 100644
--- a/chrome/browser/ui/gtk/global_error_bubble.cc
+++ b/chrome/browser/ui/gtk/global_error_bubble.cc
@@ -91,12 +91,7 @@ GlobalErrorBubble::GlobalErrorBubble(Profile* profile,
gtk_box_pack_start(GTK_BOX(bottom), accept_button, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(content), bottom, FALSE, FALSE, 0);
- if (error_->IsAcceptButtonDefault())
- gtk_widget_grab_focus(accept_button);
- else if (cancel_button)
- gtk_widget_grab_focus(cancel_button);
- else
- NOTREACHED();
+ gtk_widget_grab_focus(accept_button);
g_signal_connect(accept_button, "clicked",
G_CALLBACK(OnAcceptButtonThunk), this);
diff --git a/chrome/browser/ui/views/global_error_bubble_view.cc b/chrome/browser/ui/views/global_error_bubble_view.cc
index a0cf75e..981bae8 100644
--- a/chrome/browser/ui/views/global_error_bubble_view.cc
+++ b/chrome/browser/ui/views/global_error_bubble_view.cc
@@ -53,18 +53,16 @@ GlobalErrorBubbleView::GlobalErrorBubbleView(Browser* browser,
message_label_->SetMultiLine(true);
message_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
- bool accept_default = error_->IsAcceptButtonDefault();
string16 accept_string(error_->GetBubbleViewAcceptButtonLabel());
scoped_ptr<views::TextButton> accept_button(
new views::NativeTextButton(this, accept_string));
- accept_button->SetIsDefault(accept_default);
+ accept_button->SetIsDefault(true);
accept_button->set_tag(TAG_ACCEPT_BUTTON);
string16 cancel_string(error_->GetBubbleViewCancelButtonLabel());
scoped_ptr<views::TextButton> cancel_button;
if (!cancel_string.empty()) {
cancel_button.reset(new views::NativeTextButton(this, cancel_string));
- cancel_button->SetIsDefault(!accept_default);
cancel_button->set_tag(TAG_CANCEL_BUTTON);
}
@@ -103,11 +101,11 @@ GlobalErrorBubbleView::GlobalErrorBubbleView(Browser* browser,
layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing);
layout->StartRow(0, 2);
+ layout->AddView(accept_button.release());
if (cancel_button.get())
layout->AddView(cancel_button.release());
else
layout->SkipColumns(1);
- layout->AddView(accept_button.release());
}
GlobalErrorBubbleView::~GlobalErrorBubbleView() {