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

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

Issue 2268393002: [Mac][MD User Menu] Adjusted the vertical position of icon in avatar button (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Extra { Created 4 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 } 90 }
91 91
92 - (void)drawInteriorWithFrame:(NSRect)frame inView:(NSView*)controlView { 92 - (void)drawInteriorWithFrame:(NSRect)frame inView:(NSView*)controlView {
93 NSRect frameAfterPadding = NSInsetRect(frame, kButtonExtraPadding, 0); 93 NSRect frameAfterPadding = NSInsetRect(frame, kButtonExtraPadding, 0);
94 [super drawInteriorWithFrame:frameAfterPadding inView:controlView]; 94 [super drawInteriorWithFrame:frameAfterPadding inView:controlView];
95 } 95 }
96 96
97 - (void)drawImage:(NSImage*)image 97 - (void)drawImage:(NSImage*)image
98 withFrame:(NSRect)frame 98 withFrame:(NSRect)frame
99 inView:(NSView*)controlView { 99 inView:(NSView*)controlView {
100 // The image used in the generic button case needs to be shifted down 100 // The image used in the generic button case as well as the material-designed
101 // slightly to be centered correctly. 101 // error icon both need to be shifted down slightly to be centered correctly.
102 // TODO(noms): When the assets are fixed, remove this latter offset. 102 // TODO(noms): When the assets are fixed, remove this latter offset.
103 if (!hasError_) 103 if (!hasError_ || switches::IsMaterialDesignUserMenu())
104 frame = NSOffsetRect(frame, 0, 1); 104 frame = NSOffsetRect(frame, 0, 1);
105 [super drawImage:image withFrame:frame inView:controlView]; 105 [super drawImage:image withFrame:frame inView:controlView];
106 } 106 }
107 107
108 - (void)drawBezelWithFrame:(NSRect)frame 108 - (void)drawBezelWithFrame:(NSRect)frame
109 inView:(NSView*)controlView { 109 inView:(NSView*)controlView {
110 HoverState hoverState = 110 HoverState hoverState =
111 [base::mac::ObjCCastStrict<AvatarButton>(controlView) hoverState]; 111 [base::mac::ObjCCastStrict<AvatarButton>(controlView) hoverState];
112 ui::NinePartImageIds imageIds = kNormalBorderImageIds; 112 ui::NinePartImageIds imageIds = kNormalBorderImageIds;
113 if (isThemedWindow_) 113 if (isThemedWindow_)
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 layoutSubviews]; 303 layoutSubviews];
304 } 304 }
305 } 305 }
306 306
307 - (void)setErrorStatus:(BOOL)hasError { 307 - (void)setErrorStatus:(BOOL)hasError {
308 hasError_ = hasError; 308 hasError_ = hasError;
309 [self updateAvatarButtonAndLayoutParent:YES]; 309 [self updateAvatarButtonAndLayoutParent:YES];
310 } 310 }
311 311
312 @end 312 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698