Chromium Code Reviews| Index: chrome/browser/ui/cocoa/info_bubble_view.mm |
| diff --git a/chrome/browser/ui/cocoa/info_bubble_view.mm b/chrome/browser/ui/cocoa/info_bubble_view.mm |
| index 90f89e971ac5ea75588909aed0593de66075bba1..81eade77d4e0d81c36eafcffdbca58452dc398a5 100644 |
| --- a/chrome/browser/ui/cocoa/info_bubble_view.mm |
| +++ b/chrome/browser/ui/cocoa/info_bubble_view.mm |
| @@ -5,6 +5,8 @@ |
| #import "chrome/browser/ui/cocoa/info_bubble_view.h" |
| #include "base/logging.h" |
| +#include "base/mac/foundation_util.h" |
| +#import "chrome/browser/ui/cocoa/info_bubble_window.h" |
| #import "third_party/google_toolbox_for_mac/src/AppKit/GTMNSBezierPath+RoundRect.h" |
| @implementation InfoBubbleView |
| @@ -23,6 +25,24 @@ |
| return self; |
| } |
| +- (BOOL)performKeyEquivalent:(NSEvent *)event { |
| + InfoBubbleWindow* info_bubble_window = |
| + base::mac::ObjCCast<InfoBubbleWindow>([self window]); |
| + if (info_bubble_window && [info_bubble_window isClosing]) { |
| + // When a keyboard shortcut is pressed, the method that handles it is |
| + // -[NSApplication _handleKeyEquivalent:], which calls the |
| + // -performKeyEquivalent methods on all windows in the window list, whether |
|
Robert Sesek
2016/01/13 21:39:50
If this is sent to all windows, why not no-op this
Avi (use Gerrit)
2016/01/13 21:53:20
Because -[NSView performKeyEquivalent] is official
|
| + // they are open or closed, shown or hidden, active or dying. If a bubble |
| + // window is closed but lingers in an autorelease pool, it might receive |
| + // unexpected requests for key commands; see <http://crbug.com/574798> for |
| + // an example. In such a case, make sure the key equivalent search stops |
| + // here rather than proceeding down the view hierarchy and tickling stale |
| + // pointers. |
| + return NO; |
| + } |
| + return [super performKeyEquivalent:event]; |
| +} |
| + |
| - (void)drawRect:(NSRect)rect { |
| // Make room for the border to be seen. |
| NSRect bounds = [self bounds]; |