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

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

Issue 1123313006: Revert of [Contextual Search] Remove opt-in code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
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 eab9307b34348b61f74e87c51a8f155cf08a41cb..d6b0b12befc22e3975648a3aea09878b798a3107 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
@@ -23,6 +23,7 @@
UNDEFINED,
CLOSED,
PEEKED,
+ PROMO,
EXPANDED,
MAXIMIZED;
}
@@ -145,7 +146,7 @@
}
@Override
- protected boolean isPromoAvailable() {
+ protected boolean isPanelPromoAvailable() {
return mManagementDelegate != null && mManagementDelegate.isOptOutPromoAvailable();
}
@@ -153,7 +154,6 @@
public void onPromoButtonClick(boolean accepted) {
super.onPromoButtonClick(accepted);
mManagementDelegate.logPromoOutcome();
- setIsPromoActive(false);
}
@Override
@@ -236,7 +236,19 @@
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);
@@ -383,6 +395,24 @@
public void updateBasePageSelectionYPx(float y) {
// NOTE(pedrosimonetti): exposing superclass method to the interface.
super.updateBasePageSelectionYPx(y);
+ }
+
+ @Override
+ public void setPromoContentHeight(float height) {
+ // NOTE(pedrosimonetti): exposing superclass method to the interface.
+ super.setPromoContentHeight(height);
+ }
+
+ @Override
+ public void setShouldHidePromoHeader(boolean shouldHidePromoHeader) {
+ // NOTE(pedrosimonetti): exposing superclass method to the interface.
+ super.setShouldHidePromoHeader(shouldHidePromoHeader);
+ }
+
+ @Override
+ public void animateAfterFirstRunSuccess() {
+ // NOTE(pedrosimonetti): exposing superclass method to the interface.
+ super.animateAfterFirstRunSuccess();
}
@Override

Powered by Google App Engine
This is Rietveld 408576698