Index: chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java |
index 211f9f63c8d3c0dc0e2201d943aa8b324380973e..6ee72c4d7ddf173911a4f9a53bb5cd7cdf9612ab 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java |
@@ -510,6 +510,16 @@ public class ContextualSearchManager extends ContextualSearchObservable |
mWereSearchResultsSeen = false; |
+ // Show the Peek Promo only when the Panel wasn't previously visible, provided |
+ // the policy allows it. |
+ if (!mSearchPanelDelegate.isShowing()) { |
+ boolean isPeekPromoAvailable = mPolicy.isPeekPromoAvailable(mSelectionController); |
+ if (isPeekPromoAvailable) { |
+ mSearchPanelDelegate.showPeekPromo(); |
+ mPolicy.registerPeekPromoSeen(); |
+ } |
+ } |
+ |
// TODO(donnd): although we are showing the bar here, we have not yet set the text! |
// Refactor to show the bar and set the text at the same time! |
// TODO(donnd): If there was a previously ongoing contextual search, we should ensure |
@@ -1088,36 +1098,6 @@ public class ContextualSearchManager extends ContextualSearchObservable |
? mSearchPanelDelegate.getContentViewCore().computeVerticalScrollOffset() : -1.f; |
} |
- /** |
- * This is called when the search panel is shown or is hidden. |
- * @param isVisible True if the panel is now visible. |
- */ |
- public void onContentViewVisibilityChanged(boolean isVisible) { |
- if (isVisible) { |
- mWereSearchResultsSeen = true; |
- // If there's no current request, then either a search term resolution |
- // is in progress or we should do a verbatim search now. |
- if (mSearchRequest == null |
- && mPolicy.shouldCreateVerbatimRequest(mSelectionController, |
- mNetworkCommunicator.getBasePageUrl())) { |
- mSearchRequest = new ContextualSearchRequest( |
- mSelectionController.getSelectedText()); |
- mDidStartLoadingResolvedSearchRequest = false; |
- } |
- if ((mSearchRequest != null && !mDidStartLoadingResolvedSearchRequest) |
- || mShouldLoadDelayedSearch) { |
- // mShouldLoadDelayedSearch is used in the long-press 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. |
- mSearchRequest.setNormalPriority(); |
- loadSearchUrl(); |
- } |
- mShouldLoadDelayedSearch = true; |
- mPolicy.updateCountersForOpen(); |
- } |
- } |
- |
@Override |
public void preserveBasePageSelectionOnNextLossOfFocus() { |
ContentViewCore basePageContentView = getBaseContentView(); |