| 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 #import "chrome/browser/ui/cocoa/image_button_cell.h" | 9 #import "chrome/browser/ui/cocoa/image_button_cell.h" |
| 10 #import "chrome/browser/ui/cocoa/view_id_util.h" | 10 #import "chrome/browser/ui/cocoa/view_id_util.h" |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 return themeIsDark ? SK_ColorWHITE : SkColorSetRGB(0x5A, 0x5A, 0x5A); | 228 return themeIsDark ? SK_ColorWHITE : SkColorSetRGB(0x5A, 0x5A, 0x5A); |
| 229 } | 229 } |
| 230 | 230 |
| 231 - (NSImage*)browserToolsIconForFillColor:(SkColor)fillColor { | 231 - (NSImage*)browserToolsIconForFillColor:(SkColor)fillColor { |
| 232 // Create a |BrowserToolsImageRep| to draw the browser tools icon using | 232 // Create a |BrowserToolsImageRep| to draw the browser tools icon using |
| 233 // the provided fill color. | 233 // the provided fill color. |
| 234 base::scoped_nsobject<BrowserToolsImageRep> imageRep = | 234 base::scoped_nsobject<BrowserToolsImageRep> imageRep = |
| 235 [[BrowserToolsImageRep alloc] | 235 [[BrowserToolsImageRep alloc] |
| 236 initWithDrawSelector:@selector(drawBrowserToolsIcon:) | 236 initWithDrawSelector:@selector(drawBrowserToolsIcon:) |
| 237 delegate:[BrowserToolsImageRep class]]; | 237 delegate:[BrowserToolsImageRep class]]; |
| 238 [imageRep setFillColor:skia::SkColorToCalibratedNSColor(fillColor)]; | 238 if (!ui::MaterialDesignController::IsModeMaterial()) { |
| 239 [imageRep setFillColor:skia::SkColorToCalibratedNSColor(fillColor)]; |
| 240 } else { |
| 241 [imageRep setFillColor:skia::SkColorToSRGBNSColor(fillColor)]; |
| 242 } |
| 239 | 243 |
| 240 // Create the image from the image rep. | 244 // Create the image from the image rep. |
| 241 NSImage* browserToolsIcon = | 245 NSImage* browserToolsIcon = |
| 242 [[[NSImage alloc] initWithSize:kMDButtonIconSize] autorelease]; | 246 [[[NSImage alloc] initWithSize:kMDButtonIconSize] autorelease]; |
| 243 [browserToolsIcon setCacheMode:NSImageCacheAlways]; | 247 [browserToolsIcon setCacheMode:NSImageCacheAlways]; |
| 244 [browserToolsIcon addRepresentation:imageRep]; | 248 [browserToolsIcon addRepresentation:imageRep]; |
| 245 | 249 |
| 246 return browserToolsIcon; | 250 return browserToolsIcon; |
| 247 } | 251 } |
| 248 | 252 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 // Update the hover and pressed image backgrounds to match the current theme. | 394 // Update the hover and pressed image backgrounds to match the current theme. |
| 391 if (ui::MaterialDesignController::IsModeMaterial()) { | 395 if (ui::MaterialDesignController::IsModeMaterial()) { |
| 392 [self resetButtonStateImages]; | 396 [self resetButtonStateImages]; |
| 393 } | 397 } |
| 394 } | 398 } |
| 395 | 399 |
| 396 - (void)windowDidChangeActive { | 400 - (void)windowDidChangeActive { |
| 397 } | 401 } |
| 398 | 402 |
| 399 @end | 403 @end |
| OLD | NEW |