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

Unified Diff: chrome/browser/ui/cocoa/profiles/avatar_button_controller.mm

Issue 2459073003: [Mac] Implement an active state for the avatar button (Closed)
Patch Set: Updated comment Created 4 years, 2 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/cocoa/profiles/avatar_button_controller.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/profiles/avatar_button_controller.mm
diff --git a/chrome/browser/ui/cocoa/profiles/avatar_button_controller.mm b/chrome/browser/ui/cocoa/profiles/avatar_button_controller.mm
index 73c774c8ddfb3c0e519fe23b1a20c10d54e4fe0e..13e7fab50156145572600031057f433514afeca8 100644
--- a/chrome/browser/ui/cocoa/profiles/avatar_button_controller.mm
+++ b/chrome/browser/ui/cocoa/profiles/avatar_button_controller.mm
@@ -103,11 +103,11 @@ const CGFloat kTitleKern = 0.25;
- (void)drawBezelWithFrame:(NSRect)frame
inView:(NSView*)controlView {
- HoverState hoverState =
- [base::mac::ObjCCastStrict<AvatarButton>(controlView) hoverState];
+ AvatarButton* button = base::mac::ObjCCastStrict<AvatarButton>(controlView);
+ HoverState hoverState = [button hoverState];
NSColor* backgroundColor = nil;
- if (hoverState == kHoverStateMouseDown) {
+ if (hoverState == kHoverStateMouseDown || [button isActive]) {
backgroundColor = skia::SkColorToSRGBNSColor(kButtonPressedColor);
} else if (hoverState == kHoverStateMouseOver) {
backgroundColor = skia::SkColorToSRGBNSColor(kButtonHoverColor);
@@ -294,4 +294,22 @@ const CGFloat kTitleKern = 0.25;
[self updateAvatarButtonAndLayoutParent:YES];
}
+- (void)showAvatarBubbleAnchoredAt:(NSView*)anchor
+ withMode:(BrowserWindow::AvatarBubbleMode)mode
+ withServiceType:(signin::GAIAServiceType)serviceType
+ fromAccessPoint:(signin_metrics::AccessPoint)accessPoint {
+ AvatarButton* button = base::mac::ObjCCastStrict<AvatarButton>(button_);
+ [button setIsActive:YES];
+ [super showAvatarBubbleAnchoredAt:anchor
+ withMode:mode
+ withServiceType:serviceType
+ fromAccessPoint:accessPoint];
+}
+
+- (void)bubbleWillClose:(NSNotification*)notif {
+ AvatarButton* button = base::mac::ObjCCastStrict<AvatarButton>(button_);
+ [button setIsActive:NO];
+ [super bubbleWillClose:notif];
+}
+
@end
« no previous file with comments | « chrome/browser/ui/cocoa/profiles/avatar_button_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698