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) |