| 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 8d42cff512f0fa2f16218f0c207acba94b3d03c7..da8d2399d7d2707e4ab0a387753b039587948a9e 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
|
| @@ -9,8 +9,9 @@ import android.graphics.Rect;
|
| import android.view.View;
|
|
|
| import org.chromium.chrome.browser.compositor.LayerTitleCache;
|
| +import org.chromium.chrome.browser.compositor.bottombar.OverlayPanel;
|
| import org.chromium.chrome.browser.compositor.bottombar.OverlayPanel.StateChangeReason;
|
| -import org.chromium.chrome.browser.compositor.bottombar.contextualsearch.ContextualSearchPanel;
|
| +import org.chromium.chrome.browser.compositor.bottombar.OverlayPanelManager;
|
| import org.chromium.chrome.browser.compositor.layouts.ContextualSearchSupportedLayout;
|
| import org.chromium.chrome.browser.compositor.layouts.Layout;
|
| import org.chromium.chrome.browser.compositor.layouts.LayoutRenderHost;
|
| @@ -49,19 +50,18 @@ public class ContextualSearchLayout extends ContextualSearchSupportedLayout {
|
| * @param updateHost The {@link LayoutUpdateHost} view for this layout.
|
| * @param renderHost The {@link LayoutRenderHost} view for this layout.
|
| * @param eventFilter The {@link EventFilter} that is needed for this view.
|
| + * @param panelManager The {@link OverlayPanelManager} for getting the active panel.
|
| */
|
| public ContextualSearchLayout(Context context, LayoutUpdateHost updateHost,
|
| - LayoutRenderHost renderHost, EventFilter eventFilter, ContextualSearchPanel panel) {
|
| - super(context, updateHost, renderHost, eventFilter, panel);
|
| + LayoutRenderHost renderHost, EventFilter eventFilter,
|
| + OverlayPanelManager panelManager) {
|
| + super(context, updateHost, renderHost, eventFilter, panelManager);
|
| mTabListSceneLayer = new TabListSceneLayer();
|
| - // TODO(changwan): use SceneOverlayTree's setContentTree() instead once we refactor
|
| - // ContextualSearchSupportedLayout into LayoutHelper.
|
| - mTabListSceneLayer.setContentTree(super.getSceneLayer());
|
| }
|
|
|
| @Override
|
| public View getViewForInteraction() {
|
| - ContentViewCore content = mSearchPanel.getContentViewCore();
|
| + ContentViewCore content = mPanelManager.getActivePanel().getContentViewCore();
|
| if (content != null) return content.getContainerView();
|
| return super.getViewForInteraction();
|
| }
|
| @@ -73,7 +73,7 @@ public class ContextualSearchLayout extends ContextualSearchSupportedLayout {
|
|
|
| @Override
|
| public float getTopControlsOffset(float currentOffsetDp) {
|
| - return MathUtils.clamp(mBaseTab.getY(), -mSearchPanel.getToolbarHeight(),
|
| + return MathUtils.clamp(mBaseTab.getY(), -mPanelManager.getActivePanel().getToolbarHeight(),
|
| Math.min(currentOffsetDp, 0f));
|
| }
|
|
|
| @@ -82,8 +82,11 @@ public class ContextualSearchLayout extends ContextualSearchSupportedLayout {
|
| super.updateLayout(time, dt);
|
| if (mBaseTab == null) return;
|
|
|
| - mBaseTab.setY(mSearchPanel.getBasePageY());
|
| - mBaseTab.setBrightness(mSearchPanel.getBasePageBrightness());
|
| + OverlayPanel panel = mPanelManager.getActivePanel();
|
| + if (panel != null) {
|
| + mBaseTab.setY(panel.getBasePageY());
|
| + mBaseTab.setBrightness(panel.getBasePageBrightness());
|
| + }
|
|
|
| boolean needUpdate = mBaseTab.updateSnap(dt);
|
| if (needUpdate) requestUpdate();
|
| @@ -99,13 +102,16 @@ public class ContextualSearchLayout extends ContextualSearchSupportedLayout {
|
| // if the SearchContentView's vertical scroll position is zero. Otherwise the
|
| // ContentView will appear to jump in the screen. Coordinate with @dtrainor to solve
|
| // this problem.
|
| - mSearchPanel.updateTopControlsState(TopControlsState.BOTH, false);
|
| + mPanelManager.getActivePanel().updateTopControlsState(TopControlsState.BOTH, false);
|
| return true;
|
| }
|
|
|
| @Override
|
| public void show(long time, boolean animate) {
|
| + // TODO(changwan): use SceneOverlayTree's setContentTree() instead once we refactor
|
| + // ContextualSearchSupportedLayout into LayoutHelper.
|
| mTabListSceneLayer.setContentTree(super.getSceneLayer());
|
| +
|
| super.show(time, animate);
|
|
|
| resetLayout();
|
| @@ -161,29 +167,29 @@ public class ContextualSearchLayout extends ContextualSearchSupportedLayout {
|
| @Override
|
| public void onDown(long time, float x, float y) {
|
| mInitialPanelTouchY = y;
|
| - mSearchPanel.handleSwipeStart();
|
| + mPanelManager.getActivePanel().handleSwipeStart();
|
| }
|
|
|
| @Override
|
| public void drag(long time, float x, float y, float deltaX, float deltaY) {
|
| final float ty = y - mInitialPanelTouchY;
|
|
|
| - mSearchPanel.handleSwipeMove(ty);
|
| + mPanelManager.getActivePanel().handleSwipeMove(ty);
|
| }
|
|
|
| @Override
|
| public void onUpOrCancel(long time) {
|
| - mSearchPanel.handleSwipeEnd();
|
| + mPanelManager.getActivePanel().handleSwipeEnd();
|
| }
|
|
|
| @Override
|
| public void fling(long time, float x, float y, float velocityX, float velocityY) {
|
| - mSearchPanel.handleFling(velocityY);
|
| + mPanelManager.getActivePanel().handleFling(velocityY);
|
| }
|
|
|
| @Override
|
| public void click(long time, float x, float y) {
|
| - mSearchPanel.handleClick(time, x, y);
|
| + mPanelManager.getActivePanel().handleClick(time, x, y);
|
| }
|
|
|
| // ============================================================================================
|
| @@ -192,23 +198,23 @@ public class ContextualSearchLayout extends ContextualSearchSupportedLayout {
|
|
|
| @Override
|
| public void swipeStarted(long time, ScrollDirection direction, float x, float y) {
|
| - mSearchPanel.handleSwipeStart();
|
| + mPanelManager.getActivePanel().handleSwipeStart();
|
| }
|
|
|
| @Override
|
| public void swipeUpdated(long time, float x, float y, float dx, float dy, float tx, float ty) {
|
| - mSearchPanel.handleSwipeMove(ty);
|
| + mPanelManager.getActivePanel().handleSwipeMove(ty);
|
| }
|
|
|
| @Override
|
| public void swipeFlingOccurred(
|
| long time, float x, float y, float tx, float ty, float vx, float vy) {
|
| - mSearchPanel.handleFling(vy);
|
| + mPanelManager.getActivePanel().handleFling(vy);
|
| }
|
|
|
| @Override
|
| public void swipeFinished(long time) {
|
| - mSearchPanel.handleSwipeEnd();
|
| + mPanelManager.getActivePanel().handleSwipeEnd();
|
| }
|
|
|
| @Override
|
| @@ -218,7 +224,7 @@ public class ContextualSearchLayout extends ContextualSearchSupportedLayout {
|
|
|
| @Override
|
| public boolean onBackPressed() {
|
| - mSearchPanel.closePanel(StateChangeReason.BACK_PRESS, true);
|
| + mPanelManager.getActivePanel().closePanel(StateChangeReason.BACK_PRESS, true);
|
| return true;
|
| }
|
|
|
| @@ -245,7 +251,7 @@ public class ContextualSearchLayout extends ContextualSearchSupportedLayout {
|
|
|
| @Override
|
| public float getToolbarBrightness() {
|
| - return mSearchPanel.getBasePageBrightness();
|
| + return mPanelManager.getActivePanel().getBasePageBrightness();
|
| }
|
|
|
| @Override
|
|
|