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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/input/AdapterInputConnection.java

Issue 1278593004: Introduce ThreadedInputConnection behind a switch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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/public/android/java/src/org/chromium/content/browser/input/AdapterInputConnection.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/input/AdapterInputConnection.java b/content/public/android/java/src/org/chromium/content/browser/input/AdapterInputConnection.java
index 00b2b107d67ab0e991ebf5703dd191f4d7ce063a..2a01cfb286b57f3f6cde0d2ff4513f6eed836c86 100644
--- a/content/public/android/java/src/org/chromium/content/browser/input/AdapterInputConnection.java
+++ b/content/public/android/java/src/org/chromium/content/browser/input/AdapterInputConnection.java
@@ -29,9 +29,10 @@ import org.chromium.ui.base.ime.TextInputType;
* It then adapts android's IME to chrome's RenderWidgetHostView using the
* native ImeAdapterAndroid via the class ImeAdapter.
*/
-public class AdapterInputConnection extends BaseInputConnection {
+public class AdapterInputConnection
+ extends BaseInputConnection implements ChromiumBaseInputConnection {
private static final String TAG = "cr.InputConnection";
- private static final boolean DEBUG = false;
+ private static final boolean DEBUG = true;
/**
* Selection value should be -1 if not known. See EditorInfo.java for details.
*/
@@ -156,24 +157,7 @@ public class AdapterInputConnection extends BaseInputConnection {
return builder.toString();
}
- /**
- * Updates the AdapterInputConnection's internal representation of the text being edited and
- * its selection and composition properties. The resulting Editable is accessible through the
- * getEditable() method. If the text has not changed, this also calls updateSelection on the
- * InputMethodManager.
- *
- * @param text The String contents of the field being edited.
- * @param selectionStart The character offset of the selection start, or the caret position if
- * there is no selection.
- * @param selectionEnd The character offset of the selection end, or the caret position if there
- * is no selection.
- * @param compositionStart The character offset of the composition start, or -1 if there is no
- * composition.
- * @param compositionEnd The character offset of the composition end, or -1 if there is no
- * selection.
- * @param isNonImeChange True when the update was caused by non-IME (e.g. Javascript).
- */
- @VisibleForTesting
+ @Override
public void updateState(String text, int selectionStart, int selectionEnd, int compositionStart,
int compositionEnd, boolean isNonImeChange) {
if (DEBUG) {
@@ -282,7 +266,7 @@ public class AdapterInputConnection extends BaseInputConnection {
public boolean performEditorAction(int actionCode) {
if (DEBUG) Log.w(TAG, "performEditorAction [%d]", actionCode);
if (actionCode == EditorInfo.IME_ACTION_NEXT) {
- restartInput();
+ getInputMethodManagerWrapper().restartInput(mInternalView);
// Send TAB key event
long timeStampMs = SystemClock.uptimeMillis();
mImeAdapter.sendSyntheticKeyEvent(
@@ -535,17 +519,6 @@ public class AdapterInputConnection extends BaseInputConnection {
}
/**
- * Informs the InputMethodManager and InputMethodSession (i.e. the IME) that the text
- * state is no longer what the IME has and that it needs to be updated.
- */
- void restartInput() {
- if (DEBUG) Log.w(TAG, "restartInput");
- getInputMethodManagerWrapper().restartInput(mInternalView);
- mNumNestedBatchEdits = 0;
- mPendingAccent = 0;
- }
-
- /**
* @see BaseInputConnection#setComposingRegion(int, int)
*/
@Override
@@ -644,4 +617,9 @@ public class AdapterInputConnection extends BaseInputConnection {
int compositionEnd = getComposingSpanEnd(mEditable);
return new ImeState(text, selectionStart, selectionEnd, compositionStart, compositionEnd);
}
+
+ @Override
+ public void restartInput() {
+ getInputMethodManagerWrapper().restartInput(mInternalView);
+ }
}

Powered by Google App Engine
This is Rietveld 408576698