Index: chrome/browser/views/html_dialog_view.cc |
=================================================================== |
--- chrome/browser/views/html_dialog_view.cc (revision 27254) |
+++ chrome/browser/views/html_dialog_view.cc (working copy) |
@@ -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 @@ |
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 @@ |
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()); |
} |