Skip to content

Commit

Permalink
Revert 207409 "[Mac][MC] Re-add the global event monitor to clos..."
Browse files Browse the repository at this point in the history
> [Mac][MC] Re-add the global event monitor to close the bubble.
> 
> This is needed because clicking on other NSStatusItems and menubar extras does
> not generate a -windowDidResignKey: notification.
> 
> BUG=243128
> TEST=See comment 8 in the bug for steps.
> R=dewittj@chromium.org, sail@chromium.org
> 
> Review URL: https://codereview.chromium.org/17469002

TBR=rsesek@chromium.org

Review URL: https://codereview.chromium.org/17218008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207417 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
rsesek@chromium.org committed Jun 20, 2013
1 parent 40187a9 commit 21dfc34
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 20 deletions.
4 changes: 0 additions & 4 deletions ui/message_center/cocoa/tray_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ MESSAGE_CENTER_EXPORT

// View controller that provides this window's content.
scoped_nsobject<MCTrayViewController> viewController_;

// An event monitor that listens for clicks outside the tray window to cause
// it to close.
id clickEventMonitor_;
}

// Designated initializer.
Expand Down
16 changes: 0 additions & 16 deletions ui/message_center/cocoa/tray_controller.mm
Original file line number Diff line number Diff line change
Expand Up @@ -48,26 +48,10 @@ - (id)initWithMessageCenterTray:(message_center::MessageCenterTray*)tray {
NSView* contentView = [viewController_ view];
[window setFrame:[contentView frame] display:NO];
[window setContentView:contentView];

// The global event monitor will close the tray in response to events
// delivered to other applications, and -windowDidResignKey: will catch
// events within the application.
clickEventMonitor_ =
[NSEvent addGlobalMonitorForEventsMatchingMask:NSLeftMouseDownMask |
NSRightMouseDownMask |
NSOtherMouseDownMask
handler:^(NSEvent* event) {
[self windowDidResignKey:nil];
}];
}
return self;
}

- (void)dealloc {
[NSEvent removeMonitor:clickEventMonitor_];
[super dealloc];
}

- (void)close {
[viewController_ onWindowClosing];
[super close];
Expand Down

0 comments on commit 21dfc34

Please sign in to comment.