summaryrefslogtreecommitdiffstats
path: root/chrome/browser/app_controller_mac.mm
diff options
context:
space:
mode:
authornoms <noms@chromium.org>2014-09-23 08:20:16 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-23 15:20:29 +0000
commitdd5b6a619317f1e93348a71e70062275bda8e8dc (patch)
tree9cda9e43872b57243d7a809a4bd95e89f3551e00 /chrome/browser/app_controller_mac.mm
parent5ce3577e3fb5e043dc13229c06423823c60f7abc (diff)
downloadchromium_src-dd5b6a619317f1e93348a71e70062275bda8e8dc.zip
chromium_src-dd5b6a619317f1e93348a71e70062275bda8e8dc.tar.gz
chromium_src-dd5b6a619317f1e93348a71e70062275bda8e8dc.tar.bz2
After locking a profile and showing the User Manager, make Guest the active profile
This is particularly important on Mac, where unless we do this the Bookmarks/History menu bar items will reflect the last active profile (which has now been locked). On Windows this is a nice to have and to be consistent. Overall this adds an extra layer of security that you won't accidentally open a locked profile's window. BUG=412952 Review URL: https://codereview.chromium.org/585653002 Cr-Commit-Position: refs/heads/master@{#296187}
Diffstat (limited to 'chrome/browser/app_controller_mac.mm')
-rw-r--r--chrome/browser/app_controller_mac.mm73
1 files changed, 34 insertions, 39 deletions
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm
index e5d1bdb..5f4b192 100644
--- a/chrome/browser/app_controller_mac.mm
+++ b/chrome/browser/app_controller_mac.mm
@@ -217,7 +217,6 @@ bool IsProfileSignedOut(Profile* profile) {
withReply:(NSAppleEventDescriptor*)reply;
- (void)windowLayeringDidChange:(NSNotification*)inNotification;
- (void)activeSpaceDidChange:(NSNotification*)inNotification;
-- (void)windowChangedToProfile:(Profile*)profile;
- (void)checkForAnyKeyWindows;
- (BOOL)userWillWaitForInProgressDownloads:(int)downloadCount;
- (BOOL)shouldQuitWithInProgressDownloads;
@@ -639,44 +638,6 @@ class AppControllerProfileObserver : public ProfileInfoCacheObserver {
[self fixCloseMenuItemKeyEquivalents];
}
-// Called when the user has changed browser windows, meaning the backing profile
-// may have changed. This can cause a rebuild of the user-data menus. This is a
-// no-op if the new profile is the same as the current one. This will always be
-// the original profile and never incognito.
-- (void)windowChangedToProfile:(Profile*)profile {
- if (lastProfile_ == profile)
- return;
-
- // Before tearing down the menu controller bridges, return the Cocoa menus to
- // their initial state.
- if (bookmarkMenuBridge_.get())
- bookmarkMenuBridge_->ResetMenu();
- if (historyMenuBridge_.get())
- historyMenuBridge_->ResetMenu();
-
- // Rebuild the menus with the new profile.
- lastProfile_ = profile;
-
- bookmarkMenuBridge_.reset(new BookmarkMenuBridge(lastProfile_,
- [[[NSApp mainMenu] itemWithTag:IDC_BOOKMARKS_MENU] submenu]));
- // No need to |BuildMenu| here. It is done lazily upon menu access.
-
- historyMenuBridge_.reset(new HistoryMenuBridge(lastProfile_));
- historyMenuBridge_->BuildMenu();
-
- chrome::BrowserCommandController::
- UpdateSharedCommandsForIncognitoAvailability(
- menuState_.get(), lastProfile_);
- profilePrefRegistrar_.reset(new PrefChangeRegistrar());
- profilePrefRegistrar_->Init(lastProfile_->GetPrefs());
- profilePrefRegistrar_->Add(
- prefs::kIncognitoModeAvailability,
- base::Bind(&chrome::BrowserCommandController::
- UpdateSharedCommandsForIncognitoAvailability,
- menuState_.get(),
- lastProfile_));
-}
-
- (void)checkForAnyKeyWindows {
if ([NSApp keyWindow])
return;
@@ -1533,6 +1494,40 @@ class AppControllerProfileObserver : public ProfileInfoCacheObserver {
appShimMenuController_.reset([[AppShimMenuController alloc] init]);
}
+- (void)windowChangedToProfile:(Profile*)profile {
+ if (lastProfile_ == profile)
+ return;
+
+ // Before tearing down the menu controller bridges, return the Cocoa menus to
+ // their initial state.
+ if (bookmarkMenuBridge_.get())
+ bookmarkMenuBridge_->ResetMenu();
+ if (historyMenuBridge_.get())
+ historyMenuBridge_->ResetMenu();
+
+ // Rebuild the menus with the new profile.
+ lastProfile_ = profile;
+
+ bookmarkMenuBridge_.reset(new BookmarkMenuBridge(lastProfile_,
+ [[[NSApp mainMenu] itemWithTag:IDC_BOOKMARKS_MENU] submenu]));
+ // No need to |BuildMenu| here. It is done lazily upon menu access.
+
+ historyMenuBridge_.reset(new HistoryMenuBridge(lastProfile_));
+ historyMenuBridge_->BuildMenu();
+
+ chrome::BrowserCommandController::
+ UpdateSharedCommandsForIncognitoAvailability(
+ menuState_.get(), lastProfile_);
+ profilePrefRegistrar_.reset(new PrefChangeRegistrar());
+ profilePrefRegistrar_->Init(lastProfile_->GetPrefs());
+ profilePrefRegistrar_->Add(
+ prefs::kIncognitoModeAvailability,
+ base::Bind(&chrome::BrowserCommandController::
+ UpdateSharedCommandsForIncognitoAvailability,
+ menuState_.get(),
+ lastProfile_));
+}
+
- (void)applicationDidChangeScreenParameters:(NSNotification*)notification {
// During this callback the working area is not always already updated. Defer.
[self performSelector:@selector(delayedScreenParametersUpdate)