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_RENDERER_HOST_IME_ADAPTER_ANDROID_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_IME_ADAPTER_ANDROID_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_IME_ADAPTER_ANDROID_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_IME_ADAPTER_ANDROID_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 | 9 |
| 10 #include "base/android/jni_helper.h" |
| 11 |
10 namespace content { | 12 namespace content { |
11 | 13 |
12 class RenderWidgetHostViewAndroid; | 14 class RenderWidgetHostViewAndroid; |
13 struct NativeWebKeyboardEvent; | 15 struct NativeWebKeyboardEvent; |
14 | 16 |
15 // This class is in charge of dispatching key events from the java side | 17 // This class is in charge of dispatching key events from the java side |
16 // and forward to renderer along with input method results via | 18 // and forward to renderer along with input method results via |
17 // corresponding host view. | 19 // corresponding host view. |
| 20 // Ownership of these objects remains on the native side (see |
| 21 // RenderWidgetHostViewAndroid). |
18 class ImeAdapterAndroid { | 22 class ImeAdapterAndroid { |
19 public: | 23 public: |
20 explicit ImeAdapterAndroid(RenderWidgetHostViewAndroid* rwhva); | 24 explicit ImeAdapterAndroid(RenderWidgetHostViewAndroid* rwhva); |
21 ~ImeAdapterAndroid(); | 25 ~ImeAdapterAndroid(); |
22 | 26 |
23 // Called from java -> native | 27 // Called from java -> native |
24 // The java side is responsible to translate android KeyEvent various enums | 28 // The java side is responsible to translate android KeyEvent various enums |
25 // and values into the corresponding WebKit::WebInputEvent. | 29 // and values into the corresponding WebKit::WebInputEvent. |
26 bool SendKeyEvent(JNIEnv* env, jobject, | 30 bool SendKeyEvent(JNIEnv* env, jobject, |
27 jobject original_key_event, | 31 jobject original_key_event, |
(...skipping 18 matching lines...) Expand all Loading... |
46 void SelectAll(JNIEnv*, jobject); | 50 void SelectAll(JNIEnv*, jobject); |
47 void Cut(JNIEnv*, jobject); | 51 void Cut(JNIEnv*, jobject); |
48 void Copy(JNIEnv*, jobject); | 52 void Copy(JNIEnv*, jobject); |
49 void Paste(JNIEnv*, jobject); | 53 void Paste(JNIEnv*, jobject); |
50 | 54 |
51 // Called from native -> java | 55 // Called from native -> java |
52 void CancelComposition(); | 56 void CancelComposition(); |
53 | 57 |
54 private: | 58 private: |
55 RenderWidgetHostViewAndroid* rwhva_; | 59 RenderWidgetHostViewAndroid* rwhva_; |
56 jobject java_ime_adapter_; | 60 JavaObjectWeakGlobalRef java_ime_adapter_; |
57 }; | 61 }; |
58 | 62 |
59 bool RegisterImeAdapter(JNIEnv* env); | 63 bool RegisterImeAdapter(JNIEnv* env); |
60 | 64 |
61 } // namespace content | 65 } // namespace content |
62 | 66 |
63 #endif // CONTENT_BROWSER_RENDERER_HOST_IME_ADAPTER_ANDROID_H_ | 67 #endif // CONTENT_BROWSER_RENDERER_HOST_IME_ADAPTER_ANDROID_H_ |
OLD | NEW |