Chromium Code Reviews| 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 9ebbb5b57ef8576cac1111b73192d98c93ad29ca..df5b6b386ea7eecfb1e6764fecc6136d0a01998e 100644 |
| --- a/android_webview/java/src/org/chromium/android_webview/AwContents.java |
| +++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java |
| @@ -60,6 +60,7 @@ import org.chromium.base.annotations.SuppressFBWarnings; |
| import org.chromium.components.navigation_interception.InterceptNavigationDelegate; |
| import org.chromium.components.navigation_interception.NavigationParams; |
| import org.chromium.content.browser.AppWebMessagePort; |
| +import org.chromium.content.browser.ContentClassFactory; |
|
boliu
2017/04/25 20:30:28
layer violation
|
| import org.chromium.content.browser.ContentViewCore; |
| import org.chromium.content.browser.ContentViewStatics; |
| import org.chromium.content.browser.SmartClipProvider; |
| @@ -69,6 +70,7 @@ import org.chromium.content_public.browser.LoadUrlParams; |
| import org.chromium.content_public.browser.MessagePort; |
| import org.chromium.content_public.browser.NavigationController; |
| import org.chromium.content_public.browser.NavigationHistory; |
| +import org.chromium.content_public.browser.TextClassifierProvider; |
| import org.chromium.content_public.browser.WebContents; |
| import org.chromium.content_public.browser.navigation_controller.LoadURLType; |
| import org.chromium.content_public.browser.navigation_controller.UserAgentOverrideOption; |
| @@ -1037,6 +1039,12 @@ public class AwContents implements SmartClipProvider { |
| * ^^^^^^^^^ See the native class declaration for more details on relative object lifetimes. |
| */ |
| private void setNewAwContents(long newAwContentsPtr) { |
| + TextClassifierProvider textClassifierProvider = (mWebContents != null) |
| + ? mWebContents.getTextClassifierProvider() |
| + : ContentClassFactory.get().createTextClassifierProvider(mContext); |
|
boliu
2017/04/25 20:30:28
simplify the API, if it's null, then content will
|
| + |
| + assert textClassifierProvider != null; |
| + |
| if (mNativeAwContents != 0) { |
| destroyNatives(); |
| mContentViewCore = null; |
| @@ -1054,6 +1062,7 @@ public class AwContents implements SmartClipProvider { |
| // WebContent's browser context. |
| WebContents webContents = nativeGetWebContents(mNativeAwContents); |
| + webContents.setTextClassifierProvider(textClassifierProvider); |
| mWindowAndroid = getWindowAndroid(mContext); |
| mContentViewCore = new ContentViewCore(mContext, PRODUCT_VERSION); |
| @@ -2343,6 +2352,14 @@ public class AwContents implements SmartClipProvider { |
| return (mSettings.getDisabledActionModeMenuItems() & actionModeItem) != actionModeItem; |
| } |
| + public void setTextClassifier(Object textClassifier) { |
| + mWebContents.getTextClassifierProvider().setTextClassifier(textClassifier); |
| + } |
| + |
| + public Object getTextClassifier() { |
| + return mWebContents.getTextClassifierProvider().getTextClassifier(); |
| + } |
| + |
| //-------------------------------------------------------------------------------------------- |
| // View and ViewGroup method implementations |
| //-------------------------------------------------------------------------------------------- |