Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/RecentScrollTapSuppression.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/RecentScrollTapSuppression.java b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/RecentScrollTapSuppression.java |
| index c82d4086173aa77e1186cd9c74041e2524e32e2f..9a962d4f423b1754040e98ffc7cdcbfd6776c4a2 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/RecentScrollTapSuppression.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/RecentScrollTapSuppression.java |
| @@ -13,9 +13,10 @@ public class RecentScrollTapSuppression extends ContextualSearchHeuristic { |
| // once feature is enabled by default. |
| private static final int DEFAULT_RECENT_SCROLL_SUPPRESSION_DURATION_MS = 300; |
| - private final int mExperiementThresholdMs; |
| + private int mExperimentThresholdMs; |
|
Donn Denman
2016/09/23 20:40:13
Nit: can't this stay final? Maybe the constructor
Theresa
2016/09/23 20:57:30
Done.
|
| private final int mDurationSinceRecentScrollMs; |
| private final boolean mIsConditionSatisfied; |
| + private final boolean mIsEnabled; |
| /** |
| * Constructs a Tap suppression heuristic that handles a Tap after a recent scroll. |
| @@ -32,24 +33,25 @@ public class RecentScrollTapSuppression extends ContextualSearchHeuristic { |
| } else { |
| mDurationSinceRecentScrollMs = 0; |
| } |
| - mExperiementThresholdMs = ContextualSearchFieldTrial.getRecentScrollSuppressionDurationMs(); |
| + |
| + mExperimentThresholdMs = ContextualSearchFieldTrial.getRecentScrollSuppressionDurationMs(); |
| + |
| // If the configured threshold is 0, then suppression is not enabled. |
| - if (mExperiementThresholdMs > 0) { |
| - mIsConditionSatisfied = mDurationSinceRecentScrollMs > 0 |
| - && mDurationSinceRecentScrollMs < mExperiementThresholdMs; |
| - } else { |
| - mIsConditionSatisfied = false; |
| - } |
| + mIsEnabled = mExperimentThresholdMs > 0; |
| + if (!mIsEnabled) mExperimentThresholdMs = DEFAULT_RECENT_SCROLL_SUPPRESSION_DURATION_MS; |
| + |
| + mIsConditionSatisfied = mDurationSinceRecentScrollMs > 0 |
| + && mDurationSinceRecentScrollMs < mExperimentThresholdMs; |
| } |
| @Override |
| protected boolean isConditionSatisfied() { |
| - return mIsConditionSatisfied; |
| + return mIsEnabled && mIsConditionSatisfied; |
| } |
| @Override |
| protected void logConditionState() { |
| - if (mExperiementThresholdMs > 0) { |
| + if (mIsEnabled) { |
| ContextualSearchUma.logRecentScrollSuppression(mIsConditionSatisfied); |
| } |
| } |
| @@ -65,7 +67,6 @@ public class RecentScrollTapSuppression extends ContextualSearchHeuristic { |
| @Override |
| protected boolean isConditionSatisfiedForAggregateLogging() { |
| - return mDurationSinceRecentScrollMs > 0 |
| - && mDurationSinceRecentScrollMs < DEFAULT_RECENT_SCROLL_SUPPRESSION_DURATION_MS; |
| + return !mIsEnabled && mIsConditionSatisfied; |
| } |
| } |