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

Unified Diff: blimp/client/core/contents/android/java/src/org/chromium/blimp/core/contents/input/ImeHelperDialog.java

Issue 2292343002: Hooking up Blimp IME with BlimpContents (Closed)
Patch Set: Fixed linux client Created 4 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 side-by-side diff with in-line comments
Download patch
Index: blimp/client/core/contents/android/java/src/org/chromium/blimp/core/contents/input/ImeHelperDialog.java
diff --git a/blimp/client/app/android/java/src/org/chromium/blimp/input/ImeHelperDialog.java b/blimp/client/core/contents/android/java/src/org/chromium/blimp/core/contents/input/ImeHelperDialog.java
similarity index 86%
rename from blimp/client/app/android/java/src/org/chromium/blimp/input/ImeHelperDialog.java
rename to blimp/client/core/contents/android/java/src/org/chromium/blimp/core/contents/input/ImeHelperDialog.java
index ec9e77521f428d7906fc47d2c4caeab3642d9858..b33985c4c54e3a249820b620c8bc527be2d73bb2 100644
--- a/blimp/client/app/android/java/src/org/chromium/blimp/input/ImeHelperDialog.java
+++ b/blimp/client/core/contents/android/java/src/org/chromium/blimp/core/contents/input/ImeHelperDialog.java
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-package org.chromium.blimp.input;
+package org.chromium.blimp.core.contents.input;
import android.app.Activity;
import android.content.Context;
@@ -19,7 +19,7 @@ import android.widget.TextView;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.JNINamespace;
import org.chromium.blimp.R;
-import org.chromium.blimp.session.BlimpClientSession;
+import org.chromium.ui.base.WindowAndroid;
import org.chromium.ui.base.ime.TextInputType;
/**
@@ -30,38 +30,29 @@ import org.chromium.ui.base.ime.TextInputType;
@JNINamespace("blimp::client")
public class ImeHelperDialog {
private static final String TAG = "ImeHelperDialog";
- private long mNativeImeHelperDialog;
private final Context mContext;
+
private AlertDialog mAlertDialog;
+ private long mNativeImeHelperDialog;
- /**
- * Builds a new ImeHelperDialog.
- * @param context The {@link Context} of the activity.
- */
- public ImeHelperDialog(Context context) {
- mContext = context;
+ @CalledByNative
+ private static ImeHelperDialog create(long nativeImeHelperDialog, WindowAndroid windowAndroid) {
+ return new ImeHelperDialog(nativeImeHelperDialog,
+ WindowAndroid.activityFromContext(windowAndroid.getContext().get()));
}
/**
- * To be called when the native library is loaded so that this class can initialize its native
- * components.
- * @param blimpClientSession The {@link BlimpClientSession} that contains the features
- * required by the native components of the ImeHelperDialog.
+ * Builds a new {@link ImeHelperDialog}.
+ * @param nativeImeHelperDialog The pointer to the native ImeHelperDialog.
+ * @param context The {@link Context} of the activity.
*/
- public void initialize(BlimpClientSession blimpClientSession) {
- assert mNativeImeHelperDialog == 0;
-
- mNativeImeHelperDialog = nativeInit(blimpClientSession);
+ private ImeHelperDialog(long nativeImeHelperDialog, Context context) {
+ mContext = context;
+ mNativeImeHelperDialog = nativeImeHelperDialog;
}
- /**
- * To be called when this class should be torn down. This {@link View} should not be used after
- * this.
- */
- public void destroy() {
- if (mNativeImeHelperDialog == 0) return;
-
- nativeDestroy(mNativeImeHelperDialog);
+ @CalledByNative
+ private void clearNativePtr() {
mNativeImeHelperDialog = 0;
}
@@ -190,7 +181,5 @@ public class ImeHelperDialog {
editText.setImeOptions(imeOptions);
}
- private native long nativeInit(BlimpClientSession blimpClientSession);
- private native void nativeDestroy(long nativeImeHelperDialog);
private native void nativeOnImeTextEntered(long nativeImeHelperDialog, String text);
}

Powered by Google App Engine
This is Rietveld 408576698