| Index: chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerDocument.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerDocument.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerDocument.java
|
| index 3cc891bd43b60a61d2f64be3a4a3ce8cc6c0e38f..b3ed7ec25fef4e5f9cec5ea6bef304d0577fb49a 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerDocument.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerDocument.java
|
| @@ -14,6 +14,7 @@ import android.view.ViewGroup;
|
|
|
| import org.chromium.chrome.browser.ChromeApplication;
|
| import org.chromium.chrome.browser.UrlConstants;
|
| +import org.chromium.chrome.browser.compositor.bottombar.OverlayPanel;
|
| import org.chromium.chrome.browser.compositor.bottombar.OverlayPanelContentViewDelegate;
|
| import org.chromium.chrome.browser.compositor.bottombar.OverlayPanelManager;
|
| import org.chromium.chrome.browser.compositor.bottombar.contextualsearch.ContextualSearchPanel;
|
| @@ -75,7 +76,7 @@ public class LayoutManagerDocument extends LayoutManager
|
| // Event Filter Handlers
|
| /** A {@link GestureHandler} that will delegate all events to {@link #getActiveLayout()}. */
|
| protected final GestureHandler mGestureHandler;
|
| - private final EdgeSwipeHandler mContextualSearchEdgeSwipeHandler;
|
| + private final EdgeSwipeHandler mOverlayPanelEdgeSwipeHandler;
|
| private final EdgeSwipeHandler mReaderModeEdgeSwipeHandler;
|
|
|
| // Internal State
|
| @@ -112,7 +113,7 @@ public class LayoutManagerDocument extends LayoutManager
|
| };
|
|
|
| // Build Event Filter Handlers
|
| - mContextualSearchEdgeSwipeHandler = new ContextualSearchEdgeSwipeHandler(this);
|
| + mOverlayPanelEdgeSwipeHandler = new OverlayPanelEdgeSwipeHandler(this);
|
| mReaderModeEdgeSwipeHandler = new ReaderModeEdgeSwipeHandler(
|
| mReaderModePanelSelector, this);
|
| mGestureHandler = new GestureHandlerLayoutDelegate(this);
|
| @@ -124,7 +125,7 @@ public class LayoutManagerDocument extends LayoutManager
|
| mContextualSearchEventFilter = new ContextualSearchEventFilter(
|
| context, this, mGestureHandler, mOverlayPanelManager);
|
| EventFilter contextualSearchStaticEventFilter = new ContextualSearchStaticEventFilter(
|
| - context, this, mOverlayPanelManager, mContextualSearchEdgeSwipeHandler, this);
|
| + context, this, mOverlayPanelManager, mOverlayPanelEdgeSwipeHandler, this);
|
| EventFilter readerModeStaticEventFilter = new ReaderModeStaticEventFilter(
|
| context, this, mReaderModePanelSelector, mReaderModeEdgeSwipeHandler, this);
|
| EventFilter staticCascadeEventFilter = new CascadeEventFilter(context, this,
|
| @@ -317,7 +318,8 @@ public class LayoutManagerDocument extends LayoutManager
|
| @Override
|
| public void handleTapContextualSearchBar(long time, float x, float y) {
|
| if (getActiveLayout() == mContextualSearchLayout) return;
|
| - if (mContextualSearchDelegate == null) return;
|
| +
|
| + OverlayPanel panel = mOverlayPanelManager.getActivePanel();
|
|
|
| // When not in compatibility mode, tapping on the Search Bar will expand the Panel,
|
| // therefore we must start showing the ContextualSearchLayout.
|
| @@ -326,7 +328,7 @@ public class LayoutManagerDocument extends LayoutManager
|
| // ContextualSearchLayout. Coordinate with dtrainor@ to solve this. It might be
|
| // necessary for the ContextualSearchPanel to be able to trigger the display of the
|
| // ContextualSearchLayout.
|
| - if (!mContextualSearchDelegate.isRunningInCompatibilityMode()) {
|
| + if (panel != null && panel.supportsContextualSearchLayout()) {
|
| showContextualSearchLayout(true);
|
| }
|
|
|
| @@ -363,35 +365,28 @@ public class LayoutManagerDocument extends LayoutManager
|
| }
|
| }
|
|
|
| - private class ContextualSearchEdgeSwipeHandler extends EdgeSwipeHandlerLayoutDelegate {
|
| - public ContextualSearchEdgeSwipeHandler(LayoutProvider provider) {
|
| + private class OverlayPanelEdgeSwipeHandler extends EdgeSwipeHandlerLayoutDelegate {
|
| + public OverlayPanelEdgeSwipeHandler(LayoutProvider provider) {
|
| super(provider);
|
| }
|
|
|
| @Override
|
| public void swipeStarted(ScrollDirection direction, float x, float y) {
|
| - if (isCompatabilityMode()) {
|
| - mContextualSearchDelegate.openResolvedSearchUrlInNewTab();
|
| - return;
|
| - }
|
| -
|
| - if (getActiveLayout() != mContextualSearchLayout) {
|
| + OverlayPanel panel = mOverlayPanelManager.getActivePanel();
|
| + if (getActiveLayout() != mContextualSearchLayout && panel != null
|
| + && panel.supportsContextualSearchLayout()) {
|
| showContextualSearchLayout(false);
|
| }
|
|
|
| - super.swipeStarted(direction, x, y);
|
| + if (panel != null && !panel.onInterceptBarSwipe()) {
|
| + super.swipeStarted(direction, x, y);
|
| + }
|
| }
|
|
|
| @Override
|
| public boolean isSwipeEnabled(ScrollDirection direction) {
|
| - return direction == ScrollDirection.UP
|
| - && mContextualSearchDelegate != null
|
| - && mContextualSearchDelegate.isShowingSearchPanel();
|
| - }
|
| -
|
| - private boolean isCompatabilityMode() {
|
| - return mContextualSearchDelegate != null
|
| - && mContextualSearchDelegate.isRunningInCompatibilityMode();
|
| + OverlayPanel panel = mOverlayPanelManager.getActivePanel();
|
| + return direction == ScrollDirection.UP && panel != null && panel.isShowing();
|
| }
|
| }
|
|
|
|
|