Index: chrome/browser/app_controller_mac.mm |
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm |
index 70ac660513c6c78302e0de7f4d43608dc8002c34..21488631af8828683c531f56f825eb8ecef10333 100644 |
--- a/chrome/browser/app_controller_mac.mm |
+++ b/chrome/browser/app_controller_mac.mm |
@@ -44,6 +44,7 @@ |
#import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h" |
#import "chrome/browser/ui/cocoa/browser_window_cocoa.h" |
#import "chrome/browser/ui/cocoa/browser_window_controller.h" |
+#import "chrome/browser/ui/cocoa/chrome_event_processing_window.h" |
#import "chrome/browser/ui/cocoa/confirm_quit_panel_controller.h" |
#import "chrome/browser/ui/cocoa/encoding_menu_controller_delegate_mac.h" |
#import "chrome/browser/ui/cocoa/history_menu_bridge.h" |
@@ -353,8 +354,7 @@ const AEEventClass kAECloudPrintUninstallClass = 'GCPu'; |
} |
// Helper routine to get the window controller if the key window is a tabbed |
-// window, or nil if not. Examples of non-tabbed windows are "about" or |
-// "preferences". |
+// window, or nil if not. For example, the "about" window is non-tabbed. |
- (TabWindowController*)keyWindowTabController { |
NSWindowController* keyWindowController = |
[[NSApp keyWindow] windowController]; |
@@ -365,8 +365,7 @@ const AEEventClass kAECloudPrintUninstallClass = 'GCPu'; |
} |
// Helper routine to get the window controller if the main window is a tabbed |
-// window, or nil if not. Examples of non-tabbed windows are "about" or |
-// "preferences". |
+// window, or nil if not. For example, the "about" window is non-tabbed. |
- (TabWindowController*)mainWindowTabController { |
NSWindowController* mainWindowController = |
[[NSApp mainWindow] windowController]; |
@@ -411,9 +410,13 @@ const AEEventClass kAECloudPrintUninstallClass = 'GCPu'; |
- (void)fixCloseMenuItemKeyEquivalents:(NSWindow*)window { |
fileMenuUpdatePending_ = NO; |
TabWindowController* tabController = [self keyWindowTabController]; |
- if (!tabController && ![NSApp keyWindow]) { |
- // There might be a small amount of time where there is no key window, |
- // so just use our main browser window if there is one. |
+ if (!tabController && |
+ (![NSApp keyWindow] || |
+ [[NSApp keyWindow] isKindOfClass:[ChromeEventProcessingWindow class]])) { |
Ilya Sherman
2011/10/15 04:31:38
This seems a little hacky, but I wasn't sure of a
Scott Hess - ex-Googler
2011/10/19 02:43:41
I agree - I think that this is EXACTLY the kind of
|
+ // If the key window is a |ChromeEventProcessingWindow| (i.e. a bubble), the |
+ // window that should handle the close menu item action is the main window. |
+ // Also, there might be a small amount of time where there is no key window; |
+ // in that case as well, just use our main browser window if there is one. |
tabController = [self mainWindowTabController]; |
Scott Hess - ex-Googler
2011/10/19 02:43:41
Wow, this whole thing seems hokey. AFAICT, the on
|
} |
BOOL hasTabs = !!tabController; |