Chromium Code Reviews| 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 #include "chrome/app/vector_icons/vector_icons.h" | 8 #include "chrome/app/vector_icons/vector_icons.h" |
| 9 #import "chrome/browser/ui/cocoa/themed_window.h" | 9 #import "chrome/browser/ui/cocoa/themed_window.h" |
| 10 #import "chrome/browser/ui/cocoa/view_id_util.h" | 10 #import "chrome/browser/ui/cocoa/view_id_util.h" |
| 11 #include "ui/base/material_design/material_design_controller.h" | 11 #include "ui/base/material_design/material_design_controller.h" |
| 12 #include "ui/base/theme_provider.h" | |
| 12 #include "ui/gfx/color_palette.h" | 13 #include "ui/gfx/color_palette.h" |
| 13 | 14 |
| 14 @interface AppToolbarButton () | 15 @interface AppToolbarButton () |
| 15 - (void)commonInit; | 16 - (void)commonInit; |
| 16 @end | 17 @end |
| 17 | 18 |
| 18 @implementation AppToolbarButton | 19 @implementation AppToolbarButton |
| 19 | 20 |
| 20 - (instancetype)initWithFrame:(NSRect)frame { | 21 - (instancetype)initWithFrame:(NSRect)frame { |
| 21 if ((self = [super initWithFrame:frame])) { | 22 if ((self = [super initWithFrame:frame])) { |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 43 return &kBrowserToolsUpdateIcon; | 44 return &kBrowserToolsUpdateIcon; |
| 44 case AppMenuIconController::IconType::GLOBAL_ERROR: | 45 case AppMenuIconController::IconType::GLOBAL_ERROR: |
| 45 case AppMenuIconController::IconType::INCOMPATIBILITY_WARNING: | 46 case AppMenuIconController::IconType::INCOMPATIBILITY_WARNING: |
| 46 return &kBrowserToolsErrorIcon; | 47 return &kBrowserToolsErrorIcon; |
| 47 } | 48 } |
| 48 | 49 |
| 49 return nullptr; | 50 return nullptr; |
| 50 } | 51 } |
| 51 | 52 |
| 52 - (SkColor)vectorIconColor:(BOOL)themeIsDark { | 53 - (SkColor)vectorIconColor:(BOOL)themeIsDark { |
| 54 const ui::ThemeProvider* provider = [[self window] themeProvider]; | |
| 53 switch (severity_) { | 55 switch (severity_) { |
| 54 case AppMenuIconController::Severity::NONE: | 56 case AppMenuIconController::Severity::NONE: |
| 55 return themeIsDark ? SK_ColorWHITE : gfx::kChromeIconGrey; | 57 return themeIsDark ? SK_ColorWHITE |
| 58 : provider && provider->ShouldIncreaseContrast() | |
|
Mark Mentovai
2017/02/23 01:54:16
I suggest but don’t require (parentheses) around e
| |
| 59 ? SK_ColorBLACK | |
| 60 : gfx::kChromeIconGrey; | |
| 56 break; | 61 break; |
| 57 | 62 |
| 58 case AppMenuIconController::Severity::LOW: | 63 case AppMenuIconController::Severity::LOW: |
| 59 return themeIsDark ? gfx::kGoogleGreen300 : gfx::kGoogleGreen700; | 64 return themeIsDark ? gfx::kGoogleGreen300 : gfx::kGoogleGreen700; |
| 60 break; | 65 break; |
| 61 | 66 |
| 62 case AppMenuIconController::Severity::MEDIUM: | 67 case AppMenuIconController::Severity::MEDIUM: |
| 63 return themeIsDark ? gfx::kGoogleYellow300 : gfx::kGoogleYellow700; | 68 return themeIsDark ? gfx::kGoogleYellow300 : gfx::kGoogleYellow700; |
| 64 break; | 69 break; |
| 65 | 70 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 77 shouldAnimate:(BOOL)shouldAnimate { | 82 shouldAnimate:(BOOL)shouldAnimate { |
| 78 if (severity != severity_ || type != type_) { | 83 if (severity != severity_ || type != type_) { |
| 79 severity_ = severity; | 84 severity_ = severity; |
| 80 type_ = type; | 85 type_ = type; |
| 81 // Update the button state images with the new severity color or icon type. | 86 // Update the button state images with the new severity color or icon type. |
| 82 [self resetButtonStateImages]; | 87 [self resetButtonStateImages]; |
| 83 } | 88 } |
| 84 } | 89 } |
| 85 | 90 |
| 86 @end | 91 @end |
| OLD | NEW |