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

Unified Diff: content/browser/renderer_host/ime_adapter_android.h

Issue 2752113005: Let ImeAdapterAndroid have the same lifecycle as its Java peer (Closed)
Patch Set: background rwhva Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/ime_adapter_android.h
diff --git a/content/browser/renderer_host/ime_adapter_android.h b/content/browser/renderer_host/ime_adapter_android.h
index 72ab6d3ed3298b683e3aef302472a424f4de310f..0a9e9f761f7bbb2c488f38fc243366fddc7f82de 100644
--- a/content/browser/renderer_host/ime_adapter_android.h
+++ b/content/browser/renderer_host/ime_adapter_android.h
@@ -10,6 +10,7 @@
#include <vector>
#include "base/android/jni_weak_ref.h"
+#include "base/memory/weak_ptr.h"
#include "base/strings/string16.h"
#include "content/common/content_export.h"
#include "ui/gfx/geometry/rect_f.h"
@@ -33,7 +34,8 @@ class RenderWidgetHostViewAndroid;
// RenderWidgetHostViewAndroid).
class CONTENT_EXPORT ImeAdapterAndroid {
public:
- explicit ImeAdapterAndroid(RenderWidgetHostViewAndroid* rwhva);
+ ImeAdapterAndroid(JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj);
~ImeAdapterAndroid();
// Called from java -> native
@@ -60,9 +62,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,12 +79,14 @@ 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);
bool RequestTextInputStateUpdate(JNIEnv*,
const base::android::JavaParamRef<jobject>&);
+ void SetRenderWidgetHostViewAndroid(
+ const base::WeakPtr<RenderWidgetHostViewAndroid> rwhva);
+
// Called from native -> java
void CancelComposition();
void FocusedNodeChanged(bool is_editable_node);
@@ -105,7 +106,7 @@ class CONTENT_EXPORT ImeAdapterAndroid {
const base::android::JavaParamRef<jobject>& text,
const base::string16& text16);
- RenderWidgetHostViewAndroid* rwhva_;
+ base::WeakPtr<RenderWidgetHostViewAndroid> rwhva_;
JavaObjectWeakGlobalRef java_ime_adapter_;
};

Powered by Google App Engine
This is Rietveld 408576698