Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Side by Side Diff: chrome/browser/ui/cocoa/profiles/avatar_button.mm

Issue 2459073003: [Mac] Implement an active state for the avatar button (Closed)
Patch Set: Updated comment Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/profiles/avatar_button.h ('k') | chrome/browser/ui/cocoa/profiles/avatar_button_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698