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