OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ui/events/android/key_event_utils.h" | 5 #include "ui/events/android/key_event_utils.h" |
6 | 6 |
7 #include "jni/KeyEvent_jni.h" | 7 #include "jni/KeyEvent_jni.h" |
8 | 8 |
9 namespace ui { | 9 namespace ui { |
10 namespace events { | 10 namespace events { |
11 namespace android { | 11 namespace android { |
12 | 12 |
13 bool RegisterKeyEvent(JNIEnv* env) { | |
14 return JNI_KeyEvent::RegisterNativesImpl(env); | |
15 } | |
16 | |
17 base::android::ScopedJavaLocalRef<jobject> CreateKeyEvent(JNIEnv* env, | 13 base::android::ScopedJavaLocalRef<jobject> CreateKeyEvent(JNIEnv* env, |
18 int action, | 14 int action, |
19 int key_code) { | 15 int key_code) { |
20 return JNI_KeyEvent::Java_KeyEvent_ConstructorAVKE_I_I(env, action, key_code); | 16 return JNI_KeyEvent::Java_KeyEvent_ConstructorAVKE_I_I(env, action, key_code); |
21 } | 17 } |
22 | 18 |
23 int GetKeyEventUnicodeChar(JNIEnv* env, | 19 int GetKeyEventUnicodeChar(JNIEnv* env, |
24 const base::android::JavaRef<jobject>& event, | 20 const base::android::JavaRef<jobject>& event, |
25 int meta_state) { | 21 int meta_state) { |
26 return static_cast<int>(JNI_KeyEvent::Java_KeyEvent_getUnicodeCharI_I( | 22 return static_cast<int>(JNI_KeyEvent::Java_KeyEvent_getUnicodeCharI_I( |
27 env, event.obj(), meta_state)); | 23 env, event.obj(), meta_state)); |
28 } | 24 } |
29 | 25 |
30 } // namespace android | 26 } // namespace android |
31 } // namespace events | 27 } // namespace events |
32 } // namespace ui | 28 } // namespace ui |
OLD | NEW |