Chromium Code Reviews| Index: chrome/browser/cocoa/tab_view.mm |
| =================================================================== |
| --- chrome/browser/cocoa/tab_view.mm (revision 16861) |
| +++ chrome/browser/cocoa/tab_view.mm (working copy) |
| @@ -17,8 +17,23 @@ |
| return self; |
| } |
| +- (void)awakeFromNib { |
| + // Set up the tracking rect for the close button mouseover. Add it |
| + // to the |closeButton_| view, but we'll handle the message ourself. |
| + // The mouseover is always enabled, because the close button works |
| + // regardless of key/main/active status. |
| + trackingArea_.reset( |
| + [[NSTrackingArea alloc] initWithRect:[closeButton_ bounds] |
| + options:NSTrackingMouseEnteredAndExited | |
| + NSTrackingActiveAlways |
| + owner:self |
|
pink (ping after 24hrs)
2009/05/27 13:07:59
are you sure this doesn't set up an ownership cycl
rohitrao (ping after 24h)
2009/05/27 23:58:50
I added logging in dealloc and verified that deall
|
| + userInfo:nil]); |
| + [closeButton_ addTrackingArea:trackingArea_.get()]; |
| +} |
| + |
| - (void)dealloc { |
| // [self gtm_unregisterForThemeNotifications]; |
| + [closeButton_ removeTrackingArea:trackingArea_.get()]; |
| [super dealloc]; |
| } |
| @@ -29,6 +44,18 @@ |
| return YES; |
| } |
| +- (void)mouseEntered:(NSEvent *)theEvent { |
| + // We only set up one tracking area, so we know any mouseEntered: |
| + // messages are for close button mouseovers. |
| + [closeButton_ setImage:[NSImage imageNamed:@"close_bar_h"]]; |
| +} |
| + |
| +- (void)mouseExited:(NSEvent *)theEvent { |
| + // We only set up one tracking area, so we know any mouseExited: |
| + // messages are for close button mouseovers. |
| + [closeButton_ setImage:[NSImage imageNamed:@"close_bar"]]; |
| +} |
| + |
| // Determines which view a click in our frame actually hit. It's either this |
| // view or our child close button. |
| - (NSView *)hitTest:(NSPoint)aPoint { |