summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/extensions/extension_view.cc
diff options
context:
space:
mode:
authorjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-18 17:36:33 +0000
committerjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-18 17:36:33 +0000
commit31f2db3de431af43175c912298addbb4f7465c50 (patch)
tree1087b7a1cadfe287674f7e790c79c7d8347eafb2 /chrome/browser/views/extensions/extension_view.cc
parent9f07e60d403013e3f17b5dd55e5031318c34d4cd (diff)
downloadchromium_src-31f2db3de431af43175c912298addbb4f7465c50.zip
chromium_src-31f2db3de431af43175c912298addbb4f7465c50.tar.gz
chromium_src-31f2db3de431af43175c912298addbb4f7465c50.tar.bz2
Fixes several focus issue with popup in the extensions' browser actions:
- when opening a browser action popup, it gets the focus. - tab traversal now works in the popup - pressing esc closes the popup (if the keyboard event is not processed by the page) BUG=22654, 28087, 28086 TEST=Create an extension with a browser extension that shows a popup. Make the popup so that it has a textfield (that gets focused when the popup show) and a button. Install the extension. Open the popup, the textfield should have focus. Press tab, the focus should go to the button. Press Esc, the popup should be closed. Review URL: http://codereview.chromium.org/402036 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32335 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/extensions/extension_view.cc')
-rw-r--r--chrome/browser/views/extensions/extension_view.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/chrome/browser/views/extensions/extension_view.cc b/chrome/browser/views/extensions/extension_view.cc
index c0118ba..7945307 100644
--- a/chrome/browser/views/extensions/extension_view.cc
+++ b/chrome/browser/views/extensions/extension_view.cc
@@ -22,6 +22,11 @@ ExtensionView::ExtensionView(ExtensionHost* host, Browser* browser)
container_(NULL),
is_clipped_(false) {
host_->set_view(this);
+
+ // This view needs to be focusable so it can act as the focused view for the
+ // focus manager. This is required to have SkipDefaultKeyEventProcessing
+ // called so the tab key events are forwarded to the renderer.
+ SetFocusable(true);
}
ExtensionView::~ExtensionView() {
@@ -170,6 +175,12 @@ void ExtensionView::PreferredSizeChanged() {
}
}
+bool ExtensionView::SkipDefaultKeyEventProcessing(const views::KeyEvent& e) {
+ // Let the tab key event be processed by the renderer (instead of moving the
+ // focus to the next focusable view).
+ return (e.GetKeyCode() == base::VKEY_TAB);
+}
+
void ExtensionView::HandleMouseEvent() {
if (container_)
container_->OnExtensionMouseEvent(this);