Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchPolicy.java | 
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchPolicy.java b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchPolicy.java | 
| index a7ce11542692e550a7e39646fc6a46167418ee7a..b1d8623cee1751df8dd856d1bedec9c96226c25f 100644 | 
| --- a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchPolicy.java | 
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchPolicy.java | 
| @@ -26,6 +26,7 @@ import javax.annotation.Nullable; | 
| class ContextualSearchPolicy { | 
| private static final Pattern CONTAINS_WHITESPACE_PATTERN = Pattern.compile("\\s"); | 
| private static final int REMAINING_NOT_APPLICABLE = -1; | 
| + private static final int ONE_DAY_IN_MILLIS = 24 * 60 * 60 * 1000; | 
| private static ContextualSearchPolicy sInstance; | 
| @@ -304,6 +305,36 @@ class ContextualSearchPolicy { | 
| return !isUserUndecided(); | 
| } | 
| + /** | 
| + * The search provider icon is animated every time on long press if the user has never opened | 
| + * the panel before and once a day on tap. | 
| + * | 
| + * @param selectionType The type of selection made by the user. | 
| + * @param isShowing Whether the panel is showing. | 
| + * @return Whether the search provider icon should be animated. | 
| + */ | 
| + boolean shouldAnimateSearchProviderIcon(SelectionType selectionType, boolean isShowing) { | 
| + if (isShowing) { | 
| + return false; | 
| + } | 
| + | 
| + if (selectionType == SelectionType.TAP) { | 
| + long currentTimeMillis = System.currentTimeMillis(); | 
| + long lastAnimatedTimeMillis = | 
| + mPreferenceManager.getContextualSearchLastAnimationTime(); | 
| + if (Math.abs(currentTimeMillis - lastAnimatedTimeMillis) > ONE_DAY_IN_MILLIS) { | 
| + mPreferenceManager.setContextualSearchLastAnimationTime(currentTimeMillis); | 
| + return true; | 
| + } else { | 
| + return false; | 
| + } | 
| + } else if (selectionType == SelectionType.LONG_PRESS) { | 
| + return DisableablePromoTapCounter.getInstance(mPreferenceManager).isEnabled(); | 
| 
 
pedro (no code reviews)
2015/10/27 20:32:00
As we've discussed offline, this counter is for ta
 
Theresa
2015/10/28 02:01:53
Done.
 
 | 
| + } | 
| + | 
| + return false; | 
| + } | 
| + | 
| // -------------------------------------------------------------------------------------------- | 
| // Testing support. | 
| // -------------------------------------------------------------------------------------------- |