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

Unified Diff: chrome/browser/ui/cocoa/hover_close_button.mm

Issue 1883033002: [Mac] Update tab audio icon to Material Design and tweak close box color. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/hover_close_button.mm
diff --git a/chrome/browser/ui/cocoa/hover_close_button.mm b/chrome/browser/ui/cocoa/hover_close_button.mm
index ba5e9be34b1c3d3fd4b18b443f9f27521aafc34e..1797e94166c0dfa5709e0d9edc59bd93e586bcb2 100644
--- a/chrome/browser/ui/cocoa/hover_close_button.mm
+++ b/chrome/browser/ui/cocoa/hover_close_button.mm
@@ -9,6 +9,7 @@
#include "chrome/browser/themes/theme_properties.h"
#include "chrome/browser/themes/theme_service.h"
#import "chrome/browser/ui/cocoa/browser_window_controller.h"
+#import "chrome/browser/ui/cocoa/tabs/tab_controller.h"
#import "chrome/browser/ui/cocoa/tabs/tab_view.h"
#include "chrome/grit/generated_resources.h"
#include "grit/components_strings.h"
@@ -18,6 +19,7 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/material_design/material_design_controller.h"
#include "ui/base/resource/resource_bundle.h"
+#include "ui/gfx/color_palette.h"
#include "ui/gfx/image/image_skia_util_mac.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/gfx/vector_icons_public.h"
@@ -157,6 +159,26 @@ NSString* const kFadeOutValueKeyPath = @"fadeOutValue";
return base::mac::ObjCCast<TabView>([self superview]);
}
+- (SkColor)iconColor {
+ if ([[self window] hasDarkTheme]) {
+ return SkColorSetARGB(0xFF, 0xC4, 0xC4, 0xC4);
+ }
+
+ const ui::ThemeProvider* themeProvider = [[self window] themeProvider];
+ if (themeProvider) {
+ TabView* tabView = [self tabView];
+ bool use_active_tab_text_color = !tabView || [tabView isActiveTab];
+
+ const SkColor titleColor = use_active_tab_text_color ?
+ themeProvider->GetColor(ThemeProperties::COLOR_TAB_TEXT) :
+ themeProvider->GetColor(ThemeProperties::COLOR_BACKGROUND_TAB_TEXT);
+ return SkColorSetA(titleColor, 0xA0);
+ }
+
+ // Return the default COLOR_TAB_TEXT color.
+ return SkColorSetARGB(0xA0, 0x00, 0x00, 0x00);
+}
+
- (NSImage*)imageForHoverState:(HoverState)hoverState {
int imageID = IDR_CLOSE_1;
@@ -177,33 +199,12 @@ NSString* const kFadeOutValueKeyPath = @"fadeOutValue";
}
gfx::VectorIconId vectorIconID;
- SkColor vectorIconColor;
- const ui::ThemeProvider* themeProvider = nullptr;
- TabView* tabView;
+ SkColor vectorIconColor = gfx::kPlaceholderColor;
switch (hoverState) {
case kHoverStateNone:
vectorIconID = gfx::VectorIconId::TAB_CLOSE_NORMAL;
- // Determine the vector icon color, which for this icon is the color
- // of the "x".
- themeProvider = [[self window] themeProvider];
- if (themeProvider) {
- if (themeProvider->InIncognitoMode()) {
- vectorIconColor = SkColorSetARGB(0xFF, 0xC4, 0xC4, 0xC4);
- } else {
- tabView = [self tabView];
- bool use_active_tab_text_color = !tabView || [tabView isActiveTab];
-
- const SkColor titleColor = use_active_tab_text_color ?
- themeProvider->GetColor(ThemeProperties::COLOR_TAB_TEXT) :
- themeProvider->GetColor(
- ThemeProperties::COLOR_BACKGROUND_TAB_TEXT);
- vectorIconColor = SkColorSetA(titleColor, 0xA0);
- }
- } else {
- // 0x000000 is the default COLOR_TAB_TEXT color.
- vectorIconColor = SkColorSetARGB(0xA0, 0x00, 0x00, 0x00);
- }
+ vectorIconColor = [self iconColor];
break;
case kHoverStateMouseOver:
// For mouse over, the icon color is the fill color of the circle.

Powered by Google App Engine
This is Rietveld 408576698