Index: content/browser/android/ime_adapter_android.h |
diff --git a/content/browser/renderer_host/ime_adapter_android.h b/content/browser/android/ime_adapter_android.h |
similarity index 73% |
rename from content/browser/renderer_host/ime_adapter_android.h |
rename to content/browser/android/ime_adapter_android.h |
index 72ab6d3ed3298b683e3aef302472a424f4de310f..f3e9e5973efe028b22be2cec5f88f2b0727979fc 100644 |
--- a/content/browser/renderer_host/ime_adapter_android.h |
+++ b/content/browser/android/ime_adapter_android.h |
@@ -2,8 +2,8 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef CONTENT_BROWSER_RENDERER_HOST_IME_ADAPTER_ANDROID_H_ |
-#define CONTENT_BROWSER_RENDERER_HOST_IME_ADAPTER_ANDROID_H_ |
+#ifndef CONTENT_BROWSER_ANDROID_IME_ADAPTER_ANDROID_H_ |
+#define CONTENT_BROWSER_ANDROID_IME_ADAPTER_ANDROID_H_ |
#include <jni.h> |
@@ -12,6 +12,7 @@ |
#include "base/android/jni_weak_ref.h" |
#include "base/strings/string16.h" |
#include "content/common/content_export.h" |
+#include "content/public/browser/web_contents_observer.h" |
#include "ui/gfx/geometry/rect_f.h" |
namespace blink { |
@@ -25,16 +26,19 @@ namespace content { |
class RenderFrameHost; |
class RenderWidgetHostImpl; |
class RenderWidgetHostViewAndroid; |
+class WebContentsImpl; |
// This class is in charge of dispatching key events from the java side |
// and forward to renderer along with input method results via |
// corresponding host view. |
// Ownership of these objects remains on the native side (see |
// RenderWidgetHostViewAndroid). |
-class CONTENT_EXPORT ImeAdapterAndroid { |
+class CONTENT_EXPORT ImeAdapterAndroid : public WebContentsObserver { |
public: |
- explicit ImeAdapterAndroid(RenderWidgetHostViewAndroid* rwhva); |
- ~ImeAdapterAndroid(); |
+ ImeAdapterAndroid(JNIEnv* env, |
+ const base::android::JavaParamRef<jobject>& obj, |
+ WebContents* web_contents); |
+ ~ImeAdapterAndroid() override; |
// Called from java -> native |
bool SendKeyEvent( |
@@ -60,9 +64,6 @@ class CONTENT_EXPORT ImeAdapterAndroid { |
int relative_cursor_pos); |
void FinishComposingText(JNIEnv* env, |
const base::android::JavaParamRef<jobject>&); |
- void AttachImeAdapter( |
- JNIEnv*, |
- const base::android::JavaParamRef<jobject>& java_object); |
void SetEditableSelectionOffsets(JNIEnv*, |
const base::android::JavaParamRef<jobject>&, |
int start, |
@@ -80,9 +81,10 @@ class CONTENT_EXPORT ImeAdapterAndroid { |
const base::android::JavaParamRef<jobject>&, |
int before, |
int after); |
- void ResetImeAdapter(JNIEnv*, const base::android::JavaParamRef<jobject>&); |
- void RequestCursorUpdate(JNIEnv*, const base::android::JavaParamRef<jobject>&, |
- bool immediateRequest, bool monitorRequest); |
+ void RequestCursorUpdate(JNIEnv*, |
+ const base::android::JavaParamRef<jobject>&, |
+ bool immediateRequest, |
+ bool monitorRequest); |
bool RequestTextInputStateUpdate(JNIEnv*, |
const base::android::JavaParamRef<jobject>&); |
@@ -96,6 +98,14 @@ class CONTENT_EXPORT ImeAdapterAndroid { |
return java_ime_adapter_.get(env); |
} |
+ // WebContentsObserver implementation. |
+ void RenderViewReady() override; |
+ void RenderViewHostChanged(RenderViewHost* old_host, |
+ RenderViewHost* new_host) override; |
+ void DidAttachInterstitialPage() override; |
+ void DidDetachInterstitialPage() override; |
+ void WebContentsDestroyed() override; |
+ |
private: |
RenderWidgetHostImpl* GetFocusedWidget(); |
RenderFrameHost* GetFocusedFrame(); |
@@ -104,6 +114,11 @@ class CONTENT_EXPORT ImeAdapterAndroid { |
const base::android::JavaParamRef<jobject>& obj, |
const base::android::JavaParamRef<jobject>& text, |
const base::string16& text16); |
+ RenderWidgetHostViewAndroid* GetRenderWidgetHostViewAndroid() const; |
+ void UpdateRenderProcessConnection(RenderWidgetHostViewAndroid* new_rwhva); |
+ |
+ // Reference to the current WebContents. |
+ WebContentsImpl* web_contents_; |
boliu
2017/03/27 17:18:12
you don't need this. WebContentsObserver has a web
Jinsuk Kim
2017/03/27 22:38:19
Removed.
|
RenderWidgetHostViewAndroid* rwhva_; |
JavaObjectWeakGlobalRef java_ime_adapter_; |
@@ -113,4 +128,4 @@ bool RegisterImeAdapter(JNIEnv* env); |
} // namespace content |
-#endif // CONTENT_BROWSER_RENDERER_HOST_IME_ADAPTER_ANDROID_H_ |
+#endif // CONTENT_BROWSER_ANDROID_IME_ADAPTER_ANDROID_H_ |