| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/toolbar/app_toolbar_button.h" | 5 #import "chrome/browser/ui/cocoa/toolbar/app_toolbar_button.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #import "chrome/browser/ui/cocoa/themed_window.h" | 8 #import "chrome/browser/ui/cocoa/themed_window.h" |
| 9 #import "chrome/browser/ui/cocoa/view_id_util.h" | 9 #import "chrome/browser/ui/cocoa/view_id_util.h" |
| 10 #include "ui/gfx/color_palette.h" |
| 10 | 11 |
| 11 class AppMenuButtonIconPainterDelegateMac : | 12 class AppMenuButtonIconPainterDelegateMac : |
| 12 public AppMenuIconPainter::Delegate { | 13 public AppMenuIconPainter::Delegate { |
| 13 public: | 14 public: |
| 14 explicit AppMenuButtonIconPainterDelegateMac(NSButton* button) : | 15 explicit AppMenuButtonIconPainterDelegateMac(NSButton* button) : |
| 15 button_(button) {} | 16 button_(button) {} |
| 16 ~AppMenuButtonIconPainterDelegateMac() override {} | 17 ~AppMenuButtonIconPainterDelegateMac() override {} |
| 17 | 18 |
| 18 void ScheduleAppMenuIconPaint() override { | 19 void ScheduleAppMenuIconPaint() override { |
| 19 [button_ setNeedsDisplay:YES]; | 20 [button_ setNeedsDisplay:YES]; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 46 view_id_util::SetID(self, VIEW_ID_APP_MENU); | 47 view_id_util::SetID(self, VIEW_ID_APP_MENU); |
| 47 delegate_.reset(new AppMenuButtonIconPainterDelegateMac(self)); | 48 delegate_.reset(new AppMenuButtonIconPainterDelegateMac(self)); |
| 48 severity_ = AppMenuIconPainter::Severity::SEVERITY_NONE; | 49 severity_ = AppMenuIconPainter::Severity::SEVERITY_NONE; |
| 49 } | 50 } |
| 50 | 51 |
| 51 - (gfx::VectorIconId)vectorIconId { | 52 - (gfx::VectorIconId)vectorIconId { |
| 52 return gfx::VectorIconId::BROWSER_TOOLS; | 53 return gfx::VectorIconId::BROWSER_TOOLS; |
| 53 } | 54 } |
| 54 | 55 |
| 55 - (SkColor)vectorIconColor:(BOOL)themeIsDark { | 56 - (SkColor)vectorIconColor:(BOOL)themeIsDark { |
| 56 const SkColor normalColor = SkColorSetRGB(0x5A, 0x5A, 0x5A); | |
| 57 const SkColor normalIncognitoColor = SkColorSetRGB(0xFF, 0xFF, 0xFF); | |
| 58 const SkColor severityMedColor = SkColorSetRGB(0xF0, 0x93, 0x00); | |
| 59 const SkColor severityMedIncognitoColor = SkColorSetRGB(0xF7, 0xCB, 0x4D); | |
| 60 const SkColor severityHighColor = SkColorSetRGB(0xC5, 0x39, 0x29); | |
| 61 const SkColor severityHighIncognitoColor = SkColorSetRGB(0xE6, 0x73, 0x7C); | |
| 62 | |
| 63 switch (severity_) { | 57 switch (severity_) { |
| 64 case AppMenuIconPainter::Severity::SEVERITY_NONE: | 58 case AppMenuIconPainter::Severity::SEVERITY_NONE: |
| 65 case AppMenuIconPainter::Severity::SEVERITY_LOW: | 59 case AppMenuIconPainter::Severity::SEVERITY_LOW: |
| 66 return themeIsDark ? normalIncognitoColor : normalColor; | 60 return themeIsDark ? SK_ColorWHITE : gfx::kChromeIconGrey; |
| 67 break; | 61 break; |
| 68 | 62 |
| 69 case AppMenuIconPainter::Severity::SEVERITY_MEDIUM: | 63 case AppMenuIconPainter::Severity::SEVERITY_MEDIUM: |
| 70 return themeIsDark ? severityMedIncognitoColor : severityMedColor; | 64 return themeIsDark ? gfx::kGoogleYellow300 : gfx::kGoogleYellow700; |
| 71 break; | 65 break; |
| 72 | 66 |
| 73 case AppMenuIconPainter::Severity::SEVERITY_HIGH: | 67 case AppMenuIconPainter::Severity::SEVERITY_HIGH: |
| 74 return themeIsDark ? severityHighIncognitoColor : severityHighColor; | 68 return themeIsDark ? gfx::kGoogleRed300 : gfx::kGoogleRed700; |
| 75 break; | 69 break; |
| 76 | 70 |
| 77 default: | 71 default: |
| 78 break; | 72 break; |
| 79 } | 73 } |
| 80 } | 74 } |
| 81 | 75 |
| 82 - (void)setSeverity:(AppMenuIconPainter::Severity)severity | 76 - (void)setSeverity:(AppMenuIconPainter::Severity)severity |
| 83 shouldAnimate:(BOOL)shouldAnimate { | 77 shouldAnimate:(BOOL)shouldAnimate { |
| 84 if (severity != severity_) { | 78 if (severity != severity_) { |
| 85 severity_ = severity; | 79 severity_ = severity; |
| 86 // Update the button state images with the new severity color. | 80 // Update the button state images with the new severity color. |
| 87 [self resetButtonStateImages]; | 81 [self resetButtonStateImages]; |
| 88 } | 82 } |
| 89 } | 83 } |
| 90 | 84 |
| 91 @end | 85 @end |
| OLD | NEW |