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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_ = AppMenuIconPainter::Severity::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 CHECK(ui::MaterialDesignController::IsModeMaterial()); | |
56 switch (type_) { | 55 switch (type_) { |
57 case AppMenuIconController::IconType::NONE: | 56 case AppMenuIconController::IconType::NONE: |
58 DCHECK_EQ(severity_, AppMenuIconPainter::SEVERITY_NONE); | 57 DCHECK_EQ(severity_, AppMenuIconPainter::SEVERITY_NONE); |
59 return gfx::VectorIconId::BROWSER_TOOLS; | 58 return gfx::VectorIconId::BROWSER_TOOLS; |
60 case AppMenuIconController::IconType::UPGRADE_NOTIFICATION: | 59 case AppMenuIconController::IconType::UPGRADE_NOTIFICATION: |
61 return gfx::VectorIconId::BROWSER_TOOLS_UPDATE; | 60 return gfx::VectorIconId::BROWSER_TOOLS_UPDATE; |
62 case AppMenuIconController::IconType::GLOBAL_ERROR: | 61 case AppMenuIconController::IconType::GLOBAL_ERROR: |
63 case AppMenuIconController::IconType::INCOMPATIBILITY_WARNING: | 62 case AppMenuIconController::IconType::INCOMPATIBILITY_WARNING: |
64 return gfx::VectorIconId::BROWSER_TOOLS_ERROR; | 63 return gfx::VectorIconId::BROWSER_TOOLS_ERROR; |
65 } | 64 } |
(...skipping 29 matching lines...) Expand all Loading... |
95 shouldAnimate:(BOOL)shouldAnimate { | 94 shouldAnimate:(BOOL)shouldAnimate { |
96 if (severity != severity_ || type != type_) { | 95 if (severity != severity_ || type != type_) { |
97 severity_ = severity; | 96 severity_ = severity; |
98 type_ = type; | 97 type_ = type; |
99 // 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. |
100 [self resetButtonStateImages]; | 99 [self resetButtonStateImages]; |
101 } | 100 } |
102 } | 101 } |
103 | 102 |
104 @end | 103 @end |
OLD | NEW |