Index: android_webview/java/src/org/chromium/android_webview/AwContents.java |
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java |
index 76cc0fcc742429d7a9e81a3e4b987b6ecdecab5b..00c8f836dc5ee79b6e5a0bf0a45f8bace05df8d8 100644 |
--- a/android_webview/java/src/org/chromium/android_webview/AwContents.java |
+++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java |
@@ -1039,6 +1039,10 @@ public class AwContents implements SmartClipProvider { |
* ^^^^^^^^^ See the native class declaration for more details on relative object lifetimes. |
*/ |
private void setNewAwContents(long newAwContentsPtr) { |
+ // Move the text classifier to the new ContentViewCore. |
+ Object textClassifier = |
+ mContentViewCore == null ? null : mContentViewCore.getCustomTextClassifier(); |
+ |
if (mNativeAwContents != 0) { |
destroyNatives(); |
mContentViewCore = null; |
@@ -1071,6 +1075,8 @@ public class AwContents implements SmartClipProvider { |
installWebContentsObserver(); |
mSettings.setWebContents(webContents); |
+ if (textClassifier != null) mContentViewCore.setTextClassifier(textClassifier); |
+ |
final float dipScale = mWindowAndroid.getWindowAndroid().getDisplay().getDipScale(); |
mDisplayObserver.onDIPScaleChanged(dipScale); |
@@ -2712,6 +2718,19 @@ public class AwContents implements SmartClipProvider { |
nativeSetRendererPriorityPolicy( |
mNativeAwContents, rendererRequestedPriority, waivedWhenNotVisible); |
} |
+ |
+ // TODO(timav): Use |TextClassifier| instead of |Object| after we switch to Android SDK 26. |
+ public void setTextClassifier(Object textClassifier) { |
+ assert mContentViewCore != null; |
+ mContentViewCore.setTextClassifier(textClassifier); |
+ } |
+ |
+ // TODO(timav): Use |TextClassifier| instead of |Object| after we switch to Android SDK 26. |
+ public Object getTextClassifier() { |
+ assert mContentViewCore != null; |
+ return mContentViewCore.getTextClassifier(); |
+ } |
+ |
//-------------------------------------------------------------------------------------------- |
// Methods called from native via JNI |
//-------------------------------------------------------------------------------------------- |