OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CONTENT_BROWSER_ANDROID_IME_UTILS_H_ | 5 #ifndef CONTENT_BROWSER_ANDROID_IME_UTILS_H_ |
6 #define CONTENT_BROWSER_ANDROID_IME_UTILS_H_ | 6 #define CONTENT_BROWSER_ANDROID_IME_UTILS_H_ |
7 #pragma once | |
8 | 7 |
9 #include <jni.h> | 8 #include <jni.h> |
10 | 9 |
11 class AndroidKeyEvent; | 10 class AndroidKeyEvent; |
12 | 11 |
13 namespace content { | 12 namespace content { |
14 | 13 |
15 struct NativeWebKeyboardEvent; | 14 struct NativeWebKeyboardEvent; |
16 | 15 |
17 // Returns a java KeyEvent from a NativeWebKeyboardEvent, NULL if it fails. | 16 // Returns a java KeyEvent from a NativeWebKeyboardEvent, NULL if it fails. |
18 jobject KeyEventFromNative(const NativeWebKeyboardEvent& event); | 17 jobject KeyEventFromNative(const NativeWebKeyboardEvent& event); |
19 | 18 |
20 // Maps a java KeyEvent into a NativeWebKeyboardEvent. | 19 // Maps a java KeyEvent into a NativeWebKeyboardEvent. |
21 // |java_key_event| is used to maintain a globalref for KeyEvent. | 20 // |java_key_event| is used to maintain a globalref for KeyEvent. |
22 // |action| will help determine the WebInputEvent type. | 21 // |action| will help determine the WebInputEvent type. |
23 // type, |modifiers|, |time_ms|, |key_code|, |unicode_char| is used to create | 22 // type, |modifiers|, |time_ms|, |key_code|, |unicode_char| is used to create |
24 // WebKeyboardEvent. |key_code| is also needed ad need to treat the enter key | 23 // WebKeyboardEvent. |key_code| is also needed ad need to treat the enter key |
25 // as a key press of character \r. | 24 // as a key press of character \r. |
26 NativeWebKeyboardEvent NativeWebKeyboardEventFromKeyEvent( | 25 NativeWebKeyboardEvent NativeWebKeyboardEventFromKeyEvent( |
27 JNIEnv* env, jobject java_key_event, int action, int modifiers, | 26 JNIEnv* env, jobject java_key_event, int action, int modifiers, |
28 long time_ms, int key_code, bool is_system_key, int unicode_char); | 27 long time_ms, int key_code, bool is_system_key, int unicode_char); |
29 | 28 |
30 } // namespace content | 29 } // namespace content |
31 | 30 |
32 #endif // CONTENT_BROWSER_ANDROID_IME_UTILS_H_ | 31 #endif // CONTENT_BROWSER_ANDROID_IME_UTILS_H_ |
OLD | NEW |