Commit da571819 authored by Donn Denman's avatar Donn Denman Committed by Chromium LUCI CQ

[TTS] Fix a bug with literal tap search preloading

Fixes a bug that caused the SERP to show blank. This was actually
due to preloading when that was inappropriate (on a literal tap)
when the user had accepted the opt-in.

This CL fixes the logic to make sure we have a resolving gesture
before we prefetch - server access is gated on the resolve since
it's the primary server request. The Cl with the bug is
https://crrev.com/c/2557337.

BUG=1160041

Change-Id: Ida97ffb037022b039c5d843f770edd2907716836
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2597886
Auto-Submit: Donn Denman <donnd@chromium.org>
Commit-Queue: Theresa  <twellington@chromium.org>
Reviewed-by: default avatarTheresa  <twellington@chromium.org>
Reviewed-by: default avatarSinan Sahin <sinansahin@google.com>
Cr-Commit-Position: refs/heads/master@{#838694}
parent 4d90633c
......@@ -1057,7 +1057,7 @@ public class ContextualSearchManager
}
if (mSearchRequest != null
&& (!mDidStartLoadingResolvedSearchRequest || mShouldLoadDelayedSearch)) {
// mShouldLoadDelayedSearch is used in the long-press case to load content.
// mShouldLoadDelayedSearch is used in the non-preloading case to load content.
// Since content is now created and destroyed for each request, was impossible
// to know if content was already loaded or recently needed to be; this is for
// the case where it needed to be.
......
......@@ -142,10 +142,7 @@ class ContextualSearchPolicy {
// We never preload unless we have sent page context (done through a Resolve request).
// Only some gestures can resolve, and only when resolve privacy rules are met.
return (mSelectionController.getSelectionType() == SelectionType.TAP
|| mSelectionController.getSelectionType()
== SelectionType.RESOLVING_LONG_PRESS)
&& shouldPreviousGestureResolve();
return isResolvingGesture() && shouldPreviousGestureResolve();
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment