| 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 "ui/events/android/key_event_utils.h" |   10 #include "ui/events/android/key_event_utils.h" | 
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   76     JNIEnv* env, |   76     JNIEnv* env, | 
|   77     const base::android::JavaRef<jobject>& android_key_event, |   77     const base::android::JavaRef<jobject>& android_key_event, | 
|   78     WebInputEvent::Type type, |   78     WebInputEvent::Type type, | 
|   79     int modifiers, |   79     int modifiers, | 
|   80     double time_sec, |   80     double time_sec, | 
|   81     int keycode, |   81     int keycode, | 
|   82     int scancode, |   82     int scancode, | 
|   83     int unicode_character, |   83     int unicode_character, | 
|   84     bool is_system_key) { |   84     bool is_system_key) { | 
|   85   DCHECK(WebInputEvent::isKeyboardEventType(type)); |   85   DCHECK(WebInputEvent::isKeyboardEventType(type)); | 
|   86   WebKeyboardEvent result(type, modifiers, time_sec); |  | 
|   87  |   86  | 
|   88   ui::DomCode dom_code = ui::DomCode::NONE; |   87   ui::DomCode dom_code = ui::DomCode::NONE; | 
|   89   if (scancode) |   88   if (scancode) | 
|   90     dom_code = ui::KeycodeConverter::NativeKeycodeToDomCode(scancode); |   89     dom_code = ui::KeycodeConverter::NativeKeycodeToDomCode(scancode); | 
 |   90  | 
 |   91   WebKeyboardEvent result( | 
 |   92       type, modifiers | ui::DomCodeToWebInputEventModifiers(dom_code), | 
 |   93       time_sec); | 
|   91   result.windowsKeyCode = ui::LocatedToNonLocatedKeyboardCode( |   94   result.windowsKeyCode = ui::LocatedToNonLocatedKeyboardCode( | 
|   92       ui::KeyboardCodeFromAndroidKeyCode(keycode)); |   95       ui::KeyboardCodeFromAndroidKeyCode(keycode)); | 
|   93   result.modifiers |= ui::DomCodeToWebInputEventModifiers(dom_code); |  | 
|   94   result.nativeKeyCode = keycode; |   96   result.nativeKeyCode = keycode; | 
|   95   result.domCode = static_cast<int>(dom_code); |   97   result.domCode = static_cast<int>(dom_code); | 
|   96   result.domKey = GetDomKeyFromEvent(env, android_key_event, keycode, modifiers, |   98   result.domKey = GetDomKeyFromEvent(env, android_key_event, keycode, modifiers, | 
|   97                                      unicode_character); |   99                                      unicode_character); | 
|   98   result.unmodifiedText[0] = unicode_character; |  100   result.unmodifiedText[0] = unicode_character; | 
|   99   if (result.windowsKeyCode == ui::VKEY_RETURN) { |  101   if (result.windowsKeyCode == ui::VKEY_RETURN) { | 
|  100     // This is the same behavior as GTK: |  102     // This is the same behavior as GTK: | 
|  101     // We need to treat the enter key as a key press of character \r. This |  103     // We need to treat the enter key as a key press of character \r. This | 
|  102     // is apparently just how webkit handles it and what it expects. |  104     // is apparently just how webkit handles it and what it expects. | 
|  103     result.unmodifiedText[0] = '\r'; |  105     result.unmodifiedText[0] = '\r'; | 
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  174   WebGestureEvent result(type, WebInputEvent::NoModifiers, time_sec); |  176   WebGestureEvent result(type, WebInputEvent::NoModifiers, time_sec); | 
|  175  |  177  | 
|  176   result.x = x; |  178   result.x = x; | 
|  177   result.y = y; |  179   result.y = y; | 
|  178   result.sourceDevice = blink::WebGestureDeviceTouchscreen; |  180   result.sourceDevice = blink::WebGestureDeviceTouchscreen; | 
|  179  |  181  | 
|  180   return result; |  182   return result; | 
|  181 } |  183 } | 
|  182  |  184  | 
|  183 }  // namespace content |  185 }  // namespace content | 
| OLD | NEW |