• Jinsuk Kim's avatar
    Android: Refactor gesture navigation objects to be activity-level · ed20c69b
    Jinsuk Kim authored
    HistoryNavigationLayout is a top level layout class of gesture
    navigation feature, and is a child view of Tab's
    ContentView. This CL moves it one level up in the view hierarchy
    so that it becomes a child of CompositorViewHolder instead. This
    has a few benefits:
    
    1) Many native pages included HistoryNavigationLayout in its
    layout definition. This caused undesirable dependencies on
    gesture navigation, blocking component-wise modularization
    efforts. Once it is removed from native page layout, it becomes
    much easier to build each component as its own target.
    
    2) Gesture navigation-related UI doesn't have to be instantiated
    for each tab. A single set of instances can be used for all, each
    tab only needing to provide with navigation delegate objects that
    have dependency on tab when it goes foreground.
    
    3) When the layout is added to Tab's content view, the
    UI (especially arrow's fade-away animation when navigation
    starts) is visible as long as its parent view is alive, but
    navigation between rendered and native page swaps out the content
    view. This keeps the navigation and animation from starting
    simultaneously. The refactoring gets rid of this limitation.
    
    Major changes are:
    
    - CompositorViewHolder dispatches touch event to
    HistoryNavigationLayout. If the right gesture is detected, lets
    it consume the following events.
    
    - HistoryNavigationLayout in native pages are either removed or all
    replaced with FrameLayout. This is basically reverting relevant
    parts of the past CLs:
    
    https://crrev.com/c/1249530 Implement gesture navigation on Android
    https://crrev.com/c/1423477 Android: More native pages become navigable
    https://crrev.com/c/1547547 Android: Trigger history navigation with edge swipe
    https://crrev.com/c/1554200 Android: Enable overscroll navigation in explore site page
    
    - Rendered pages also make use of
    HistoryNavigationLayout (previously SwipeRefreshHandler had its
    own NavigationHandler) and reference the NavigationHandler that
    the layout provides. This helps consolidate most of the
    navigation event handling logic in the layout.
    
    Bug: 1003914
    Change-Id: I62ed28bd8f6aab39ca7a47f2e3fdce7a131fbfb6
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1961351
    Commit-Queue: Jinsuk Kim <jinsukkim@chromium.org>
    Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#732653}
    ed20c69b
chrome_java_sources.gni 152 KB