OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/browser/renderer_host/input/web_input_event_builders_android.h
" | 5 #include "content/browser/renderer_host/input/web_input_event_builders_android.h
" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "content/browser/renderer_host/input/web_input_event_util.h" | 8 #include "content/browser/renderer_host/input/web_input_event_util.h" |
9 #include "ui/events/android/motion_event_android.h" | 9 #include "ui/events/android/motion_event_android.h" |
10 #include "ui/events/keycodes/dom/dom_code.h" | 10 #include "ui/events/keycodes/dom/dom_code.h" |
11 #include "ui/events/keycodes/dom/keycode_converter.h" | 11 #include "ui/events/keycodes/dom/keycode_converter.h" |
12 #include "ui/events/keycodes/keyboard_code_conversion.h" | 12 #include "ui/events/keycodes/keyboard_code_conversion.h" |
13 #include "ui/events/keycodes/keyboard_code_conversion_android.h" | 13 #include "ui/events/keycodes/keyboard_code_conversion_android.h" |
14 #include "ui/events/keycodes/keyboard_codes_posix.h" | 14 #include "ui/events/keycodes/keyboard_codes_posix.h" |
15 | 15 |
16 using blink::WebInputEvent; | 16 using blink::WebInputEvent; |
17 using blink::WebKeyboardEvent; | 17 using blink::WebKeyboardEvent; |
18 using blink::WebGestureEvent; | 18 using blink::WebGestureEvent; |
19 using blink::WebMouseEvent; | 19 using blink::WebMouseEvent; |
20 using blink::WebMouseWheelEvent; | 20 using blink::WebMouseWheelEvent; |
| 21 using blink::WebPointerProperties; |
21 using blink::WebTouchEvent; | 22 using blink::WebTouchEvent; |
22 using blink::WebTouchPoint; | 23 using blink::WebTouchPoint; |
23 | 24 |
24 namespace content { | 25 namespace content { |
25 | 26 |
26 namespace { | 27 namespace { |
27 | 28 |
28 ui::DomKey GetDomKeyFromEvent(int keycode, int unicode_character) { | 29 ui::DomKey GetDomKeyFromEvent(int keycode, int unicode_character) { |
29 ui::DomKey key = ui::GetDomKeyFromAndroidEvent(keycode, unicode_character); | 30 ui::DomKey key = ui::GetDomKeyFromAndroidEvent(keycode, unicode_character); |
30 if (key != ui::DomKey::NONE) | 31 if (key != ui::DomKey::NONE) |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // is apparently just how webkit handles it and what it expects. | 64 // is apparently just how webkit handles it and what it expects. |
64 result.unmodifiedText[0] = '\r'; | 65 result.unmodifiedText[0] = '\r'; |
65 } | 66 } |
66 result.text[0] = result.unmodifiedText[0]; | 67 result.text[0] = result.unmodifiedText[0]; |
67 result.isSystemKey = is_system_key; | 68 result.isSystemKey = is_system_key; |
68 result.setKeyIdentifierFromWindowsKeyCode(); | 69 result.setKeyIdentifierFromWindowsKeyCode(); |
69 | 70 |
70 return result; | 71 return result; |
71 } | 72 } |
72 | 73 |
73 WebMouseEvent WebMouseEventBuilder::Build(blink::WebInputEvent::Type type, | 74 WebMouseEvent WebMouseEventBuilder::Build( |
74 WebMouseEvent::Button button, | 75 WebInputEvent::Type type, |
75 double time_sec, | 76 WebMouseEvent::Button button, |
76 int window_x, | 77 double time_sec, |
77 int window_y, | 78 int window_x, |
78 int modifiers, | 79 int window_y, |
79 int click_count) { | 80 int modifiers, |
| 81 int click_count, |
| 82 WebPointerProperties::PointerType pointer_type) { |
| 83 |
80 DCHECK(WebInputEvent::isMouseEventType(type)); | 84 DCHECK(WebInputEvent::isMouseEventType(type)); |
81 WebMouseEvent result; | 85 WebMouseEvent result; |
82 | 86 |
83 result.type = type; | 87 result.type = type; |
| 88 result.pointerType = pointer_type; |
84 result.x = window_x; | 89 result.x = window_x; |
85 result.y = window_y; | 90 result.y = window_y; |
86 result.windowX = window_x; | 91 result.windowX = window_x; |
87 result.windowY = window_y; | 92 result.windowY = window_y; |
88 result.timeStampSeconds = time_sec; | 93 result.timeStampSeconds = time_sec; |
89 result.clickCount = click_count; | 94 result.clickCount = click_count; |
90 result.modifiers = modifiers; | 95 result.modifiers = modifiers; |
91 | 96 |
92 if (type == WebInputEvent::MouseDown || type == WebInputEvent::MouseUp) | 97 if (type == WebInputEvent::MouseDown || type == WebInputEvent::MouseUp) |
93 result.button = button; | 98 result.button = button; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 result.type = type; | 136 result.type = type; |
132 result.x = x; | 137 result.x = x; |
133 result.y = y; | 138 result.y = y; |
134 result.timeStampSeconds = time_sec; | 139 result.timeStampSeconds = time_sec; |
135 result.sourceDevice = blink::WebGestureDeviceTouchscreen; | 140 result.sourceDevice = blink::WebGestureDeviceTouchscreen; |
136 | 141 |
137 return result; | 142 return result; |
138 } | 143 } |
139 | 144 |
140 } // namespace content | 145 } // namespace content |
OLD | NEW |