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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/SelectionPopupController.java

Issue 2826303003: Let selection events bypass ContentViewCore (Closed)
Patch Set: comments Created 3 years, 8 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
Index: content/public/android/java/src/org/chromium/content/browser/SelectionPopupController.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/SelectionPopupController.java b/content/public/android/java/src/org/chromium/content/browser/SelectionPopupController.java
index 0012b5b1b0150d4da1713f251df91ffd5c2177a9..03f8421c2dda8466210238188b01d42270cc333f 100644
--- a/content/public/android/java/src/org/chromium/content/browser/SelectionPopupController.java
+++ b/content/public/android/java/src/org/chromium/content/browser/SelectionPopupController.java
@@ -28,6 +28,8 @@ import android.view.WindowManager;
import org.chromium.base.BuildInfo;
import org.chromium.base.Log;
import org.chromium.base.VisibleForTesting;
+import org.chromium.base.annotations.CalledByNative;
+import org.chromium.base.annotations.JNINamespace;
import org.chromium.base.metrics.RecordUserAction;
import org.chromium.content.R;
import org.chromium.content.browser.input.FloatingPastePopupMenu;
@@ -52,6 +54,7 @@ import java.util.List;
* to create {@link ActionMode.Callback} instance and configure the selection action
* mode tasks to their requirements.
*/
+@JNINamespace("content")
@TargetApi(Build.VERSION_CODES.M)
public class SelectionPopupController extends ActionModeCallbackHelper {
private static final String TAG = "SelectionPopupCtlr"; // 20 char limit
@@ -131,6 +134,9 @@ public class SelectionPopupController extends ActionModeCallbackHelper {
// arrives or till the selection is adjusted based on the classification result.
private boolean mPendingShowActionMode;
+ // Whether a scroll is in progress.
+ private boolean mScrollInProgress;
+
/**
* Create {@link SelectionPopupController} instance.
* @param context Context for action mode.
@@ -169,6 +175,8 @@ public class SelectionPopupController extends ActionModeCallbackHelper {
mAssistMenuItemId =
mContext.getResources().getIdentifier("textAssist", "id", "android");
}
+
+ nativeInit(webContents);
}
/**
@@ -360,6 +368,10 @@ public class SelectionPopupController extends ActionModeCallbackHelper {
}
}
+ void setScrollInProgress(boolean inProgress) {
+ mScrollInProgress = inProgress;
+ }
+
/**
* Hide or reveal the ActionMode. Note that this only has visible
* side-effects if the underlying ActionMode supports hiding.
@@ -832,9 +844,9 @@ public class SelectionPopupController extends ActionModeCallbackHelper {
}
// All coordinates are in DIP.
- void onSelectionEvent(int eventType, int xAnchor, int yAnchor,
- int left, int top, int right, int bottom, boolean isScrollInProgress,
- boolean touchScrollInProgress) {
+ @CalledByNative
+ private void onSelectionEvent(
+ int eventType, int xAnchor, int yAnchor, int left, int top, int right, int bottom) {
// Ensure the provided selection coordinates form a non-empty rect, as required by
// the selection action mode.
if (left == right) ++right;
@@ -888,7 +900,7 @@ public class SelectionPopupController extends ActionModeCallbackHelper {
case SelectionEventType.INSERTION_HANDLE_MOVED:
mSelectionRect.set(left, top, right, bottom);
- if (!isScrollInProgress && isPastePopupShowing()) {
+ if (!mScrollInProgress && isPastePopupShowing()) {
showPastePopup(xAnchor, yAnchor);
} else {
destroyPastePopup();
@@ -944,7 +956,8 @@ public class SelectionPopupController extends ActionModeCallbackHelper {
mClassificationResult = null;
}
- void onSelectionChanged(String text) {
+ @CalledByNative
+ private void onSelectionChanged(String text) {
mLastSelectedText = text;
if (mSelectionClient != null) {
mSelectionClient.onSelectionChanged(text);
@@ -1042,4 +1055,6 @@ public class SelectionPopupController extends ActionModeCallbackHelper {
showActionModeOrClearOnFailure();
}
};
+
+ private native void nativeInit(WebContents webContents);
}

Powered by Google App Engine
This is Rietveld 408576698