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 c767ef34f3da6094670dce091260568e00f97027..04e94252ea7f5a05d479aa8c2b928627222008de 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 | 
| @@ -259,6 +259,7 @@ class ContextualSearchPolicy { | 
| // Always completely reset the tap counter, since it just counts taps | 
| // since the last open. | 
| mPreferenceManager.setContextualSearchTapCount(0); | 
| + mPreferenceManager.setContextualSearchTapQuickAnswerCount(0); | 
| // Disable the "promo tap" counter, but only if we're using the Opt-out onboarding. | 
| // For Opt-in, we never disable the promo tap counter. | 
| @@ -273,6 +274,20 @@ class ContextualSearchPolicy { | 
| } | 
| /** | 
| + * Updates Tap counters to account for a quick-answer caption shown on the panel. | 
| + * @param wasActivatedByTap Whether the triggering gesture was a Tap or not. | 
| + * @param doesAnswer Whether the caption is considered an answer rather than just | 
| + * informative. | 
| + */ | 
| + void updateCountersForQuickAnswer(boolean wasActivatedByTap, boolean doesAnswer) { | 
| + if (wasActivatedByTap && doesAnswer) { | 
| + int tapsWithAnswerSinceOpen = | 
| + mPreferenceManager.getContextualSearchTapQuickAnswerCount(); | 
| + mPreferenceManager.setContextualSearchTapQuickAnswerCount(++tapsWithAnswerSinceOpen); | 
| + } | 
| + } | 
| + | 
| + /** | 
| * @return Whether a verbatim request should be made for the given base page, assuming there | 
| * is no exiting request. | 
| */ | 
| @@ -527,7 +542,8 @@ class ContextualSearchPolicy { | 
| * @return Whether the tap resolve/prefetch limit has been exceeded. | 
| */ | 
| private boolean isTapBeyondTheLimit() { | 
| - return getTapCount() > getTapLimit(); | 
| + return getTapCount() - mPreferenceManager.getContextualSearchTapQuickAnswerCount() | 
| 
 
twellington
2016/06/27 18:46:40
Do we need to do something like this in the other
 
Donn Denman
2016/06/27 20:43:00
Yes, thanks for reminding me.  We can land this an
 
pedro (no code reviews)
2016/06/27 21:11:10
Put an explanation here to clarify why we are subt
 
 | 
| + > getTapLimit(); | 
| } | 
| /** |