| 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/base/material_design/material_design_controller.h" | 10 #include "ui/base/material_design/material_design_controller.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 return self; | 40 return self; |
| 41 } | 41 } |
| 42 | 42 |
| 43 - (void)awakeFromNib { | 43 - (void)awakeFromNib { |
| 44 [self commonInit]; | 44 [self commonInit]; |
| 45 } | 45 } |
| 46 | 46 |
| 47 - (void)commonInit { | 47 - (void)commonInit { |
| 48 view_id_util::SetID(self, VIEW_ID_APP_MENU); | 48 view_id_util::SetID(self, VIEW_ID_APP_MENU); |
| 49 delegate_.reset(new AppMenuButtonIconPainterDelegateMac(self)); | 49 delegate_.reset(new AppMenuButtonIconPainterDelegateMac(self)); |
| 50 severity_ = AppMenuIconPainter::Severity::SEVERITY_NONE; | 50 severity_ = AppMenuIconController::Severity::NONE; |
| 51 type_ = AppMenuIconController::IconType::NONE; | 51 type_ = AppMenuIconController::IconType::NONE; |
| 52 } | 52 } |
| 53 | 53 |
| 54 - (gfx::VectorIconId)vectorIconId { | 54 - (gfx::VectorIconId)vectorIconId { |
| 55 switch (type_) { | 55 switch (type_) { |
| 56 case AppMenuIconController::IconType::NONE: | 56 case AppMenuIconController::IconType::NONE: |
| 57 DCHECK_EQ(severity_, AppMenuIconPainter::SEVERITY_NONE); | 57 DCHECK_EQ(severity_, AppMenuIconController::Severity::NONE); |
| 58 return gfx::VectorIconId::BROWSER_TOOLS; | 58 return gfx::VectorIconId::BROWSER_TOOLS; |
| 59 case AppMenuIconController::IconType::UPGRADE_NOTIFICATION: | 59 case AppMenuIconController::IconType::UPGRADE_NOTIFICATION: |
| 60 return gfx::VectorIconId::BROWSER_TOOLS_UPDATE; | 60 return gfx::VectorIconId::BROWSER_TOOLS_UPDATE; |
| 61 case AppMenuIconController::IconType::GLOBAL_ERROR: | 61 case AppMenuIconController::IconType::GLOBAL_ERROR: |
| 62 case AppMenuIconController::IconType::INCOMPATIBILITY_WARNING: | 62 case AppMenuIconController::IconType::INCOMPATIBILITY_WARNING: |
| 63 return gfx::VectorIconId::BROWSER_TOOLS_ERROR; | 63 return gfx::VectorIconId::BROWSER_TOOLS_ERROR; |
| 64 } | 64 } |
| 65 | 65 |
| 66 return gfx::VectorIconId::VECTOR_ICON_NONE; | 66 return gfx::VectorIconId::VECTOR_ICON_NONE; |
| 67 } | 67 } |
| 68 | 68 |
| 69 - (SkColor)vectorIconColor:(BOOL)themeIsDark { | 69 - (SkColor)vectorIconColor:(BOOL)themeIsDark { |
| 70 switch (severity_) { | 70 switch (severity_) { |
| 71 case AppMenuIconPainter::Severity::SEVERITY_NONE: | 71 case AppMenuIconController::Severity::NONE: |
| 72 return themeIsDark ? SK_ColorWHITE : gfx::kChromeIconGrey; | 72 return themeIsDark ? SK_ColorWHITE : gfx::kChromeIconGrey; |
| 73 break; | 73 break; |
| 74 | 74 |
| 75 case AppMenuIconPainter::Severity::SEVERITY_LOW: | 75 case AppMenuIconController::Severity::LOW: |
| 76 return themeIsDark ? gfx::kGoogleGreen300 : gfx::kGoogleGreen700; | 76 return themeIsDark ? gfx::kGoogleGreen300 : gfx::kGoogleGreen700; |
| 77 break; | 77 break; |
| 78 | 78 |
| 79 case AppMenuIconPainter::Severity::SEVERITY_MEDIUM: | 79 case AppMenuIconController::Severity::MEDIUM: |
| 80 return themeIsDark ? gfx::kGoogleYellow300 : gfx::kGoogleYellow700; | 80 return themeIsDark ? gfx::kGoogleYellow300 : gfx::kGoogleYellow700; |
| 81 break; | 81 break; |
| 82 | 82 |
| 83 case AppMenuIconPainter::Severity::SEVERITY_HIGH: | 83 case AppMenuIconController::Severity::HIGH: |
| 84 return themeIsDark ? gfx::kGoogleRed300 : gfx::kGoogleRed700; | 84 return themeIsDark ? gfx::kGoogleRed300 : gfx::kGoogleRed700; |
| 85 break; | 85 break; |
| 86 | 86 |
| 87 default: | 87 default: |
| 88 break; | 88 break; |
| 89 } | 89 } |
| 90 } | 90 } |
| 91 | 91 |
| 92 - (void)setSeverity:(AppMenuIconPainter::Severity)severity | 92 - (void)setSeverity:(AppMenuIconController::Severity)severity |
| 93 iconType:(AppMenuIconController::IconType)type | 93 iconType:(AppMenuIconController::IconType)type |
| 94 shouldAnimate:(BOOL)shouldAnimate { | 94 shouldAnimate:(BOOL)shouldAnimate { |
| 95 if (severity != severity_ || type != type_) { | 95 if (severity != severity_ || type != type_) { |
| 96 severity_ = severity; | 96 severity_ = severity; |
| 97 type_ = type; | 97 type_ = type; |
| 98 // Update the button state images with the new severity color or icon type. | 98 // Update the button state images with the new severity color or icon type. |
| 99 [self resetButtonStateImages]; | 99 [self resetButtonStateImages]; |
| 100 } | 100 } |
| 101 } | 101 } |
| 102 | 102 |
| 103 @end | 103 @end |
| OLD | NEW |