org.chromium.chrome.browser.compositor.bottombar.OverlayPanelContent Java Examples

The following examples show how to use org.chromium.chrome.browser.compositor.bottombar.OverlayPanelContent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ReaderModePanel.java    From delion with Apache License 2.0 4 votes vote down vote up
@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) {
            // The initial load will be the distilled content; don't try to open a new tab if
            // this is the case. All other navigations on distilled pages will come from link
            // 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);
}
 
Example #2
Source File: ContextualSearchPanel.java    From delion with Apache License 2.0 4 votes vote down vote up
@Override
public OverlayPanelContent createNewOverlayPanelContent() {
    return new OverlayPanelContent(mManagementDelegate.getOverlayContentDelegate(),
            new PanelProgressObserver(), mActivity);
}
 
Example #3
Source File: ReaderModePanel.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
@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) {
            // The initial load will be the distilled content; don't try to open a new tab if
            // this is the case. All other navigations on distilled pages will come from link
            // 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);
}
 
Example #4
Source File: ContextualSearchPanel.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
@Override
public OverlayPanelContent createNewOverlayPanelContent() {
    return new OverlayPanelContent(mManagementDelegate.getOverlayContentDelegate(),
            new PanelProgressObserver(), mActivity);
}
 
Example #5
Source File: ReaderModePanel.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@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) {
                closePanel(StateChangeReason.UNKNOWN, false);
                return;
            }

            WebContents sourceWebContents = mManagerDelegate.getBasePageWebContents();
            if (sourceWebContents == null) {
                closePanel(StateChangeReason.UNKNOWN, false);
                return;
            }

            DomDistillerTabUtils.distillAndView(sourceWebContents, distilledWebContents);
        }

        @Override
        public void onContentViewDestroyed() {
            mContentViewDelegate.releaseOverlayPanelContentViewCore();
            mIsInitialLoad = true;
        }

        @Override
        public boolean shouldInterceptNavigation(ExternalNavigationHandler externalNavHandler,
                NavigationParams navigationParams) {
            // The initial load will be the distilled content; don't try to open a new tab if
            // this is the case. All other navigations on distilled pages will come from link
            // 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);
}
 
Example #6
Source File: ContextualSearchPanel.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@Override
public OverlayPanelContent createNewOverlayPanelContent() {
    return new OverlayPanelContent(mManagementDelegate.getOverlayContentDelegate(),
            new PanelProgressObserver(), mActivity);
}