Java Code Examples for org.chromium.ui.base.PageTransition#RELOAD

The following examples show how to use org.chromium.ui.base.PageTransition#RELOAD . 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: Tab.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * Update internal Tab state when provisional load gets committed.
 * @param url The URL that was loaded.
 * @param transitionType The transition type to the current URL.
 */
void handleDidCommitProvisonalLoadForFrame(String url, int transitionType) {
    mIsNativePageCommitPending = false;
    boolean isReload = (transitionType == PageTransition.RELOAD);
    if (!maybeShowNativePage(url, isReload)) {
        showRenderedPage();
    }

    mHandler.removeMessages(MSG_ID_ENABLE_FULLSCREEN_AFTER_LOAD);
    mHandler.sendEmptyMessageDelayed(
            MSG_ID_ENABLE_FULLSCREEN_AFTER_LOAD, MAX_FULLSCREEN_LOAD_DELAY_MS);
    updateFullscreenEnabledState();

    if (getInterceptNavigationDelegate() != null) {
        getInterceptNavigationDelegate().maybeUpdateNavigationHistory();
    }
}
 
Example 2
Source File: OfflinePageUtils.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Reloads specified tab, which should allow to open an online version of the page.
 * @param tab The tab to be reloaded.
 */
public static void reload(Tab tab) {
    // If current page is an offline page, reload it with custom behavior defined in extra
    // header respected.
    LoadUrlParams params =
            new LoadUrlParams(tab.getOriginalUrl(), PageTransition.RELOAD);
    params.setVerbatimHeaders(getOfflinePageHeaderForReload(tab));
    tab.loadUrl(params);
}
 
Example 3
Source File: Tab.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Update internal Tab state when provisional load gets committed.
 * @param url The URL that was loaded.
 * @param transitionType The transition type to the current URL.
 */
void handleDidCommitProvisonalLoadForFrame(String url, int transitionType) {
    mIsNativePageCommitPending = false;
    boolean isReload = (transitionType == PageTransition.RELOAD);
    if (!maybeShowNativePage(url, isReload)) {
        showRenderedPage();
    }

    if (getInterceptNavigationDelegate() != null) {
        getInterceptNavigationDelegate().maybeUpdateNavigationHistory();
    }
}
 
Example 4
Source File: OfflinePageUtils.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Reloads specified tab, which should allow to open an online version of the page.
 * @param tab The tab to be reloaded.
 */
public static void reload(Tab tab) {
    // If current page is an offline page, reload it with custom behavior defined in extra
    // header respected.
    LoadUrlParams params =
            new LoadUrlParams(tab.getOriginalUrl(), PageTransition.RELOAD);
    params.setVerbatimHeaders(getOfflinePageHeaderForReload(tab));
    tab.loadUrl(params);
}
 
Example 5
Source File: Tab.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Update internal Tab state when provisional load gets committed.
 * @param url The URL that was loaded.
 * @param transitionType The transition type to the current URL.
 */
void handleDidFinishNavigation(String url, Integer transitionType) {
    mIsNativePageCommitPending = false;
    boolean isReload = (transitionType != null
            && (transitionType & PageTransition.CORE_MASK) == PageTransition.RELOAD);
    if (!maybeShowNativePage(url, isReload)) {
        showRenderedPage();
    }

    if (getInterceptNavigationDelegate() != null) {
        getInterceptNavigationDelegate().maybeUpdateNavigationHistory();
    }
}
 
Example 6
Source File: TabRedirectHandler.java    From delion with Apache License 2.0 4 votes vote down vote up
/**
 * Updates new url loading information to trace navigation.
 * A time based heuristic is used to determine if this loading is an effective redirect or not
 * if core of |pageTransType| is LINK.
 *
 * http://crbug.com/322567 : Trace navigation started from an external app.
 * http://crbug.com/331571 : Trace navigation started from user typing to do not override such
 * navigation.
 * http://crbug.com/426679 : Trace every navigation and the last committed entry index right
 * before starting the navigation.
 *
 * @param pageTransType page transition type of this loading.
 * @param isRedirect whether this loading is http redirect or not.
 * @param hasUserGesture whether this loading is started by a user gesture.
 * @param lastUserInteractionTime time when the last user interaction was made.
 * @param lastCommittedEntryIndex the last committed entry index right before this loading.
 */
public void updateNewUrlLoading(int pageTransType, boolean isRedirect, boolean hasUserGesture,
        long lastUserInteractionTime, int lastCommittedEntryIndex) {
    long prevNewUrlLoadingTime = mLastNewUrlLoadingTime;
    mLastNewUrlLoadingTime = SystemClock.elapsedRealtime();

    int pageTransitionCore = pageTransType & PageTransition.CORE_MASK;

    boolean isNewLoadingStartedByUser = false;
    boolean isFromIntent = pageTransitionCore == PageTransition.LINK
            && (pageTransType & PageTransition.FROM_API) != 0;
    if (!isRedirect) {
        if ((pageTransType & PageTransition.FORWARD_BACK) != 0) {
            isNewLoadingStartedByUser = true;
        } else if (pageTransitionCore != PageTransition.LINK) {
            isNewLoadingStartedByUser = true;
        } else if (prevNewUrlLoadingTime == INVALID_TIME || isFromIntent
                || lastUserInteractionTime > prevNewUrlLoadingTime) {
            isNewLoadingStartedByUser = true;
        }
    }

    if (isNewLoadingStartedByUser) {
        // Updates mInitialNavigationType for a new loading started by a user's gesture.
        if (isFromIntent && mInitialIntent != null) {
            mInitialNavigationType = NAVIGATION_TYPE_FROM_INTENT;
        } else {
            clearIntentHistory();
            if (pageTransitionCore == PageTransition.TYPED) {
                mInitialNavigationType = NAVIGATION_TYPE_FROM_USER_TYPING;
            } else if (pageTransitionCore == PageTransition.RELOAD
                    || (pageTransType & PageTransition.FORWARD_BACK) != 0) {
                mInitialNavigationType = NAVIGATION_TYPE_FROM_RELOAD;
            } else if (pageTransitionCore == PageTransition.LINK && !hasUserGesture) {
                mInitialNavigationType = NAVIGATION_TYPE_FROM_LINK_WITHOUT_USER_GESTURE;
            } else {
                mInitialNavigationType = NAVIGATION_TYPE_OTHER;
            }
        }
        mIsOnEffectiveRedirectChain = false;
        mLastCommittedEntryIndexBeforeStartingNavigation = lastCommittedEntryIndex;
        mShouldNotOverrideUrlLoadingUntilNewUrlLoading = false;
    } else if (mInitialNavigationType != NAVIGATION_TYPE_NONE) {
        // Redirect chain starts from the second url loading.
        mIsOnEffectiveRedirectChain = true;
    }
}
 
Example 7
Source File: TabRedirectHandler.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
/**
 * Updates new url loading information to trace navigation.
 * A time based heuristic is used to determine if this loading is an effective redirect or not
 * if core of |pageTransType| is LINK.
 *
 * http://crbug.com/322567 : Trace navigation started from an external app.
 * http://crbug.com/331571 : Trace navigation started from user typing to do not override such
 * navigation.
 * http://crbug.com/426679 : Trace every navigation and the last committed entry index right
 * before starting the navigation.
 *
 * @param pageTransType page transition type of this loading.
 * @param isRedirect whether this loading is http redirect or not.
 * @param hasUserGesture whether this loading is started by a user gesture.
 * @param lastUserInteractionTime time when the last user interaction was made.
 * @param lastCommittedEntryIndex the last committed entry index right before this loading.
 */
public void updateNewUrlLoading(int pageTransType, boolean isRedirect, boolean hasUserGesture,
        long lastUserInteractionTime, int lastCommittedEntryIndex) {
    long prevNewUrlLoadingTime = mLastNewUrlLoadingTime;
    mLastNewUrlLoadingTime = SystemClock.elapsedRealtime();

    int pageTransitionCore = pageTransType & PageTransition.CORE_MASK;

    boolean isNewLoadingStartedByUser = false;
    boolean isFromIntent = pageTransitionCore == PageTransition.LINK
            && (pageTransType & PageTransition.FROM_API) != 0;
    if (!isRedirect) {
        if ((pageTransType & PageTransition.FORWARD_BACK) != 0) {
            isNewLoadingStartedByUser = true;
        } else if (pageTransitionCore != PageTransition.LINK) {
            isNewLoadingStartedByUser = true;
        } else if (prevNewUrlLoadingTime == INVALID_TIME || isFromIntent
                || lastUserInteractionTime > prevNewUrlLoadingTime) {
            isNewLoadingStartedByUser = true;
        }
    }

    if (isNewLoadingStartedByUser) {
        // Updates mInitialNavigationType for a new loading started by a user's gesture.
        if (isFromIntent && mInitialIntent != null) {
            mInitialNavigationType = NAVIGATION_TYPE_FROM_INTENT;
        } else {
            clearIntentHistory();
            if (pageTransitionCore == PageTransition.TYPED) {
                mInitialNavigationType = NAVIGATION_TYPE_FROM_USER_TYPING;
            } else if (pageTransitionCore == PageTransition.RELOAD
                    || (pageTransType & PageTransition.FORWARD_BACK) != 0) {
                mInitialNavigationType = NAVIGATION_TYPE_FROM_RELOAD;
            } else if (pageTransitionCore == PageTransition.LINK && !hasUserGesture) {
                mInitialNavigationType = NAVIGATION_TYPE_FROM_LINK_WITHOUT_USER_GESTURE;
            } else {
                mInitialNavigationType = NAVIGATION_TYPE_OTHER;
            }
        }
        mIsOnEffectiveRedirectChain = false;
        mLastCommittedEntryIndexBeforeStartingNavigation = lastCommittedEntryIndex;
        mShouldNotOverrideUrlLoadingUntilNewUrlLoading = false;
    } else if (mInitialNavigationType != NAVIGATION_TYPE_NONE) {
        // Redirect chain starts from the second url loading.
        mIsOnEffectiveRedirectChain = true;
    }
}
 
Example 8
Source File: TabRedirectHandler.java    From 365browser with Apache License 2.0 4 votes vote down vote up
/**
 * Updates new url loading information to trace navigation.
 * A time based heuristic is used to determine if this loading is an effective redirect or not
 * if core of |pageTransType| is LINK.
 *
 * http://crbug.com/322567 : Trace navigation started from an external app.
 * http://crbug.com/331571 : Trace navigation started from user typing to do not override such
 * navigation.
 * http://crbug.com/426679 : Trace every navigation and the last committed entry index right
 * before starting the navigation.
 *
 * @param pageTransType page transition type of this loading.
 * @param isRedirect whether this loading is http redirect or not.
 * @param hasUserGesture whether this loading is started by a user gesture.
 * @param lastUserInteractionTime time when the last user interaction was made.
 * @param lastCommittedEntryIndex the last committed entry index right before this loading.
 */
public void updateNewUrlLoading(int pageTransType, boolean isRedirect, boolean hasUserGesture,
        long lastUserInteractionTime, int lastCommittedEntryIndex) {
    long prevNewUrlLoadingTime = mLastNewUrlLoadingTime;
    mLastNewUrlLoadingTime = SystemClock.elapsedRealtime();

    int pageTransitionCore = pageTransType & PageTransition.CORE_MASK;

    boolean isNewLoadingStartedByUser = false;
    boolean isFromIntent = pageTransitionCore == PageTransition.LINK
            && (pageTransType & PageTransition.FROM_API) != 0;
    if (!isRedirect) {
        if ((pageTransType & PageTransition.FORWARD_BACK) != 0) {
            isNewLoadingStartedByUser = true;
        } else if (pageTransitionCore != PageTransition.LINK) {
            isNewLoadingStartedByUser = true;
        } else if (prevNewUrlLoadingTime == INVALID_TIME || isFromIntent
                || lastUserInteractionTime > prevNewUrlLoadingTime) {
            isNewLoadingStartedByUser = true;
        }
    }

    if (isNewLoadingStartedByUser) {
        // Updates mInitialNavigationType for a new loading started by a user's gesture.
        if (isFromIntent && mInitialIntent != null) {
            mInitialNavigationType = NAVIGATION_TYPE_FROM_INTENT;
        } else {
            clearIntentHistory();
            if (pageTransitionCore == PageTransition.TYPED) {
                mInitialNavigationType = NAVIGATION_TYPE_FROM_USER_TYPING;
            } else if (pageTransitionCore == PageTransition.RELOAD
                    || (pageTransType & PageTransition.FORWARD_BACK) != 0) {
                mInitialNavigationType = NAVIGATION_TYPE_FROM_RELOAD;
            } else if (pageTransitionCore == PageTransition.LINK && !hasUserGesture) {
                mInitialNavigationType = NAVIGATION_TYPE_FROM_LINK_WITHOUT_USER_GESTURE;
            } else {
                mInitialNavigationType = NAVIGATION_TYPE_OTHER;
            }
        }
        mIsOnEffectiveRedirectChain = false;
        mLastCommittedEntryIndexBeforeStartingNavigation = lastCommittedEntryIndex;
        mShouldNotOverrideUrlLoadingUntilNewUrlLoading = false;
    } else if (mInitialNavigationType != NAVIGATION_TYPE_NONE) {
        // Redirect chain starts from the second url loading.
        mIsOnEffectiveRedirectChain = true;
    }
}