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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.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/ContentViewCore.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
index 57ab809bd675aee8f024ece1fc4140a0b09a2c2b..8aa15ab7ba5d47b92cd48f04eb10c44db05e29f9 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
@@ -59,10 +59,11 @@ import org.chromium.content.browser.accessibility.BrowserAccessibilityManager;
import org.chromium.content.browser.accessibility.captioning.CaptioningBridgeFactory;
import org.chromium.content.browser.accessibility.captioning.SystemCaptioningBridge;
import org.chromium.content.browser.accessibility.captioning.TextTrackSettings;
-import org.chromium.content.browser.input.AdapterInputConnection;
+import org.chromium.content.browser.input.ChromiumBaseInputConnection;
+import org.chromium.content.browser.input.ChromiumBaseInputConnectionFactory;
import org.chromium.content.browser.input.GamepadList;
import org.chromium.content.browser.input.ImeAdapter;
-import org.chromium.content.browser.input.ImeAdapter.AdapterInputConnectionFactory;
+import org.chromium.content.browser.input.InputConnectionHandlerFactory;
import org.chromium.content.browser.input.InputMethodManagerWrapper;
import org.chromium.content.browser.input.JoystickScrollProvider;
import org.chromium.content.browser.input.PastePopupMenu;
@@ -196,7 +197,7 @@ public class ContentViewCore implements
* List of anchor views stored in the order in which they were acquired mapped
* to their position.
*/
- private Map<View, Position> mAnchorViews = new LinkedHashMap<View, Position>();
+ private final Map<View, Position> mAnchorViews = new LinkedHashMap<View, Position>();
ContentViewAndroidDelegate(ViewGroup containerView, RenderCoordinates renderCoordinates) {
mRenderCoordinates = renderCoordinates;
@@ -419,6 +420,11 @@ public class ContentViewCore implements
* @see View#awakenScrollBars(int, boolean)
*/
boolean super_awakenScrollBars(int startDelay, boolean invalidate);
+
+ /**
+ * @see View#getHandler()
+ */
+ Handler super_getHandler();
}
/**
@@ -490,8 +496,8 @@ public class ContentViewCore implements
// Only valid when focused on a text / password field.
private ImeAdapter mImeAdapter;
- private ImeAdapter.AdapterInputConnectionFactory mAdapterInputConnectionFactory;
- private AdapterInputConnection mInputConnection;
+ private ChromiumBaseInputConnectionFactory mInputConnectionFactory;
+ private ChromiumBaseInputConnection mInputConnection;
private InputMethodManagerWrapper mInputMethodManagerWrapper;
// Lazily created paste popup menu, triggered either via long press in an
@@ -585,7 +591,7 @@ public class ContentViewCore implements
private int mPotentiallyActiveFlingCount;
private SmartClipDataListener mSmartClipDataListener = null;
- private ObserverList<ContainerViewObserver> mContainerViewObservers;
+ private final ObserverList<ContainerViewObserver> mContainerViewObservers;
// This holds the state of editable text (e.g. contents of <input>, contenteditable) of
// a focused element.
@@ -639,7 +645,7 @@ public class ContentViewCore implements
public ContentViewCore(Context context) {
mContext = context;
- mAdapterInputConnectionFactory = new AdapterInputConnectionFactory();
+ mInputConnectionFactory = new ChromiumBaseInputConnectionFactory();
mInputMethodManagerWrapper = new InputMethodManagerWrapper(mContext);
mRenderCoordinates = new RenderCoordinates();
@@ -738,8 +744,8 @@ public class ContentViewCore implements
}
@VisibleForTesting
- public void setAdapterInputConnectionFactory(AdapterInputConnectionFactory factory) {
- mAdapterInputConnectionFactory = factory;
+ public void setInputConnectionFactory(ChromiumBaseInputConnectionFactory factory) {
+ mInputConnectionFactory = factory;
}
@VisibleForTesting
@@ -748,7 +754,7 @@ public class ContentViewCore implements
}
@VisibleForTesting
- public AdapterInputConnection getInputConnectionForTest() {
+ public ChromiumBaseInputConnection getInputConnectionForTest() {
return mInputConnection;
}
@@ -1552,13 +1558,8 @@ public class ContentViewCore implements
// enter fullscreen mode.
outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_FULLSCREEN;
}
- mInputConnection = mAdapterInputConnectionFactory.get(mContainerView, mImeAdapter,
- mEditable, outAttrs);
- return mInputConnection;
- }
-
- @VisibleForTesting
- public AdapterInputConnection getAdapterInputConnectionForTest() {
+ mInputConnection =
+ mInputConnectionFactory.get(mContainerView, mImeAdapter, mEditable, outAttrs);
return mInputConnection;
}
@@ -2393,8 +2394,11 @@ public class ContentViewCore implements
nativeImeAdapterAndroid, textInputType, textInputFlags, showImeIfNeeded);
if (mInputConnection != null) {
- mInputConnection.updateState(text, selectionStart, selectionEnd, compositionStart,
- compositionEnd, isNonImeChange);
+ // TODO
+ if (mImeAdapter.mInputConnection != null) {
+ mImeAdapter.mInputConnection.updateState(text, selectionStart, selectionEnd,
+ compositionStart, compositionEnd, isNonImeChange);
+ }
}
if (mActionMode != null) mActionMode.invalidate();
@@ -3206,6 +3210,10 @@ public class ContentViewCore implements
mContextualSearchClient = contextualSearchClient;
}
+ public Handler getHandler() {
+ return InputConnectionHandlerFactory.getHandler(mContainerViewInternals.super_getHandler());
+ }
+
private native long nativeInit(WebContents webContents, ViewAndroidDelegate viewAndroidDelegate,
long windowAndroidPtr, HashSet<Object> retainedObjectSet);
private static native ContentViewCore nativeFromWebContentsAndroid(WebContents webContents);

Powered by Google App Engine
This is Rietveld 408576698