| 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_icon_controller.h" | 5 #import "chrome/browser/ui/cocoa/profiles/avatar_icon_controller.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
| 10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| 11 #include "chrome/app/vector_icons/vector_icons.h" |
| 11 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | 13 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
| 13 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
| 14 #include "chrome/grit/generated_resources.h" | 15 #include "chrome/grit/generated_resources.h" |
| 15 #include "chrome/grit/theme_resources.h" | 16 #include "chrome/grit/theme_resources.h" |
| 16 #include "ui/base/l10n/l10n_util_mac.h" | 17 #include "ui/base/l10n/l10n_util_mac.h" |
| 17 #include "ui/base/material_design/material_design_controller.h" | 18 #include "ui/base/material_design/material_design_controller.h" |
| 18 #include "ui/base/resource/resource_bundle.h" | 19 #include "ui/base/resource/resource_bundle.h" |
| 19 #include "ui/gfx/image/image.h" | 20 #include "ui/gfx/image/image.h" |
| 20 #include "ui/gfx/image/image_skia_util_mac.h" | 21 #include "ui/gfx/image/image_skia_util_mac.h" |
| 21 #include "ui/gfx/paint_vector_icon.h" | 22 #include "ui/gfx/paint_vector_icon.h" |
| 22 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" | 23 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" |
| 23 #include "ui/gfx/vector_icons_public.h" | |
| 24 | 24 |
| 25 @interface AvatarIconController (Private) | 25 @interface AvatarIconController (Private) |
| 26 - (void)setButtonEnabled:(BOOL)flag; | 26 - (void)setButtonEnabled:(BOOL)flag; |
| 27 - (NSImage*)compositeImageWithShadow:(NSImage*)image; | 27 - (NSImage*)compositeImageWithShadow:(NSImage*)image; |
| 28 - (void)updateAvatarButtonAndLayoutParent:(BOOL)layoutParent; | 28 - (void)updateAvatarButtonAndLayoutParent:(BOOL)layoutParent; |
| 29 @end | 29 @end |
| 30 | 30 |
| 31 @implementation AvatarIconController | 31 @implementation AvatarIconController |
| 32 | 32 |
| 33 - (id)initWithBrowser:(Browser*)browser { | 33 - (id)initWithBrowser:(Browser*)browser { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 l10n_util::GetNSString(IDS_PROFILES_BUBBLE_ACCESSIBLE_NAME) | 70 l10n_util::GetNSString(IDS_PROFILES_BUBBLE_ACCESSIBLE_NAME) |
| 71 forAttribute:NSAccessibilityTitleAttribute]; | 71 forAttribute:NSAccessibilityTitleAttribute]; |
| 72 [cell accessibilitySetOverrideValue: | 72 [cell accessibilitySetOverrideValue: |
| 73 l10n_util::GetNSString(IDS_PROFILES_BUBBLE_ACCESSIBLE_DESCRIPTION) | 73 l10n_util::GetNSString(IDS_PROFILES_BUBBLE_ACCESSIBLE_DESCRIPTION) |
| 74 forAttribute:NSAccessibilityHelpAttribute]; | 74 forAttribute:NSAccessibilityHelpAttribute]; |
| 75 [cell accessibilitySetOverrideValue: | 75 [cell accessibilitySetOverrideValue: |
| 76 l10n_util::GetNSString(IDS_PROFILES_BUBBLE_ACCESSIBLE_DESCRIPTION) | 76 l10n_util::GetNSString(IDS_PROFILES_BUBBLE_ACCESSIBLE_DESCRIPTION) |
| 77 forAttribute:NSAccessibilityDescriptionAttribute]; | 77 forAttribute:NSAccessibilityDescriptionAttribute]; |
| 78 | 78 |
| 79 NSImage* icon = NSImageFromImageSkia( | 79 NSImage* icon = NSImageFromImageSkia( |
| 80 gfx::CreateVectorIcon(gfx::VectorIconId::INCOGNITO, 24, SK_ColorWHITE)); | 80 gfx::CreateVectorIcon(kIncognitoIcon, 24, SK_ColorWHITE)); |
| 81 [button_ setImage:icon]; | 81 [button_ setImage:icon]; |
| 82 [button_ setEnabled:NO]; | 82 [button_ setEnabled:NO]; |
| 83 | 83 |
| 84 [[self view] addSubview:button_]; | 84 [[self view] addSubview:button_]; |
| 85 } | 85 } |
| 86 return self; | 86 return self; |
| 87 } | 87 } |
| 88 | 88 |
| 89 // This will take in an original image and redraw it with a shadow. | 89 // This will take in an original image and redraw it with a shadow. |
| 90 - (NSImage*)compositeImageWithShadow:(NSImage*)image { | 90 - (NSImage*)compositeImageWithShadow:(NSImage*)image { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 113 hints:nil]; | 113 hints:nil]; |
| 114 | 114 |
| 115 [destination unlockFocus]; | 115 [destination unlockFocus]; |
| 116 | 116 |
| 117 return destination.autorelease(); | 117 return destination.autorelease(); |
| 118 } | 118 } |
| 119 | 119 |
| 120 - (void)updateAvatarButtonAndLayoutParent:(BOOL)layoutParent {} | 120 - (void)updateAvatarButtonAndLayoutParent:(BOOL)layoutParent {} |
| 121 | 121 |
| 122 @end | 122 @end |
| OLD | NEW |