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

Unified Diff: chrome/browser/app_controller_mac.mm

Issue 585653002: After locking a profile and showing the User Manager, make Guest the active profile (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: don't do anything if you're already a guest profile Created 6 years, 3 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 | « chrome/browser/app_controller_mac.h ('k') | chrome/browser/profiles/profile_info_cache.h » ('j') | 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 e5d1bdb2c6384e29a8b50463bc4093dc57327496..5f4b19248585f3f15bfb1a7810c082adae521261 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)
« no previous file with comments | « chrome/browser/app_controller_mac.h ('k') | chrome/browser/profiles/profile_info_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698