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

Side by Side Diff: chrome/browser/ui/cocoa/framed_browser_window.mm

Issue 15932008: Add managed user avatar menu for mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to ToT. Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/framed_browser_window.h" 5 #import "chrome/browser/ui/cocoa/framed_browser_window.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/global_keyboard_shortcuts_mac.h" 8 #include "chrome/browser/global_keyboard_shortcuts_mac.h"
9 #include "chrome/browser/profiles/profile_info_util.h" 9 #include "chrome/browser/profiles/profile_info_util.h"
10 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 10 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 NSPoint origin = NSMakePoint(0, -6); 314 NSPoint origin = NSMakePoint(0, -6);
315 315
316 // If there is a profile avatar present, shift the button over by its 316 // If there is a profile avatar present, shift the button over by its
317 // width and some padding. 317 // width and some padding.
318 BrowserWindowController* bwc = 318 BrowserWindowController* bwc =
319 static_cast<BrowserWindowController*>([self windowController]); 319 static_cast<BrowserWindowController*>([self windowController]);
320 if ([bwc shouldShowAvatar]) { 320 if ([bwc shouldShowAvatar]) {
321 AvatarButtonController* avatarButtonVC = [bwc avatarButtonController]; 321 AvatarButtonController* avatarButtonVC = [bwc avatarButtonController];
322 NSView* avatarButton = [avatarButtonVC view]; 322 NSView* avatarButton = [avatarButtonVC view];
323 origin.x = -(NSWidth([avatarButton frame]) + 3); 323 origin.x = -(NSWidth([avatarButton frame]) + 3);
324 AvatarLabelController* avatarLabelController = [bwc avatarLabelController];
325 if (avatarLabelController)
326 origin.x -= NSWidth([[avatarLabelController view] frame]) + 10;
324 } else { 327 } else {
325 origin.x -= 6; 328 origin.x -= 6;
326 } 329 }
327 330
328 return origin; 331 return origin;
329 } 332 }
330 333
331 - (void)drawCustomFrameRect:(NSRect)rect forView:(NSView*)view { 334 - (void)drawCustomFrameRect:(NSRect)rect forView:(NSView*)view {
332 // WARNING: There is an obvious optimization opportunity here that you DO NOT 335 // WARNING: There is an obvious optimization opportunity here that you DO NOT
333 // want to take. To save painting cycles, you might think it would be a good 336 // want to take. To save painting cycles, you might think it would be a good
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 if (titleColor) 533 if (titleColor)
531 return titleColor; 534 return titleColor;
532 535
533 if (incognito) 536 if (incognito)
534 return [NSColor whiteColor]; 537 return [NSColor whiteColor];
535 else 538 else
536 return [NSColor windowFrameTextColor]; 539 return [NSColor windowFrameTextColor];
537 } 540 }
538 541
539 @end 542 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698