Java Code Examples for org.chromium.ui.base.PageTransition#FORWARD_BACK
The following examples show how to use
org.chromium.ui.base.PageTransition#FORWARD_BACK .
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: TabRedirectHandler.java From delion with Apache License 2.0 | 4 votes |
/** * 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 2
Source File: TabRedirectHandler.java From AndroidChromium with Apache License 2.0 | 4 votes |
/** * 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 3
Source File: TabRedirectHandler.java From 365browser with Apache License 2.0 | 4 votes |
/** * 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; } }