Commit 495dcf2f authored by Scott Violet's avatar Scott Violet Committed by Commit Bot

Android: cleanup of transition types

This removes adding the qualifier PageTransition.FROM_API for
TabLaunchTypes of FROM_LINK and FROM_RESTORE. I believe this was
unintentional, and doesn't make sense to use FROM_API with.

This also removes FROM_API for intents that came from chrome and
launched chrome. Again, seems like we shouldn't use FROM_API for
this scenario either.

I came across this while doing the other patches. AFAIK nothing
depends upon this, just seems worth cleaning up.

BUG=none
TEST=none

Change-Id: Id89fbc0e70fb52a662ac33a55d269460677ee152
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2511853
Commit-Queue: Scott Violet <sky@chromium.org>
Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Reviewed-by: default avatarMichael Thiessen <mthiesse@chromium.org>
Cr-Commit-Position: refs/heads/master@{#823388}
parent 770ee9a5
......@@ -1221,7 +1221,8 @@ public class ChromeTabbedActivity extends ChromeActivity<ChromeActivityComponent
if (isActivityFinishingOrDestroyed()) {
return;
}
if (isFromChrome(intent, externalAppId)) {
final boolean fromChrome = isFromChrome(intent, externalAppId);
if (fromChrome) {
RecordUserAction.record("MobileTabbedModeViewIntentFromChrome");
} else {
RecordUserAction.record("MobileTabbedModeViewIntentFromApp");
......@@ -1278,7 +1279,7 @@ public class ChromeTabbedActivity extends ChromeActivity<ChromeActivityComponent
RedirectHandlerTabHelper.updateIntentInTab(currentTab, intent);
LoadUrlParams loadUrlParams =
ChromeTabbedActivity.createLoadUrlParamsForIntent(url, referer,
hasUserGesture, mIntentHandlingTimeMs, intent);
hasUserGesture, mIntentHandlingTimeMs, intent, fromChrome);
loadUrlParams.setIsRendererInitiated(isRendererInitiated);
loadUrlParams.setInitiatorOrigin(initiatorOrigin);
currentTab.loadUrl(loadUrlParams);
......@@ -1307,7 +1308,7 @@ public class ChromeTabbedActivity extends ChromeActivity<ChromeActivityComponent
LoadUrlParams loadUrlParams =
ChromeTabbedActivity.createLoadUrlParamsForIntent(url,
referer, hasUserGesture, mIntentHandlingTimeMs,
intent);
intent, fromChrome);
loadUrlParams.setVerbatimHeaders(headers);
loadUrlParams.setIsRendererInitiated(isRendererInitiated);
loadUrlParams.setInitiatorOrigin(initiatorOrigin);
......@@ -1951,11 +1952,12 @@ public class ChromeTabbedActivity extends ChromeActivity<ChromeActivityComponent
* Create a LoadUrlParams for handling a VIEW intent.
*/
private static LoadUrlParams createLoadUrlParamsForIntent(String url, String referer,
boolean hasUserGesture, long intentHandlingTimeMs, Intent intent) {
boolean hasUserGesture, long intentHandlingTimeMs, Intent intent, boolean fromChrome) {
LoadUrlParams loadUrlParams = new LoadUrlParams(url);
loadUrlParams.setIntentReceivedTimestamp(intentHandlingTimeMs);
loadUrlParams.setHasUserGesture(hasUserGesture);
int transitionType = PageTransition.LINK | PageTransition.FROM_API;
int transitionType = PageTransition.LINK;
if (!fromChrome) transitionType |= PageTransition.FROM_API;
loadUrlParams.setTransitionType(
IntentHandler.getTransitionTypeFromIntent(intent, transitionType));
if (referer != null) {
......
......@@ -433,8 +433,6 @@ public class ChromeTabCreator extends TabCreator {
private int getTransitionType(@TabLaunchType int type, Intent intent) {
int transition = PageTransition.LINK;
switch (type) {
case TabLaunchType.FROM_RESTORE:
case TabLaunchType.FROM_LINK:
case TabLaunchType.FROM_EXTERNAL_APP:
case TabLaunchType.FROM_BROWSER_ACTIONS:
transition = PageTransition.LINK | PageTransition.FROM_API;
......@@ -446,7 +444,9 @@ public class ChromeTabCreator extends TabCreator {
case TabLaunchType.FROM_LAUNCH_NEW_INCOGNITO_TAB:
transition = PageTransition.AUTO_TOPLEVEL;
break;
case TabLaunchType.FROM_LINK:
case TabLaunchType.FROM_LONGPRESS_FOREGROUND:
case TabLaunchType.FROM_RESTORE:
transition = PageTransition.LINK;
break;
case TabLaunchType.FROM_LONGPRESS_BACKGROUND:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment