diff options
author | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-27 22:02:15 +0000 |
---|---|---|
committer | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-27 22:02:15 +0000 |
commit | 29e75de051f2dfb32e896b359e605e869f9db04e (patch) | |
tree | 0e9a5a076c15ad22ca21d20ce9c15e4c78bc49e5 /chrome | |
parent | 2beee8cce00b9e927917a0716b449379aba21cff (diff) | |
download | chromium_src-29e75de051f2dfb32e896b359e605e869f9db04e.zip chromium_src-29e75de051f2dfb32e896b359e605e869f9db04e.tar.gz chromium_src-29e75de051f2dfb32e896b359e605e869f9db04e.tar.bz2 |
Fix 8200: Pressing Esc should cancel dialogs, not commit.
When we create the OK & Cancel dialog buttons in
DialogClientView, we were registering OK as a handler
for Escape, even though the dialog had a Cancel button.
This is because we register for Esc if the member variable
|cancel_ button_| is NULL. Problem is, that member isn't
created until later on in that function.
We should be checking the |buttons| flags instead.
TEST=Open the Clear Browsing Data dialog, press Tab twice,
press Esc and make sure that the dialog closes and nothing
is cleared (from whatever checkbox was selected).
BUG=8200
Review URL: http://codereview.chromium.org/28267
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10631 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/views/dialog_client_view.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/chrome/views/dialog_client_view.cc b/chrome/views/dialog_client_view.cc index 58618b2..c32b17c 100644 --- a/chrome/views/dialog_client_view.cc +++ b/chrome/views/dialog_client_view.cc @@ -67,7 +67,7 @@ class DialogButton : public NativeButton { Window* owner_; const DialogDelegate::DialogButton type_; - DISALLOW_EVIL_CONSTRUCTORS(DialogButton); + DISALLOW_COPY_AND_ASSIGN(DialogButton); }; } // namespace @@ -114,7 +114,7 @@ void DialogClientView::ShowDialogButtons() { ok_button_->SetGroup(kButtonGroup); if (is_default_button) default_button_ = ok_button_; - if (!cancel_button_) + if (!(buttons & DialogDelegate::DIALOGBUTTON_CANCEL)) ok_button_->AddAccelerator(Accelerator(VK_ESCAPE, false, false, false)); AddChildView(ok_button_); } @@ -273,7 +273,7 @@ void DialogClientView::ViewHierarchyChanged(bool is_add, View* parent, // Listen for focus change events so we can update the default button. DCHECK(focus_manager); // bug #1291225: crash reports seem to indicate it // can be NULL. - if (focus_manager) + if (focus_manager) focus_manager->AddFocusChangeListener(this); // The "extra view" must be created and installed after the contents view |