| Index: chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerChrome.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerChrome.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerChrome.java
|
| index e1225b9a26adb7be689ee2de1df531b113da89d1..fb8e8e0f6c98704d9f52f2118481aea8bb61e26a 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerChrome.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerChrome.java
|
| @@ -13,7 +13,10 @@
|
| import org.chromium.chrome.browser.compositor.layouts.components.LayoutTab;
|
| import org.chromium.chrome.browser.compositor.layouts.components.VirtualView;
|
| import org.chromium.chrome.browser.compositor.layouts.content.TabContentManager;
|
| +import org.chromium.chrome.browser.compositor.layouts.eventfilter.BlackHoleEventFilter;
|
| import org.chromium.chrome.browser.compositor.layouts.eventfilter.EdgeSwipeHandler;
|
| +import org.chromium.chrome.browser.compositor.layouts.eventfilter.EventFilter;
|
| +import org.chromium.chrome.browser.compositor.layouts.eventfilter.GestureEventFilter;
|
| import org.chromium.chrome.browser.compositor.layouts.eventfilter.ScrollDirection;
|
| import org.chromium.chrome.browser.compositor.layouts.phone.StackLayout;
|
| import org.chromium.chrome.browser.compositor.overlays.SceneOverlay;
|
| @@ -55,6 +58,11 @@
|
| /** A {@link Layout} that should be used when the user is in the tab switcher. */
|
| protected Layout mOverviewLayout;
|
|
|
| + // Event Filters
|
| + /** A {@link EventFilter} that consumes all touch events. */
|
| + protected EventFilter mBlackHoleEventFilter;
|
| + private final GestureEventFilter mGestureEventFilter;
|
| +
|
| // Event Filter Handlers
|
| private final EdgeSwipeHandler mToolbarSwipeHandler;
|
|
|
| @@ -158,11 +166,17 @@
|
| // Build Event Filter Handlers
|
| mToolbarSwipeHandler = createToolbarSwipeHandler(this);
|
|
|
| + // Build Event Filters
|
| + mBlackHoleEventFilter = new BlackHoleEventFilter(context);
|
| + mGestureEventFilter = new GestureEventFilter(context, mGestureHandler);
|
| +
|
| // Build Layouts
|
| - mOverviewListLayout = new OverviewListLayout(context, this, renderHost);
|
| - mToolbarSwipeLayout = new ToolbarSwipeLayout(context, this, renderHost);
|
| + mOverviewListLayout =
|
| + new OverviewListLayout(context, this, renderHost, mBlackHoleEventFilter);
|
| + mToolbarSwipeLayout =
|
| + new ToolbarSwipeLayout(context, this, renderHost, mBlackHoleEventFilter);
|
| if (createOverviewLayout) {
|
| - mOverviewLayout = new StackLayout(context, this, renderHost);
|
| + mOverviewLayout = new StackLayout(context, this, renderHost, mGestureEventFilter);
|
| }
|
| }
|
|
|
| @@ -302,9 +316,7 @@
|
| */
|
| @VisibleForTesting
|
| public void simulateClick(float x, float y) {
|
| - if (getActiveLayout() instanceof StackLayout) {
|
| - ((StackLayout) getActiveLayout()).simulateClick(x, y);
|
| - }
|
| + if (getActiveLayout() != null) getActiveLayout().click(time(), x, y);
|
| }
|
|
|
| /**
|
| @@ -316,8 +328,10 @@
|
| */
|
| @VisibleForTesting
|
| public void simulateDrag(float x, float y, float dX, float dY) {
|
| - if (getActiveLayout() instanceof StackLayout) {
|
| - ((StackLayout) getActiveLayout()).simulateDrag(x, y, dX, dY);
|
| + if (getActiveLayout() != null) {
|
| + getActiveLayout().onDown(0, x, y);
|
| + getActiveLayout().drag(0, x, y, dX, dY);
|
| + getActiveLayout().onUpOrCancel(time());
|
| }
|
| }
|
|
|
|
|