OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |