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 977f0b1eb078d5938f35efef180e43f96103bc01..6a496268783df05beec46eda3a2831f0417cebed 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,8 +54,6 @@ public class ContextualSearchSelectionController { |
// Max selection length must be limited or the entire request URL can go past the 2K limit. |
private static final int MAX_SELECTION_LENGTH = 100; |
- private static final int MILLISECONDS_TO_NANOSECONDS = 1000000; |
- |
private final ChromeActivity mActivity; |
private final ContextualSearchSelectionHandler mHandler; |
private final Runnable mHandleInvalidTapRunnable; |
@@ -350,8 +348,9 @@ public class ContextualSearchSelectionController { |
// TODO(donnd): refactor to avoid needing a new handler API method as suggested by Pedro. |
if (mSelectionType != SelectionType.LONG_PRESS) { |
mWasTapGestureDetected = true; |
+ long tapTimeNanoseconds = System.nanoTime(); |
TapSuppressionHeuristics tapHeuristics = |
- new TapSuppressionHeuristics(this, mLastTapState, x, y); |
+ new TapSuppressionHeuristics(mActivity, this, mLastTapState, x, y); |
pedro (no code reviews)
2016/06/27 22:14:29
We were trying to not expose the Activity and not
Donn Denman
2016/06/28 23:39:08
Passed in tap count instead of the Activity.
|
// TODO(donnd): Move to be called when the panel closes to work with states that change. |
tapHeuristics.logConditionState(); |
// Tell the manager what it needs in order to log metrics on whether the tap would have |
@@ -360,8 +359,6 @@ public class ContextualSearchSelectionController { |
mX = x; |
mY = y; |
boolean shouldSuppressTap = tapHeuristics.shouldSuppressTap(); |
- // Remember the tap state for subsequent tap evaluation. |
- mLastTapState = new ContextualSearchTapState(x, y, shouldSuppressTap); |
if (shouldSuppressTap) { |
mHandler.handleSuppressedTap(); |
} else { |
@@ -375,7 +372,11 @@ public class ContextualSearchSelectionController { |
} |
}, TAP_NAVIGATION_DETECTION_DELAY); |
} |
+ // Remember the tap state for subsequent tap evaluation. |
+ mLastTapState = |
+ new ContextualSearchTapState(x, y, tapTimeNanoseconds, shouldSuppressTap); |
} else { |
+ // Long press; reset last tap state. |
mLastTapState = null; |
mHandler.handleInvalidTap(); |
} |