Exemplo n.º 1
0
  /** Create a new OverlayPanelContent object. This can be overridden for tests. */
  public OverlayPanelContent createNewOverlayPanelContent() {
    OverlayPanelContent overlayPanelContent =
        new OverlayPanelContent(
            mManagementDelegate.getOverlayContentDelegate(),
            new PanelProgressObserver(),
            mActivity);

    // Adds a ContentViewClient to override the default fullscreen size.
    if (!isFullscreenSizePanel()) {
      overlayPanelContent.setContentViewClient(
          new ContentViewClient() {
            @Override
            public int getDesiredWidthMeasureSpec() {
              return MeasureSpec.makeMeasureSpec(
                  getSearchContentViewWidthPx(), MeasureSpec.EXACTLY);
            }

            @Override
            public int getDesiredHeightMeasureSpec() {
              return MeasureSpec.makeMeasureSpec(
                  getSearchContentViewHeightPx(), MeasureSpec.EXACTLY);
            }
          });
    }

    return overlayPanelContent;
  }
Exemplo n.º 2
0
  @Override
  public void updateTopControlState() {
    if (mOverlayPanelContent == null) return;

    if (isFullscreenSizePanel()) {
      // Consider the ContentView height to be fullscreen, and inform the system that
      // the Toolbar is always visible (from the Compositor's perspective), even though
      // the Toolbar and Base Page might be offset outside the screen. This means the
      // renderer will consider the ContentView height to be the fullscreen height
      // minus the Toolbar height.
      //
      // This is necessary to fix the bugs: crbug.com/510205 and crbug.com/510206
      mOverlayPanelContent.updateTopControlsState(false, true, false);
    } else {
      mOverlayPanelContent.updateTopControlsState(true, false, false);
    }
  }
Exemplo n.º 3
0
 @Override
 protected void onClose(StateChangeReason reason) {
   destroySearchBarControl();
   destroyPeekPromoControl();
   if (mOverlayPanelContent != null) {
     mOverlayPanelContent.destroyContentView();
   }
   mManagementDelegate.onCloseContextualSearch(reason);
 }
Exemplo n.º 4
0
  /**
   * Handles the movement of the swipe gesture.
   *
   * @param ty The movement's total displacement in dps.
   */
  public void handleSwipeMove(float ty) {
    if (ty > 0 && getPanelState() == PanelState.MAXIMIZED) {
      // Resets the Search Content View scroll position when swiping the Panel down
      // after being maximized.
      mOverlayPanelContent.resetContentViewScroll();
    }

    // Negative ty value means an upward movement so subtracting ty means expanding the panel.
    setClampedPanelHeight(mInitialPanelHeight - ty);
    requestUpdate();
  }
Exemplo n.º 5
0
 /** Destroy the native components associated with this panel's content. */
 public void destroy() {
   // It is possible that an OverlayPanelContent was never created for this panel.
   if (mOverlayPanelContent != null) {
     mOverlayPanelContent.destroy();
   }
 }
Exemplo n.º 6
0
 @Override
 public void removeLastHistoryEntry(String historyUrl, long urlTimeMs) {
   if (mOverlayPanelContent == null) return;
   // Expose OverlayPanelContent method.
   mOverlayPanelContent.removeLastHistoryEntry(historyUrl, urlTimeMs);
 }
Exemplo n.º 7
0
 @Override
 public ContentViewCore getContentViewCore() {
   // Expose OverlayPanelContent method.
   return mOverlayPanelContent != null ? mOverlayPanelContent.getContentViewCore() : null;
 }
Exemplo n.º 8
0
 @Override
 public boolean didLoadAnyUrl() {
   return mOverlayPanelContent != null && mOverlayPanelContent.didLoadAnyUrl();
 }
Exemplo n.º 9
0
 @Override
 public boolean isContentViewShowing() {
   return mOverlayPanelContent != null && mOverlayPanelContent.isContentViewShowing();
 }
Exemplo n.º 10
0
 /** @return The vertical scroll position of the content. */
 public float getSearchContentViewVerticalScroll() {
   return mOverlayPanelContent.getContentViewVerticalScroll();
 }