Chromium Code Reviews| 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" | 10 #include "content/browser/renderer_host/input/web_input_event_util.h" |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 38 android_modifier |= AMETA_CAPS_LOCK_ON; | 38 android_modifier |= AMETA_CAPS_LOCK_ON; |
| 39 return android_modifier; | 39 return android_modifier; |
| 40 } | 40 } |
| 41 | 41 |
| 42 ui::DomKey GetDomKeyFromEvent( | 42 ui::DomKey GetDomKeyFromEvent( |
| 43 JNIEnv* env, | 43 JNIEnv* env, |
| 44 const base::android::JavaRef<jobject>& android_key_event, | 44 const base::android::JavaRef<jobject>& android_key_event, |
| 45 int keycode, | 45 int keycode, |
| 46 int modifiers, | 46 int modifiers, |
| 47 int unicode_character) { | 47 int unicode_character) { |
| 48 // Synthetic key event, not enough information to get DomKey. | |
| 49 if (android_key_event.is_null() && !unicode_character) | |
| 50 return ui::DomKey::UNIDENTIFIED; | |
|
chongz
2016/03/17 15:50:39
Sorry for the confusing logic... Will this look be
| |
| 51 | |
| 48 if (!unicode_character && env) { | 52 if (!unicode_character && env) { |
| 49 // According to spec |kAllowedModifiers| should be Shift and AltGr, however | 53 // According to spec |kAllowedModifiers| should be Shift and AltGr, however |
| 50 // Android doesn't have AltGr key and ImeAdapter::getModifiers won't pass it | 54 // Android doesn't have AltGr key and ImeAdapter::getModifiers won't pass it |
| 51 // either. | 55 // either. |
| 52 // According to discussion we want to honor CapsLock and possibly NumLock as | 56 // According to discussion we want to honor CapsLock and possibly NumLock as |
| 53 // well. https://github.com/w3c/uievents/issues/70 | 57 // well. https://github.com/w3c/uievents/issues/70 |
| 54 const int kAllowedModifiers = | 58 const int kAllowedModifiers = |
| 55 WebInputEvent::ShiftKey | WebInputEvent::CapsLockOn; | 59 WebInputEvent::ShiftKey | WebInputEvent::CapsLockOn; |
| 56 int fallback_modifiers = | 60 int fallback_modifiers = |
| 57 WebInputEventToAndroidModifier(modifiers & kAllowedModifiers); | 61 WebInputEventToAndroidModifier(modifiers & kAllowedModifiers); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 173 result.type = type; | 177 result.type = type; |
| 174 result.x = x; | 178 result.x = x; |
| 175 result.y = y; | 179 result.y = y; |
| 176 result.timeStampSeconds = time_sec; | 180 result.timeStampSeconds = time_sec; |
| 177 result.sourceDevice = blink::WebGestureDeviceTouchscreen; | 181 result.sourceDevice = blink::WebGestureDeviceTouchscreen; |
| 178 | 182 |
| 179 return result; | 183 return result; |
| 180 } | 184 } |
| 181 | 185 |
| 182 } // namespace content | 186 } // namespace content |
| OLD | NEW |