org.chromium.chrome.browser.externalnav.ExternalNavigationParams Java Examples

The following examples show how to use org.chromium.chrome.browser.externalnav.ExternalNavigationParams. 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: ContextualSearchManager.java    From delion with Apache License 2.0 6 votes vote down vote up
@Override
public boolean shouldInterceptNavigation(ExternalNavigationHandler externalNavHandler,
        NavigationParams navigationParams) {
    mTabRedirectHandler.updateNewUrlLoading(navigationParams.pageTransitionType,
            navigationParams.isRedirect,
            navigationParams.hasUserGesture || navigationParams.hasUserGestureCarryover,
            mActivity.getLastUserInteractionTime(), TabRedirectHandler.INVALID_ENTRY_INDEX);
    ExternalNavigationParams params = new ExternalNavigationParams.Builder(
            navigationParams.url, false, navigationParams.referrer,
            navigationParams.pageTransitionType, navigationParams.isRedirect)
            .setApplicationMustBeInForeground(true)
            .setRedirectHandler(mTabRedirectHandler)
            .setIsMainFrame(navigationParams.isMainFrame)
            .build();
    if (externalNavHandler.shouldOverrideUrlLoading(params)
            != OverrideUrlLoadingResult.NO_OVERRIDE) {
        mSearchPanel.maximizePanelThenPromoteToTab(StateChangeReason.TAB_PROMOTION,
                INTERCEPT_NAVIGATION_PROMOTION_ANIMATION_DURATION_MS);
        return false;
    }
    if (navigationParams.isExternalProtocol) {
        return false;
    }
    return true;
}
 
Example #2
Source File: InterceptNavigationDelegateImpl.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * Returns ExternalNavigationParams.Builder to generate ExternalNavigationParams for
 * ExternalNavigationHandler#shouldOverrideUrlLoading().
 */
public ExternalNavigationParams.Builder buildExternalNavigationParams(
        NavigationParams navigationParams, TabRedirectHandler tabRedirectHandler,
        boolean shouldCloseTab) {
    boolean isInitialTabLaunchInBackground =
            mTab.getLaunchType() == TabLaunchType.FROM_LONGPRESS_BACKGROUND && shouldCloseTab;
    // http://crbug.com/448977: If a new tab is closed by this overriding, we should open an
    // Intent in a new tab when Chrome receives it again.
    return new ExternalNavigationParams
            .Builder(navigationParams.url, mTab.isIncognito(), navigationParams.referrer,
                    navigationParams.pageTransitionType, navigationParams.isRedirect)
            .setTab(mTab)
            .setApplicationMustBeInForeground(true)
            .setRedirectHandler(tabRedirectHandler)
            .setOpenInNewTab(shouldCloseTab)
            .setIsBackgroundTabNavigation(mTab.isHidden() && !isInitialTabLaunchInBackground)
            .setIsMainFrame(navigationParams.isMainFrame)
            .setHasUserGesture(navigationParams.hasUserGesture)
            .setShouldCloseContentsOnOverrideUrlLoadingAndLaunchIntent(
                    shouldCloseTab && navigationParams.isMainFrame);
}
 
Example #3
Source File: ContextualSearchManager.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
public boolean shouldInterceptNavigation(ExternalNavigationHandler externalNavHandler,
        NavigationParams navigationParams) {
    mTabRedirectHandler.updateNewUrlLoading(navigationParams.pageTransitionType,
            navigationParams.isRedirect,
            navigationParams.hasUserGesture || navigationParams.hasUserGestureCarryover,
            mActivity.getLastUserInteractionTime(), TabRedirectHandler.INVALID_ENTRY_INDEX);
    ExternalNavigationParams params = new ExternalNavigationParams.Builder(
            navigationParams.url, false, navigationParams.referrer,
            navigationParams.pageTransitionType, navigationParams.isRedirect)
            .setApplicationMustBeInForeground(true)
            .setRedirectHandler(mTabRedirectHandler)
            .setIsMainFrame(navigationParams.isMainFrame)
            .build();
    if (externalNavHandler.shouldOverrideUrlLoading(params)
            != OverrideUrlLoadingResult.NO_OVERRIDE) {
        mSearchPanel.maximizePanelThenPromoteToTab(StateChangeReason.TAB_PROMOTION,
                INTERCEPT_NAVIGATION_PROMOTION_ANIMATION_DURATION_MS);
        return false;
    }
    if (navigationParams.isExternalProtocol) {
        return false;
    }
    return true;
}
 
Example #4
Source File: InterceptNavigationDelegateImpl.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Returns ExternalNavigationParams.Builder to generate ExternalNavigationParams for
 * ExternalNavigationHandler#shouldOverrideUrlLoading().
 */
public ExternalNavigationParams.Builder buildExternalNavigationParams(
        NavigationParams navigationParams, TabRedirectHandler tabRedirectHandler,
        boolean shouldCloseTab) {
    boolean isInitialTabLaunchInBackground =
            mTab.getLaunchType() == TabLaunchType.FROM_LONGPRESS_BACKGROUND && shouldCloseTab;
    // http://crbug.com/448977: If a new tab is closed by this overriding, we should open an
    // Intent in a new tab when Chrome receives it again.
    return new ExternalNavigationParams
            .Builder(navigationParams.url, mTab.isIncognito(), navigationParams.referrer,
                    navigationParams.pageTransitionType, navigationParams.isRedirect)
            .setTab(mTab)
            .setApplicationMustBeInForeground(true)
            .setRedirectHandler(tabRedirectHandler)
            .setOpenInNewTab(shouldCloseTab)
            .setIsBackgroundTabNavigation(mTab.isHidden() && !isInitialTabLaunchInBackground)
            .setIsMainFrame(navigationParams.isMainFrame)
            .setHasUserGesture(navigationParams.hasUserGesture)
            .setShouldCloseContentsOnOverrideUrlLoadingAndLaunchIntent(
                    shouldCloseTab && navigationParams.isMainFrame);
}
 
Example #5
Source File: InterceptNavigationDelegateImpl.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Returns ExternalNavigationParams.Builder to generate ExternalNavigationParams for
 * ExternalNavigationHandler#shouldOverrideUrlLoading().
 */
public ExternalNavigationParams.Builder buildExternalNavigationParams(
        NavigationParams navigationParams, TabRedirectHandler tabRedirectHandler,
        boolean shouldCloseTab) {
    boolean isInitialTabLaunchInBackground =
            mTab.getLaunchType() == TabLaunchType.FROM_LONGPRESS_BACKGROUND && shouldCloseTab;
    // http://crbug.com/448977: If a new tab is closed by this overriding, we should open an
    // Intent in a new tab when Chrome receives it again.
    return new ExternalNavigationParams
            .Builder(navigationParams.url, mTab.isIncognito(), navigationParams.referrer,
                    navigationParams.pageTransitionType, navigationParams.isRedirect)
            .setTab(mTab)
            .setApplicationMustBeInForeground(true)
            .setRedirectHandler(tabRedirectHandler)
            .setOpenInNewTab(shouldCloseTab)
            .setIsBackgroundTabNavigation(mTab.isHidden() && !isInitialTabLaunchInBackground)
            .setIsMainFrame(navigationParams.isMainFrame)
            .setHasUserGesture(navigationParams.hasUserGesture)
            .setShouldCloseContentsOnOverrideUrlLoadingAndLaunchIntent(
                    shouldCloseTab && navigationParams.isMainFrame);
}
 
Example #6
Source File: InterceptNavigationDelegateImpl.java    From delion with Apache License 2.0 5 votes vote down vote up
public boolean shouldIgnoreNewTab(String url, boolean incognito) {
    if (mAuthenticatorHelper != null && mAuthenticatorHelper.handleAuthenticatorUrl(url)) {
        return true;
    }

    ExternalNavigationParams params = new ExternalNavigationParams.Builder(url, incognito)
            .setTab(mTab)
            .setOpenInNewTab(true)
            .build();
    return mExternalNavHandler.shouldOverrideUrlLoading(params)
            != ExternalNavigationHandler.OverrideUrlLoadingResult.NO_OVERRIDE;
}
 
Example #7
Source File: InterceptNavigationDelegateImpl.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
public boolean shouldIgnoreNewTab(String url, boolean incognito) {
    if (mAuthenticatorHelper != null && mAuthenticatorHelper.handleAuthenticatorUrl(url)) {
        return true;
    }

    ExternalNavigationParams params = new ExternalNavigationParams.Builder(url, incognito)
            .setTab(mTab)
            .setOpenInNewTab(true)
            .build();
    return mExternalNavHandler.shouldOverrideUrlLoading(params)
            != ExternalNavigationHandler.OverrideUrlLoadingResult.NO_OVERRIDE;
}
 
Example #8
Source File: ContextualSearchManager.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public boolean shouldInterceptNavigation(
        ExternalNavigationHandler externalNavHandler, NavigationParams navigationParams) {
    mTabRedirectHandler.updateNewUrlLoading(navigationParams.pageTransitionType,
            navigationParams.isRedirect,
            navigationParams.hasUserGesture || navigationParams.hasUserGestureCarryover,
            mActivity.getLastUserInteractionTime(), TabRedirectHandler.INVALID_ENTRY_INDEX);
    ExternalNavigationParams params =
            new ExternalNavigationParams
                    .Builder(navigationParams.url, false, navigationParams.referrer,
                            navigationParams.pageTransitionType,
                            navigationParams.isRedirect)
                    .setApplicationMustBeInForeground(true)
                    .setRedirectHandler(mTabRedirectHandler)
                    .setIsMainFrame(navigationParams.isMainFrame)
                    .build();
    if (externalNavHandler.shouldOverrideUrlLoading(params)
            != OverrideUrlLoadingResult.NO_OVERRIDE) {
        mSearchPanel.maximizePanelThenPromoteToTab(StateChangeReason.TAB_PROMOTION,
                INTERCEPT_NAVIGATION_PROMOTION_ANIMATION_DURATION_MS);
        return false;
    }
    if (navigationParams.isExternalProtocol) {
        return false;
    }
    return true;
}
 
Example #9
Source File: InterceptNavigationDelegateImpl.java    From 365browser with Apache License 2.0 5 votes vote down vote up
public boolean shouldIgnoreNewTab(String url, boolean incognito) {
    if (mAuthenticatorHelper != null && mAuthenticatorHelper.handleAuthenticatorUrl(url)) {
        return true;
    }

    ExternalNavigationParams params = new ExternalNavigationParams.Builder(url, incognito)
            .setTab(mTab)
            .setOpenInNewTab(true)
            .build();
    return mExternalNavHandler.shouldOverrideUrlLoading(params)
            != ExternalNavigationHandler.OverrideUrlLoadingResult.NO_OVERRIDE;
}