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

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

Issue 691063002: Reopen a Guest browser and not the User Manager if another Guest browser is already open. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: boolean nit Created 6 years, 1 month 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 b972539badf3da9b079db1ee3a62da9e72eb4b59..60f7a31663eff08b27c132f414c27cd669812230 100644
--- a/chrome/browser/ui/startup/startup_browser_creator.cc
+++ b/chrome/browser/ui/startup/startup_browser_creator.cc
@@ -633,15 +633,26 @@ bool StartupBrowserCreator::ProcessCmdLineImpl(
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()) {
+ // Guest or locked profiles cannot be re-opened on startup. The only
+ // exception is if there's already a Guest window open in a separate
+ // process (for example, launching a new browser after clicking on a
+ // downloaded file in Guest mode).
+ bool has_guest_browsers = last_used_profile->IsGuestSession() &&
+ chrome::GetTotalBrowserCountForProfile(
+ last_used_profile->GetOffTheRecordProfile()) > 0;
+ if (signin_required ||
+ (last_used_profile->IsGuestSession() && !has_guest_browsers)) {
UserManager::Show(base::FilePath(),
profiles::USER_MANAGER_NO_TUTORIAL,
profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION);
return true;
}
}
- if (!browser_creator->LaunchBrowser(command_line, last_used_profile,
+
+ Profile* profile_to_open = last_used_profile->IsGuestSession() ?
+ last_used_profile->GetOffTheRecordProfile() : last_used_profile;
+
+ if (!browser_creator->LaunchBrowser(command_line, profile_to_open,
cur_dir, is_process_startup,
is_first_run, return_code)) {
return false;
« 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