summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authortim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-28 17:18:35 +0000
committertim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-28 17:18:35 +0000
commit9b535cfe8e2c2cbb1dd6bccdde4911923d37f0cb (patch)
tree50bd3e338fb21e68589cd19bf461e442fa123872 /chrome
parent0d158050b7b13840ca87efc9fb00bab327a736d9 (diff)
downloadchromium_src-9b535cfe8e2c2cbb1dd6bccdde4911923d37f0cb.zip
chromium_src-9b535cfe8e2c2cbb1dd6bccdde4911923d37f0cb.tar.gz
chromium_src-9b535cfe8e2c2cbb1dd6bccdde4911923d37f0cb.tar.bz2
Added an accelerator to the HtmlDialogView class so that hitting the ESC key closes the dialog.
BUG=19786 TEST=Open Sync Bookmaeks Login dialog. Enter credentials, TAB between fields, etc. to ensure nothing is broken. Hit the ESC key to dismiss the dialog. Patch by Randy Posynick (http://codereview.chromium.org/199069) Review URL: http://codereview.chromium.org/246020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27371 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/views/html_dialog_view.cc11
-rw-r--r--chrome/browser/views/html_dialog_view.h1
2 files changed, 12 insertions, 0 deletions
diff --git a/chrome/browser/views/html_dialog_view.cc b/chrome/browser/views/html_dialog_view.cc
index ea8476a..cda5340 100644
--- a/chrome/browser/views/html_dialog_view.cc
+++ b/chrome/browser/views/html_dialog_view.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/views/html_dialog_view.h"
+#include "base/keyboard_codes.h"
#include "chrome/browser/browser.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "views/widget/root_view.h"
@@ -48,6 +49,13 @@ gfx::Size HtmlDialogView::GetPreferredSize() {
return out;
}
+bool HtmlDialogView::AcceleratorPressed(const views::Accelerator& accelerator) {
+ // Pressing ESC closes the dialog.
+ DCHECK_EQ(base::VKEY_ESCAPE, accelerator.GetKeyCode());
+ OnDialogClosed(std::string());
+ return true;
+}
+
////////////////////////////////////////////////////////////////////////////////
// HtmlDialogView, views::WindowDelegate implementation:
@@ -216,5 +224,8 @@ void HtmlDialogView::InitDialog() {
HtmlDialogUI::GetPropertyAccessor().SetProperty(tab_contents_->property_bag(),
this);
+ // Pressing the ESC key will close the dialog.
+ AddAccelerator(views::Accelerator(base::VKEY_ESCAPE, false, false, false));
+
DOMView::LoadURL(delegate_->GetDialogContentURL());
}
diff --git a/chrome/browser/views/html_dialog_view.h b/chrome/browser/views/html_dialog_view.h
index ff49143..ee9e250 100644
--- a/chrome/browser/views/html_dialog_view.h
+++ b/chrome/browser/views/html_dialog_view.h
@@ -41,6 +41,7 @@ class HtmlDialogView
// Overridden from views::View:
virtual gfx::Size GetPreferredSize();
+ virtual bool AcceleratorPressed(const views::Accelerator& accelerator);
// Overridden from views::WindowDelegate:
virtual bool CanResize() const;