Commit eeac25b9 authored by gogerald's avatar gogerald Committed by Commit Bot

[StartSurface] setInitialOverviewState after onStartWithNative

This CL also fixes the issues that
1, MobileStartup.UserEnteredTabSwitcher is not recorded when onStartWithNative is
called earlier than createInitialTab

Bug: 1048318
Change-Id: I3549ad1fb250046fe293dd2437375abced1254e0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2036253
Commit-Queue: Ganggui Tang <gogerald@chromium.org>
Reviewed-by: default avatarYusuf Ozuysal <yusufo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#738429}
parent 2c8f8ff6
...@@ -891,10 +891,6 @@ public class ChromeTabbedActivity extends ChromeActivity { ...@@ -891,10 +891,6 @@ public class ChromeTabbedActivity extends ChromeActivity {
// showing a glimpse of the tab selector during start up. // showing a glimpse of the tab selector during start up.
if (!mPendingInitialTabCreation) setInitialOverviewState(); if (!mPendingInitialTabCreation) setInitialOverviewState();
if (isMainIntentFromLauncher(getIntent()) && isInOverviewMode()) {
RecordUserAction.record("MobileStartup.UserEnteredTabSwitcher");
}
resetSavedInstanceState(); resetSavedInstanceState();
} }
...@@ -988,6 +984,10 @@ public class ChromeTabbedActivity extends ChromeActivity { ...@@ -988,6 +984,10 @@ public class ChromeTabbedActivity extends ChromeActivity {
if (getActivityTab() == null && !isOverviewVisible) { if (getActivityTab() == null && !isOverviewVisible) {
showOverview(OverviewModeState.SHOWING_START); showOverview(OverviewModeState.SHOWING_START);
} }
if (isMainIntentFromLauncher(getIntent()) && mOverviewModeController.overviewVisible()) {
RecordUserAction.record("MobileStartup.UserEnteredTabSwitcher");
}
} }
private boolean shouldShowTabSwitcherOnStart() { private boolean shouldShowTabSwitcherOnStart() {
...@@ -1193,24 +1193,24 @@ public class ChromeTabbedActivity extends ChromeActivity { ...@@ -1193,24 +1193,24 @@ public class ChromeTabbedActivity extends ChromeActivity {
// If the grid tab switcher is enabled and the tab switcher will be shown on start, // If the grid tab switcher is enabled and the tab switcher will be shown on start,
// do not create a new tab. With the grid, creating a new tab is now a one tap action. // do not create a new tab. With the grid, creating a new tab is now a one tap action.
if (shouldShowTabSwitcherOnStart() && CachedFeatureFlags.isGridTabSwitcherEnabled()) return; if (!(shouldShowTabSwitcherOnStart() && CachedFeatureFlags.isGridTabSwitcherEnabled())) {
String url = HomepageManager.getHomepageUri();
String url = HomepageManager.getHomepageUri(); if (TextUtils.isEmpty(url)) {
if (TextUtils.isEmpty(url)) {
url = UrlConstants.NTP_URL;
} else {
boolean startupHomepageIsNtp = false;
// Migrate legacy NTP URLs (chrome://newtab) to the newer format
// (chrome-native://newtab)
if (NewTabPage.isNTPUrl(url)) {
url = UrlConstants.NTP_URL; url = UrlConstants.NTP_URL;
startupHomepageIsNtp = true; } else {
boolean startupHomepageIsNtp = false;
// Migrate legacy NTP URLs (chrome://newtab) to the newer format
// (chrome-native://newtab)
if (NewTabPage.isNTPUrl(url)) {
url = UrlConstants.NTP_URL;
startupHomepageIsNtp = true;
}
RecordHistogram.recordBooleanHistogram(
"MobileStartup.LoadedHomepageOnColdStart", startupHomepageIsNtp);
} }
RecordHistogram.recordBooleanHistogram(
"MobileStartup.LoadedHomepageOnColdStart", startupHomepageIsNtp);
}
getTabCreator(false).launchUrl(url, TabLaunchType.FROM_STARTUP); 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.
......
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