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

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

Issue 2653283002: Route IME Events to Focused RenderWidgets (Android) (Closed)
Patch Set: Added a Content Browser Test Created 3 years, 10 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
« no previous file with comments | « no previous file | content/browser/renderer_host/ime_adapter_android.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <vector> 10 #include <vector>
11 11
12 #include "base/android/jni_weak_ref.h" 12 #include "base/android/jni_weak_ref.h"
13 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
14 #include "content/common/content_export.h"
14 #include "ui/gfx/geometry/rect_f.h" 15 #include "ui/gfx/geometry/rect_f.h"
15 16
16 namespace blink { 17 namespace blink {
17 18
18 struct WebCompositionUnderline; 19 struct WebCompositionUnderline;
19 20
20 } // namespace blink 21 } // namespace blink
21 22
22 namespace content { 23 namespace content {
23 24
24 class RenderFrameHost; 25 class RenderFrameHost;
25 class RenderWidgetHostImpl; 26 class RenderWidgetHostImpl;
26 class RenderWidgetHostViewAndroid; 27 class RenderWidgetHostViewAndroid;
27 class WebContents;
28 28
29 // This class is in charge of dispatching key events from the java side 29 // This class is in charge of dispatching key events from the java side
30 // and forward to renderer along with input method results via 30 // and forward to renderer along with input method results via
31 // corresponding host view. 31 // corresponding host view.
32 // Ownership of these objects remains on the native side (see 32 // Ownership of these objects remains on the native side (see
33 // RenderWidgetHostViewAndroid). 33 // RenderWidgetHostViewAndroid).
34 class ImeAdapterAndroid { 34 class CONTENT_EXPORT ImeAdapterAndroid {
EhsanK 2017/02/16 19:08:13 Link errors without this.
35 public: 35 public:
36 explicit ImeAdapterAndroid(RenderWidgetHostViewAndroid* rwhva); 36 explicit ImeAdapterAndroid(RenderWidgetHostViewAndroid* rwhva);
37 ~ImeAdapterAndroid(); 37 ~ImeAdapterAndroid();
38 38
39 // Called from java -> native 39 // Called from java -> native
40 bool SendKeyEvent( 40 bool SendKeyEvent(
41 JNIEnv* env, 41 JNIEnv* env,
42 const base::android::JavaParamRef<jobject>&, 42 const base::android::JavaParamRef<jobject>&,
43 const base::android::JavaParamRef<jobject>& original_key_event, 43 const base::android::JavaParamRef<jobject>& original_key_event,
44 int type, 44 int type,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 void RequestCursorUpdate(JNIEnv*, const base::android::JavaParamRef<jobject>&, 79 void RequestCursorUpdate(JNIEnv*, const base::android::JavaParamRef<jobject>&,
80 bool immediateRequest, bool monitorRequest); 80 bool immediateRequest, bool monitorRequest);
81 bool RequestTextInputStateUpdate(JNIEnv*, 81 bool RequestTextInputStateUpdate(JNIEnv*,
82 const base::android::JavaParamRef<jobject>&); 82 const base::android::JavaParamRef<jobject>&);
83 83
84 // Called from native -> java 84 // Called from native -> java
85 void CancelComposition(); 85 void CancelComposition();
86 void FocusedNodeChanged(bool is_editable_node); 86 void FocusedNodeChanged(bool is_editable_node);
87 void SetCharacterBounds(const std::vector<gfx::RectF>& rects); 87 void SetCharacterBounds(const std::vector<gfx::RectF>& rects);
88 88
89 base::android::ScopedJavaLocalRef<jobject> java_ime_adapter_for_testing(
90 JNIEnv* env) {
91 return java_ime_adapter_.get(env);
92 }
93
89 private: 94 private:
90 RenderWidgetHostImpl* GetRenderWidgetHostImpl(); 95 RenderWidgetHostImpl* GetFocusedWidget();
91 RenderFrameHost* GetFocusedFrame(); 96 RenderFrameHost* GetFocusedFrame();
92 WebContents* GetWebContents();
93 std::vector<blink::WebCompositionUnderline> GetUnderlinesFromSpans( 97 std::vector<blink::WebCompositionUnderline> GetUnderlinesFromSpans(
94 JNIEnv* env, 98 JNIEnv* env,
95 const base::android::JavaParamRef<jobject>& obj, 99 const base::android::JavaParamRef<jobject>& obj,
96 const base::android::JavaParamRef<jobject>& text, 100 const base::android::JavaParamRef<jobject>& text,
97 const base::string16& text16); 101 const base::string16& text16);
98 102
99 RenderWidgetHostViewAndroid* rwhva_; 103 RenderWidgetHostViewAndroid* rwhva_;
100 JavaObjectWeakGlobalRef java_ime_adapter_; 104 JavaObjectWeakGlobalRef java_ime_adapter_;
101 }; 105 };
102 106
103 bool RegisterImeAdapter(JNIEnv* env); 107 bool RegisterImeAdapter(JNIEnv* env);
104 108
105 } // namespace content 109 } // namespace content
106 110
107 #endif // CONTENT_BROWSER_RENDERER_HOST_IME_ADAPTER_ANDROID_H_ 111 #endif // CONTENT_BROWSER_RENDERER_HOST_IME_ADAPTER_ANDROID_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/ime_adapter_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698