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

Side by Side Diff: chrome/browser/ui/cocoa/hover_close_button.mm

Issue 2126043002: [Material][Mac] Fix Default Favicon's Color (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix for rsesek 2 Created 4 years, 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/hover_close_button.h" 5 #import "chrome/browser/ui/cocoa/hover_close_button.h"
6 6
7 #include "base/mac/foundation_util.h" 7 #include "base/mac/foundation_util.h"
8 #include "base/strings/sys_string_conversions.h" 8 #include "base/strings/sys_string_conversions.h"
9 #include "chrome/browser/themes/theme_properties.h" 9 #include "chrome/browser/themes/theme_properties.h"
10 #include "chrome/browser/themes/theme_service.h" 10 #include "chrome/browser/themes/theme_service.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 } 152 }
153 153
154 - (void)setFadeOutValue:(CGFloat)value { 154 - (void)setFadeOutValue:(CGFloat)value {
155 [self setNeedsDisplay]; 155 [self setNeedsDisplay];
156 } 156 }
157 157
158 - (TabView *)tabView { 158 - (TabView *)tabView {
159 return base::mac::ObjCCast<TabView>([self superview]); 159 return base::mac::ObjCCast<TabView>([self superview]);
160 } 160 }
161 161
162 - (SkColor)iconColor {
163 if ([[self window] hasDarkTheme]) {
164 return SkColorSetARGB(0xFF, 0xC4, 0xC4, 0xC4);
165 }
166
167 const ui::ThemeProvider* themeProvider = [[self window] themeProvider];
168 if (themeProvider) {
169 TabView* tabView = [self tabView];
170 bool use_active_tab_text_color = !tabView || [tabView isActiveTab];
171
172 const SkColor titleColor = use_active_tab_text_color ?
173 themeProvider->GetColor(ThemeProperties::COLOR_TAB_TEXT) :
174 themeProvider->GetColor(ThemeProperties::COLOR_BACKGROUND_TAB_TEXT);
175 return SkColorSetA(titleColor, 0xA0);
176 }
177
178 // Return the default COLOR_TAB_TEXT color.
179 return SkColorSetARGB(0xA0, 0x00, 0x00, 0x00);
180 }
181
182 - (NSImage*)imageForHoverState:(HoverState)hoverState { 162 - (NSImage*)imageForHoverState:(HoverState)hoverState {
183 int imageID = IDR_CLOSE_1; 163 int imageID = IDR_CLOSE_1;
184 164
185 if (!ui::MaterialDesignController::IsModeMaterial()) { 165 if (!ui::MaterialDesignController::IsModeMaterial()) {
186 switch (hoverState) { 166 switch (hoverState) {
187 case kHoverStateNone: 167 case kHoverStateNone:
188 imageID = IDR_CLOSE_1; 168 imageID = IDR_CLOSE_1;
189 break; 169 break;
190 case kHoverStateMouseOver: 170 case kHoverStateMouseOver:
191 imageID = IDR_CLOSE_1_H; 171 imageID = IDR_CLOSE_1_H;
192 break; 172 break;
193 case kHoverStateMouseDown: 173 case kHoverStateMouseDown:
194 imageID = IDR_CLOSE_1_P; 174 imageID = IDR_CLOSE_1_P;
195 break; 175 break;
196 } 176 }
197 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); 177 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
198 return bundle.GetNativeImageNamed(imageID).ToNSImage(); 178 return bundle.GetNativeImageNamed(imageID).ToNSImage();
199 } 179 }
200 180
201 gfx::VectorIconId vectorIconID; 181 gfx::VectorIconId vectorIconID;
202 SkColor vectorIconColor = gfx::kPlaceholderColor; 182 SkColor vectorIconColor = gfx::kPlaceholderColor;
183 TabView* tabView = [self tabView];
203 184
204 switch (hoverState) { 185 switch (hoverState) {
205 case kHoverStateNone: 186 case kHoverStateNone:
206 vectorIconID = gfx::VectorIconId::TAB_CLOSE_NORMAL; 187 vectorIconID = gfx::VectorIconId::TAB_CLOSE_NORMAL;
207 vectorIconColor = [self iconColor]; 188 vectorIconColor =
189 tabView ? [tabView iconColor] : tabs::kDefaultTabTextColor;
208 break; 190 break;
209 case kHoverStateMouseOver: 191 case kHoverStateMouseOver:
210 // For mouse over, the icon color is the fill color of the circle. 192 // For mouse over, the icon color is the fill color of the circle.
211 vectorIconID = gfx::VectorIconId::TAB_CLOSE_HOVERED_PRESSED; 193 vectorIconID = gfx::VectorIconId::TAB_CLOSE_HOVERED_PRESSED;
212 vectorIconColor = SkColorSetARGB(0xFF, 0xDB, 0x44, 0x37); 194 vectorIconColor = SkColorSetARGB(0xFF, 0xDB, 0x44, 0x37);
213 break; 195 break;
214 case kHoverStateMouseDown: 196 case kHoverStateMouseDown:
215 // For mouse pressed, the icon color is the fill color of the circle. 197 // For mouse pressed, the icon color is the fill color of the circle.
216 vectorIconID = gfx::VectorIconId::TAB_CLOSE_HOVERED_PRESSED; 198 vectorIconID = gfx::VectorIconId::TAB_CLOSE_HOVERED_PRESSED;
217 vectorIconColor = SkColorSetARGB(0xFF, 0xA8, 0x35, 0x2A); 199 vectorIconColor = SkColorSetARGB(0xFF, 0xA8, 0x35, 0x2A);
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 break; 285 break;
304 case kHoverStateMouseDown: 286 case kHoverStateMouseDown:
305 imageID = IDR_CLOSE_DIALOG_P; 287 imageID = IDR_CLOSE_DIALOG_P;
306 break; 288 break;
307 } 289 }
308 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); 290 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
309 return bundle.GetNativeImageNamed(imageID).ToNSImage(); 291 return bundle.GetNativeImageNamed(imageID).ToNSImage();
310 } 292 }
311 293
312 @end 294 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/hover_close_button.h ('k') | chrome/browser/ui/cocoa/tabs/alert_indicator_button_cocoa.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698