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

Side by Side Diff: content/public/android/java/src/org/chromium/content/browser/SelectionPopupController.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 unified diff | Download patch
« no previous file with comments | « content/public/android/java/src/org/chromium/content/browser/SelectionClient.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.content.browser; 5 package org.chromium.content.browser;
6 6
7 import android.annotation.TargetApi; 7 import android.annotation.TargetApi;
8 import android.app.Activity; 8 import android.app.Activity;
9 import android.app.SearchManager; 9 import android.app.SearchManager;
10 import android.content.ClipData; 10 import android.content.ClipData;
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 int eventType, int xAnchor, int yAnchor, int left, int top, int righ t, int bottom) { 920 int eventType, int xAnchor, int yAnchor, int left, int top, int righ t, int bottom) {
921 // Ensure the provided selection coordinates form a non-empty rect, as r equired by 921 // Ensure the provided selection coordinates form a non-empty rect, as r equired by
922 // the selection action mode. 922 // the selection action mode.
923 if (left == right) ++right; 923 if (left == right) ++right;
924 if (top == bottom) ++bottom; 924 if (top == bottom) ++bottom;
925 switch (eventType) { 925 switch (eventType) {
926 case SelectionEventType.SELECTION_HANDLES_SHOWN: 926 case SelectionEventType.SELECTION_HANDLES_SHOWN:
927 mSelectionRect.set(left, top, right, bottom); 927 mSelectionRect.set(left, top, right, bottom);
928 mHasSelection = true; 928 mHasSelection = true;
929 mUnselectAllOnDismiss = true; 929 mUnselectAllOnDismiss = true;
930 if (mSelectionClient == null || !mSelectionClient.sendsSelection PopupUpdates()) { 930 if (mSelectionClient != null
931 showActionModeOrClearOnFailure(); 931 && mSelectionClient.requestSelectionPopupUpdates(true /* suggest */)) {
932 } else {
933 // Rely on |mSelectionClient| sending a classification reque st and the request 932 // Rely on |mSelectionClient| sending a classification reque st and the request
934 // always calling onClassified() callback. 933 // always calling onClassified() callback.
935 mPendingShowActionMode = true; 934 mPendingShowActionMode = true;
935 } else {
936 showActionModeOrClearOnFailure();
936 } 937 }
937 break; 938 break;
938 939
939 case SelectionEventType.SELECTION_HANDLES_MOVED: 940 case SelectionEventType.SELECTION_HANDLES_MOVED:
940 mSelectionRect.set(left, top, right, bottom); 941 mSelectionRect.set(left, top, right, bottom);
941 if (mPendingShowActionMode) { 942 if (mPendingShowActionMode) {
942 showActionModeOrClearOnFailure(); 943 showActionModeOrClearOnFailure();
943 } else { 944 } else {
944 invalidateContentRect(); 945 invalidateContentRect();
945 } 946 }
946 break; 947 break;
947 948
948 case SelectionEventType.SELECTION_HANDLES_CLEARED: 949 case SelectionEventType.SELECTION_HANDLES_CLEARED:
949 mHasSelection = false; 950 mHasSelection = false;
950 mUnselectAllOnDismiss = false; 951 mUnselectAllOnDismiss = false;
951 mSelectionRect.setEmpty(); 952 mSelectionRect.setEmpty();
953 if (mSelectionClient != null) mSelectionClient.cancelAllRequests ();
952 finishActionMode(); 954 finishActionMode();
953 break; 955 break;
954 956
955 case SelectionEventType.SELECTION_HANDLE_DRAG_STARTED: 957 case SelectionEventType.SELECTION_HANDLE_DRAG_STARTED:
956 hideActionMode(true); 958 hideActionMode(true);
957 break; 959 break;
958 960
959 case SelectionEventType.SELECTION_HANDLE_DRAG_STOPPED: 961 case SelectionEventType.SELECTION_HANDLE_DRAG_STOPPED:
960 if (mSelectionClient == null || !mSelectionClient.sendsSelection PopupUpdates()) { 962 if (mSelectionClient != null
963 && mSelectionClient.requestSelectionPopupUpdates(false / * suggest */)) {
964 // Rely on |mSelectionClient| sending a classification reque st and the request
965 // always calling onClassified() callback.
966 } else {
961 hideActionMode(false); 967 hideActionMode(false);
962 } 968 }
963 // Otherwise rely on |mSelectionClient| sending a classification request and the
964 // request always calling onClassified() callback.
965 break; 969 break;
966 970
967 case SelectionEventType.INSERTION_HANDLE_SHOWN: 971 case SelectionEventType.INSERTION_HANDLE_SHOWN:
968 mSelectionRect.set(left, top, right, bottom); 972 mSelectionRect.set(left, top, right, bottom);
969 mIsInsertion = true; 973 mIsInsertion = true;
970 break; 974 break;
971 975
972 case SelectionEventType.INSERTION_HANDLE_MOVED: 976 case SelectionEventType.INSERTION_HANDLE_MOVED:
973 mSelectionRect.set(left, top, right, bottom); 977 mSelectionRect.set(left, top, right, bottom);
974 if (!mScrollInProgress && isPastePopupShowing()) { 978 if (!mScrollInProgress && isPastePopupShowing()) {
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 if (mPendingShowActionMode) return; 1138 if (mPendingShowActionMode) return;
1135 } 1139 }
1136 1140
1137 // Rely on this method to clear |mHidden| and unhide the action mode . 1141 // Rely on this method to clear |mHidden| and unhide the action mode .
1138 showActionModeOrClearOnFailure(); 1142 showActionModeOrClearOnFailure();
1139 } 1143 }
1140 }; 1144 };
1141 1145
1142 private native void nativeInit(WebContents webContents); 1146 private native void nativeInit(WebContents webContents);
1143 } 1147 }
OLDNEW
« no previous file with comments | « content/public/android/java/src/org/chromium/content/browser/SelectionClient.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698