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

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

Issue 2729623002: Update vector icons in browser profiles code (bubble, etc.) to structs. (Closed)
Patch Set: review Created 3 years, 9 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
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/app/vector_icons/vector_icons.h"
9 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/profiles/profile_attributes_entry.h" 11 #include "chrome/browser/profiles/profile_attributes_entry.h"
11 #include "chrome/browser/profiles/profile_attributes_storage.h" 12 #include "chrome/browser/profiles/profile_attributes_storage.h"
12 #include "chrome/browser/profiles/profile_manager.h" 13 #include "chrome/browser/profiles/profile_manager.h"
13 #include "chrome/browser/profiles/profiles_state.h" 14 #include "chrome/browser/profiles/profiles_state.h"
15 #import "chrome/browser/themes/theme_properties.h"
14 #include "chrome/browser/themes/theme_service.h" 16 #include "chrome/browser/themes/theme_service.h"
15 #include "chrome/browser/themes/theme_service_factory.h" 17 #include "chrome/browser/themes/theme_service_factory.h"
16 #include "chrome/browser/ui/browser.h" 18 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_window.h" 19 #include "chrome/browser/ui/browser_window.h"
18 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 20 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
19 #include "chrome/browser/ui/cocoa/l10n_util.h" 21 #include "chrome/browser/ui/cocoa/l10n_util.h"
20 #import "chrome/browser/ui/cocoa/profiles/avatar_button.h" 22 #import "chrome/browser/ui/cocoa/profiles/avatar_button.h"
21 #include "chrome/grit/generated_resources.h" 23 #include "chrome/grit/generated_resources.h"
22 #import "chrome/browser/themes/theme_properties.h"
23 #include "chrome/grit/theme_resources.h" 24 #include "chrome/grit/theme_resources.h"
24 #include "components/signin/core/common/profile_management_switches.h" 25 #include "components/signin/core/common/profile_management_switches.h"
25 #include "skia/ext/skia_utils_mac.h" 26 #include "skia/ext/skia_utils_mac.h"
26 #import "ui/base/cocoa/appkit_utils.h" 27 #import "ui/base/cocoa/appkit_utils.h"
27 #include "ui/base/l10n/l10n_util_mac.h" 28 #include "ui/base/l10n/l10n_util_mac.h"
28 #include "ui/base/material_design/material_design_controller.h" 29 #include "ui/base/material_design/material_design_controller.h"
29 #include "ui/gfx/color_palette.h" 30 #include "ui/gfx/color_palette.h"
30 #include "ui/gfx/image/image_skia_util_mac.h" 31 #include "ui/gfx/image/image_skia_util_mac.h"
31 #include "ui/gfx/paint_vector_icon.h" 32 #include "ui/gfx/paint_vector_icon.h"
32 #include "ui/gfx/vector_icons_public.h"
33 33
34 namespace { 34 namespace {
35 35
36 const SkColor kButtonHoverColor = SkColorSetARGB(20, 0, 0, 0); 36 const SkColor kButtonHoverColor = SkColorSetARGB(20, 0, 0, 0);
37 const SkColor kButtonPressedColor = SkColorSetARGB(31, 0, 0, 0); 37 const SkColor kButtonPressedColor = SkColorSetARGB(31, 0, 0, 0);
38 const SkColor kAvatarIconColor = SkColorSetRGB(0x5a, 0x5a, 0x5a); 38 const SkColor kAvatarIconColor = SkColorSetRGB(0x5a, 0x5a, 0x5a);
39 39
40 const CGFloat kButtonHeight = 24; 40 const CGFloat kButtonHeight = 24;
41 41
42 // NSButtons have a default padding of 5px. Buttons should have a padding of 42 // NSButtons have a default padding of 5px. Buttons should have a padding of
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 256
257 NSString* buttonTitle = base::SysUTF16ToNSString(useGenericButton ? 257 NSString* buttonTitle = base::SysUTF16ToNSString(useGenericButton ?
258 base::string16() : 258 base::string16() :
259 profiles::GetAvatarButtonTextForProfile(browser_->profile())); 259 profiles::GetAvatarButtonTextForProfile(browser_->profile()));
260 [[button_ cell] setHasError:hasError_ withTitle:buttonTitle]; 260 [[button_ cell] setHasError:hasError_ withTitle:buttonTitle];
261 261
262 AvatarButton* button = 262 AvatarButton* button =
263 base::mac::ObjCCastStrict<AvatarButton>(button_); 263 base::mac::ObjCCastStrict<AvatarButton>(button_);
264 264
265 if (useGenericButton) { 265 if (useGenericButton) {
266 NSImage* avatarIcon = NSImageFromImageSkia(gfx::CreateVectorIcon( 266 NSImage* avatarIcon = NSImageFromImageSkia(
267 gfx::VectorIconId::USER_ACCOUNT_AVATAR, 18, kAvatarIconColor)); 267 gfx::CreateVectorIcon(kUserAccountAvatarIcon, 18, kAvatarIconColor));
268 [button setDefaultImage:avatarIcon]; 268 [button setDefaultImage:avatarIcon];
269 [button setHoverImage:nil]; 269 [button setHoverImage:nil];
270 [button setPressedImage:nil]; 270 [button setPressedImage:nil];
271 [button setImagePosition:NSImageOnly]; 271 [button setImagePosition:NSImageOnly];
272 } else if (hasError_) { 272 } else if (hasError_) {
273 NSImage* errorIcon = NSImageFromImageSkia(gfx::CreateVectorIcon( 273 NSImage* errorIcon = NSImageFromImageSkia(
274 gfx::VectorIconId::SYNC_PROBLEM, 16, gfx::kGoogleRed700)); 274 gfx::CreateVectorIcon(kSyncProblemIcon, 16, gfx::kGoogleRed700));
275 [button setDefaultImage:errorIcon]; 275 [button setDefaultImage:errorIcon];
276 [button setHoverImage:nil]; 276 [button setHoverImage:nil];
277 [button setPressedImage:nil]; 277 [button setPressedImage:nil];
278 [button setImage:errorIcon]; 278 [button setImage:errorIcon];
279 [button setImagePosition:NSImageLeft]; 279 [button setImagePosition:NSImageLeft];
280 } else { 280 } else {
281 [button setDefaultImage:nil]; 281 [button setDefaultImage:nil];
282 [button setHoverImage:nil]; 282 [button setHoverImage:nil];
283 [button setPressedImage:nil]; 283 [button setPressedImage:nil];
284 [button setImagePosition:NSNoImage]; 284 [button setImagePosition:NSNoImage];
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 } 344 }
345 345
346 - (void)bubbleWillClose:(NSNotification*)notif { 346 - (void)bubbleWillClose:(NSNotification*)notif {
347 AvatarButton* button = base::mac::ObjCCastStrict<AvatarButton>(button_); 347 AvatarButton* button = base::mac::ObjCCastStrict<AvatarButton>(button_);
348 [button setIsActive:NO]; 348 [button setIsActive:NO];
349 [self updateAvatarButtonAndLayoutParent:NO]; 349 [self updateAvatarButtonAndLayoutParent:NO];
350 [super bubbleWillClose:notif]; 350 [super bubbleWillClose:notif];
351 } 351 }
352 352
353 @end 353 @end
OLDNEW
« no previous file with comments | « chrome/app/vector_icons/user_account_avatar.icon ('k') | chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698