| 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(WebInputEvent::Type type, |
| 74 WebMouseEvent::Button button, | 75 WebMouseEvent::Button button, |
| 75 double time_sec, | 76 double time_sec, |
| 76 int window_x, | 77 int window_x, |
| 77 int window_y, | 78 int window_y, |
| 78 int modifiers, | 79 int modifiers, |
| 79 int click_count) { | 80 int click_count, |
| 81 WebPointerProperties::PointerType poin
ter_type) { |
| 80 DCHECK(WebInputEvent::isMouseEventType(type)); | 82 DCHECK(WebInputEvent::isMouseEventType(type)); |
| 81 WebMouseEvent result; | 83 WebMouseEvent result; |
| 82 | 84 |
| 83 result.type = type; | 85 result.type = type; |
| 86 result.pointerType = pointer_type; |
| 84 result.x = window_x; | 87 result.x = window_x; |
| 85 result.y = window_y; | 88 result.y = window_y; |
| 86 result.windowX = window_x; | 89 result.windowX = window_x; |
| 87 result.windowY = window_y; | 90 result.windowY = window_y; |
| 88 result.timeStampSeconds = time_sec; | 91 result.timeStampSeconds = time_sec; |
| 89 result.clickCount = click_count; | 92 result.clickCount = click_count; |
| 90 result.modifiers = modifiers; | 93 result.modifiers = modifiers; |
| 91 | 94 |
| 92 if (type == WebInputEvent::MouseDown || type == WebInputEvent::MouseUp) | 95 if (type == WebInputEvent::MouseDown || type == WebInputEvent::MouseUp) |
| 93 result.button = button; | 96 result.button = button; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 result.type = type; | 134 result.type = type; |
| 132 result.x = x; | 135 result.x = x; |
| 133 result.y = y; | 136 result.y = y; |
| 134 result.timeStampSeconds = time_sec; | 137 result.timeStampSeconds = time_sec; |
| 135 result.sourceDevice = blink::WebGestureDeviceTouchscreen; | 138 result.sourceDevice = blink::WebGestureDeviceTouchscreen; |
| 136 | 139 |
| 137 return result; | 140 return result; |
| 138 } | 141 } |
| 139 | 142 |
| 140 } // namespace content | 143 } // namespace content |
| OLD | NEW |