Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(604)

Unified Diff: chrome/browser/ui/startup/startup_browser_creator.cc

Issue 2582123002: Disable --load-and-launch-app, --load-apps and --cloud-print-file if last_used_profile is not avail… (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/startup/startup_browser_creator.cc
diff --git a/chrome/browser/ui/startup/startup_browser_creator.cc b/chrome/browser/ui/startup/startup_browser_creator.cc
index 9caec3b3b51986a3d74f665f9aa47bbd0971989f..0301388c14a786c24c2d22685d1636bb319ed72f 100644
--- a/chrome/browser/ui/startup/startup_browser_creator.cc
+++ b/chrome/browser/ui/startup/startup_browser_creator.cc
@@ -262,15 +262,9 @@ void DumpBrowserHistograms(const base::FilePath& output_file) {
static_cast<int>(output_string.size()));
}
-// Shows the User Manager on startup if the last used profile must sign in or
-// if the last used profile was the guest or system profile.
-// Returns true if the User Manager was shown, false otherwise.
-bool ShowUserManagerOnStartupIfNeeded(
- Profile* last_used_profile, const base::CommandLine& command_line) {
-#if defined(OS_CHROMEOS)
- // ChromeOS never shows the User Manager on startup.
- return false;
-#else
Peter Kasting 2016/12/20 01:43:49 It's not obvious to me from the new callers whethe
zmin 2016/12/20 20:32:14 I have moved the #ifdef to ShouldShowUserManagerOn
+// Return true if the last used profile must sign in or the last used profile
Peter Kasting 2016/12/20 01:43:49 Nit: Return -> returns
zmin 2016/12/20 20:32:13 Done.
+// was the guest or system profile. Otherwise, return false.
Peter Kasting 2016/12/20 01:43:49 Nit: Remove last sentence, it's implied. This com
zmin 2016/12/20 20:32:13 Done.
+bool ShouldShowUserManagerOnStartup(Profile* last_used_profile) {
ProfileAttributesEntry* entry = nullptr;
bool has_entry =
g_browser_process->profile_manager()
@@ -289,6 +283,22 @@ bool ShowUserManagerOnStartupIfNeeded(
return false;
}
}
+ return true;
+}
+
+// Shows the User Manager on startup if the last used profile must sign in or
+// if the last used profile was the guest or system profile.
+// Returns true if the User Manager was shown, false otherwise.
Peter Kasting 2016/12/20 01:43:49 Nit: Or just "Returns whether the User Manager was
zmin 2016/12/20 20:32:14 Done.
+bool ShowUserManagerOnStartupIfNeeded(Profile* last_used_profile,
+ const base::CommandLine& command_line) {
+#if defined(OS_CHROMEOS)
+ // ChromeOS never shows the User Manager on startup.
+ return false;
+#else
+
+ if (!ShouldShowUserManagerOnStartup(last_used_profile)) {
Peter Kasting 2016/12/20 01:43:49 Nit: {} unnecessary (and inconsistent with other p
zmin 2016/12/20 20:32:13 Done.
+ return false;
+ }
// Show the User Manager.
profiles::UserManagerAction action =
@@ -587,11 +597,14 @@ bool StartupBrowserCreator::ProcessCmdLineImpl(
}
bool silent_launch = false;
+ bool should_show_user_manager =
+ ShouldShowUserManagerOnStartup(last_used_profile);
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
// If we are just displaying a print dialog we shouldn't open browser
// windows.
if (command_line.HasSwitch(switches::kCloudPrintFile) &&
+ !should_show_user_manager &&
print_dialog_cloud::CreatePrintDialogFromCommandLine(last_used_profile,
command_line)) {
silent_launch = true;
@@ -683,6 +696,7 @@ bool StartupBrowserCreator::ProcessCmdLineImpl(
return true;
if (command_line.HasSwitch(extensions::switches::kLoadApps) &&
+ !should_show_user_manager &&
!IncognitoModePrefs::ShouldLaunchIncognito(
command_line, last_used_profile->GetPrefs())) {
if (!ProcessLoadApps(command_line, cur_dir, last_used_profile))
@@ -699,6 +713,7 @@ bool StartupBrowserCreator::ProcessCmdLineImpl(
// Check for --load-and-launch-app.
if (command_line.HasSwitch(apps::kLoadAndLaunchApp) &&
+ !should_show_user_manager &&
!IncognitoModePrefs::ShouldLaunchIncognito(
command_line, last_used_profile->GetPrefs())) {
base::CommandLine::StringType path =
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698