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

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

Issue 1536623003: [Contextual Search] Keep Panel upon orientation change. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing Changwan's comments Created 5 years 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/ContextualSearchPanelBase.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java
index 03a7a5a4975a01a3f23324fab7046b426acde8f3..a0aeebf61632f3d35a648d454229d62d86106a33 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java
@@ -5,6 +5,7 @@
package org.chromium.chrome.browser.compositor.bottombar.contextualsearch;
import android.content.Context;
+import android.graphics.Color;
import android.os.Handler;
import android.view.LayoutInflater;
import android.view.View;
@@ -312,6 +313,13 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
}
/**
+ * @return Whether the narrow version of the Panel is supported, in any orientation.
+ */
+ protected boolean isNarrowSizePanelSupported() {
+ return !isFullscreenSizePanel() || getFullscreenHeight() > SMALL_PANEL_WIDTH_THRESHOLD_DP;
+ }
+
+ /**
* @return The current width of the Contextual Search Panel.
*/
protected float calculateSearchPanelWidth() {
@@ -380,6 +388,13 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
}
/**
+ * @return The maximum height of the Contextual Search Panel in dps.
+ */
+ public float getMaximumHeight() {
+ return mMaximumHeight;
+ }
+
+ /**
* @return The maximum width of the Contextual Search Panel in pixels.
*/
public int getMaximumWidthPx() {
@@ -637,6 +652,18 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
return mBasePageBrightness;
}
+ /**
+ * @return The color to fill the base page when viewport is resized/changes orientation.
+ */
+ public int getBasePageBackgroundColor() {
+ // TODO(pedrosimonetti): Get the color from the CVC and apply a proper brightness transform.
+ // NOTE(pedrosimonetti): Assumes the background color of the base page to be white (255)
+ // and applies a simple brightness transformation based on the base page value.
+ int value = Math.round(255 * mBasePageBrightness);
+ value = MathUtils.clamp(value, 0, 255);
+ return Color.rgb(value, value, value);
+ }
+
// --------------------------------------------------------------------------------------------
// Progress Bar states
// --------------------------------------------------------------------------------------------

Powered by Google App Engine
This is Rietveld 408576698