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 { ...@@ -113,8 +113,10 @@ public class TabGroupUiMediator {
@Override @Override
public void didAddTab(Tab tab, int type) { 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; return;
}
resetTabStripWithRelatedTabsForId(tab.getId()); resetTabStripWithRelatedTabsForId(tab.getId());
} }
...@@ -127,8 +129,9 @@ public class TabGroupUiMediator { ...@@ -127,8 +129,9 @@ public class TabGroupUiMediator {
@Override @Override
public void tabClosureUndone(Tab tab) { public void tabClosureUndone(Tab tab) {
if (!mIsTabGroupUiVisible && !mIsShowingOverViewMode) if (!mIsTabGroupUiVisible && !mIsShowingOverViewMode) {
resetTabStripWithRelatedTabsForId(tab.getId()); resetTabStripWithRelatedTabsForId(tab.getId());
}
} }
}; };
mOverviewModeObserver = new EmptyOverviewModeObserver() { mOverviewModeObserver = new EmptyOverviewModeObserver() {
......
...@@ -845,14 +845,16 @@ public class ChromeTabbedActivity extends ChromeActivity implements ScreenshotMo ...@@ -845,14 +845,16 @@ public class ChromeTabbedActivity extends ChromeActivity implements ScreenshotMo
mOverviewModeObserver = new EmptyOverviewModeObserver() { mOverviewModeObserver = new EmptyOverviewModeObserver() {
@Override @Override
public void onOverviewModeStartedShowing(boolean showToolbar) { public void onOverviewModeStartedShowing(boolean showToolbar) {
if (getAssistStatusHandler() != null) if (getAssistStatusHandler() != null) {
getAssistStatusHandler().updateAssistState(); getAssistStatusHandler().updateAssistState();
}
} }
@Override @Override
public void onOverviewModeFinishedHiding() { public void onOverviewModeFinishedHiding() {
if (getAssistStatusHandler() != null) if (getAssistStatusHandler() != null) {
getAssistStatusHandler().updateAssistState(); getAssistStatusHandler().updateAssistState();
}
} }
}; };
mOverviewModeController.addOverviewModeObserver(mOverviewModeObserver); mOverviewModeController.addOverviewModeObserver(mOverviewModeObserver);
...@@ -1291,7 +1293,7 @@ public class ChromeTabbedActivity extends ChromeActivity implements ScreenshotMo ...@@ -1291,7 +1293,7 @@ public class ChromeTabbedActivity extends ChromeActivity implements ScreenshotMo
"MobileStartup.LoadedHomepageOnColdStart", startupHomepageIsNtp); "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 // If we didn't call setInitialOverviewState() in startWithNative() because
// mPendingInitialTabCreation was true then do so now. // mPendingInitialTabCreation was true then do so now.
......
...@@ -154,8 +154,10 @@ public class LayoutManager implements LayoutUpdateHost, LayoutProvider, ...@@ -154,8 +154,10 @@ public class LayoutManager implements LayoutUpdateHost, LayoutProvider,
// Open the new tab // Open the new tab
if (type == TabLaunchType.FROM_RESTORE || type == TabLaunchType.FROM_REPARENTING if (type == TabLaunchType.FROM_RESTORE || type == TabLaunchType.FROM_REPARENTING
|| type == TabLaunchType.FROM_EXTERNAL_APP || type == TabLaunchType.FROM_EXTERNAL_APP
|| type == TabLaunchType.FROM_LAUNCHER_SHORTCUT) || type == TabLaunchType.FROM_LAUNCHER_SHORTCUT
|| type == TabLaunchType.FROM_STARTUP) {
return; return;
}
tabCreating(getTabModelSelector().getCurrentTabId(), tab.getUrl(), tab.isIncognito()); tabCreating(getTabModelSelector().getCurrentTabId(), tab.getUrl(), tab.isIncognito());
} }
......
...@@ -318,7 +318,10 @@ public class TabState { ...@@ -318,7 +318,10 @@ public class TabState {
} }
try { try {
tabState.tabLaunchTypeAtCreation = stream.readInt(); 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) { } catch (EOFException eof) {
tabState.tabLaunchTypeAtCreation = null; tabState.tabLaunchTypeAtCreation = null;
Log.w(TAG, Log.w(TAG,
......
...@@ -326,6 +326,7 @@ public class ChromeTabCreator extends TabCreatorManager.TabCreator { ...@@ -326,6 +326,7 @@ public class ChromeTabCreator extends TabCreatorManager.TabCreator {
transition = PageTransition.LINK | PageTransition.FROM_API; transition = PageTransition.LINK | PageTransition.FROM_API;
break; break;
case TabLaunchType.FROM_CHROME_UI: case TabLaunchType.FROM_CHROME_UI:
case TabLaunchType.FROM_STARTUP:
case TabLaunchType.FROM_LAUNCHER_SHORTCUT: case TabLaunchType.FROM_LAUNCHER_SHORTCUT:
case TabLaunchType.FROM_LAUNCH_NEW_INCOGNITO_TAB: case TabLaunchType.FROM_LAUNCH_NEW_INCOGNITO_TAB:
transition = PageTransition.AUTO_TOPLEVEL; transition = PageTransition.AUTO_TOPLEVEL;
......
...@@ -82,6 +82,8 @@ class TabModel : public content::NotificationObserver { ...@@ -82,6 +82,8 @@ class TabModel : public content::NotificationObserver {
FROM_BROWSER_ACTIONS, FROM_BROWSER_ACTIONS,
// Opened by an external application launching a new Chrome incognito tab. // Opened by an external application launching a new Chrome incognito tab.
FROM_LAUNCH_NEW_INCOGNITO_TAB, FROM_LAUNCH_NEW_INCOGNITO_TAB,
// Opened a non-restored tab during the startup process
FROM_STARTUP,
// Must be last. // Must be last.
SIZE 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