Commit 0fddfdbf authored by Mihai Sardarescu's avatar Mihai Sardarescu Committed by Chromium LUCI CQ

Show the profile picker when the application is existed.

Per https://bugs.chromium.org/p/chromium/issues/detail?id=1166192#c10,
the product decision was to always show the profile picker on
start-up instead of restoring the session. This CL shows the profile
picker even instead of restoring the session.

Note: The user has a choice to never show the profile picker on start-up
(and restore their session) -  they just have to select
"Don't show on start-up" on the profile picker UI.

Bug: 1166192

Change-Id: I853a227abfff7f7fe7f24c07c4166ef553d4b75c
Fixed: 1166192
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2629268Reviewed-by: default avatarTommy Martino <tmartino@chromium.org>
Reviewed-by: default avatarJan Krcal <jkrcal@chromium.org>
Commit-Queue: Mihai Sardarescu <msarda@chromium.org>
Auto-Submit: Mihai Sardarescu <msarda@chromium.org>
Cr-Commit-Position: refs/heads/master@{#845703}
parent 0f58149d
......@@ -285,10 +285,6 @@ bool ShouldShowProfilePickerAtProcessLaunch(
#if BUILDFLAG(IS_CHROMEOS_ASH)
return false;
#else
// If multiple profiles get restored, do not show the picker.
if (!profile_manager->GetLastOpenedProfiles().empty())
return false;
// Don't show the picker if a certain profile (or an incognito window in the
// default profile) is explicitly requested.
if (profiles::IsGuestModeRequested(command_line,
......@@ -949,6 +945,20 @@ bool StartupBrowserCreator::LaunchBrowserForLastProfiles(
command_line.HasSwitch(switches::kNotificationLaunchId);
#endif // defined(OS_WIN)
// TODO(crbug.com/1150326) Calling ShouldShowProfilePickerAtProcessLaunch()
// a second time here duplicates the logic to show the profile picker. The
// decision to show the picker should instead be on the previous call to
// ShouldShowProfilePickerAtProcessLaunch() issued from
// GetStartupProfilePath().
if (ShouldShowProfilePickerAtProcessLaunch(
g_browser_process->profile_manager(), command_line) &&
last_used_profile && last_used_profile->IsGuestSession()) {
// The guest session is used to indicate the the profile picker should be
// displayed on start-up. See GetStartupProfilePath().
ShowUserManager(/*is_process_startup=*/process_startup);
return true;
}
// |last_opened_profiles| will be empty in the following circumstances:
// - This is the first launch. |last_used_profile| is the initial profile.
// - The user exited the browser by closing all windows for all profiles.
......
......@@ -2186,8 +2186,9 @@ INSTANTIATE_TEST_SUITE_P(
/*switch_name=*/base::nullopt,
/*switch_value_ascii=*/base::nullopt,
/*url_arg=*/GURL("https://www.foo.com/")},
// Picker should also not be shown in session restore.
ProfilePickerSetup{/*expected_to_show=*/false,
// Regression test for http://crbug.com/1166192
// Picker should be shown even in case of session restore.
ProfilePickerSetup{/*expected_to_show=*/true,
/*switch_name=*/base::nullopt,
/*switch_value_ascii=*/base::nullopt,
/*url_arg=*/base::nullopt,
......
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