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

Unified Diff: chrome/browser/app_controller_mac.mm

Issue 230923004: Use OffTheRecord version when using Guest profiles to handle commands. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: moved guest test to separate method and called in a couple more places Created 6 years, 8 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/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]);
}
}
« 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