| 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 579e11d4d0992560cfd668dd39d197d3bffdb033..2a2b5993baf93fca8d61ee25615cfa2f191a5217 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
|
| @@ -494,8 +494,8 @@
|
| }
|
|
|
| private ImeAdapter createImeAdapter() {
|
| - return new ImeAdapter(mWebContents, new InputMethodManagerWrapper(mContext),
|
| - new ImeAdapter.ImeAdapterDelegate() {
|
| + return new ImeAdapter(
|
| + new InputMethodManagerWrapper(mContext), new ImeAdapter.ImeAdapterDelegate() {
|
| @Override
|
| public void onImeEvent() {
|
| mPopupZoomer.hide(true);
|
| @@ -583,9 +583,10 @@
|
|
|
| initPopupZoomer(mContext);
|
| mImeAdapter = createImeAdapter();
|
| + attachImeAdapter();
|
|
|
| mSelectionPopupController = new SelectionPopupController(mContext, windowAndroid,
|
| - webContents, viewDelegate.getContainerView(), mRenderCoordinates);
|
| + webContents, viewDelegate.getContainerView(), mRenderCoordinates, mImeAdapter);
|
| mSelectionPopupController.setCallback(ActionModeCallbackHelper.EMPTY_CALLBACK);
|
| mSelectionPopupController.setContainerView(getContainerView());
|
|
|
| @@ -1775,14 +1776,16 @@
|
| }
|
|
|
| @CalledByNative
|
| - private void updateImeAdapter(int textInputType, int textInputFlags, int textInputMode,
|
| - String text, int selectionStart, int selectionEnd, int compositionStart,
|
| - int compositionEnd, boolean showImeIfNeeded, boolean replyToRequest) {
|
| + private void updateImeAdapter(long nativeImeAdapterAndroid, int textInputType,
|
| + int textInputFlags, int textInputMode, String text, int selectionStart,
|
| + int selectionEnd, int compositionStart, int compositionEnd, boolean showImeIfNeeded,
|
| + boolean replyToRequest) {
|
| try {
|
| TraceEvent.begin("ContentViewCore.updateImeAdapter");
|
| boolean focusedNodeEditable = (textInputType != TextInputType.NONE);
|
| boolean focusedNodeIsPassword = (textInputType == TextInputType.PASSWORD);
|
|
|
| + mImeAdapter.attach(nativeImeAdapterAndroid);
|
| mImeAdapter.updateState(textInputType, textInputFlags, textInputMode, showImeIfNeeded,
|
| text, selectionStart, selectionEnd, compositionStart, compositionEnd,
|
| replyToRequest);
|
| @@ -1799,6 +1802,11 @@
|
| }
|
| }
|
|
|
| + @CalledByNative
|
| + private void forceUpdateImeAdapter(long nativeImeAdapterAndroid) {
|
| + mImeAdapter.attach(nativeImeAdapterAndroid);
|
| + }
|
| +
|
| /**
|
| * Called (from native) when the <select> popup needs to be shown.
|
| * @param anchorView View anchored for popup.
|
| @@ -1909,8 +1917,18 @@
|
| @SuppressWarnings("unused")
|
| @CalledByNative
|
| private void onRenderProcessChange() {
|
| + attachImeAdapter();
|
| // Immediately sync closed caption settings to the new render process.
|
| mSystemCaptioningBridge.syncToListener(this);
|
| + }
|
| +
|
| + /**
|
| + * Attaches the native ImeAdapter object to the java ImeAdapter to allow communication via JNI.
|
| + */
|
| + public void attachImeAdapter() {
|
| + if (mImeAdapter != null && mNativeContentViewCore != 0) {
|
| + mImeAdapter.attach(nativeGetNativeImeAdapter(mNativeContentViewCore));
|
| + }
|
| }
|
|
|
| /**
|
| @@ -2657,6 +2675,9 @@
|
| private native void nativeSelectPopupMenuItems(long nativeContentViewCoreImpl,
|
| long nativeSelectPopupSourceFrame, int[] indices);
|
|
|
| +
|
| + private native long nativeGetNativeImeAdapter(long nativeContentViewCoreImpl);
|
| +
|
| private native int nativeGetCurrentRenderProcessId(long nativeContentViewCoreImpl);
|
|
|
| private native void nativeSetAllowJavascriptInterfacesInspection(
|
|
|