Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Unified Diff: ui/views/controls/webview/unhandled_keyboard_event_handler_win.cc

Issue 679743002: MacViews: UnhandledKeyboardEventHandler stub (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/views/controls/webview/unhandled_keyboard_event_handler_win.cc
diff --git a/ui/views/controls/webview/unhandled_keyboard_event_handler_win.cc b/ui/views/controls/webview/unhandled_keyboard_event_handler_win.cc
index 463ef7e3a05bec59b0ce3ca1aa947a4281c01b1b..e31aabbf90125dd632147d9ae04efe3483728ff9 100644
--- a/ui/views/controls/webview/unhandled_keyboard_event_handler_win.cc
+++ b/ui/views/controls/webview/unhandled_keyboard_event_handler_win.cc
@@ -4,62 +4,17 @@
#include "ui/views/controls/webview/unhandled_keyboard_event_handler.h"
-#include "base/logging.h"
-#include "content/public/browser/native_web_keyboard_event.h"
#include "ui/events/event.h"
-#include "ui/views/focus/focus_manager.h"
-
-using content::NativeWebKeyboardEvent;
namespace views {
-UnhandledKeyboardEventHandler::UnhandledKeyboardEventHandler() {
- ignore_next_char_event_ = false;
-}
-
-void UnhandledKeyboardEventHandler::HandleKeyboardEvent(
- const NativeWebKeyboardEvent& event,
+// static
+void UnhandledKeyboardEventHandler::HandleNativeKeyboardEvent(
+ gfx::NativeEvent event,
FocusManager* focus_manager) {
- if (!focus_manager) {
- NOTREACHED();
- return;
- }
- // Previous calls to TranslateMessage can generate Char events as well as
- // RawKeyDown events, even if the latter triggered an accelerator. In these
- // cases, we discard the Char events.
- if (event.type == blink::WebInputEvent::Char && ignore_next_char_event_) {
- ignore_next_char_event_ = false;
- return;
- }
- // It's necessary to reset this flag, because a RawKeyDown event may not
- // always generate a Char event.
- ignore_next_char_event_ = false;
-
- if (event.type == blink::WebInputEvent::RawKeyDown) {
- ui::Accelerator accelerator(
- static_cast<ui::KeyboardCode>(event.windowsKeyCode),
- content::GetModifiersFromNativeWebKeyboardEvent(event));
-
- // This is tricky: we want to set ignore_next_char_event_ if
- // ProcessAccelerator returns true. But ProcessAccelerator might delete
- // |this| if the accelerator is a "close tab" one. So we speculatively
- // set the flag and fix it if no event was handled.
- ignore_next_char_event_ = true;
-
- if (focus_manager->ProcessAccelerator(accelerator)) {
- return;
- }
-
- // ProcessAccelerator didn't handle the accelerator, so we know both
- // that |this| is still valid, and that we didn't want to set the flag.
- ignore_next_char_event_ = false;
- }
-
// Any unhandled keyboard/character messages should be defproced.
// This allows stuff like F10, etc to work correctly.
- if (!event.os_event)
- return;
- const MSG& message(event.os_event->native_event());
+ const MSG& message(event->native_event());
DefWindowProc(message.hwnd, message.message, message.wParam, message.lParam);
}

Powered by Google App Engine
This is Rietveld 408576698