Bug 1446729 - 2. Rename TextInputController to SessionTextInput; r?esawin draft
authorJim Chen <nchen@mozilla.com>
Sun, 18 Mar 2018 05:38:55 -0400
changeset 769092 605375eea828da85adbeeeeb625b17d41fb75c70
parent 769091 3634fa6023a3316b6a2155e4278965feb5e2f42b
child 769093 787378a76bafe68cf23b83d5c752943ffb8ef9c0
push id103035
push userbmo:nchen@mozilla.com
push dateSun, 18 Mar 2018 09:44:48 +0000
reviewersesawin
bugs1446729
milestone61.0a1
Bug 1446729 - 2. Rename TextInputController to SessionTextInput; r?esawin Following the naming scheme "SessionFoo" for GeckoSession sub-objects, and "getFoo()" for getters of GeckoSession sub-objects, rename TextInputController to SessionTextInput and getTextInputController() to getTextInput(). MozReview-Commit-ID: 6GtgCjCLKhg
mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoEditable.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoEditableChild.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoInputConnection.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoView.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/SessionTextInput.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/TextInputController.java
widget/android/GeckoEditableSupport.h
widget/android/GeneratedJNIWrappers.cpp
widget/android/GeneratedJNIWrappers.h
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoEditable.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoEditable.java
@@ -42,17 +42,17 @@ import android.view.KeyEvent;
  * GeckoEditable implements only some functions of Editable
  * The field mText contains the actual underlying
  * SpannableStringBuilder/Editable that contains our text.
  */
 public final class GeckoEditable
     extends IGeckoEditableParent.Stub
     implements InvocationHandler,
                Editable,
-               TextInputController.EditableClient {
+               SessionTextInput.EditableClient {
 
     private static final boolean DEBUG = false;
     private static final String LOGTAG = "GeckoEditable";
 
     // Filters to implement Editable's filtering functionality
     private InputFilter[] mFilters;
 
     private final AsyncText mText;
@@ -66,17 +66,17 @@ public final class GeckoEditable
     private Handler mIcRunHandler;
     private Handler mIcPostHandler;
 
     // Parent process child used as a default for key events.
     /* package */ IGeckoEditableChild mDefaultChild; // Used by IC thread.
     // Parent or content process child that has the focus.
     /* package */ IGeckoEditableChild mFocusedChild; // Used by IC thread.
     /* package */ IBinder mFocusedToken; // Used by Gecko/binder thread.
-    /* package */ TextInputController.EditableListener mListener;
+    /* package */ SessionTextInput.EditableListener mListener;
 
     /* package */ boolean mInBatchMode; // Used by IC thread
     /* package */ boolean mNeedSync; // Used by IC thread
     // Gecko side needs an updated composition from Java;
     private boolean mNeedUpdateComposition; // Used by IC thread
     private boolean mSuppressKeyUp; // Used by IC thread
 
     private boolean mIgnoreSelectionChange; // Used by Gecko thread
@@ -273,17 +273,17 @@ public final class GeckoEditable
         public Spanned getShadowText() {
             if (DEBUG) {
                 assertOnIcThread();
             }
             return mShadowText;
         }
 
         public synchronized void syncShadowText(
-                final TextInputController.EditableListener listener) {
+                final SessionTextInput.EditableListener listener) {
             if (DEBUG) {
                 assertOnIcThread();
             }
 
             if (mCurrentStart > mCurrentOldEnd && mShadowStart > mShadowOldEnd) {
                 // Still check selection changes.
                 if (!mCurrentSelectionChanged) {
                     return;
@@ -598,42 +598,42 @@ public final class GeckoEditable
             }
             onKeyEvent(mFocusedChild, event, event.getAction(),
                        /* metaState */ 0, /* isSynthesizedImeKey */ true);
         }
     }
 
     public GeckoEditable() {
         if (DEBUG) {
-            // Called by TextInputController.
+            // Called by SessionTextInput.
             ThreadUtils.assertOnUiThread();
         }
 
         mText = new AsyncText();
         mActions = new ConcurrentLinkedQueue<Action>();
 
         final Class<?>[] PROXY_INTERFACES = { Editable.class };
         mProxy = (Editable) Proxy.newProxyInstance(Editable.class.getClassLoader(),
                                                    PROXY_INTERFACES, this);
 
         mIcRunHandler = mIcPostHandler = ThreadUtils.getUiHandler();
     }
 
     public void setDefaultEditableChild(final IGeckoEditableChild child) {
         if (DEBUG) {
-            // Called by TextInputController.
+            // Called by SessionTextInput.
             ThreadUtils.assertOnUiThread();
             Log.d(LOGTAG, "setDefaultEditableChild " + child);
         }
         mDefaultChild = child;
     }
 
-    public void setListener(final TextInputController.EditableListener newListener) {
+    public void setListener(final SessionTextInput.EditableListener newListener) {
         if (DEBUG) {
-            // Called by TextInputController.
+            // Called by SessionTextInput.
             ThreadUtils.assertOnUiThread();
             Log.d(LOGTAG, "setListener " + newListener);
         }
 
         mIcPostHandler.post(new Runnable() {
             @Override
             public void run() {
                 if (DEBUG) {
@@ -680,17 +680,17 @@ public final class GeckoEditable
      * @return Whether there was a composition
      */
     private boolean icMaybeSendComposition(final CharSequence sequence,
                                            final int flags) throws RemoteException {
         final boolean useEntireText = (flags & SEND_COMPOSITION_USE_ENTIRE_TEXT) != 0;
         final boolean notifyGecko = (flags & SEND_COMPOSITION_NOTIFY_GECKO) != 0;
         final boolean keepCurrent = (flags & SEND_COMPOSITION_KEEP_CURRENT) != 0;
         final int updateFlags = keepCurrent ?
-                GeckoEditableChild.FLAG_KEEP_CURRENT_COMPOSITION : 0;
+                                GeckoEditableChild.FLAG_KEEP_CURRENT_COMPOSITION : 0;
 
         if (!keepCurrent) {
             // If keepCurrent is true, the composition may not actually be updated;
             // so we may still need to update the composition in the future.
             mNeedUpdateComposition = false;
         }
 
         int selStart = Selection.getSelectionStart(sequence);
@@ -841,17 +841,17 @@ public final class GeckoEditable
                 Log.d(LOGTAG, " added " + rangeType +
                               " : " + Integer.toHexString(rangeStyles) +
                               " : " + Integer.toHexString(rangeForeColor) +
                               " : " + Integer.toHexString(rangeBackColor));
             }
         } while (rangeStart < composingEnd);
     }
 
-    @Override // TextInputController.EditableClient
+    @Override // SessionTextInput.EditableClient
     public void sendKeyEvent(final KeyEvent event, int action, int metaState) {
         if (DEBUG) {
             assertOnIcThread();
             Log.d(LOGTAG, "sendKeyEvent(" + event + ", " + action + ", " + metaState + ")");
         }
         /*
            We are actually sending two events to Gecko here,
            1. Event from the event parameter (key event)
@@ -875,33 +875,33 @@ public final class GeckoEditable
             onKeyEvent(mFocusedChild, event, action, metaState,
                        /* isSynthesizedImeKey */ false);
             icOfferAction(new Action(Action.TYPE_EVENT));
         } catch (final RemoteException e) {
             Log.e(LOGTAG, "Remote call failed", e);
         }
     }
 
-    @Override // TextInputController.EditableClient
+    @Override // SessionTextInput.EditableClient
     public Editable getEditable() {
         if (!onIcThread()) {
             // Android may be holding an old InputConnection; ignore
             if (DEBUG) {
                 Log.i(LOGTAG, "getEditable() called on non-IC thread");
             }
             return null;
         }
         if (mListener == null) {
             // We haven't initialized or we've been destroyed.
             return null;
         }
         return mProxy;
     }
 
-    @Override // TextInputController.EditableClient
+    @Override // SessionTextInput.EditableClient
     public void setBatchMode(boolean inBatchMode) {
         if (!onIcThread()) {
             // Android may be holding an old InputConnection; ignore
             if (DEBUG) {
                 Log.i(LOGTAG, "setBatchMode() called on non-IC thread");
             }
             return;
         }
@@ -923,27 +923,27 @@ public final class GeckoEditable
             mNeedSync = true;
             return;
         }
 
         mNeedSync = false;
         mText.syncShadowText(mListener);
     }
 
-    @Override // TextInputController.EditableClient
+    @Override // SessionTextInput.EditableClient
     public void setSuppressKeyUp(boolean suppress) {
         if (DEBUG) {
             assertOnIcThread();
         }
         // Suppress key up event generated as a result of
         // translating characters to key events
         mSuppressKeyUp = suppress;
     }
 
-    @Override // TextInputController.EditableClient
+    @Override // SessionTextInput.EditableClient
     public Handler setInputConnectionHandler(final Handler handler) {
         if (handler == mIcRunHandler) {
             return mIcRunHandler;
         }
         if (DEBUG) {
             assertOnIcThread();
         }
 
@@ -973,22 +973,22 @@ public final class GeckoEditable
                 }
             }
         });
 
         icOfferAction(Action.newSetHandler(handler));
         return handler;
     }
 
-    @Override // TextInputController.EditableClient
+    @Override // SessionTextInput.EditableClient
     public void postToInputConnection(final Runnable runnable) {
         mIcPostHandler.post(runnable);
     }
 
-    @Override // TextInputController.EditableClient
+    @Override // SessionTextInput.EditableClient
     public void requestCursorUpdates(int requestMode) {
         try {
             if (mFocusedChild != null) {
                 mFocusedChild.onImeRequestCursorUpdates(requestMode);
             }
         } catch (final RemoteException e) {
             Log.e(LOGTAG, "Remote call failed", e);
         }
@@ -1056,73 +1056,73 @@ public final class GeckoEditable
         return false;
     }
 
     @Override // IGeckoEditableParent
     public void notifyIME(final IGeckoEditableChild child, final int type) {
         // On Gecko or binder thread.
         if (DEBUG) {
             // NOTIFY_IME_REPLY_EVENT is logged separately, inside geckoActionReply()
-            if (type != TextInputController.EditableListener.NOTIFY_IME_REPLY_EVENT) {
+            if (type != SessionTextInput.EditableListener.NOTIFY_IME_REPLY_EVENT) {
                 Log.d(LOGTAG, "notifyIME(" +
-                              getConstantName(TextInputController.EditableListener.class,
+                              getConstantName(SessionTextInput.EditableListener.class,
                                               "NOTIFY_IME_", type) +
                               ")");
             }
         }
 
         final IBinder token = child.asBinder();
-        if (type == TextInputController.EditableListener.NOTIFY_IME_OF_TOKEN) {
+        if (type == SessionTextInput.EditableListener.NOTIFY_IME_OF_TOKEN) {
             synchronized (this) {
                 if (mFocusedToken != null && mFocusedToken != token &&
                         mFocusedToken.pingBinder()) {
                     // Focused child already exists and is alive.
                     Log.w(LOGTAG, "Already focused");
                     return;
                 }
                 mFocusedToken = token;
                 return;
             }
-        } else if (type == TextInputController.EditableListener.NOTIFY_IME_OPEN_VKB) {
+        } else if (type == SessionTextInput.EditableListener.NOTIFY_IME_OPEN_VKB) {
             // Always from parent process.
             ThreadUtils.assertOnGeckoThread();
         } else if (!binderCheckToken(token, /* allowNull */ false)) {
             return;
         }
 
-        if (type == TextInputController.EditableListener.NOTIFY_IME_OF_BLUR) {
+        if (type == SessionTextInput.EditableListener.NOTIFY_IME_OF_BLUR) {
             synchronized (this) {
                 onTextChange(token, "", 0, Integer.MAX_VALUE);
                 mActions.clear();
                 mFocusedToken = null;
             }
-        } else if (type == TextInputController.EditableListener.NOTIFY_IME_REPLY_EVENT) {
+        } else if (type == SessionTextInput.EditableListener.NOTIFY_IME_REPLY_EVENT) {
             geckoActionReply(mActions.poll());
             if (!mActions.isEmpty()) {
                 // Only post to IC thread below when the queue is empty.
                 return;
             }
         }
 
         mIcPostHandler.post(new Runnable() {
             @Override
             public void run() {
-                if (type == TextInputController.EditableListener.NOTIFY_IME_REPLY_EVENT) {
+                if (type == SessionTextInput.EditableListener.NOTIFY_IME_REPLY_EVENT) {
                     if (mNeedSync) {
                         icSyncShadowText();
                     }
                     return;
                 }
 
-                if (type == TextInputController.EditableListener.NOTIFY_IME_OF_FOCUS &&
+                if (type == SessionTextInput.EditableListener.NOTIFY_IME_OF_FOCUS &&
                         mListener != null) {
                     mFocusedChild = child;
                     mNeedSync = false;
                     mText.syncShadowText(/* listener */ null);
-                } else if (type == TextInputController.EditableListener.NOTIFY_IME_OF_BLUR) {
+                } else if (type == SessionTextInput.EditableListener.NOTIFY_IME_OF_BLUR) {
                     mFocusedChild = null;
                 }
 
                 if (mListener != null) {
                     mListener.notifyIME(type);
                 }
             }
         });
@@ -1130,17 +1130,17 @@ public final class GeckoEditable
 
     @Override // IGeckoEditableParent
     public void notifyIMEContext(final int state, final String typeHint,
                                  final String modeHint, final String actionHint,
                                  final int flags) {
         // On Gecko or binder thread.
         if (DEBUG) {
             Log.d(LOGTAG, "notifyIMEContext(" +
-                          getConstantName(TextInputController.EditableListener.class,
+                          getConstantName(SessionTextInput.EditableListener.class,
                                           "IME_STATE_", state) +
                           ", \"" + typeHint + "\", \"" + modeHint + "\", \"" + actionHint +
                           "\", 0x" + Integer.toHexString(flags) + ")");
         }
 
         // Don't check token for notifyIMEContext, because the calls all come
         // from the parent process.
         ThreadUtils.assertOnGeckoThread();
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoEditableChild.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoEditableChild.java
@@ -3,17 +3,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.gecko;
 
 import org.mozilla.gecko.annotation.WrapForJNI;
 import org.mozilla.gecko.mozglue.JNIObject;
 import org.mozilla.gecko.util.ThreadUtils;
-import org.mozilla.geckoview.TextInputController;
+import org.mozilla.geckoview.SessionTextInput;
 
 import android.graphics.RectF;
 import android.os.IBinder;
 import android.os.RemoteException;
 import android.util.Log;
 import android.view.KeyEvent;
 
 /**
@@ -128,20 +128,20 @@ public final class GeckoEditableChild ex
         return mEditableParent.asBinder();
     }
 
     @WrapForJNI(calledFrom = "gecko")
     private void notifyIME(final int type) {
         if (DEBUG) {
             ThreadUtils.assertOnGeckoThread();
             Log.d(LOGTAG, "notifyIME(" + GeckoEditable.getConstantName(
-                          TextInputController.EditableListener.class,
+                          SessionTextInput.EditableListener.class,
                           "NOTIFY_IME_", type) + ")");
         }
-        if (type == TextInputController.EditableListener.NOTIFY_IME_TO_CANCEL_COMPOSITION) {
+        if (type == SessionTextInput.EditableListener.NOTIFY_IME_TO_CANCEL_COMPOSITION) {
             // Composition should have been canceled on the parent side through text
             // update notifications. We cannot verify that here because we don't
             // keep track of spans on the child side, but it's simple to add the
             // check to the parent side if ever needed.
             return;
         }
 
         try {
@@ -154,17 +154,17 @@ public final class GeckoEditableChild ex
 
     @WrapForJNI(calledFrom = "gecko")
     private void notifyIMEContext(final int state, final String typeHint,
                                   final String modeHint, final String actionHint,
                                   final int flags) {
         if (DEBUG) {
             ThreadUtils.assertOnGeckoThread();
             Log.d(LOGTAG, "notifyIMEContext(" + GeckoEditable.getConstantName(
-                          TextInputController.EditableListener.class,
+                          SessionTextInput.EditableListener.class,
                           "IME_STATE_", state) + ", \"" +
                           typeHint + "\", \"" + modeHint + "\", \"" + actionHint +
                           "\", 0x" + Integer.toHexString(flags) + ")");
         }
 
         try {
             mEditableParent.notifyIMEContext(state, typeHint, modeHint, actionHint, flags);
         } catch (final RemoteException e) {
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoInputConnection.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoInputConnection.java
@@ -8,17 +8,17 @@ package org.mozilla.gecko;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
 
 import org.mozilla.gecko.util.ActivityUtils;
 import org.mozilla.gecko.util.GamepadUtils;
 import org.mozilla.gecko.util.ThreadUtils;
 import org.mozilla.geckoview.GeckoSession;
-import org.mozilla.geckoview.TextInputController;
+import org.mozilla.geckoview.SessionTextInput;
 
 import android.annotation.SuppressLint;
 import android.annotation.TargetApi;
 import android.app.Activity;
 import android.content.Context;
 import android.content.res.Configuration;
 import android.graphics.Matrix;
 import android.graphics.RectF;
@@ -43,18 +43,18 @@ import android.view.inputmethod.CursorAn
 import android.view.inputmethod.EditorInfo;
 import android.view.inputmethod.ExtractedText;
 import android.view.inputmethod.ExtractedTextRequest;
 import android.view.inputmethod.InputConnection;
 import android.view.inputmethod.InputMethodManager;
 
 public class GeckoInputConnection
     extends BaseInputConnection
-    implements TextInputController.Delegate,
-               TextInputController.EditableListener {
+    implements SessionTextInput.Delegate,
+               SessionTextInput.EditableListener {
 
     private static final boolean DEBUG = false;
     protected static final String LOGTAG = "GeckoInputConnection";
 
     private static final String CUSTOM_HANDLER_TEST_METHOD = "testInputConnection";
     private static final String CUSTOM_HANDLER_TEST_CLASS =
         "org.mozilla.gecko.tests.components.GeckoViewComponent$TextInput";
 
@@ -71,57 +71,57 @@ public class GeckoInputConnection
     private boolean mFocused;
     private int mLastSelectionStart;
     private int mLastSelectionEnd;
 
     private String mCurrentInputMethod = "";
 
     private final GeckoSession mSession;
     private final View mView;
-    private final TextInputController.EditableClient mEditableClient;
+    private final SessionTextInput.EditableClient mEditableClient;
     protected int mBatchEditCount;
     private ExtractedTextRequest mUpdateRequest;
     private final ExtractedText mUpdateExtract = new ExtractedText();
     private final InputConnection mKeyInputConnection;
     private CursorAnchorInfo.Builder mCursorAnchorInfoBuilder;
 
     // Prevent showSoftInput and hideSoftInput from causing reentrant calls on some devices.
     private volatile boolean mSoftInputReentrancyGuard;
 
-    public static TextInputController.Delegate create(
+    public static SessionTextInput.Delegate create(
             final GeckoSession session,
             final View targetView,
-            final TextInputController.EditableClient editable) {
-        TextInputController.Delegate ic = new GeckoInputConnection(session, targetView, editable);
+            final SessionTextInput.EditableClient editable) {
+        SessionTextInput.Delegate ic = new GeckoInputConnection(session, targetView, editable);
         if (DEBUG) {
             ic = wrapForDebug(ic);
         }
         return ic;
     }
 
-    private static TextInputController.Delegate wrapForDebug(final TextInputController.Delegate ic) {
+    private static SessionTextInput.Delegate wrapForDebug(final SessionTextInput.Delegate ic) {
         final InvocationHandler handler = new InvocationHandler() {
             private final StringBuilder mCallLevel = new StringBuilder();
 
             @Override
             public Object invoke(final Object proxy, final Method method,
                                  final Object[] args) throws Throwable {
                 final StringBuilder log = new StringBuilder(mCallLevel);
                 log.append("> ").append(method.getName()).append("(");
                 if (args != null) {
                     for (int i = 0; i < args.length; i++) {
                         final Object arg = args[i];
                         // translate argument values to constant names
                         if ("notifyIME".equals(method.getName()) && i == 0) {
                             log.append(GeckoEditable.getConstantName(
-                                    TextInputController.EditableListener.class,
+                                    SessionTextInput.EditableListener.class,
                                     "NOTIFY_IME_", arg));
                         } else if ("notifyIMEContext".equals(method.getName()) && i == 0) {
                             log.append(GeckoEditable.getConstantName(
-                                    TextInputController.EditableListener.class,
+                                    SessionTextInput.EditableListener.class,
                                     "IME_STATE_", arg));
                         } else {
                             GeckoEditable.debugAppend(log, arg);
                         }
                         log.append(", ");
                     }
                     if (args.length > 0) {
                         log.setLength(log.length() - 2);
@@ -142,28 +142,28 @@ public class GeckoInputConnection
                 if (!method.getReturnType().equals(Void.TYPE)) {
                     GeckoEditable.debugAppend(log.append(": "), ret);
                 }
                 Log.d(LOGTAG, log.toString());
                 return ret;
             }
         };
 
-        return (TextInputController.Delegate) Proxy.newProxyInstance(
+        return (SessionTextInput.Delegate) Proxy.newProxyInstance(
                 GeckoInputConnection.class.getClassLoader(),
                 new Class<?>[] {
                         InputConnection.class,
-                        TextInputController.Delegate.class,
-                        TextInputController.EditableListener.class
+                        SessionTextInput.Delegate.class,
+                        SessionTextInput.EditableListener.class
                 }, handler);
     }
 
     protected GeckoInputConnection(final GeckoSession session,
                                    final View targetView,
-                                   final TextInputController.EditableClient editable) {
+                                   final SessionTextInput.EditableClient editable) {
         super(targetView, true);
         mSession = session;
         mView = targetView;
         mEditableClient = editable;
         mIMEState = IME_STATE_DISABLED;
         // InputConnection that sends keys for plugins, which don't have full editors
         mKeyInputConnection = new BaseInputConnection(targetView, false);
     }
@@ -266,17 +266,17 @@ public class GeckoInputConnection
         if ((req.flags & GET_TEXT_WITH_STYLES) != 0) {
             extract.text = new SpannableString(editable);
         } else {
             extract.text = editable.toString();
         }
         return extract;
     }
 
-    @Override // TextInputController.Delegate
+    @Override // SessionTextInput.Delegate
     public View getView() {
         return mView;
     }
 
     private InputMethodManager getInputMethodManager() {
         View view = getView();
         if (view == null) {
             return null;
@@ -364,17 +364,17 @@ public class GeckoInputConnection
             mBatchEditCount = 0;
         }
 
         // Do not reset mIMEState here; see comments in notifyIMEContext
 
         restartInput();
     }
 
-    @Override // TextInputController.EditableListener
+    @Override // SessionTextInput.EditableListener
     public void onTextChange() {
 
         if (mUpdateRequest == null) {
             return;
         }
 
         final InputMethodManager imm = getInputMethodManager();
         final View v = getView();
@@ -392,17 +392,17 @@ public class GeckoInputConnection
         if ((mUpdateRequest.flags & GET_TEXT_WITH_STYLES) != 0) {
             mUpdateExtract.text = new SpannableString(editable);
         } else {
             mUpdateExtract.text = editable.toString();
         }
         imm.updateExtractedText(v, mUpdateRequest.token, mUpdateExtract);
     }
 
-    @Override // TextInputController.EditableListener
+    @Override // SessionTextInput.EditableListener
     public void onSelectionChange() {
 
         final Editable editable = getEditable();
         if (editable != null) {
             mLastSelectionStart = Selection.getSelectionStart(editable);
             mLastSelectionEnd = Selection.getSelectionEnd(editable);
             notifySelectionChange(mLastSelectionStart, mLastSelectionEnd);
         }
@@ -416,17 +416,17 @@ public class GeckoInputConnection
         if (imm == null || v == null || editable == null) {
             return;
         }
         imm.updateSelection(v, start, end, getComposingSpanStart(editable),
                             getComposingSpanEnd(editable));
     }
 
     @TargetApi(21)
-    @Override // TextInputController.EditableListener
+    @Override // SessionTextInput.EditableListener
     public void updateCompositionRects(final RectF[] rects) {
         if (!(Build.VERSION.SDK_INT >= 21)) {
             return;
         }
 
         final View view = getView();
         if (view == null) {
             return;
@@ -485,30 +485,30 @@ public class GeckoInputConnection
         imm.updateCursorAnchorInfo(view, mCursorAnchorInfoBuilder.build());
     }
 
     @Override
     public boolean requestCursorUpdates(int cursorUpdateMode) {
 
         if ((cursorUpdateMode & InputConnection.CURSOR_UPDATE_IMMEDIATE) != 0) {
             mEditableClient.requestCursorUpdates(
-                    TextInputController.EditableClient.ONE_SHOT);
+                    SessionTextInput.EditableClient.ONE_SHOT);
         }
 
         if ((cursorUpdateMode & InputConnection.CURSOR_UPDATE_MONITOR) != 0) {
             mEditableClient.requestCursorUpdates(
-                    TextInputController.EditableClient.START_MONITOR);
+                    SessionTextInput.EditableClient.START_MONITOR);
         } else {
             mEditableClient.requestCursorUpdates(
-                    TextInputController.EditableClient.END_MONITOR);
+                    SessionTextInput.EditableClient.END_MONITOR);
         }
         return true;
     }
 
-    @Override // TextInputController.EditableListener
+    @Override // SessionTextInput.EditableListener
     public void onDefaultKeyEvent(final KeyEvent event) {
         ThreadUtils.postToUiThread(new Runnable() {
             @Override
             public void run() {
                 GeckoInputConnection.this.performDefaultKeyAction(event);
             }
         });
     }
@@ -590,32 +590,32 @@ public class GeckoInputConnection
         if (isPhysicalKeyboardPresent()) {
             handler = ThreadUtils.getUiHandler();
         } else {
             handler = getBackgroundHandler();
         }
         return mEditableClient.setInputConnectionHandler(handler);
     }
 
-    @Override // TextInputController.Delegate
+    @Override // SessionTextInput.Delegate
     public Handler getHandler(Handler defHandler) {
         if (!canReturnCustomHandler()) {
             return defHandler;
         }
 
         return getHandler();
     }
 
     // Android N: @Override // InputConnection
     @SuppressLint("Override")
     public void closeConnection() {
         // Not supported at the moment.
     }
 
-    @Override // TextInputController.Delegate
+    @Override // SessionTextInput.Delegate
     public synchronized InputConnection onCreateInputConnection(EditorInfo outAttrs) {
         // Some keyboards require us to fill out outAttrs even if we return null.
         outAttrs.inputType = InputType.TYPE_CLASS_TEXT;
         outAttrs.imeOptions = EditorInfo.IME_ACTION_NONE;
         outAttrs.actionLabel = null;
 
         if (mIMEState == IME_STATE_DISABLED) {
             hideSoftInput();
@@ -810,17 +810,17 @@ public class GeckoInputConnection
     }
 
     @Override
     public boolean sendKeyEvent(KeyEvent event) {
         sendKeyEvent(event.getAction(), event);
         return false; // seems to always return false
     }
 
-    @Override // TextInputController.Delegate
+    @Override // SessionTextInput.Delegate
     public boolean onKeyPreIme(int keyCode, KeyEvent event) {
         return false;
     }
 
     private boolean shouldProcessKey(int keyCode, KeyEvent event) {
         switch (keyCode) {
             case KeyEvent.KEYCODE_MENU:
             case KeyEvent.KEYCODE_BACK:
@@ -910,22 +910,22 @@ public class GeckoInputConnection
             @Override
             public void run() {
                 sendKeyEvent(action, event);
             }
         });
         return true;
     }
 
-    @Override // TextInputController.Delegate
+    @Override // SessionTextInput.Delegate
     public boolean onKeyDown(int keyCode, KeyEvent event) {
         return processKey(KeyEvent.ACTION_DOWN, keyCode, event);
     }
 
-    @Override // TextInputController.Delegate
+    @Override // SessionTextInput.Delegate
     public boolean onKeyUp(int keyCode, KeyEvent event) {
         return processKey(KeyEvent.ACTION_UP, keyCode, event);
     }
 
     /**
      * Get a key that represents a given character.
      */
     private KeyEvent getCharKeyEvent(final char c) {
@@ -939,17 +939,17 @@ public class GeckoInputConnection
 
             @Override
             public int getUnicodeChar(int metaState) {
                 return c;
             }
         };
     }
 
-    @Override // TextInputController.Delegate
+    @Override // SessionTextInput.Delegate
     public boolean onKeyMultiple(int keyCode, int repeatCount, final KeyEvent event) {
         if (keyCode == KeyEvent.KEYCODE_UNKNOWN) {
             // KEYCODE_UNKNOWN means the characters are in KeyEvent.getCharacters()
             final String str = event.getCharacters();
             for (int i = 0; i < str.length(); i++) {
                 final KeyEvent charEvent = getCharKeyEvent(str.charAt(i));
                 if (!processKey(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_UNKNOWN, charEvent) ||
                     !processKey(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_UNKNOWN, charEvent)) {
@@ -963,38 +963,38 @@ public class GeckoInputConnection
             if (!processKey(KeyEvent.ACTION_DOWN, keyCode, event) ||
                 !processKey(KeyEvent.ACTION_UP, keyCode, event)) {
                 return false;
             }
         }
         return true;
     }
 
-    @Override // TextInputController.Delegate
+    @Override // SessionTextInput.Delegate
     public boolean onKeyLongPress(int keyCode, KeyEvent event) {
         View v = getView();
         switch (keyCode) {
             case KeyEvent.KEYCODE_MENU:
                 InputMethodManager imm = getInputMethodManager();
                 imm.toggleSoftInputFromWindow(v.getWindowToken(),
                                               InputMethodManager.SHOW_FORCED, 0);
                 return true;
             default:
                 break;
         }
         return false;
     }
 
-    @Override // TextInputController.Delegate
+    @Override // SessionTextInput.Delegate
     public synchronized boolean isInputActive() {
         // Make sure this picks up PASSWORD state as well.
         return mIMEState != IME_STATE_DISABLED;
     }
 
-    @Override // TextInputController.EditableListener
+    @Override // SessionTextInput.EditableListener
     public void notifyIME(int type) {
         switch (type) {
 
             case NOTIFY_IME_OF_FOCUS:
                 // Showing/hiding vkb is done in notifyIMEContext
                 mFocused = true;
                 resetInputConnection();
                 break;
@@ -1035,17 +1035,17 @@ public class GeckoInputConnection
             default:
                 if (DEBUG) {
                     throw new IllegalArgumentException("Unexpected NOTIFY_IME=" + type);
                 }
                 break;
         }
     }
 
-    @Override // TextInputController.EditableListener
+    @Override // SessionTextInput.EditableListener
     public synchronized void notifyIMEContext(int state, final String typeHint,
                                               final String modeHint, final String actionHint,
                                               final int flags) {
         // For some input type we will use a widget to display the ui, for those we must not
         // display the ime. We can display a widget for date and time types and, if the sdk version
         // is 11 or greater, for datetime/month/week as well.
         if (typeHint != null &&
             (typeHint.equalsIgnoreCase("date") ||
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java
@@ -84,17 +84,17 @@ public class GeckoSession extends LayerS
     }
 
     private final NativeQueue mNativeQueue =
         new NativeQueue(State.INITIAL, State.READY);
 
     private final EventDispatcher mEventDispatcher =
         new EventDispatcher(mNativeQueue);
 
-    private final TextInputController mTextInput = new TextInputController(this, mNativeQueue);
+    private final SessionTextInput mTextInput = new SessionTextInput(this, mNativeQueue);
 
     private String mId = UUID.randomUUID().toString().replace("-", "");
     /* package */ String getId() { return mId; }
 
     private final GeckoSessionHandler<ContentDelegate> mContentHandler =
         new GeckoSessionHandler<ContentDelegate>(
             "GeckoViewContent", this,
             new String[]{
@@ -837,21 +837,21 @@ public class GeckoSession extends LayerS
             // session is closed to be properly queued, until the session is open again.
             for (final GeckoSessionHandler<?> handler : mSessionHandlers) {
                 handler.setSessionIsReady(getEventDispatcher(), !inProgress);
             }
         }
     }
 
     /**
-     * Get the TextInputController instance for this session.
+     * Get the SessionTextInput instance for this session. May be called on any thread.
      *
-     * @return TextInputController instance.
+     * @return SessionTextInput instance.
      */
-    public @NonNull TextInputController getTextInputController() {
+    public @NonNull SessionTextInput getTextInput() {
         // May be called on any thread.
         return mTextInput;
     }
 
     /**
     * Load the given URI.
     * @param uri The URI of the resource to load.
     */
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoView.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoView.java
@@ -289,27 +289,27 @@ public class GeckoView extends FrameLayo
         if (mSession == null) {
             setSession(new GeckoSession());
         }
 
         if (!mSession.isOpen()) {
             mSession.open(getContext().getApplicationContext());
         }
 
-        mSession.getTextInputController().setView(this);
+        mSession.getTextInput().setView(this);
 
         super.onAttachedToWindow();
     }
 
     @Override
     public void onDetachedFromWindow() {
         super.onDetachedFromWindow();
 
         if (mSession != null) {
-          mSession.getTextInputController().setView(null);
+          mSession.getTextInput().setView(null);
         }
 
         if (mStateSaved) {
             // If we saved state earlier, we don't want to close the window.
             return;
         }
 
         if (mSession != null && mSession.isOpen()) {
@@ -395,70 +395,70 @@ public class GeckoView extends FrameLayo
         });
     }
 
     @Override
     public Handler getHandler() {
         if (Build.VERSION.SDK_INT >= 24 || mSession == null) {
             return super.getHandler();
         }
-        return mSession.getTextInputController().getHandler(super.getHandler());
+        return mSession.getTextInput().getHandler(super.getHandler());
     }
 
     @Override
     public InputConnection onCreateInputConnection(final EditorInfo outAttrs) {
         if (mSession == null) {
             return null;
         }
-        return mSession.getTextInputController().onCreateInputConnection(outAttrs);
+        return mSession.getTextInput().onCreateInputConnection(outAttrs);
     }
 
     @Override
     public boolean onKeyPreIme(int keyCode, KeyEvent event) {
         if (super.onKeyPreIme(keyCode, event)) {
             return true;
         }
         return mSession != null &&
-               mSession.getTextInputController().onKeyPreIme(keyCode, event);
+               mSession.getTextInput().onKeyPreIme(keyCode, event);
     }
 
     @Override
     public boolean onKeyUp(int keyCode, KeyEvent event) {
         if (super.onKeyUp(keyCode, event)) {
             return true;
         }
         return mSession != null &&
-               mSession.getTextInputController().onKeyUp(keyCode, event);
+               mSession.getTextInput().onKeyUp(keyCode, event);
     }
 
     @Override
     public boolean onKeyDown(int keyCode, KeyEvent event) {
         if (super.onKeyDown(keyCode, event)) {
             return true;
         }
         return mSession != null &&
-               mSession.getTextInputController().onKeyDown(keyCode, event);
+               mSession.getTextInput().onKeyDown(keyCode, event);
     }
 
     @Override
     public boolean onKeyLongPress(int keyCode, KeyEvent event) {
         if (super.onKeyLongPress(keyCode, event)) {
             return true;
         }
         return mSession != null &&
-               mSession.getTextInputController().onKeyLongPress(keyCode, event);
+               mSession.getTextInput().onKeyLongPress(keyCode, event);
     }
 
     @Override
     public boolean onKeyMultiple(int keyCode, int repeatCount, KeyEvent event) {
         if (super.onKeyMultiple(keyCode, repeatCount, event)) {
             return true;
         }
         return mSession != null &&
-               mSession.getTextInputController().onKeyMultiple(keyCode, repeatCount, event);
+               mSession.getTextInput().onKeyMultiple(keyCode, repeatCount, event);
     }
 
     @Override
     public void dispatchDraw(final Canvas canvas) {
         super.dispatchDraw(canvas);
 
         if (mSession != null) {
             mSession.getOverscrollEdgeEffect().draw(canvas);
rename from mobile/android/geckoview/src/main/java/org/mozilla/geckoview/TextInputController.java
rename to mobile/android/geckoview/src/main/java/org/mozilla/geckoview/SessionTextInput.java
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/TextInputController.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/SessionTextInput.java
@@ -19,22 +19,22 @@ import android.support.annotation.NonNul
 import android.support.annotation.Nullable;
 import android.text.Editable;
 import android.view.KeyEvent;
 import android.view.View;
 import android.view.inputmethod.EditorInfo;
 import android.view.inputmethod.InputConnection;
 
 /**
- * TextInputController handles text input for GeckoSession through key events or input
+ * SessionTextInput handles text input for GeckoSession through key events or input
  * methods. It is typically used to implement certain methods in View such as {@code
  * onCreateInputConnection()}, by forwarding such calls to corresponding methods in
- * TextInputController.
+ * SessionTextInput.
  */
-public final class TextInputController {
+public final class SessionTextInput {
 
     // Interface to access GeckoInputConnection from TextInputController.
     public interface Delegate {
         View getView();
         Handler getHandler(Handler defHandler);
         InputConnection onCreateInputConnection(EditorInfo attrs);
         boolean onKeyPreIme(int keyCode, KeyEvent event);
         boolean onKeyDown(int keyCode, KeyEvent event);
@@ -95,18 +95,18 @@ public final class TextInputController {
     }
 
     private final GeckoSession mSession;
     private final NativeQueue mQueue;
     private final GeckoEditable mEditable = new GeckoEditable();
     private final GeckoEditableChild mEditableChild = new GeckoEditableChild(mEditable);
     private Delegate mInputConnection;
 
-    /* package */ TextInputController(final @NonNull GeckoSession session,
-                                      final @NonNull NativeQueue queue) {
+    /* package */ SessionTextInput(final @NonNull GeckoSession session,
+                                   final @NonNull NativeQueue queue) {
         mSession = session;
         mQueue = queue;
         mEditable.setDefaultEditableChild(mEditableChild);
     }
 
     /* package */ void onWindowChanged(final GeckoSession.Window window) {
         if (mQueue.isReady()) {
             window.attachEditable(mEditable, mEditableChild);
@@ -124,17 +124,17 @@ public final class TextInputController {
      * then call this method from the overridden method.
      *
      * For example:<pre>
      * &#64;Override
      * public Handler getHandler() {
      *     if (Build.VERSION.SDK_INT &gt;= 24) {
      *         return super.getHandler();
      *     }
-     *     return getSession().getTextInputController().getHandler(super.getHandler());
+     *     return getSession().getTextInput().getHandler(super.getHandler());
      * }</pre>
      *
      * @param defHandler Handler returned by the system {@code getHandler} implementation.
      * @return Handler to return to the system through {@code getHandler}.
      */
     public @NonNull Handler getHandler(final @NonNull Handler defHandler) {
         // May be called on any thread.
         if (mInputConnection != null) {
--- a/widget/android/GeckoEditableSupport.h
+++ b/widget/android/GeckoEditableSupport.h
@@ -35,18 +35,18 @@ class GeckoEditableSupport final
         * Gecko and Java maintain separate selections, and synchronize when
            needed through selection updates and set-selection events
         * Java controls the composition, and Gecko shadows the Java
            composition through update composition events
     */
 
     using EditableBase =
             java::GeckoEditableChild::Natives<GeckoEditableSupport>;
-    using EditableClient = java::TextInputController::EditableClient;
-    using EditableListener = java::TextInputController::EditableListener;
+    using EditableClient = java::SessionTextInput::EditableClient;
+    using EditableListener = java::SessionTextInput::EditableListener;
 
     // RAII helper class that automatically sends an event reply through
     // OnImeSynchronize, as required by events like OnImeReplaceText.
     class AutoIMESynchronize
     {
         GeckoEditableSupport* const mGES;
     public:
         AutoIMESynchronize(GeckoEditableSupport* ges) : mGES(ges) {}
--- a/widget/android/GeneratedJNIWrappers.cpp
+++ b/widget/android/GeneratedJNIWrappers.cpp
@@ -2577,19 +2577,19 @@ constexpr char GeckoSession::Window::OnR
 auto GeckoSession::Window::OnReady(mozilla::jni::Object::Param a0) const -> void
 {
     return mozilla::jni::Method<OnReady_t>::Call(Window::mCtx, nullptr, a0);
 }
 
 constexpr char GeckoSession::Window::Open_t::name[];
 constexpr char GeckoSession::Window::Open_t::signature[];
 
-const char TextInputController::name[] =
-        "org/mozilla/geckoview/TextInputController";
-
-const char TextInputController::EditableClient::name[] =
-        "org/mozilla/geckoview/TextInputController$EditableClient";
-
-const char TextInputController::EditableListener::name[] =
-        "org/mozilla/geckoview/TextInputController$EditableListener";
+const char SessionTextInput::name[] =
+        "org/mozilla/geckoview/SessionTextInput";
+
+const char SessionTextInput::EditableClient::name[] =
+        "org/mozilla/geckoview/SessionTextInput$EditableClient";
+
+const char SessionTextInput::EditableListener::name[] =
+        "org/mozilla/geckoview/SessionTextInput$EditableListener";
 
 } /* java */
 } /* mozilla */
--- a/widget/android/GeneratedJNIWrappers.h
+++ b/widget/android/GeneratedJNIWrappers.h
@@ -7435,32 +7435,32 @@ public:
     };
 
     static const mozilla::jni::CallingThread callingThread =
             mozilla::jni::CallingThread::ANY;
 
     template<class Impl> class Natives;
 };
 
-class TextInputController : public mozilla::jni::ObjectBase<TextInputController>
+class SessionTextInput : public mozilla::jni::ObjectBase<SessionTextInput>
 {
 public:
     static const char name[];
 
-    explicit TextInputController(const Context& ctx) : ObjectBase<TextInputController>(ctx) {}
+    explicit SessionTextInput(const Context& ctx) : ObjectBase<SessionTextInput>(ctx) {}
 
     class EditableClient;
     class EditableListener;
 
     static const mozilla::jni::CallingThread callingThread =
             mozilla::jni::CallingThread::ANY;
 
 };
 
-class TextInputController::EditableClient : public mozilla::jni::ObjectBase<EditableClient>
+class SessionTextInput::EditableClient : public mozilla::jni::ObjectBase<EditableClient>
 {
 public:
     static const char name[];
 
     explicit EditableClient(const Context& ctx) : ObjectBase<EditableClient>(ctx) {}
 
     static const int32_t END_MONITOR = 3;
 
@@ -7468,17 +7468,17 @@ public:
 
     static const int32_t START_MONITOR = 2;
 
     static const mozilla::jni::CallingThread callingThread =
             mozilla::jni::CallingThread::ANY;
 
 };
 
-class TextInputController::EditableListener : public mozilla::jni::ObjectBase<EditableListener>
+class SessionTextInput::EditableListener : public mozilla::jni::ObjectBase<EditableListener>
 {
 public:
     static const char name[];
 
     explicit EditableListener(const Context& ctx) : ObjectBase<EditableListener>(ctx) {}
 
     static const int32_t IME_FLAG_PRIVATE_BROWSING = 1;