Commit 96020cfd authored by Ted Choc's avatar Ted Choc Committed by Commit Bot

Introduce FROM_STARTUP as a TabLaunchType.

This allows the code to distinguish a tab created on startup from
tab created FROM_CHROME_UI.  We animate tabs created that use
FROM_CHROME_UI, but we do not want to do that for tabs created on
startup.

The aim is that this will fix the flakiness of the
MainIntentBehaviorMetrics.

BUG=980587

Change-Id: Id00df9944c30a2b7b120ecb29b268af8ea3618c7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1786672Reviewed-by: default avatarDavid Trainor <dtrainor@chromium.org>
Commit-Queue: Ted Choc <tedchoc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#693919}
parent 5d580fe4
......@@ -113,8 +113,10 @@ public class TabGroupUiMediator {
@Override
public void didAddTab(Tab tab, int type) {
if (type == TabLaunchType.FROM_CHROME_UI || type == TabLaunchType.FROM_RESTORE)
if (type == TabLaunchType.FROM_CHROME_UI || type == TabLaunchType.FROM_RESTORE
|| type == TabLaunchType.FROM_STARTUP) {
return;
}
resetTabStripWithRelatedTabsForId(tab.getId());
}
......@@ -127,8 +129,9 @@ public class TabGroupUiMediator {
@Override
public void tabClosureUndone(Tab tab) {
if (!mIsTabGroupUiVisible && !mIsShowingOverViewMode)
if (!mIsTabGroupUiVisible && !mIsShowingOverViewMode) {
resetTabStripWithRelatedTabsForId(tab.getId());
}
}
};
mOverviewModeObserver = new EmptyOverviewModeObserver() {
......
......@@ -845,14 +845,16 @@ public class ChromeTabbedActivity extends ChromeActivity implements ScreenshotMo
mOverviewModeObserver = new EmptyOverviewModeObserver() {
@Override
public void onOverviewModeStartedShowing(boolean showToolbar) {
if (getAssistStatusHandler() != null)
if (getAssistStatusHandler() != null) {
getAssistStatusHandler().updateAssistState();
}
}
@Override
public void onOverviewModeFinishedHiding() {
if (getAssistStatusHandler() != null)
if (getAssistStatusHandler() != null) {
getAssistStatusHandler().updateAssistState();
}
}
};
mOverviewModeController.addOverviewModeObserver(mOverviewModeObserver);
......@@ -1291,7 +1293,7 @@ public class ChromeTabbedActivity extends ChromeActivity implements ScreenshotMo
"MobileStartup.LoadedHomepageOnColdStart", startupHomepageIsNtp);
}
getTabCreator(false).launchUrl(url, TabLaunchType.FROM_CHROME_UI);
getTabCreator(false).launchUrl(url, TabLaunchType.FROM_STARTUP);
// If we didn't call setInitialOverviewState() in startWithNative() because
// mPendingInitialTabCreation was true then do so now.
......
......@@ -154,8 +154,10 @@ public class LayoutManager implements LayoutUpdateHost, LayoutProvider,
// Open the new tab
if (type == TabLaunchType.FROM_RESTORE || type == TabLaunchType.FROM_REPARENTING
|| type == TabLaunchType.FROM_EXTERNAL_APP
|| type == TabLaunchType.FROM_LAUNCHER_SHORTCUT)
|| type == TabLaunchType.FROM_LAUNCHER_SHORTCUT
|| type == TabLaunchType.FROM_STARTUP) {
return;
}
tabCreating(getTabModelSelector().getCurrentTabId(), tab.getUrl(), tab.isIncognito());
}
......
......@@ -318,7 +318,10 @@ public class TabState {
}
try {
tabState.tabLaunchTypeAtCreation = stream.readInt();
if (tabState.tabLaunchTypeAtCreation == -1) tabState.tabLaunchTypeAtCreation = null;
if (tabState.tabLaunchTypeAtCreation < 0
|| tabState.tabLaunchTypeAtCreation >= TabLaunchType.SIZE) {
tabState.tabLaunchTypeAtCreation = null;
}
} catch (EOFException eof) {
tabState.tabLaunchTypeAtCreation = null;
Log.w(TAG,
......
......@@ -326,6 +326,7 @@ public class ChromeTabCreator extends TabCreatorManager.TabCreator {
transition = PageTransition.LINK | PageTransition.FROM_API;
break;
case TabLaunchType.FROM_CHROME_UI:
case TabLaunchType.FROM_STARTUP:
case TabLaunchType.FROM_LAUNCHER_SHORTCUT:
case TabLaunchType.FROM_LAUNCH_NEW_INCOGNITO_TAB:
transition = PageTransition.AUTO_TOPLEVEL;
......
......@@ -82,6 +82,8 @@ class TabModel : public content::NotificationObserver {
FROM_BROWSER_ACTIONS,
// Opened by an external application launching a new Chrome incognito tab.
FROM_LAUNCH_NEW_INCOGNITO_TAB,
// Opened a non-restored tab during the startup process
FROM_STARTUP,
// Must be last.
SIZE
};
......
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