| Index: chrome/browser/app_controller_mac.mm
|
| diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm
|
| index 70b0707c5dea2c852de1dd84aee4dbdbcca41080..f3227efd01216acbde28a52d91768bb025f2acef 100644
|
| --- a/chrome/browser/app_controller_mac.mm
|
| +++ b/chrome/browser/app_controller_mac.mm
|
| @@ -955,7 +955,7 @@ class AppControllerProfileObserver : public ProfileInfoCacheObserver {
|
| // check, otherwise it should have been disabled in the UI in
|
| // |-validateUserInterfaceItem:|.
|
| - (void)commandDispatch:(id)sender {
|
| - Profile* lastProfile = [self lastProfile];
|
| + Profile* lastProfile = [self safeLastProfileForNewWindows];
|
|
|
| // Handle the case where we're dispatching a command from a sender that's in a
|
| // browser window. This means that the command came from a background window
|
| @@ -1290,6 +1290,16 @@ class AppControllerProfileObserver : public ProfileInfoCacheObserver {
|
| *CommandLine::ForCurrentProcess()));
|
| }
|
|
|
| +- (Profile*)safeLastProfileForNewWindows {
|
| + Profile* profile = [self lastProfile];
|
| +
|
| + // Guest sessions must always be OffTheRecord. Use that when opening windows.
|
| + if (profile->IsGuestSession())
|
| + return profile->GetOffTheRecordProfile();
|
| +
|
| + return profile;
|
| +}
|
| +
|
| // Various methods to open URLs that we get in a native fashion. We use
|
| // StartupBrowserCreator here because on the other platforms, URLs to open come
|
| // through the ProcessSingleton, and it calls StartupBrowserCreator. It's best
|
| @@ -1353,7 +1363,7 @@ class AppControllerProfileObserver : public ProfileInfoCacheObserver {
|
| chrome::ShowSettings(browser);
|
| } else {
|
| // No browser window, so create one for the options tab.
|
| - chrome::OpenOptionsWindow([self lastProfile]);
|
| + chrome::OpenOptionsWindow([self safeLastProfileForNewWindows]);
|
| }
|
| }
|
|
|
| @@ -1362,7 +1372,7 @@ class AppControllerProfileObserver : public ProfileInfoCacheObserver {
|
| chrome::ShowAboutChrome(browser);
|
| } else {
|
| // No browser window, so create one for the about tab.
|
| - chrome::OpenAboutWindow([self lastProfile]);
|
| + chrome::OpenAboutWindow([self safeLastProfileForNewWindows]);
|
| }
|
| }
|
|
|
|
|