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

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwContents.java

Issue 2882583004: [SmartText selection] Implement TextClassifier getter and setter (Closed)
Patch Set: Rebased again Created 3 years, 7 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
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
//--------------------------------------------------------------------------------------------
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698