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

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

Issue 2963013002: [TTS] Fix for tap on a previous tap-selection. (Closed)
Patch Set: Updated the CSInternalStateTest. Created 3 years, 6 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/ContextualSearchManager.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java
index 53e907b32a93b9b1cdedf5326a7981434555abe1..16056d5b76718cca8cadbdd86ca436d6f3d895b0 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java
@@ -94,6 +94,10 @@ public class ContextualSearchManager implements ContextualSearchManagementDelega
// timer).
private static final int TAP_NEAR_PREVIOUS_DETECTION_DELAY_MS = 100;
+ // How long to wait for a Tap to be converted to a Long-press gesture when the user taps on
+ // an existing tap-selection.
+ private static final int TAP_ON_TAP_SELECTION_DELAY_MS = 100;
+
private static final int NANOSECONDS_IN_A_MILLISECOND = 1000000;
private final ObserverList<ContextualSearchObserver> mObservers =
@@ -1519,6 +1523,26 @@ public class ContextualSearchManager implements ContextualSearchManagementDelega
}, TAP_NEAR_PREVIOUS_DETECTION_DELAY_MS);
}
+ /**
+ * Waits for possible Tap gesture that's on a previously established tap-selection.
+ * If the current Tap was on the previous tap-selection then this selection will become
+ * a Long-press selection and we'll recognize that gesture and start processing it.
+ * If that doesn't happen within our time window (which is the common case) then we'll
+ * advance to the next state in normal Tap processing.
+ */
+ @Override
+ public void waitForPossibleTapOnTapSelection() {
+ mInternalStateController.notifyStartingWorkOn(
+ InternalState.WAITING_FOR_POSSIBLE_TAP_ON_TAP_SELECTION);
+ new Handler().postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ mInternalStateController.notifyFinishedWorkOn(
+ InternalState.WAITING_FOR_POSSIBLE_TAP_ON_TAP_SELECTION);
+ }
+ }, TAP_ON_TAP_SELECTION_DELAY_MS);
+ }
+
/** Starts a Resolve request to our server for the best Search Term. */
@Override
public void resolveSearchTerm() {

Powered by Google App Engine
This is Rietveld 408576698