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 6234318ec73fae0d255163bce462adb6a5ece342..6dbe3e6afd0db9fb61b7945c1322e73a8d283441 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 |
@@ -67,6 +67,7 @@ public class ContextualSearchSelectionController { |
private boolean mWasTapGestureDetected; |
// Reflects whether the last tap was valid and whether we still have a tap-based selection. |
private ContextualSearchTapState mLastTapState; |
+ private TapSuppressionHeuristics mTapHeuristics; |
private boolean mIsWaitingForInvalidTapDetection; |
private boolean mIsSelectionEstablished; |
private boolean mShouldHandleSelectionModification; |
@@ -372,16 +373,17 @@ public class ContextualSearchSelectionController { |
ChromePreferenceManager prefs = ChromePreferenceManager.getInstance(mActivity); |
int adjustedTapsSinceOpen = prefs.getContextualSearchTapCount() |
- prefs.getContextualSearchTapQuickAnswerCount(); |
- TapSuppressionHeuristics tapHeuristics = |
+ if (mTapHeuristics != null) mTapHeuristics.destroy(); |
+ mTapHeuristics = |
new TapSuppressionHeuristics(this, mLastTapState, x, y, adjustedTapsSinceOpen); |
// TODO(donnd): Move to be called when the panel closes to work with states that change. |
- tapHeuristics.logConditionState(); |
+ mTapHeuristics.logConditionState(); |
// Tell the manager what it needs in order to log metrics on whether the tap would have |
// been suppressed if each of the heuristics were satisfied. |
- mHandler.handleMetricsForWouldSuppressTap(tapHeuristics); |
+ mHandler.handleMetricsForWouldSuppressTap(mTapHeuristics); |
mX = x; |
mY = y; |
- boolean shouldSuppressTap = tapHeuristics.shouldSuppressTap(); |
+ boolean shouldSuppressTap = mTapHeuristics.shouldSuppressTap(); |
if (shouldSuppressTap) { |
mHandler.handleSuppressedTap(); |
} else { |