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

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

Issue 661603007: Fix re-opening Chrome after the last active profile was a Guest profile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months 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 20f8ceacbc74547c6f0362231cbd9500af1882bd..ab5f471aeee0f9690fa53e8bc6bb701c1de927dc 100644
--- a/chrome/browser/ui/startup/startup_browser_creator.cc
+++ b/chrome/browser/ui/startup/startup_browser_creator.cc
@@ -628,6 +628,8 @@ bool StartupBrowserCreator::ProcessCmdLineImpl(
last_used_profile->GetPath());
bool signin_required = profile_index != std::string::npos &&
profile_info.ProfileIsSigninRequiredAtIndex(profile_index);
+
+ // Guest or locked profiles cannot be re-opened on startup.
if (signin_required || last_used_profile->IsGuestSession()) {
UserManager::Show(base::FilePath(),
profiles::USER_MANAGER_NO_TUTORIAL,
@@ -641,6 +643,16 @@ bool StartupBrowserCreator::ProcessCmdLineImpl(
return false;
}
} else {
+ // Guest profiles should not be reopened on startup. This can happen if
+ // the last used profile was a Guest, but other profiles were also open
+ // when Chrome was closed. In this case, pick a different open profile
+ // to be the active one, since the Guest profile is never added to the list
+ // of open profiles.
+ if (switches::IsNewAvatarMenu() && last_used_profile->IsGuestSession()) {
+ DCHECK(!last_opened_profiles[0]->IsGuestSession());
+ last_used_profile = last_opened_profiles[0];
sky 2014/10/16 19:51:12 How do you know last_opened_profiles isn't a guest
noms (inactive) 2014/10/16 19:57:05 Only non-off-the-record profiles are added to the
+ }
+
// Launch the last used profile with the full command line, and the other
// opened profiles without the URLs to launch.
CommandLine command_line_without_urls(command_line.GetProgram());
@@ -663,11 +675,6 @@ bool StartupBrowserCreator::ProcessCmdLineImpl(
!HasPendingUncleanExit(*it))
continue;
- // Don't re-open a browser window for the guest profile.
- if (switches::IsNewAvatarMenu() &&
sky 2014/10/16 19:51:12 Can't this still happen?
noms (inactive) 2014/10/16 19:57:05 No, since none of the profiles in last_opened_prof
- (*it)->IsGuestSession())
- continue;
-
if (!browser_creator->LaunchBrowser((*it == last_used_profile) ?
command_line : command_line_without_urls, *it, cur_dir,
is_process_startup, is_first_run, return_code))
@@ -677,12 +684,7 @@ bool StartupBrowserCreator::ProcessCmdLineImpl(
}
// This must be done after all profiles have been launched so the observer
// knows about all profiles to wait for before activating this one.
-
- // If the last used profile was the guest one, we didn't open it so
- // we don't need to activate it either.
- if (!switches::IsNewAvatarMenu() &&
- !last_used_profile->IsGuestSession())
- profile_launch_observer.Get().set_profile_to_activate(last_used_profile);
+ profile_launch_observer.Get().set_profile_to_activate(last_used_profile);
}
return true;
}
« 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