Chromium Code Reviews| 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..237973d8d0507b7eb18e214111a0a44e3ca113a6 100644 |
| --- a/chrome/browser/ui/startup/startup_browser_creator.cc |
| +++ b/chrome/browser/ui/startup/startup_browser_creator.cc |
| @@ -633,15 +633,25 @@ 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). |
| + size_t guest_browsers = last_used_profile->IsGuestSession() ? |
| + chrome::GetTotalBrowserCountForProfile( |
| + last_used_profile->GetOffTheRecordProfile()) : -1; |
|
sky
2014/10/30 21:17:51
I suspect the -1 to a size_t is going to cause war
noms (inactive)
2014/10/31 19:52:10
Done. Also fixed the logic a bit (there needs to b
|
| + if (signin_required || (guest_browsers == 0)) { |
| 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; |