diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-19 19:16:08 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-19 19:16:08 +0000 |
commit | 38c0aca3049cb6a8e709243442302d978184477e (patch) | |
tree | d5c572e0f98199132ab3b6c9e1e3d6fd41a4fad0 /chrome/browser/extensions | |
parent | 896f8820356938ebf722c036610347d504c1c8d0 (diff) | |
download | chromium_src-38c0aca3049cb6a8e709243442302d978184477e.zip chromium_src-38c0aca3049cb6a8e709243442302d978184477e.tar.gz chromium_src-38c0aca3049cb6a8e709243442302d978184477e.tar.bz2 |
Merge 32335
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
TBR=jcampan@chromium.org
Review URL: http://codereview.chromium.org/415001
git-svn-id: svn://svn.chromium.org/chrome/branches/249/src@32529 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions')
-rw-r--r-- | chrome/browser/extensions/extension_host.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc index 28f7403..63021f6 100644 --- a/chrome/browser/extensions/extension_host.cc +++ b/chrome/browser/extensions/extension_host.cc @@ -8,6 +8,7 @@ #include "app/l10n_util.h" #include "app/resource_bundle.h" +#include "base/keyboard_codes.h" #include "base/message_loop.h" #include "base/singleton.h" #include "base/string_util.h" @@ -537,6 +538,14 @@ void ExtensionHost::UpdateDragCursor(WebDragOperation operation) { } void ExtensionHost::GotFocus() { +#if defined(TOOLKIT_VIEWS) + // Request focus so that the FocusManager has a focused view and can perform + // normally its key event processing (so that it lets tab key events go to the + // renderer). + view()->RequestFocus(); +#else + // TODO(port) +#endif } void ExtensionHost::TakeFocus(bool reverse) { @@ -547,6 +556,14 @@ bool ExtensionHost::IsReservedAccelerator(const NativeWebKeyboardEvent& event) { } bool ExtensionHost::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { + if (extension_host_type_ == ViewType::EXTENSION_POPUP && + event.windowsKeyCode == base::VKEY_ESCAPE) { + NotificationService::current()->Notify( + NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE, + Source<Profile>(profile_), + Details<ExtensionHost>(this)); + return true; + } return false; } |