| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/toolbar_button_cocoa.h" | 5 #import "chrome/browser/ui/cocoa/toolbar/toolbar_button_cocoa.h" |
| 6 | 6 |
| 7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
| 8 #include "base/mac/sdk_forward_declarations.h" | 8 #include "base/mac/sdk_forward_declarations.h" |
| 9 #include "chrome/app/vector_icons/vector_icons.h" | 9 #include "chrome/app/vector_icons/vector_icons.h" |
| 10 #import "chrome/browser/ui/cocoa/image_button_cell.h" | 10 #import "chrome/browser/ui/cocoa/image_button_cell.h" |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 case VIEW_ID_APP_MENU: | 217 case VIEW_ID_APP_MENU: |
| 218 return &kBrowserToolsIcon; | 218 return &kBrowserToolsIcon; |
| 219 default: | 219 default: |
| 220 break; | 220 break; |
| 221 } | 221 } |
| 222 | 222 |
| 223 return nullptr; | 223 return nullptr; |
| 224 } | 224 } |
| 225 | 225 |
| 226 - (SkColor)vectorIconColor:(BOOL)themeIsDark { | 226 - (SkColor)vectorIconColor:(BOOL)themeIsDark { |
| 227 return themeIsDark ? SK_ColorWHITE : SkColorSetRGB(0x5A, 0x5A, 0x5A); | 227 const ui::ThemeProvider* provider = [[self window] themeProvider]; |
| 228 return themeIsDark ? SK_ColorWHITE |
| 229 : (provider && provider->ShouldIncreaseContrast() |
| 230 ? SK_ColorBLACK |
| 231 : SkColorSetRGB(0x5A, 0x5A, 0x5A)); |
| 228 } | 232 } |
| 229 | 233 |
| 230 - (NSImage*)browserToolsIconForFillColor:(SkColor)fillColor { | 234 - (NSImage*)browserToolsIconForFillColor:(SkColor)fillColor { |
| 231 // Create a |BrowserToolsImageRep| to draw the browser tools icon using | 235 // Create a |BrowserToolsImageRep| to draw the browser tools icon using |
| 232 // the provided fill color. | 236 // the provided fill color. |
| 233 base::scoped_nsobject<BrowserToolsImageRep> imageRep( | 237 base::scoped_nsobject<BrowserToolsImageRep> imageRep( |
| 234 [[BrowserToolsImageRep alloc] | 238 [[BrowserToolsImageRep alloc] |
| 235 initWithDrawSelector:@selector(drawBrowserToolsIcon:) | 239 initWithDrawSelector:@selector(drawBrowserToolsIcon:) |
| 236 delegate:[BrowserToolsImageRep class]]); | 240 delegate:[BrowserToolsImageRep class]]); |
| 237 [imageRep setFillColor:skia::SkColorToSRGBNSColor(fillColor)]; | 241 [imageRep setFillColor:skia::SkColorToSRGBNSColor(fillColor)]; |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 | 385 |
| 382 - (void)windowDidChangeTheme { | 386 - (void)windowDidChangeTheme { |
| 383 // Update the hover and pressed image backgrounds to match the current theme. | 387 // Update the hover and pressed image backgrounds to match the current theme. |
| 384 [self resetButtonStateImages]; | 388 [self resetButtonStateImages]; |
| 385 } | 389 } |
| 386 | 390 |
| 387 - (void)windowDidChangeActive { | 391 - (void)windowDidChangeActive { |
| 388 } | 392 } |
| 389 | 393 |
| 390 @end | 394 @end |
| OLD | NEW |