Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(548)

Side by Side Diff: chrome/browser/ui/cocoa/toolbar/app_toolbar_button.mm

Issue 2614333002: Revert of Create vector icon resource directory specific to Chrome. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/BUILD.gn ('k') | chrome/browser/ui/cocoa/toolbar/reload_button_cocoa.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "chrome/app/vector_icons/vector_icons.h"
9 #import "chrome/browser/ui/cocoa/themed_window.h" 8 #import "chrome/browser/ui/cocoa/themed_window.h"
10 #import "chrome/browser/ui/cocoa/view_id_util.h" 9 #import "chrome/browser/ui/cocoa/view_id_util.h"
11 #include "ui/base/material_design/material_design_controller.h" 10 #include "ui/base/material_design/material_design_controller.h"
12 #include "ui/gfx/color_palette.h" 11 #include "ui/gfx/color_palette.h"
13 12
14 @interface AppToolbarButton () 13 @interface AppToolbarButton ()
15 - (void)commonInit; 14 - (void)commonInit;
16 @end 15 @end
17 16
18 @implementation AppToolbarButton 17 @implementation AppToolbarButton
19 18
20 - (instancetype)initWithFrame:(NSRect)frame { 19 - (instancetype)initWithFrame:(NSRect)frame {
21 if ((self = [super initWithFrame:frame])) { 20 if ((self = [super initWithFrame:frame])) {
22 [self commonInit]; 21 [self commonInit];
23 } 22 }
24 return self; 23 return self;
25 } 24 }
26 25
27 - (void)awakeFromNib { 26 - (void)awakeFromNib {
28 [self commonInit]; 27 [self commonInit];
29 } 28 }
30 29
31 - (void)commonInit { 30 - (void)commonInit {
32 view_id_util::SetID(self, VIEW_ID_APP_MENU); 31 view_id_util::SetID(self, VIEW_ID_APP_MENU);
33 severity_ = AppMenuIconController::Severity::NONE; 32 severity_ = AppMenuIconController::Severity::NONE;
34 type_ = AppMenuIconController::IconType::NONE; 33 type_ = AppMenuIconController::IconType::NONE;
35 } 34 }
36 35
37 - (const gfx::VectorIcon*)vectorIcon { 36 - (gfx::VectorIconId)vectorIconId {
38 switch (type_) { 37 switch (type_) {
39 case AppMenuIconController::IconType::NONE: 38 case AppMenuIconController::IconType::NONE:
40 DCHECK_EQ(severity_, AppMenuIconController::Severity::NONE); 39 DCHECK_EQ(severity_, AppMenuIconController::Severity::NONE);
41 return &kBrowserToolsIcon; 40 return gfx::VectorIconId::BROWSER_TOOLS;
42 case AppMenuIconController::IconType::UPGRADE_NOTIFICATION: 41 case AppMenuIconController::IconType::UPGRADE_NOTIFICATION:
43 return &kBrowserToolsUpdateIcon; 42 return gfx::VectorIconId::BROWSER_TOOLS_UPDATE;
44 case AppMenuIconController::IconType::GLOBAL_ERROR: 43 case AppMenuIconController::IconType::GLOBAL_ERROR:
45 case AppMenuIconController::IconType::INCOMPATIBILITY_WARNING: 44 case AppMenuIconController::IconType::INCOMPATIBILITY_WARNING:
46 return &kBrowserToolsErrorIcon; 45 return gfx::VectorIconId::BROWSER_TOOLS_ERROR;
47 } 46 }
48 47
49 return nullptr; 48 return gfx::VectorIconId::VECTOR_ICON_NONE;
50 } 49 }
51 50
52 - (SkColor)vectorIconColor:(BOOL)themeIsDark { 51 - (SkColor)vectorIconColor:(BOOL)themeIsDark {
53 switch (severity_) { 52 switch (severity_) {
54 case AppMenuIconController::Severity::NONE: 53 case AppMenuIconController::Severity::NONE:
55 return themeIsDark ? SK_ColorWHITE : gfx::kChromeIconGrey; 54 return themeIsDark ? SK_ColorWHITE : gfx::kChromeIconGrey;
56 break; 55 break;
57 56
58 case AppMenuIconController::Severity::LOW: 57 case AppMenuIconController::Severity::LOW:
59 return themeIsDark ? gfx::kGoogleGreen300 : gfx::kGoogleGreen700; 58 return themeIsDark ? gfx::kGoogleGreen300 : gfx::kGoogleGreen700;
(...skipping 17 matching lines...) Expand all
77 shouldAnimate:(BOOL)shouldAnimate { 76 shouldAnimate:(BOOL)shouldAnimate {
78 if (severity != severity_ || type != type_) { 77 if (severity != severity_ || type != type_) {
79 severity_ = severity; 78 severity_ = severity;
80 type_ = type; 79 type_ = type;
81 // Update the button state images with the new severity color or icon type. 80 // Update the button state images with the new severity color or icon type.
82 [self resetButtonStateImages]; 81 [self resetButtonStateImages];
83 } 82 }
84 } 83 }
85 84
86 @end 85 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/BUILD.gn ('k') | chrome/browser/ui/cocoa/toolbar/reload_button_cocoa.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698