Index: content/browser/renderer_host/input/web_input_event_builders_android.cc |
diff --git a/content/browser/renderer_host/input/web_input_event_builders_android.cc b/content/browser/renderer_host/input/web_input_event_builders_android.cc |
index 37dd16af7280d7c349738c9640ae8c52404f078d..006e04ea93f1e5916ba307380fcf53c8991f95db 100644 |
--- a/content/browser/renderer_host/input/web_input_event_builders_android.cc |
+++ b/content/browser/renderer_host/input/web_input_event_builders_android.cc |
@@ -4,10 +4,10 @@ |
#include "content/browser/renderer_host/input/web_input_event_builders_android.h" |
+#include <android/keycodes.h> |
#include "base/logging.h" |
#include "content/browser/renderer_host/input/motion_event_android.h" |
#include "content/browser/renderer_host/input/web_input_event_util.h" |
-#include "content/browser/renderer_host/input/web_input_event_util_posix.h" |
#include "ui/events/keycodes/keyboard_code_conversion_android.h" |
#include "ui/events/keycodes/keyboard_codes_posix.h" |
@@ -21,6 +21,40 @@ using blink::WebTouchPoint; |
namespace content { |
+static blink::WebInputEvent::Modifiers GetLocationModifiersFromAndoridKeyCode( |
Wez
2015/09/03 06:05:47
typo: Andorid -> Android
dtapuska
2015/09/03 13:39:40
Done.
|
+ int key_code) { |
+ switch (key_code) { |
+ case AKEYCODE_ALT_LEFT: |
+ case AKEYCODE_CTRL_LEFT: |
+ case AKEYCODE_META_LEFT: |
+ case AKEYCODE_SHIFT_LEFT: |
+ return blink::WebInputEvent::IsLeft; |
+ case AKEYCODE_ALT_RIGHT: |
+ case AKEYCODE_CTRL_RIGHT: |
+ case AKEYCODE_META_RIGHT: |
+ case AKEYCODE_SHIFT_RIGHT: |
+ return blink::WebInputEvent::IsRight; |
+ case AKEYCODE_NUMPAD_0: |
+ case AKEYCODE_NUMPAD_1: |
+ case AKEYCODE_NUMPAD_2: |
+ case AKEYCODE_NUMPAD_3: |
+ case AKEYCODE_NUMPAD_4: |
+ case AKEYCODE_NUMPAD_5: |
+ case AKEYCODE_NUMPAD_6: |
+ case AKEYCODE_NUMPAD_7: |
+ case AKEYCODE_NUMPAD_8: |
+ case AKEYCODE_NUMPAD_9: |
+ case AKEYCODE_NUMPAD_DIVIDE: |
+ case AKEYCODE_NUMPAD_MULTIPLY: |
+ case AKEYCODE_NUMPAD_SUBTRACT: |
+ case AKEYCODE_NUMPAD_ADD: |
+ case AKEYCODE_NUMPAD_DOT: |
+ return blink::WebInputEvent::IsKeyPad; |
+ default: |
+ return static_cast<blink::WebInputEvent::Modifiers>(0); |
+ } |
+} |
+ |
WebKeyboardEvent WebKeyboardEventBuilder::Build(WebInputEvent::Type type, |
int modifiers, |
double time_sec, |
@@ -33,10 +67,9 @@ WebKeyboardEvent WebKeyboardEventBuilder::Build(WebInputEvent::Type type, |
result.type = type; |
result.modifiers = modifiers; |
result.timeStampSeconds = time_sec; |
- ui::KeyboardCode windows_key_code = |
- ui::KeyboardCodeFromAndroidKeyCode(keycode); |
- UpdateWindowsKeyCodeAndKeyIdentifier(&result, windows_key_code); |
- result.modifiers |= GetLocationModifiersFromWindowsKeyCode(windows_key_code); |
+ result.windowsKeyCode = ui::KeyboardCodeFromAndroidKeyCode(keycode); |
+ |
Wez
2015/09/03 06:05:47
nit: Remove this blank line?
dtapuska
2015/09/03 13:39:40
Done.
|
+ result.modifiers |= GetLocationModifiersFromAndoridKeyCode(keycode); |
result.nativeKeyCode = keycode; |
result.unmodifiedText[0] = unicode_character; |
if (result.windowsKeyCode == ui::VKEY_RETURN) { |
@@ -47,6 +80,7 @@ WebKeyboardEvent WebKeyboardEventBuilder::Build(WebInputEvent::Type type, |
} |
result.text[0] = result.unmodifiedText[0]; |
result.isSystemKey = is_system_key; |
+ result.setKeyIdentifierFromWindowsKeyCode(); |
return result; |
} |