Commit 8d4eba3e authored by Jan Krcal's avatar Jan Krcal Committed by Commit Bot

[Profile picker] Skip the picker whenever opening an app

This CL makes sure the profile picker is skipped when an app is
explicitly requested using a command-line parameter.

Bug: 1123543
Change-Id: If894b3144946ea7d71bcfdf921563d65d4045cee
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2464927
Commit-Queue: Tommy Martino <tmartino@chromium.org>
Auto-Submit: Jan Krcal <jkrcal@chromium.org>
Reviewed-by: default avatarTommy Martino <tmartino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#816571}
parent 5f6fe21e
...@@ -308,6 +308,15 @@ bool ShouldShowProfilePicker(const base::CommandLine& command_line, ...@@ -308,6 +308,15 @@ bool ShouldShowProfilePicker(const base::CommandLine& command_line,
return false; return false;
} }
// Don't show the picker if an app is explicitly requested to open. This URL
// param should be ideally paired with switches::kProfileDirectory but it's
// better to err on the side of opening the last profile than to err on the
// side of not opening the app directly.
if (command_line.HasSwitch(switches::kApp) ||
command_line.HasSwitch(switches::kAppId)) {
return false;
}
// If the browser is launched due to activation on Windows native notification, // If the browser is launched due to activation on Windows native notification,
// the profile id encoded in the notification launch id should be chosen over // the profile id encoded in the notification launch id should be chosen over
// the profile picker. // the profile picker.
......
...@@ -1976,4 +1976,26 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorPickerTest, ...@@ -1976,4 +1976,26 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorPickerTest,
Browser* new_browser = FindOneOtherBrowser(browser()); Browser* new_browser = FindOneOtherBrowser(browser());
EXPECT_TRUE(new_browser); EXPECT_TRUE(new_browser);
} }
IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorPickerTest, SkipsPickerInAppMode) {
base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
command_line.AppendSwitch(switches::kApp);
StartWithTwoProfiles(command_line);
// Skips the picker and creates a new browser window.
Browser* new_browser = FindOneOtherBrowser(browser());
EXPECT_TRUE(new_browser);
}
IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorPickerTest, SkipsPickerWithAppId) {
base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
command_line.AppendSwitch(switches::kAppId);
StartWithTwoProfiles(command_line);
// Skips the picker and creates a new browser window.
Browser* new_browser = FindOneOtherBrowser(browser());
EXPECT_TRUE(new_browser);
}
#endif // !defined(OS_CHROMEOS) #endif // !defined(OS_CHROMEOS)
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