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 2b5d8476ccbd99b0ab3d18ea46de57b62e03f98c..60c2af470a6bd97e0e32f781c995213657d69386 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 |
@@ -48,6 +48,7 @@ import org.chromium.content.browser.input.SelectPopup; |
import org.chromium.content.browser.input.SelectPopupDialog; |
import org.chromium.content.browser.input.SelectPopupDropdown; |
import org.chromium.content.browser.input.SelectPopupItem; |
+import org.chromium.content.browser.input.TextSuggestionHost; |
import org.chromium.content_public.browser.AccessibilitySnapshotCallback; |
import org.chromium.content_public.browser.AccessibilitySnapshotNode; |
import org.chromium.content_public.browser.ActionModeCallbackHelper; |
@@ -218,6 +219,8 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Displa |
// Only valid when focused on a text / password field. |
private ImeAdapter mImeAdapter; |
+ private TextSuggestionHost mTextSuggestionHost; |
+ |
// Size of the viewport in physical pixels as set from onSizeChanged. |
private int mViewportWidthPix; |
private int mViewportHeightPix; |
@@ -369,6 +372,19 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Displa |
mSelectionPopupController = actionMode; |
} |
+ /** |
+ * @return The TextSuggestionHost that handles displaying the text suggestion menu. |
+ */ |
+ @VisibleForTesting |
+ public TextSuggestionHost getTextSuggestionHostForTesting() { |
+ return mTextSuggestionHost; |
+ } |
+ |
+ @VisibleForTesting |
+ public void setTextSuggestionHostForTesting(TextSuggestionHost textSuggestionHost) { |
+ mTextSuggestionHost = textSuggestionHost; |
+ } |
+ |
@Override |
public void addWindowAndroidChangedObserver(WindowAndroidChangedObserver observer) { |
mWindowAndroidChangedObservers.addObserver(observer); |
@@ -459,6 +475,8 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Displa |
initPopupZoomer(mContext); |
mImeAdapter = new ImeAdapter( |
mWebContents, mContainerView, new InputMethodManagerWrapper(mContext)); |
+ mTextSuggestionHost = new TextSuggestionHost( |
+ mContext, mWebContents, mContainerView, this, mRenderCoordinates); |
mImeAdapter.addEventObserver(this); |
mSelectionPopupController = new SelectionPopupController( |
@@ -990,6 +1008,7 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Displa |
destroyPastePopup(); |
hideSelectPopupWithCancelMessage(); |
mPopupZoomer.hide(false); |
+ mTextSuggestionHost.hidePopups(); |
if (mWebContents != null) mWebContents.dismissTextHandles(); |
} |
@@ -999,6 +1018,7 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Displa |
destroyPastePopup(); |
hideSelectPopupWithCancelMessage(); |
mPopupZoomer.hide(false); |
+ mTextSuggestionHost.hidePopups(); |
} |
private void restoreSelectionPopupsIfNecessary() { |
@@ -2140,6 +2160,7 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Displa |
hidePopupsAndPreserveSelection(); |
showSelectActionMode(); |
} |
+ mTextSuggestionHost.hidePopups(); |
int rotationDegrees = 0; |
switch (rotation) { |