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

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

Issue 2863573004: Explicitly tell Smart Select whether or not to suggest (Closed)
Patch Set: fixing nits 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
Index: content/public/android/java/src/org/chromium/content/browser/ContextSelectionClient.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContextSelectionClient.java b/content/public/android/java/src/org/chromium/content/browser/ContextSelectionClient.java
index c5f75ba685507f6dad0eb0ca605ac54127a873e4..4bc9e92ae083e321f620cba6efb43494d8776ea1 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ContextSelectionClient.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ContextSelectionClient.java
@@ -11,7 +11,6 @@ import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.JNINamespace;
import org.chromium.content_public.browser.WebContents;
import org.chromium.ui.base.WindowAndroid;
-import org.chromium.ui.touch_selection.SelectionEventType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -77,40 +76,19 @@ public class ContextSelectionClient implements SelectionClient {
public void onSelectionChanged(String selection) {}
@Override
- public void onSelectionEvent(int eventType, float posXPix, float posYPix) {
- switch (eventType) {
- case SelectionEventType.SELECTION_HANDLES_SHOWN:
- // This event is sent when the long press is detected which causes
- // selection to appear for the first time. Temporarily hiding the
- // handles that happens e.g. during scroll does not affect this event.
- requestSurroundingText(SUGGEST_AND_CLASSIFY);
- break;
-
- case SelectionEventType.SELECTION_HANDLES_CLEARED:
- // The ActionMode should be stopped when this event comes.
- cancelAllRequests();
- break;
-
- case SelectionEventType.SELECTION_HANDLE_DRAG_STOPPED:
- // This event is sent after a user stopped dragging one of the
- // selection handles, i.e. stopped modifying the selection.
- requestSurroundingText(CLASSIFY);
- break;
-
- default:
- break; // ignore
- }
- }
+ public void onSelectionEvent(int eventType, float posXPix, float posYPix) {}
@Override
public void showUnhandledTapUIIfNeeded(int x, int y) {}
@Override
- public boolean sendsSelectionPopupUpdates() {
+ public boolean requestSelectionPopupUpdates(boolean shouldSuggest) {
+ requestSurroundingText(shouldSuggest ? SUGGEST_AND_CLASSIFY : CLASSIFY);
return true;
}
- private void cancelAllRequests() {
+ @Override
+ public void cancelAllRequests() {
if (mNativeContextSelectionClient != 0) {
nativeCancelAllRequests(mNativeContextSelectionClient);
}

Powered by Google App Engine
This is Rietveld 408576698