Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: content/browser/renderer_host/ime_adapter_android.h

Issue 10911012: Upstream Android IME support (ImeAdapter). (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 namespace content { 10 namespace content {
11 11
12 class RenderWidgetHostViewAndroid; 12 class RenderWidgetHostViewAndroid;
13 struct NativeWebKeyboardEvent; 13 struct NativeWebKeyboardEvent;
14 14
15 // This class is in charge of dispatching key events from the java side 15 // This class is in charge of dispatching key events from the java side
16 // and forward to renderer along with input method results via 16 // and forward to renderer along with input method results via
17 // corresponding host view. 17 // corresponding host view.
18 class ImeAdapterAndroid { 18 class ImeAdapterAndroid {
19 public: 19 public:
20 explicit ImeAdapterAndroid(RenderWidgetHostViewAndroid* rwhva); 20 explicit ImeAdapterAndroid(RenderWidgetHostViewAndroid* rwhva);
21 ~ImeAdapterAndroid(); 21 ~ImeAdapterAndroid();
22 22
23 static bool RegisterImeAdapter(JNIEnv* env); 23 static bool RegisterImeAdapter(JNIEnv* env);
24 24
25 // Called from java -> native 25 // Called from java -> native
26 // The java side is responsible to translate android KeyEvent various enums 26 // The java side is responsible to translate android KeyEvent various enums
27 // and values into the corresponding WebKit::WebInputEvent. 27 // and values into the corresponding WebKit::WebInputEvent.
28 bool SendKeyEvent(JNIEnv* env, jobject,
29 jobject original_key_event,
30 int action, int meta_state,
31 long event_time, int key_code,
32 bool is_system_key, int unicode_text);
33 // |event_type| is a value of WebInputEvent::Type.
34 bool SendSyntheticKeyEvent(JNIEnv*,
35 jobject,
36 int event_type,
37 long timestamp_ms,
38 int native_key_code,
39 int unicode_char);
40 void SetComposingText(JNIEnv*, jobject, jstring text, int new_cursor_pos);
41 void CommitText(JNIEnv*, jobject, jstring text);
42 void AttachImeAdapter(JNIEnv*, jobject java_object);
43 void ReplaceText(JNIEnv*, jobject, jstring text);
44 void ClearFocus(JNIEnv*, jobject);
45 void SetEditableSelectionOffsets(JNIEnv*, jobject, int start, int end);
46 void SetComposingRegion(JNIEnv*, jobject, int start, int end);
47 void DeleteSurroundingText(JNIEnv*, jobject, int before, int after);
28 void Unselect(JNIEnv*, jobject); 48 void Unselect(JNIEnv*, jobject);
29 void SelectAll(JNIEnv*, jobject); 49 void SelectAll(JNIEnv*, jobject);
30 void Cut(JNIEnv*, jobject); 50 void Cut(JNIEnv*, jobject);
31 void Copy(JNIEnv*, jobject); 51 void Copy(JNIEnv*, jobject);
32 void Paste(JNIEnv*, jobject); 52 void Paste(JNIEnv*, jobject);
33 53
54 // Called from native -> java
55 void CancelComposition();
56
34 private: 57 private:
35 RenderWidgetHostViewAndroid* rwhva_; 58 RenderWidgetHostViewAndroid* rwhva_;
36 jobject java_ime_adapter_; 59 jobject java_ime_adapter_;
37 }; 60 };
38 61
39 } // namespace content 62 } // namespace content
40 63
41 #endif // CONTENT_BROWSER_RENDERER_HOST_IME_ADAPTER_ANDROID_H_ 64 #endif // CONTENT_BROWSER_RENDERER_HOST_IME_ADAPTER_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698