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

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

Issue 2552423002: [Mac] Fix for avatar button active state (Closed)
Patch Set: Removed the Fast Chooser Profile Menu code in cocoa Created 4 years 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_controller.h" 5 #import "chrome/browser/ui/cocoa/profiles/avatar_button_controller.h"
6 6
7 #include "base/mac/foundation_util.h" 7 #include "base/mac/foundation_util.h"
8 #include "base/strings/sys_string_conversions.h" 8 #include "base/strings/sys_string_conversions.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/profiles/profile_attributes_entry.h" 10 #include "chrome/browser/profiles/profile_attributes_entry.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 if (switches::IsMaterialDesignUserMenu()) 178 if (switches::IsMaterialDesignUserMenu())
179 [[avatarButton cell] setHighlightsBy:NSNoCellMask]; 179 [[avatarButton cell] setHighlightsBy:NSNoCellMask];
180 [avatarButton setBordered:YES]; 180 [avatarButton setBordered:YES];
181 181
182 if (cocoa_l10n_util::ShouldDoExperimentalRTLLayout()) 182 if (cocoa_l10n_util::ShouldDoExperimentalRTLLayout())
183 [avatarButton setAutoresizingMask:NSViewMaxXMargin | NSViewMinYMargin]; 183 [avatarButton setAutoresizingMask:NSViewMaxXMargin | NSViewMinYMargin];
184 else 184 else
185 [avatarButton setAutoresizingMask:NSViewMinXMargin | NSViewMinYMargin]; 185 [avatarButton setAutoresizingMask:NSViewMinXMargin | NSViewMinYMargin];
186 [avatarButton setTarget:self]; 186 [avatarButton setTarget:self];
187 [avatarButton setAction:@selector(buttonClicked:)]; 187 [avatarButton setAction:@selector(buttonClicked:)];
188 [avatarButton setRightAction:@selector(buttonRightClicked:)]; 188 [avatarButton setRightAction:@selector(buttonClicked:)];
189 189
190 // Check if the account already has an authentication or sync error and 190 // Check if the account already has an authentication or sync error and
191 // initialize the avatar button UI. 191 // initialize the avatar button UI.
192 hasError_ = profileObserver_->HasAvatarError(); 192 hasError_ = profileObserver_->HasAvatarError();
193 [self updateAvatarButtonAndLayoutParent:NO]; 193 [self updateAvatarButtonAndLayoutParent:NO];
194 194
195 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; 195 NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
196 [center addObserver:self 196 [center addObserver:self
197 selector:@selector(themeDidChangeNotification:) 197 selector:@selector(themeDidChangeNotification:)
198 name:kBrowserThemeDidChangeNotification 198 name:kBrowserThemeDidChangeNotification
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 291
292 - (void)setErrorStatus:(BOOL)hasError { 292 - (void)setErrorStatus:(BOOL)hasError {
293 hasError_ = hasError; 293 hasError_ = hasError;
294 [self updateAvatarButtonAndLayoutParent:YES]; 294 [self updateAvatarButtonAndLayoutParent:YES];
295 } 295 }
296 296
297 - (void)showAvatarBubbleAnchoredAt:(NSView*)anchor 297 - (void)showAvatarBubbleAnchoredAt:(NSView*)anchor
298 withMode:(BrowserWindow::AvatarBubbleMode)mode 298 withMode:(BrowserWindow::AvatarBubbleMode)mode
299 withServiceType:(signin::GAIAServiceType)serviceType 299 withServiceType:(signin::GAIAServiceType)serviceType
300 fromAccessPoint:(signin_metrics::AccessPoint)accessPoint { 300 fromAccessPoint:(signin_metrics::AccessPoint)accessPoint {
301 AvatarButton* button = base::mac::ObjCCastStrict<AvatarButton>(button_);
302 [button setIsActive:YES];
303 [super showAvatarBubbleAnchoredAt:anchor 301 [super showAvatarBubbleAnchoredAt:anchor
304 withMode:mode 302 withMode:mode
305 withServiceType:serviceType 303 withServiceType:serviceType
306 fromAccessPoint:accessPoint]; 304 fromAccessPoint:accessPoint];
305
306 AvatarButton* button = base::mac::ObjCCastStrict<AvatarButton>(button_);
307 [button setIsActive:[[menuController_ window] isVisible]];
307 } 308 }
308 309
309 - (void)bubbleWillClose:(NSNotification*)notif { 310 - (void)bubbleWillClose:(NSNotification*)notif {
310 AvatarButton* button = base::mac::ObjCCastStrict<AvatarButton>(button_); 311 AvatarButton* button = base::mac::ObjCCastStrict<AvatarButton>(button_);
311 [button setIsActive:NO]; 312 [button setIsActive:NO];
312 [super bubbleWillClose:notif]; 313 [super bubbleWillClose:notif];
313 } 314 }
314 315
315 @end 316 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698