| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chrome.browser.compositor.layouts; | 5 package org.chromium.chrome.browser.compositor.layouts; |
| 6 | 6 |
| 7 import android.annotation.TargetApi; | 7 import android.annotation.TargetApi; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.os.Build; | 9 import android.os.Build; |
| 10 import android.util.SparseArray; | 10 import android.util.SparseArray; |
| 11 import android.view.MotionEvent; | 11 import android.view.MotionEvent; |
| 12 import android.view.ViewGroup; | 12 import android.view.ViewGroup; |
| 13 | 13 |
| 14 import org.chromium.chrome.browser.ChromeApplication; | 14 import org.chromium.chrome.browser.ChromeApplication; |
| 15 import org.chromium.chrome.browser.UrlConstants; | 15 import org.chromium.chrome.browser.UrlConstants; |
| 16 import org.chromium.chrome.browser.compositor.bottombar.OverlayPanelContentViewD
elegate; | 16 import org.chromium.chrome.browser.compositor.bottombar.OverlayPanelContentViewD
elegate; |
| 17 import org.chromium.chrome.browser.compositor.bottombar.OverlayPanelManager; | 17 import org.chromium.chrome.browser.compositor.bottombar.OverlayPanelManager; |
| 18 import org.chromium.chrome.browser.compositor.bottombar.contextualsearch.Context
ualSearchPanel; | 18 import org.chromium.chrome.browser.compositor.bottombar.contextualsearch.Context
ualSearchPanel; |
| 19 import org.chromium.chrome.browser.compositor.bottombar.readermode.ReaderModePan
el; | 19 import org.chromium.chrome.browser.compositor.bottombar.readermode.ReaderModePan
el; |
| 20 import org.chromium.chrome.browser.compositor.layouts.components.LayoutTab; | 20 import org.chromium.chrome.browser.compositor.layouts.components.LayoutTab; |
| 21 import org.chromium.chrome.browser.compositor.layouts.components.VirtualView; | 21 import org.chromium.chrome.browser.compositor.layouts.components.VirtualView; |
| 22 import org.chromium.chrome.browser.compositor.layouts.content.TabContentManager; | 22 import org.chromium.chrome.browser.compositor.layouts.content.TabContentManager; |
| 23 import org.chromium.chrome.browser.compositor.layouts.eventfilter.EdgeSwipeHandl
er; | 23 import org.chromium.chrome.browser.compositor.layouts.eventfilter.EdgeSwipeHandl
er; |
| 24 import org.chromium.chrome.browser.compositor.layouts.eventfilter.EmptyEdgeSwipe
Handler; | 24 import org.chromium.chrome.browser.compositor.layouts.eventfilter.EmptyEdgeSwipe
Handler; |
| 25 import org.chromium.chrome.browser.compositor.layouts.eventfilter.GestureHandler
; |
| 25 import org.chromium.chrome.browser.compositor.layouts.eventfilter.ScrollDirectio
n; | 26 import org.chromium.chrome.browser.compositor.layouts.eventfilter.ScrollDirectio
n; |
| 26 import org.chromium.chrome.browser.compositor.overlays.SceneOverlay; | 27 import org.chromium.chrome.browser.compositor.overlays.SceneOverlay; |
| 27 import org.chromium.chrome.browser.compositor.scene_layer.ToolbarSceneLayer; | 28 import org.chromium.chrome.browser.compositor.scene_layer.ToolbarSceneLayer; |
| 28 import org.chromium.chrome.browser.contextualsearch.ContextualSearchManagementDe
legate; | 29 import org.chromium.chrome.browser.contextualsearch.ContextualSearchManagementDe
legate; |
| 29 import org.chromium.chrome.browser.device.DeviceClassManager; | 30 import org.chromium.chrome.browser.device.DeviceClassManager; |
| 30 import org.chromium.chrome.browser.dom_distiller.ReaderModeManagerDelegate; | 31 import org.chromium.chrome.browser.dom_distiller.ReaderModeManagerDelegate; |
| 31 import org.chromium.chrome.browser.fullscreen.FullscreenManager; | 32 import org.chromium.chrome.browser.fullscreen.FullscreenManager; |
| 32 import org.chromium.chrome.browser.tab.Tab; | 33 import org.chromium.chrome.browser.tab.Tab; |
| 33 import org.chromium.chrome.browser.tabmodel.TabCreatorManager; | 34 import org.chromium.chrome.browser.tabmodel.TabCreatorManager; |
| 34 import org.chromium.chrome.browser.tabmodel.TabModel; | 35 import org.chromium.chrome.browser.tabmodel.TabModel; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 49 */ | 50 */ |
| 50 public class LayoutManagerDocument extends LayoutManager | 51 public class LayoutManagerDocument extends LayoutManager |
| 51 implements OverlayPanelContentViewDelegate { | 52 implements OverlayPanelContentViewDelegate { |
| 52 // Layouts | 53 // Layouts |
| 53 /** A {@link Layout} used for showing a normal web page. */ | 54 /** A {@link Layout} used for showing a normal web page. */ |
| 54 protected final StaticLayout mStaticLayout; | 55 protected final StaticLayout mStaticLayout; |
| 55 | 56 |
| 56 // Event Filters | 57 // Event Filters |
| 57 private final EdgeSwipeHandler mToolbarSwipeHandler; | 58 private final EdgeSwipeHandler mToolbarSwipeHandler; |
| 58 | 59 |
| 60 // Event Filter Handlers |
| 61 /** A {@link GestureHandler} that will delegate all events to {@link #getAct
iveLayout()}. */ |
| 62 protected final GestureHandler mGestureHandler; |
| 63 |
| 59 // Internal State | 64 // Internal State |
| 60 private final SparseArray<LayoutTab> mTabCache = new SparseArray<LayoutTab>(
); | 65 private final SparseArray<LayoutTab> mTabCache = new SparseArray<LayoutTab>(
); |
| 61 private final ContextualSearchPanel mContextualSearchPanel; | 66 private final ContextualSearchPanel mContextualSearchPanel; |
| 62 private final ReaderModePanel mReaderModePanel; | 67 private final ReaderModePanel mReaderModePanel; |
| 63 private final OverlayPanelManager mOverlayPanelManager; | 68 private final OverlayPanelManager mOverlayPanelManager; |
| 64 private final ToolbarSceneLayer mToolbarOverlay; | 69 private final ToolbarSceneLayer mToolbarOverlay; |
| 65 /** A delegate for interacting with the Contextual Search manager. */ | 70 /** A delegate for interacting with the Contextual Search manager. */ |
| 66 protected ContextualSearchManagementDelegate mContextualSearchDelegate; | 71 protected ContextualSearchManagementDelegate mContextualSearchDelegate; |
| 67 | 72 |
| 68 private final Context mContext; | 73 private final Context mContext; |
| 69 | 74 |
| 70 @SuppressWarnings("unused") private TabModelSelectorTabObserver mTabModelSel
ectorTabObserver; | 75 @SuppressWarnings("unused") private TabModelSelectorTabObserver mTabModelSel
ectorTabObserver; |
| 71 | 76 |
| 72 /** | 77 /** |
| 73 * Creates a {@link LayoutManagerDocument} instance. | 78 * Creates a {@link LayoutManagerDocument} instance. |
| 74 * @param host A {@link LayoutManagerHost} instance. | 79 * @param host A {@link LayoutManagerHost} instance. |
| 75 */ | 80 */ |
| 76 public LayoutManagerDocument(LayoutManagerHost host) { | 81 public LayoutManagerDocument(LayoutManagerHost host) { |
| 77 super(host); | 82 super(host); |
| 78 mContext = host.getContext(); | 83 mContext = host.getContext(); |
| 79 LayoutRenderHost renderHost = host.getLayoutRenderHost(); | 84 LayoutRenderHost renderHost = host.getLayoutRenderHost(); |
| 80 | 85 |
| 81 mToolbarOverlay = new ToolbarSceneLayer(mContext, this, renderHost); | 86 mToolbarOverlay = new ToolbarSceneLayer(mContext, this, renderHost); |
| 82 | 87 |
| 83 // Build Event Filter Handlers | 88 // Build Event Filter Handlers |
| 89 mGestureHandler = new GestureHandlerLayoutDelegate(this); |
| 84 mToolbarSwipeHandler = new ToolbarSwipeHandler(this); | 90 mToolbarSwipeHandler = new ToolbarSwipeHandler(this); |
| 85 | 91 |
| 86 mOverlayPanelManager = new OverlayPanelManager(); | 92 mOverlayPanelManager = new OverlayPanelManager(); |
| 87 | 93 |
| 88 // Build Layouts | 94 // Build Layouts |
| 89 mStaticLayout = new StaticLayout(mContext, this, renderHost, null, mOver
layPanelManager); | 95 mStaticLayout = new StaticLayout(mContext, this, renderHost, null, mOver
layPanelManager); |
| 90 | 96 |
| 91 // Contextual Search scene overlay. | 97 // Contextual Search scene overlay. |
| 92 mContextualSearchPanel = new ContextualSearchPanel(mContext, this, mOver
layPanelManager); | 98 mContextualSearchPanel = new ContextualSearchPanel(mContext, this, mOver
layPanelManager); |
| 93 | 99 |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 || !FeatureUtilities.isDocumentModeEligible(mHost.getContext
()) | 388 || !FeatureUtilities.isDocumentModeEligible(mHost.getContext
()) |
| 383 || !DeviceClassManager.enableToolbarSwipe() | 389 || !DeviceClassManager.enableToolbarSwipe() |
| 384 || (manager != null && manager.getPersistentFullscreenMode()
)) { | 390 || (manager != null && manager.getPersistentFullscreenMode()
)) { |
| 385 return false; | 391 return false; |
| 386 } | 392 } |
| 387 | 393 |
| 388 return direction == ScrollDirection.LEFT || direction == ScrollDirec
tion.RIGHT; | 394 return direction == ScrollDirection.LEFT || direction == ScrollDirec
tion.RIGHT; |
| 389 } | 395 } |
| 390 } | 396 } |
| 391 } | 397 } |
| OLD | NEW |