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

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

Issue 566473002: mac: Make the avatar button layer backed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from avi, round 2. Created 6 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 | « chrome/browser/ui/cocoa/browser_window_controller_private.mm ('k') | 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/profiles/profiles_state.h" 9 #include "chrome/browser/profiles/profiles_state.h"
10 #include "chrome/browser/themes/theme_service.h" 10 #include "chrome/browser/themes/theme_service.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 base::scoped_nsobject<CustomThemeButtonCell> cell( 179 base::scoped_nsobject<CustomThemeButtonCell> cell(
180 [[CustomThemeButtonCell alloc] initWithThemedWindow:isThemedWindow_]); 180 [[CustomThemeButtonCell alloc] initWithThemedWindow:isThemedWindow_]);
181 SigninErrorController* errorController = 181 SigninErrorController* errorController =
182 profiles::GetSigninErrorController(browser->profile()); 182 profiles::GetSigninErrorController(browser->profile());
183 183
184 [button_ setCell:cell.get()]; 184 [button_ setCell:cell.get()];
185 185
186 if (errorController) 186 if (errorController)
187 [cell setHasError:errorController->HasError() withTitle:[button_ title]]; 187 [cell setHasError:errorController->HasError() withTitle:[button_ title]];
188 188
189 [button_ setWantsLayer:YES];
189 [self setView:button_]; 190 [self setView:button_];
190 191
191 [button_ setBezelStyle:NSShadowlessSquareBezelStyle]; 192 [button_ setBezelStyle:NSShadowlessSquareBezelStyle];
192 [button_ setButtonType:NSMomentaryChangeButton]; 193 [button_ setButtonType:NSMomentaryChangeButton];
193 [button_ setBordered:YES]; 194 [button_ setBordered:YES];
194 // This is a workaround for an issue in the HoverImageButton where the 195 // This is a workaround for an issue in the HoverImageButton where the
195 // button is initially sized incorrectly unless a default image is provided. 196 // button is initially sized incorrectly unless a default image is provided.
196 [button_ setImage:GetImageFromResourceID(IDR_AVATAR_MAC_BUTTON_DROPARROW)]; 197 [button_ setImage:GetImageFromResourceID(IDR_AVATAR_MAC_BUTTON_DROPARROW)];
197 [button_ setImagePosition:NSImageRight]; 198 [button_ setImagePosition:NSImageRight];
198 [button_ setAutoresizingMask:NSViewMinXMargin | NSViewMinYMargin]; 199 [button_ setAutoresizingMask:NSViewMinXMargin | NSViewMinYMargin];
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 layoutSubviews]; 272 layoutSubviews];
272 } 273 }
273 } 274 }
274 275
275 - (void)updateErrorStatus:(BOOL)hasError { 276 - (void)updateErrorStatus:(BOOL)hasError {
276 [[button_ cell] setHasError:hasError withTitle:[button_ title]]; 277 [[button_ cell] setHasError:hasError withTitle:[button_ title]];
277 [self updateAvatarButtonAndLayoutParent:YES]; 278 [self updateAvatarButtonAndLayoutParent:YES];
278 } 279 }
279 280
280 @end 281 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller_private.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698