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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/phone/ContextualSearchLayout.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/layouts/phone/ContextualSearchLayout.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/phone/ContextualSearchLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/phone/ContextualSearchLayout.java
index 1484d5c2ffeb062fd8e9880a0113a9d3fd57b3ba..da3742d08f0f94ff80632d7ca4eb8d28b8f20395 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/phone/ContextualSearchLayout.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/phone/ContextualSearchLayout.java
@@ -5,6 +5,7 @@
package org.chromium.chrome.browser.compositor.layouts.phone;
import android.content.Context;
+import android.graphics.Color;
import android.graphics.Rect;
import android.view.View;
@@ -56,13 +57,46 @@ public class ContextualSearchLayout extends ContextualSearchSupportedLayout {
LayoutRenderHost renderHost, EventFilter eventFilter,
OverlayPanelManager panelManager) {
super(context, updateHost, renderHost, eventFilter, panelManager);
- mTabListSceneLayer = new TabListSceneLayer();
+ mTabListSceneLayer = new TabListSceneLayer() {
+ @Override
+ protected int getTabListBackgroundColor(Context context) {
+ OverlayPanel panel = mPanelManager.getActivePanel();
+ // If the panel is null (which in theory should never happen in this case since
+ // this layout is only present when the Panel is open), we will assume the
+ // background color to be white (assuming most pages have a white background).
+ if (panel == null) {
+ return Color.WHITE;
+ } else {
+ return panel.getBasePageBackgroundColor();
+ }
+ }
+ };
+ }
+
+ /**
+ * Handles the resizing of the viewport.
+ * @param width The new width in dp.
+ * @param height The new height in dp.
+ */
+ protected void onSizeChanged(float width, float height) {
+ if (mBaseTab != null) {
+ OverlayPanel panel = mPanelManager.getActivePanel();
+ if (panel != null) {
+ mBaseTab.setMaxContentWidth(width);
+ mBaseTab.setMaxContentHeight(panel.getMaximumHeight());
+ mBaseTab.setContentSize(width, panel.getMaximumHeight());
+ }
+ }
}
@Override
public View getViewForInteraction() {
- ContentViewCore content = mPanelManager.getActivePanel().getContentViewCore();
- if (content != null) return content.getContainerView();
+ OverlayPanel panel = mPanelManager.getActivePanel();
+ if (panel != null) {
+ ContentViewCore content = panel.getContentViewCore();
+ if (content != null) return content.getContainerView();
+ }
+
return super.getViewForInteraction();
}

Powered by Google App Engine
This is Rietveld 408576698