| 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 <android/input.h> | 7 #include <android/input.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "content/browser/renderer_host/input/web_input_event_util.h" | |
| 11 #include "ui/events/android/key_event_utils.h" | 10 #include "ui/events/android/key_event_utils.h" |
| 12 #include "ui/events/android/motion_event_android.h" | 11 #include "ui/events/android/motion_event_android.h" |
| 12 #include "ui/events/blink/blink_event_util.h" |
| 13 #include "ui/events/keycodes/dom/dom_code.h" | 13 #include "ui/events/keycodes/dom/dom_code.h" |
| 14 #include "ui/events/keycodes/dom/keycode_converter.h" | 14 #include "ui/events/keycodes/dom/keycode_converter.h" |
| 15 #include "ui/events/keycodes/keyboard_code_conversion.h" | 15 #include "ui/events/keycodes/keyboard_code_conversion.h" |
| 16 #include "ui/events/keycodes/keyboard_code_conversion_android.h" | 16 #include "ui/events/keycodes/keyboard_code_conversion_android.h" |
| 17 #include "ui/events/keycodes/keyboard_codes_posix.h" | 17 #include "ui/events/keycodes/keyboard_codes_posix.h" |
| 18 | 18 |
| 19 using blink::WebInputEvent; | 19 using blink::WebInputEvent; |
| 20 using blink::WebKeyboardEvent; | 20 using blink::WebKeyboardEvent; |
| 21 using blink::WebGestureEvent; | 21 using blink::WebGestureEvent; |
| 22 using blink::WebMouseEvent; | 22 using blink::WebMouseEvent; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 WebKeyboardEvent result; | 86 WebKeyboardEvent result; |
| 87 | 87 |
| 88 ui::DomCode dom_code = ui::DomCode::NONE; | 88 ui::DomCode dom_code = ui::DomCode::NONE; |
| 89 if (scancode) | 89 if (scancode) |
| 90 dom_code = ui::KeycodeConverter::NativeKeycodeToDomCode(scancode); | 90 dom_code = ui::KeycodeConverter::NativeKeycodeToDomCode(scancode); |
| 91 result.type = type; | 91 result.type = type; |
| 92 result.modifiers = modifiers; | 92 result.modifiers = modifiers; |
| 93 result.timeStampSeconds = time_sec; | 93 result.timeStampSeconds = time_sec; |
| 94 result.windowsKeyCode = ui::LocatedToNonLocatedKeyboardCode( | 94 result.windowsKeyCode = ui::LocatedToNonLocatedKeyboardCode( |
| 95 ui::KeyboardCodeFromAndroidKeyCode(keycode)); | 95 ui::KeyboardCodeFromAndroidKeyCode(keycode)); |
| 96 result.modifiers |= DomCodeToWebInputEventModifiers(dom_code); | 96 result.modifiers |= ui::DomCodeToWebInputEventModifiers(dom_code); |
| 97 result.nativeKeyCode = keycode; | 97 result.nativeKeyCode = keycode; |
| 98 result.domCode = static_cast<int>(dom_code); | 98 result.domCode = static_cast<int>(dom_code); |
| 99 result.domKey = GetDomKeyFromEvent(env, android_key_event, keycode, modifiers, | 99 result.domKey = GetDomKeyFromEvent(env, android_key_event, keycode, modifiers, |
| 100 unicode_character); | 100 unicode_character); |
| 101 result.unmodifiedText[0] = unicode_character; | 101 result.unmodifiedText[0] = unicode_character; |
| 102 if (result.windowsKeyCode == ui::VKEY_RETURN) { | 102 if (result.windowsKeyCode == ui::VKEY_RETURN) { |
| 103 // This is the same behavior as GTK: | 103 // This is the same behavior as GTK: |
| 104 // We need to treat the enter key as a key press of character \r. This | 104 // We need to treat the enter key as a key press of character \r. This |
| 105 // is apparently just how webkit handles it and what it expects. | 105 // is apparently just how webkit handles it and what it expects. |
| 106 result.unmodifiedText[0] = '\r'; | 106 result.unmodifiedText[0] = '\r'; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 result.type = type; | 176 result.type = type; |
| 177 result.x = x; | 177 result.x = x; |
| 178 result.y = y; | 178 result.y = y; |
| 179 result.timeStampSeconds = time_sec; | 179 result.timeStampSeconds = time_sec; |
| 180 result.sourceDevice = blink::WebGestureDeviceTouchscreen; | 180 result.sourceDevice = blink::WebGestureDeviceTouchscreen; |
| 181 | 181 |
| 182 return result; | 182 return result; |
| 183 } | 183 } |
| 184 | 184 |
| 185 } // namespace content | 185 } // namespace content |
| OLD | NEW |