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

Side by Side Diff: content/browser/renderer_host/native_web_keyboard_event_aura.cc

Issue 63253002: Rename WebKit namespace to blink (part 3) (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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "content/public/browser/native_web_keyboard_event.h" 5 #include "content/public/browser/native_web_keyboard_event.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/browser/renderer_host/web_input_event_aura.h" 8 #include "content/browser/renderer_host/web_input_event_aura.h"
9 #include "ui/events/event.h" 9 #include "ui/events/event.h"
10 10
11 namespace { 11 namespace {
12 12
13 // We need to copy |os_event| in NativeWebKeyboardEvent because it is 13 // We need to copy |os_event| in NativeWebKeyboardEvent because it is
14 // queued in RenderWidgetHost and may be passed and used 14 // queued in RenderWidgetHost and may be passed and used
15 // RenderViewHostDelegate::HandledKeybardEvent after the original aura 15 // RenderViewHostDelegate::HandledKeybardEvent after the original aura
16 // event is destroyed. 16 // event is destroyed.
17 ui::Event* CopyEvent(ui::Event* event) { 17 ui::Event* CopyEvent(ui::Event* event) {
18 return event ? static_cast<ui::KeyEvent*>(event)->Copy() : NULL; 18 return event ? static_cast<ui::KeyEvent*>(event)->Copy() : NULL;
19 } 19 }
20 20
21 int EventFlagsToWebInputEventModifiers(int flags) { 21 int EventFlagsToWebInputEventModifiers(int flags) {
22 return 22 return
23 (flags & ui::EF_SHIFT_DOWN ? WebKit::WebInputEvent::ShiftKey : 0) | 23 (flags & ui::EF_SHIFT_DOWN ? blink::WebInputEvent::ShiftKey : 0) |
24 (flags & ui::EF_CONTROL_DOWN ? WebKit::WebInputEvent::ControlKey : 0) | 24 (flags & ui::EF_CONTROL_DOWN ? blink::WebInputEvent::ControlKey : 0) |
25 (flags & ui::EF_CAPS_LOCK_DOWN ? WebKit::WebInputEvent::CapsLockOn : 0) | 25 (flags & ui::EF_CAPS_LOCK_DOWN ? blink::WebInputEvent::CapsLockOn : 0) |
26 (flags & ui::EF_ALT_DOWN ? WebKit::WebInputEvent::AltKey : 0); 26 (flags & ui::EF_ALT_DOWN ? blink::WebInputEvent::AltKey : 0);
27 } 27 }
28 28
29 } // namespace 29 } // namespace
30 30
31 using WebKit::WebKeyboardEvent; 31 using blink::WebKeyboardEvent;
32 32
33 namespace content { 33 namespace content {
34 34
35 NativeWebKeyboardEvent::NativeWebKeyboardEvent() 35 NativeWebKeyboardEvent::NativeWebKeyboardEvent()
36 : os_event(NULL), 36 : os_event(NULL),
37 skip_in_browser(false) { 37 skip_in_browser(false) {
38 } 38 }
39 39
40 NativeWebKeyboardEvent::NativeWebKeyboardEvent(gfx::NativeEvent native_event) 40 NativeWebKeyboardEvent::NativeWebKeyboardEvent(gfx::NativeEvent native_event)
41 : WebKeyboardEvent(MakeWebKeyboardEvent( 41 : WebKeyboardEvent(MakeWebKeyboardEvent(
(...skipping 12 matching lines...) Expand all
54 NativeWebKeyboardEvent::NativeWebKeyboardEvent( 54 NativeWebKeyboardEvent::NativeWebKeyboardEvent(
55 ui::EventType key_event_type, 55 ui::EventType key_event_type,
56 bool is_char, 56 bool is_char,
57 wchar_t character, 57 wchar_t character,
58 int state, 58 int state,
59 double time_stamp_seconds) 59 double time_stamp_seconds)
60 : os_event(NULL), 60 : os_event(NULL),
61 skip_in_browser(false) { 61 skip_in_browser(false) {
62 switch (key_event_type) { 62 switch (key_event_type) {
63 case ui::ET_KEY_PRESSED: 63 case ui::ET_KEY_PRESSED:
64 type = is_char ? WebKit::WebInputEvent::Char : 64 type = is_char ? blink::WebInputEvent::Char :
65 WebKit::WebInputEvent::RawKeyDown; 65 blink::WebInputEvent::RawKeyDown;
66 break; 66 break;
67 case ui::ET_KEY_RELEASED: 67 case ui::ET_KEY_RELEASED:
68 type = WebKit::WebInputEvent::KeyUp; 68 type = blink::WebInputEvent::KeyUp;
69 break; 69 break;
70 default: 70 default:
71 NOTREACHED(); 71 NOTREACHED();
72 } 72 }
73 73
74 modifiers = EventFlagsToWebInputEventModifiers(state); 74 modifiers = EventFlagsToWebInputEventModifiers(state);
75 timeStampSeconds = time_stamp_seconds; 75 timeStampSeconds = time_stamp_seconds;
76 windowsKeyCode = character; 76 windowsKeyCode = character;
77 nativeKeyCode = character; 77 nativeKeyCode = character;
78 text[0] = character; 78 text[0] = character;
(...skipping 11 matching lines...) Expand all
90 skip_in_browser = other.skip_in_browser; 90 skip_in_browser = other.skip_in_browser;
91 91
92 return *this; 92 return *this;
93 } 93 }
94 94
95 NativeWebKeyboardEvent::~NativeWebKeyboardEvent() { 95 NativeWebKeyboardEvent::~NativeWebKeyboardEvent() {
96 delete os_event; 96 delete os_event;
97 } 97 }
98 98
99 } // namespace content 99 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698