#include "ui/gfx/image/image.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/views/background.h"
+#include "ui/views/controls/webview/unhandled_keyboard_event_handler.h"
#include "ui/views/controls/webview/webview.h"
#include "ui/views/layout/fill_layout.h"
#include "ui/views/window/client_view.h"
: NativeWindow(web_contents, options),
window_(new views::Widget),
web_view_(inspectable_web_contents()->GetView()->GetView()),
+ keyboard_event_handler_(new views::UnhandledKeyboardEventHandler),
resizable_(true) {
options.Get(switches::kResizable, &resizable_);
options.Get(switches::kTitle, &title_);
void NativeWindowViews::HandleKeyboardEvent(
content::WebContents*,
const content::NativeWebKeyboardEvent& event) {
- if (event.type == blink::WebInputEvent::RawKeyDown) {
- ui::Accelerator accelerator(
- static_cast<ui::KeyboardCode>(event.windowsKeyCode),
- content::GetModifiersFromNativeWebKeyboardEvent(event));
-
- if (GetFocusManager()->ProcessAccelerator(accelerator)) {
- return;
- }
- }
+ keyboard_event_handler_->HandleKeyboardEvent(event, GetFocusManager());
}
bool NativeWindowViews::AcceleratorPressed(const ui::Accelerator& accelerator) {
#include "ui/views/widget/widget_delegate.h"
namespace views {
+class UnhandledKeyboardEventHandler;
class Widget;
}
scoped_ptr<views::Widget> window_;
views::View* web_view_; // Managed by inspectable_web_contents_.
+ // Handles unhandled keyboard messages coming back from the renderer process.
+ scoped_ptr<views::UnhandledKeyboardEventHandler> keyboard_event_handler_;
+
// Map from accelerator to menu item's command id.
accelerator_util::AcceleratorTable accelerator_table_;