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

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

Issue 2237023002: [MD User Menu] Adjusted the size and position of avatar button icon (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 | chrome/browser/ui/views/profiles/new_avatar_button.cc » ('j') | 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 IDR_AVATAR_NATIVE_BUTTON_AVATAR_PRESSED)]; 257 IDR_AVATAR_NATIVE_BUTTON_AVATAR_PRESSED)];
258 // This is a workaround for an issue in the HoverImageButton where the 258 // This is a workaround for an issue in the HoverImageButton where the
259 // button is initially sized incorrectly unless a default image is provided. 259 // button is initially sized incorrectly unless a default image is provided.
260 // See crbug.com/298501. 260 // See crbug.com/298501.
261 [button setImage:GetImageFromResourceID(IDR_AVATAR_NATIVE_BUTTON_AVATAR)]; 261 [button setImage:GetImageFromResourceID(IDR_AVATAR_NATIVE_BUTTON_AVATAR)];
262 [button setImagePosition:NSImageOnly]; 262 [button setImagePosition:NSImageOnly];
263 } else if (hasError_) { 263 } else if (hasError_) {
264 NSImage* errorIcon = 264 NSImage* errorIcon =
265 switches::IsMaterialDesignUserMenu() 265 switches::IsMaterialDesignUserMenu()
266 ? NSImageFromImageSkia(gfx::CreateVectorIcon( 266 ? NSImageFromImageSkia(gfx::CreateVectorIcon(
267 gfx::VectorIconId::SYNC_PROBLEM, 13, gfx::kGoogleRed700)) 267 gfx::VectorIconId::SYNC_PROBLEM, 16, gfx::kGoogleRed700))
268 : GetImageFromResourceID(IDR_ICON_PROFILES_AVATAR_BUTTON_ERROR); 268 : GetImageFromResourceID(IDR_ICON_PROFILES_AVATAR_BUTTON_ERROR);
269 [button setDefaultImage:errorIcon]; 269 [button setDefaultImage:errorIcon];
270 [button setHoverImage:nil]; 270 [button setHoverImage:nil];
271 [button setPressedImage:nil]; 271 [button setPressedImage:nil];
272 [button setImage:errorIcon]; 272 [button setImage:errorIcon];
273 [button setImagePosition:NSImageRight]; 273 [button setImagePosition:switches::IsMaterialDesignUserMenu()
274 ? NSImageLeft
275 : NSImageRight];
274 } else { 276 } else {
275 [button setDefaultImage:nil]; 277 [button setDefaultImage:nil];
276 [button setHoverImage:nil]; 278 [button setHoverImage:nil];
277 [button setPressedImage:nil]; 279 [button setPressedImage:nil];
278 [button setImagePosition:NSNoImage]; 280 [button setImagePosition:NSNoImage];
279 } 281 }
280 282
281 base::scoped_nsobject<NSMutableParagraphStyle> paragraphStyle( 283 base::scoped_nsobject<NSMutableParagraphStyle> paragraphStyle(
282 [[NSMutableParagraphStyle alloc] init]); 284 [[NSMutableParagraphStyle alloc] init]);
283 [paragraphStyle setAlignment:NSLeftTextAlignment]; 285 [paragraphStyle setAlignment:NSLeftTextAlignment];
(...skipping 15 matching lines...) Expand all
299 layoutSubviews]; 301 layoutSubviews];
300 } 302 }
301 } 303 }
302 304
303 - (void)setErrorStatus:(BOOL)hasError { 305 - (void)setErrorStatus:(BOOL)hasError {
304 hasError_ = hasError; 306 hasError_ = hasError;
305 [self updateAvatarButtonAndLayoutParent:YES]; 307 [self updateAvatarButtonAndLayoutParent:YES];
306 } 308 }
307 309
308 @end 310 @end
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/profiles/new_avatar_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698