org.chromium.chrome.browser.tab.TabRedirectHandler Java Examples

The following examples show how to use org.chromium.chrome.browser.tab.TabRedirectHandler. 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
/**
 * Initializes this manager.
 * @param parentView The parent view to attach Contextual Search UX to.
 */
public void initialize(ViewGroup parentView) {
    mNativeContextualSearchManagerPtr = nativeInit();

    mParentView = parentView;
    mParentView.getViewTreeObserver().addOnGlobalFocusChangeListener(mOnFocusChangeListener);

    mTabRedirectHandler = new TabRedirectHandler(mActivity);

    mIsShowingPromo = false;
    mDidLogPromoOutcome = false;
    mDidStartLoadingResolvedSearchRequest = false;
    mWereSearchResultsSeen = false;
    mIsInitialized = true;

    listenForTabModelSelectorNotifications();
}
 
Example #2
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 #3
Source File: ExternalNavigationParams.java    From delion with Apache License 2.0 6 votes vote down vote up
private ExternalNavigationParams(String url, boolean isIncognito, String referrerUrl,
        int pageTransition, boolean isRedirect, boolean appMustBeInForeground,
        TabRedirectHandler redirectHandler, Tab tab, boolean openInNewTab,
        boolean isBackgroundTabNavigation, boolean isMainFrame, String webApkPackageName,
        boolean hasUserGesture,
        boolean shouldCloseContentsOnOverrideUrlLoadingAndLaunchIntent) {
    mUrl = url;
    mIsIncognito = isIncognito;
    mPageTransition = pageTransition;
    mReferrerUrl = referrerUrl;
    mIsRedirect = isRedirect;
    mApplicationMustBeInForeground = appMustBeInForeground;
    mRedirectHandler = redirectHandler;
    mTab = tab;
    mOpenInNewTab = openInNewTab;
    mIsBackgroundTabNavigation = isBackgroundTabNavigation;
    mIsMainFrame = isMainFrame;
    mWebApkPackageName = webApkPackageName;
    mHasUserGesture = hasUserGesture;
    mShouldCloseContentsOnOverrideUrlLoadingAndLaunchIntent =
            shouldCloseContentsOnOverrideUrlLoadingAndLaunchIntent;
}
 
Example #4
Source File: ContextualSearchManager.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Initializes this manager.
 * @param parentView The parent view to attach Contextual Search UX to.
 */
public void initialize(ViewGroup parentView) {
    mNativeContextualSearchManagerPtr = nativeInit();

    mParentView = parentView;
    mParentView.getViewTreeObserver().addOnGlobalFocusChangeListener(mOnFocusChangeListener);

    mTabRedirectHandler = new TabRedirectHandler(mActivity);

    mIsShowingPromo = false;
    mDidLogPromoOutcome = false;
    mDidStartLoadingResolvedSearchRequest = false;
    mWereSearchResultsSeen = false;
    mIsInitialized = true;

    listenForTabModelSelectorNotifications();
}
 
Example #5
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 #6
Source File: ExternalNavigationParams.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
private ExternalNavigationParams(String url, boolean isIncognito, String referrerUrl,
        int pageTransition, boolean isRedirect, boolean appMustBeInForeground,
        TabRedirectHandler redirectHandler, Tab tab, boolean openInNewTab,
        boolean isBackgroundTabNavigation, boolean isMainFrame, String webApkPackageName,
        boolean hasUserGesture,
        boolean shouldCloseContentsOnOverrideUrlLoadingAndLaunchIntent) {
    mUrl = url;
    mIsIncognito = isIncognito;
    mPageTransition = pageTransition;
    mReferrerUrl = referrerUrl;
    mIsRedirect = isRedirect;
    mApplicationMustBeInForeground = appMustBeInForeground;
    mRedirectHandler = redirectHandler;
    mTab = tab;
    mOpenInNewTab = openInNewTab;
    mIsBackgroundTabNavigation = isBackgroundTabNavigation;
    mIsMainFrame = isMainFrame;
    mWebApkPackageName = webApkPackageName;
    mHasUserGesture = hasUserGesture;
    mShouldCloseContentsOnOverrideUrlLoadingAndLaunchIntent =
            shouldCloseContentsOnOverrideUrlLoadingAndLaunchIntent;
}
 
Example #7
Source File: ContextualSearchManager.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Initializes this manager.
 * @param parentView The parent view to attach Contextual Search UX to.
 */
public void initialize(ViewGroup parentView) {
    mNativeContextualSearchManagerPtr = nativeInit();

    mParentView = parentView;
    mParentView.getViewTreeObserver().addOnGlobalFocusChangeListener(mOnFocusChangeListener);

    mTabRedirectHandler = new TabRedirectHandler(mActivity);

    mIsShowingPromo = false;
    mDidLogPromoOutcome = false;
    mDidStartLoadingResolvedSearchRequest = false;
    mWereSearchResultsSeen = false;
    mIsInitialized = true;

    mInternalStateController.reset(StateChangeReason.UNKNOWN);

    listenForTabModelSelectorNotifications();
}
 
Example #8
Source File: ExternalNavigationParams.java    From 365browser with Apache License 2.0 6 votes vote down vote up
private ExternalNavigationParams(String url, boolean isIncognito, String referrerUrl,
        int pageTransition, boolean isRedirect, boolean appMustBeInForeground,
        TabRedirectHandler redirectHandler, Tab tab, boolean openInNewTab,
        boolean isBackgroundTabNavigation, boolean isMainFrame, String webApkPackageName,
        boolean hasUserGesture,
        boolean shouldCloseContentsOnOverrideUrlLoadingAndLaunchIntent) {
    mUrl = url;
    mIsIncognito = isIncognito;
    mPageTransition = pageTransition;
    mReferrerUrl = referrerUrl;
    mIsRedirect = isRedirect;
    mApplicationMustBeInForeground = appMustBeInForeground;
    mRedirectHandler = redirectHandler;
    mTab = tab;
    mOpenInNewTab = openInNewTab;
    mIsBackgroundTabNavigation = isBackgroundTabNavigation;
    mIsMainFrame = isMainFrame;
    mWebApkPackageName = webApkPackageName;
    mHasUserGesture = hasUserGesture;
    mShouldCloseContentsOnOverrideUrlLoadingAndLaunchIntent =
            shouldCloseContentsOnOverrideUrlLoadingAndLaunchIntent;
}
 
Example #9
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 #10
Source File: ExternalNavigationParams.java    From delion with Apache License 2.0 4 votes vote down vote up
/** @return The redirect handler. */
public TabRedirectHandler getRedirectHandler() {
    return mRedirectHandler;
}
 
Example #11
Source File: ExternalNavigationParams.java    From delion with Apache License 2.0 4 votes vote down vote up
/** Sets a tab redirect handler. */
public Builder setRedirectHandler(TabRedirectHandler handler) {
    mRedirectHandler = handler;
    return this;
}
 
Example #12
Source File: ExternalNavigationParams.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
/** @return The redirect handler. */
public TabRedirectHandler getRedirectHandler() {
    return mRedirectHandler;
}
 
Example #13
Source File: ExternalNavigationParams.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
/** Sets a tab redirect handler. */
public Builder setRedirectHandler(TabRedirectHandler handler) {
    mRedirectHandler = handler;
    return this;
}
 
Example #14
Source File: ExternalNavigationParams.java    From 365browser with Apache License 2.0 4 votes vote down vote up
/** @return The redirect handler. */
public TabRedirectHandler getRedirectHandler() {
    return mRedirectHandler;
}
 
Example #15
Source File: ExternalNavigationParams.java    From 365browser with Apache License 2.0 4 votes vote down vote up
/** Sets a tab redirect handler. */
public Builder setRedirectHandler(TabRedirectHandler handler) {
    mRedirectHandler = handler;
    return this;
}