use of org.chromium.chrome.browser.compositor.bottombar.OverlayPanelContent in project AndroidChromium by JackyAndroid.
the class ReaderModePanel method createNewOverlayPanelContent.
@Override
public OverlayPanelContent createNewOverlayPanelContent() {
OverlayContentDelegate delegate = new OverlayContentDelegate() {
/**
* Track if a navigation/load is the first one for this content.
*/
private boolean mIsInitialLoad = true;
@Override
public void onContentViewCreated(ContentViewCore contentView) {
mContentViewDelegate.setOverlayPanelContentViewCore(contentView);
WebContents distilledWebContents = contentView.getWebContents();
if (distilledWebContents == null)
return;
WebContents sourceWebContents = mManagerDelegate.getBasePageWebContents();
if (sourceWebContents == null)
return;
DomDistillerTabUtils.distillAndView(sourceWebContents, distilledWebContents);
}
@Override
public void onContentViewDestroyed() {
mContentViewDelegate.releaseOverlayPanelContentViewCore();
mIsInitialLoad = true;
}
@Override
public boolean shouldInterceptNavigation(ExternalNavigationHandler externalNavHandler, NavigationParams navigationParams) {
// clicks.
if (mIsInitialLoad) {
mIsInitialLoad = false;
return true;
}
if (!navigationParams.isExternalProtocol) {
mManagerDelegate.createNewTab(navigationParams.url);
return false;
}
return true;
}
};
return new OverlayPanelContent(delegate, new OverlayContentProgressObserver(), mActivity);
}
Aggregations