コード例 #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;
  }
コード例 #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);
    }
  }
コード例 #3
0
 @Override
 protected void onClose(StateChangeReason reason) {
   destroySearchBarControl();
   destroyPeekPromoControl();
   if (mOverlayPanelContent != null) {
     mOverlayPanelContent.destroyContentView();
   }
   mManagementDelegate.onCloseContextualSearch(reason);
 }
コード例 #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();
  }
コード例 #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();
   }
 }
コード例 #6
0
 @Override
 public void removeLastHistoryEntry(String historyUrl, long urlTimeMs) {
   if (mOverlayPanelContent == null) return;
   // Expose OverlayPanelContent method.
   mOverlayPanelContent.removeLastHistoryEntry(historyUrl, urlTimeMs);
 }
コード例 #7
0
 @Override
 public ContentViewCore getContentViewCore() {
   // Expose OverlayPanelContent method.
   return mOverlayPanelContent != null ? mOverlayPanelContent.getContentViewCore() : null;
 }
コード例 #8
0
 @Override
 public boolean didLoadAnyUrl() {
   return mOverlayPanelContent != null && mOverlayPanelContent.didLoadAnyUrl();
 }
コード例 #9
0
 @Override
 public boolean isContentViewShowing() {
   return mOverlayPanelContent != null && mOverlayPanelContent.isContentViewShowing();
 }
コード例 #10
0
 /** @return The vertical scroll position of the content. */
 public float getSearchContentViewVerticalScroll() {
   return mOverlayPanelContent.getContentViewVerticalScroll();
 }