Chromium Code Reviews| Index: chrome/browser/ui/cocoa/location_bar/star_decoration.mm |
| diff --git a/chrome/browser/ui/cocoa/location_bar/star_decoration.mm b/chrome/browser/ui/cocoa/location_bar/star_decoration.mm |
| index 08ee25ee35afb7f7f4843156c3213ddfc3a6c4a5..e2e22e17a28274ea373f877744b3260252c3c5e1 100644 |
| --- a/chrome/browser/ui/cocoa/location_bar/star_decoration.mm |
| +++ b/chrome/browser/ui/cocoa/location_bar/star_decoration.mm |
| @@ -37,29 +37,31 @@ StarDecoration::StarDecoration(CommandUpdater* command_updater) |
| StarDecoration::~StarDecoration() { |
| } |
| -void StarDecoration::SetStarred(bool starred, bool locationBarIsDark) { |
| +void StarDecoration::SetStarred(bool starred, bool location_bar_is_dark) { |
| starred_ = starred; |
| - const int image_id = starred ? IDR_STAR_LIT : IDR_STAR; |
| const int tip_id = starred ? IDS_TOOLTIP_STARRED : IDS_TOOLTIP_STAR; |
| - if (ui::MaterialDesignController::IsModeMaterial()) { |
| - NSImage* theImage; |
| - gfx::VectorIconId iconId = starred_ ? |
| - gfx::VectorIconId::LOCATION_BAR_STAR_ACTIVE : |
| - gfx::VectorIconId::LOCATION_BAR_STAR; |
| - SkColor starColor = gfx::kPlaceholderColor; |
| - if (locationBarIsDark) { |
| - starColor = SK_ColorWHITE; |
| - } else if (starred_) { |
| - starColor = gfx::kGoogleBlue500; |
| - } else { |
| - starColor = gfx::kChromeIconGrey; |
| - } |
| - theImage = NSImageFromImageSkia(gfx::CreateVectorIcon( |
| - iconId, 16, starColor)); |
| - SetImage(theImage); |
| - } else { |
| + if (!ui::MaterialDesignController::IsModeMaterial()) { |
| + const int image_id = starred ? IDR_STAR_LIT : IDR_STAR; |
| SetImage(OmniboxViewMac::ImageForResource(image_id)); |
| + tooltip_.reset([l10n_util::GetNSStringWithFixup(tip_id) retain]); |
| + return; |
| } |
| + NSImage* theImage; |
|
tapted
2016/04/28 14:29:44
theImage -> vector_image? Also it should be declar
shrike
2016/04/28 21:05:35
Missed cleaning this up after a previous change. O
|
| + gfx::VectorIconId icon_id = starred_ ? |
| + gfx::VectorIconId::LOCATION_BAR_STAR_ACTIVE : |
| + gfx::VectorIconId::LOCATION_BAR_STAR; |
| + SkColor star_color = gfx::kChromeIconGrey; |
| + if (location_bar_is_dark) { |
| + star_color = starred_ ? gfx::kGoogleBlue300 |
| + : SkColorSetA(SK_ColorWHITE, 0xCC); |
| + } else if (starred_) { |
| + star_color = starred_ ? gfx::kGoogleBlue500 |
| + : gfx::kChromeIconGrey; |
|
tapted
2016/04/28 14:29:44
the second half of this ternary if-else isn't need
shrike
2016/04/28 21:05:35
Thank you.
|
| + } |
| + const int kIconSize = 16; |
| + theImage = NSImageFromImageSkia( |
| + gfx::CreateVectorIcon(icon_id, kIconSize, star_color)); |
| + SetImage(theImage); |
| tooltip_.reset([l10n_util::GetNSStringWithFixup(tip_id) retain]); |
| } |