| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "chrome/browser/ui/cocoa/profiles/avatar_button.h" | 5 #import "chrome/browser/ui/cocoa/profiles/avatar_button.h" |
| 6 | 6 |
| 7 @interface AvatarButton (Private) | 7 @interface AvatarButton (Private) |
| 8 | 8 |
| 9 - (void)rightMouseDown:(NSEvent*)event; | 9 - (void)rightMouseDown:(NSEvent*)event; |
| 10 - (void)performRightClick; | 10 - (void)performRightClick; |
| 11 | 11 |
| 12 @end | 12 @end |
| 13 | 13 |
| 14 @implementation AvatarButton | 14 @implementation AvatarButton |
| 15 | 15 |
| 16 @synthesize isActive = isActive_; |
| 17 |
| 16 // Overrides -rightMouseDown and implements a custom mouse tracking loop. | 18 // Overrides -rightMouseDown and implements a custom mouse tracking loop. |
| 17 - (void)rightMouseDown:(NSEvent*)event { | 19 - (void)rightMouseDown:(NSEvent*)event { |
| 18 NSEvent* nextEvent = event; | 20 NSEvent* nextEvent = event; |
| 19 BOOL mouseInBounds = NO; | 21 BOOL mouseInBounds = NO; |
| 20 hoverState_ = kHoverStateMouseDown; | 22 hoverState_ = kHoverStateMouseDown; |
| 21 | 23 |
| 22 do { | 24 do { |
| 23 nextEvent = [[self window] | 25 nextEvent = [[self window] |
| 24 nextEventMatchingMask:NSRightMouseDraggedMask | | 26 nextEventMatchingMask:NSRightMouseDraggedMask | |
| 25 NSRightMouseUpMask]; | 27 NSRightMouseUpMask]; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 38 } | 40 } |
| 39 | 41 |
| 40 - (void)performRightClick { | 42 - (void)performRightClick { |
| 41 [[super target] performSelector:rightAction_ withObject:self]; | 43 [[super target] performSelector:rightAction_ withObject:self]; |
| 42 } | 44 } |
| 43 | 45 |
| 44 - (void)setRightAction:(SEL)selector { | 46 - (void)setRightAction:(SEL)selector { |
| 45 rightAction_ = selector; | 47 rightAction_ = selector; |
| 46 } | 48 } |
| 47 | 49 |
| 50 - (void)setIsActive:(BOOL)isActive { |
| 51 BOOL activeChanged = isActive_ != isActive; |
| 52 isActive_ = isActive; |
| 53 [self setNeedsDisplay:activeChanged]; |
| 54 } |
| 55 |
| 48 @end | 56 @end |
| OLD | NEW |