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

Unified Diff: chrome/browser/ui/cocoa/apps/app_shim_menu_controller_mac.mm

Issue 1114803002: Mac: App menuBars: Ignore closing windows if they are not main (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cl format Created 5 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 | chrome/browser/ui/cocoa/apps/app_shim_menu_controller_mac_browsertest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/apps/app_shim_menu_controller_mac.mm
diff --git a/chrome/browser/ui/cocoa/apps/app_shim_menu_controller_mac.mm b/chrome/browser/ui/cocoa/apps/app_shim_menu_controller_mac.mm
index d0cf82813948187494708513f629c6ac4044d0d2..7a1611802b2c222fdb0dd1b71ecd8458e00cfe42 100644
--- a/chrome/browser/ui/cocoa/apps/app_shim_menu_controller_mac.mm
+++ b/chrome/browser/ui/cocoa/apps/app_shim_menu_controller_mac.mm
@@ -394,17 +394,18 @@ void SetItemWithTagVisible(NSMenuItem* top_level_item,
else
[self removeMenuItems];
} else if ([name isEqualToString:NSWindowWillCloseNotification]) {
- // Always reset back to the Chrome menu. This once scanned [NSApp windows]
- // to predict whether we could expect another Chrome window to become main,
- // and skip the reset. However, panels need to do strange things during
- // window close to ensure panels never get chosen for key status over a
- // browser window (which is likely because they are given an elevated
- // [NSWindow level]). Trying to handle this case is not robust.
- // Unfortunately, resetting the menu to Chrome unconditionally means that
- // if another packaged app window becomes key, the menu will flicker.
- // TODO(tapted): Investigate restoring the logic when the panel code is
- // removed.
- [self removeMenuItems];
+ // If the window being closed has main status, reset back to the Chrome
+ // menu. This once scanned [NSApp windows] to predict whether we could
+ // expect another Chrome window to become main, and skip the reset. However,
+ // panels need to do strange things during window close to ensure panels
+ // never get chosen for key status over a browser window (which is likely
+ // because they are given an elevated [NSWindow level]). Trying to handle
+ // this case is not robust. Unfortunately, resetting the menu to Chrome
+ // unconditionally means that if another packaged app window becomes key,
+ // the menu will flicker. TODO(tapted): Investigate restoring the logic when
+ // the panel code is removed.
+ if ([[notification object] isMainWindow])
+ [self removeMenuItems];
} else {
NOTREACHED();
}
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/apps/app_shim_menu_controller_mac_browsertest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698