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

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

Issue 1489453003: jni: Pass method parameters as JavaParamRef in content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 #include "base/android/jni_weak_ref.h" 10 #include "base/android/jni_weak_ref.h"
(...skipping 12 matching lines...) Expand all
23 // Ownership of these objects remains on the native side (see 23 // Ownership of these objects remains on the native side (see
24 // RenderWidgetHostViewAndroid). 24 // RenderWidgetHostViewAndroid).
25 class ImeAdapterAndroid { 25 class ImeAdapterAndroid {
26 public: 26 public:
27 explicit ImeAdapterAndroid(RenderWidgetHostViewAndroid* rwhva); 27 explicit ImeAdapterAndroid(RenderWidgetHostViewAndroid* rwhva);
28 ~ImeAdapterAndroid(); 28 ~ImeAdapterAndroid();
29 29
30 // Called from java -> native 30 // Called from java -> native
31 // The java side is responsible to translate android KeyEvent various enums 31 // The java side is responsible to translate android KeyEvent various enums
32 // and values into the corresponding blink::WebInputEvent. 32 // and values into the corresponding blink::WebInputEvent.
33 bool SendKeyEvent(JNIEnv* env, jobject, 33 bool SendKeyEvent(
34 jobject original_key_event, 34 JNIEnv* env,
35 int action, int meta_state, 35 const base::android::JavaParamRef<jobject>&,
36 long event_time, int key_code, 36 const base::android::JavaParamRef<jobject>& original_key_event,
37 int scan_code, bool is_system_key, 37 int action,
38 int unicode_text); 38 int meta_state,
39 long event_time,
40 int key_code,
41 int scan_code,
42 bool is_system_key,
43 int unicode_text);
39 // |event_type| is a value of WebInputEvent::Type. 44 // |event_type| is a value of WebInputEvent::Type.
40 bool SendSyntheticKeyEvent(JNIEnv*, 45 bool SendSyntheticKeyEvent(JNIEnv*,
41 jobject, 46 const base::android::JavaParamRef<jobject>&,
42 int event_type, 47 int event_type,
43 long timestamp_ms, 48 long timestamp_ms,
44 int native_key_code, 49 int native_key_code,
45 int modifiers, 50 int modifiers,
46 int unicode_char); 51 int unicode_char);
47 void SetComposingText(JNIEnv*, 52 void SetComposingText(JNIEnv*,
48 jobject obj, 53 const base::android::JavaParamRef<jobject>& obj,
49 jobject text, 54 const base::android::JavaParamRef<jobject>& text,
50 jstring text_str, 55 const base::android::JavaParamRef<jstring>& text_str,
51 int new_cursor_pos); 56 int new_cursor_pos);
52 void CommitText(JNIEnv*, jobject, jstring text_str); 57 void CommitText(JNIEnv*,
53 void FinishComposingText(JNIEnv* env, jobject); 58 const base::android::JavaParamRef<jobject>&,
54 void AttachImeAdapter(JNIEnv*, jobject java_object); 59 const base::android::JavaParamRef<jstring>& text_str);
55 void SetEditableSelectionOffsets(JNIEnv*, jobject, int start, int end); 60 void FinishComposingText(JNIEnv* env,
56 void SetComposingRegion(JNIEnv*, jobject, int start, int end); 61 const base::android::JavaParamRef<jobject>&);
57 void DeleteSurroundingText(JNIEnv*, jobject, int before, int after); 62 void AttachImeAdapter(
58 void ResetImeAdapter(JNIEnv*, jobject); 63 JNIEnv*,
64 const base::android::JavaParamRef<jobject>& java_object);
65 void SetEditableSelectionOffsets(JNIEnv*,
66 const base::android::JavaParamRef<jobject>&,
67 int start,
68 int end);
69 void SetComposingRegion(JNIEnv*,
70 const base::android::JavaParamRef<jobject>&,
71 int start,
72 int end);
73 void DeleteSurroundingText(JNIEnv*,
74 const base::android::JavaParamRef<jobject>&,
75 int before,
76 int after);
77 void ResetImeAdapter(JNIEnv*, const base::android::JavaParamRef<jobject>&);
59 78
60 // Called from native -> java 79 // Called from native -> java
61 void CancelComposition(); 80 void CancelComposition();
62 void FocusedNodeChanged(bool is_editable_node); 81 void FocusedNodeChanged(bool is_editable_node);
63 82
64 private: 83 private:
65 RenderWidgetHostImpl* GetRenderWidgetHostImpl(); 84 RenderWidgetHostImpl* GetRenderWidgetHostImpl();
66 RenderFrameHost* GetFocusedFrame(); 85 RenderFrameHost* GetFocusedFrame();
67 WebContents* GetWebContents(); 86 WebContents* GetWebContents();
68 87
69 RenderWidgetHostViewAndroid* rwhva_; 88 RenderWidgetHostViewAndroid* rwhva_;
70 JavaObjectWeakGlobalRef java_ime_adapter_; 89 JavaObjectWeakGlobalRef java_ime_adapter_;
71 }; 90 };
72 91
73 bool RegisterImeAdapter(JNIEnv* env); 92 bool RegisterImeAdapter(JNIEnv* env);
74 93
75 } // namespace content 94 } // namespace content
76 95
77 #endif // CONTENT_BROWSER_RENDERER_HOST_IME_ADAPTER_ANDROID_H_ 96 #endif // CONTENT_BROWSER_RENDERER_HOST_IME_ADAPTER_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698