Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1390)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanel.java

Issue 997733002: [Contextual Search] Prevents promo from being displayed incorrectly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing Donn's comment Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanel.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanel.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanel.java
index 188e231fccd98b23cd1ad4a1907e3f8765243d1a..c5660e5afae7dc65521805b2e644d9ba35e8e543 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanel.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanel.java
@@ -213,7 +213,19 @@ public class ContextualSearchPanel extends ContextualSearchPanelAnimation
if (mManagementDelegate.isRunningInCompatibilityMode()) {
mManagementDelegate.openResolvedSearchUrlInNewTab();
} else {
- expandPanel(StateChangeReason.SEARCH_BAR_TAP);
+ // NOTE(pedrosimonetti): If the promo is active and getPromoContentHeight()
+ // returns -1 that means that the promo page hasn't finished loading, and
+ // therefore it wasn't possible to calculate the height of the promo contents.
+ // This will only happen if the user taps on a word that will trigger the
+ // promo, and then quickly taps on the peeking bar, before the promo page
+ // (which is local) finishes loading.
+ //
+ // TODO(pedrosimonetti): For now, we're simply ignoring the tap action in
+ // that case. Consider implementing a better approach, where the Panel
+ // would auto-expand once the height is calculated.
+ if (!getIsPromoActive() || getPromoContentHeight() != -1) {
+ expandPanel(StateChangeReason.SEARCH_BAR_TAP);
+ }
}
} else if (isExpanded()) {
peekPanel(StateChangeReason.SEARCH_BAR_TAP);
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698