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

Side by Side Diff: ui/views/controls/webview/unhandled_keyboard_event_handler_win.cc

Issue 61553006: Rename WebKit namespace to blink (part 5) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/controls/webview/unhandled_keyboard_event_handler.h" 5 #include "ui/views/controls/webview/unhandled_keyboard_event_handler.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/public/browser/native_web_keyboard_event.h" 8 #include "content/public/browser/native_web_keyboard_event.h"
9 #include "ui/events/event.h" 9 #include "ui/events/event.h"
10 #include "ui/views/focus/focus_manager.h" 10 #include "ui/views/focus/focus_manager.h"
11 11
12 using content::NativeWebKeyboardEvent; 12 using content::NativeWebKeyboardEvent;
13 13
14 namespace views { 14 namespace views {
15 15
16 UnhandledKeyboardEventHandler::UnhandledKeyboardEventHandler() { 16 UnhandledKeyboardEventHandler::UnhandledKeyboardEventHandler() {
17 ignore_next_char_event_ = false; 17 ignore_next_char_event_ = false;
18 } 18 }
19 19
20 void UnhandledKeyboardEventHandler::HandleKeyboardEvent( 20 void UnhandledKeyboardEventHandler::HandleKeyboardEvent(
21 const NativeWebKeyboardEvent& event, 21 const NativeWebKeyboardEvent& event,
22 FocusManager* focus_manager) { 22 FocusManager* focus_manager) {
23 if (!focus_manager) { 23 if (!focus_manager) {
24 NOTREACHED(); 24 NOTREACHED();
25 return; 25 return;
26 } 26 }
27 // Previous calls to TranslateMessage can generate Char events as well as 27 // Previous calls to TranslateMessage can generate Char events as well as
28 // RawKeyDown events, even if the latter triggered an accelerator. In these 28 // RawKeyDown events, even if the latter triggered an accelerator. In these
29 // cases, we discard the Char events. 29 // cases, we discard the Char events.
30 if (event.type == WebKit::WebInputEvent::Char && ignore_next_char_event_) { 30 if (event.type == blink::WebInputEvent::Char && ignore_next_char_event_) {
31 ignore_next_char_event_ = false; 31 ignore_next_char_event_ = false;
32 return; 32 return;
33 } 33 }
34 // It's necessary to reset this flag, because a RawKeyDown event may not 34 // It's necessary to reset this flag, because a RawKeyDown event may not
35 // always generate a Char event. 35 // always generate a Char event.
36 ignore_next_char_event_ = false; 36 ignore_next_char_event_ = false;
37 37
38 if (event.type == WebKit::WebInputEvent::RawKeyDown) { 38 if (event.type == blink::WebInputEvent::RawKeyDown) {
39 ui::Accelerator accelerator( 39 ui::Accelerator accelerator(
40 static_cast<ui::KeyboardCode>(event.windowsKeyCode), 40 static_cast<ui::KeyboardCode>(event.windowsKeyCode),
41 content::GetModifiersFromNativeWebKeyboardEvent(event)); 41 content::GetModifiersFromNativeWebKeyboardEvent(event));
42 42
43 // This is tricky: we want to set ignore_next_char_event_ if 43 // This is tricky: we want to set ignore_next_char_event_ if
44 // ProcessAccelerator returns true. But ProcessAccelerator might delete 44 // ProcessAccelerator returns true. But ProcessAccelerator might delete
45 // |this| if the accelerator is a "close tab" one. So we speculatively 45 // |this| if the accelerator is a "close tab" one. So we speculatively
46 // set the flag and fix it if no event was handled. 46 // set the flag and fix it if no event was handled.
47 ignore_next_char_event_ = true; 47 ignore_next_char_event_ = true;
48 48
(...skipping 12 matching lines...) Expand all
61 if (!event.os_event) 61 if (!event.os_event)
62 return; 62 return;
63 const MSG& message(event.os_event->native_event()); 63 const MSG& message(event.os_event->native_event());
64 #else 64 #else
65 const MSG& message(event.os_event); 65 const MSG& message(event.os_event);
66 #endif 66 #endif
67 DefWindowProc(message.hwnd, message.message, message.wParam, message.lParam); 67 DefWindowProc(message.hwnd, message.message, message.wParam, message.lParam);
68 } 68 }
69 69
70 } // namespace views 70 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/webview/unhandled_keyboard_event_handler_linux.cc ('k') | webkit/child/fling_animator_impl_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698