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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchSelectionController.java

Issue 1239583003: Update touch selection notification names, add ESTABLISHED. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed boolean member to track SELECTION_ESTABLISHED instead of DISSOLVED. Created 5 years, 5 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: chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchSelectionController.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchSelectionController.java b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchSelectionController.java
index 176227acfa148a17b9dd473d5a8373e3d87ef43d..b43cd80e98288fe2fbfafbb75f0f26156ef19ef6 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchSelectionController.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchSelectionController.java
@@ -54,6 +54,7 @@ public class ContextualSearchSelectionController {
private boolean mIsSelectionBeingModified;
private boolean mWasLastTapValid;
private boolean mIsWaitingForInvalidTapDetection;
+ private boolean mIsSelectionEstablished;
private boolean mShouldHandleSelectionModification;
private boolean mDidExpandSelection;
@@ -188,22 +189,28 @@ public class ContextualSearchSelectionController {
void handleSelectionEvent(int eventType, float posXPix, float posYPix) {
boolean shouldHandleSelection = false;
switch (eventType) {
- case SelectionEventType.SELECTION_SHOWN:
+ case SelectionEventType.SELECTION_HANDLES_SHOWN:
mWasTapGestureDetected = false;
mSelectionType = SelectionType.LONG_PRESS;
shouldHandleSelection = true;
break;
- case SelectionEventType.SELECTION_CLEARED:
+ case SelectionEventType.SELECTION_HANDLES_CLEARED:
mHandler.handleSelectionDismissal();
resetAllStates();
break;
- case SelectionEventType.SELECTION_DRAG_STARTED:
+ case SelectionEventType.SELECTION_HANDLE_DRAG_STARTED:
mIsSelectionBeingModified = true;
break;
- case SelectionEventType.SELECTION_DRAG_STOPPED:
+ case SelectionEventType.SELECTION_HANDLE_DRAG_STOPPED:
mIsSelectionBeingModified = false;
shouldHandleSelection = mShouldHandleSelectionModification;
break;
+ case SelectionEventType.SELECTION_ESTABLISHED:
+ mIsSelectionEstablished = true;
+ break;
+ case SelectionEventType.SELECTION_DISSOLVED:
+ mIsSelectionEstablished = false;
+ break;
default:
}
@@ -232,7 +239,6 @@ public class ContextualSearchSelectionController {
mHandler.handleSelection(selection, isValidSelection(selection), type, mX, mY);
}
-
/**
* Resets all internal state of this class, including the tap state.
*/
@@ -363,6 +369,14 @@ public class ContextualSearchSelectionController {
return mIsWaitingForInvalidTapDetection;
}
+ /**
+ * @return whether the selection has been dissolved, for testing.
+ */
+ @VisibleForTesting
+ boolean isSelectionDissolved() {
jdduke (slow) 2015/07/16 23:15:50 Super nit: Let's keep the getter name similar to
Donn Denman 2015/07/16 23:24:51 Done.
+ return !mIsSelectionEstablished;
+ }
+
/** Determines if the given selection is valid or not.
* @param selection The selection portion of the context.
* @return whether the given selection is considered a valid target for a search.

Powered by Google App Engine
This is Rietveld 408576698