Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #include "chrome/browser/ui/cocoa/gradient_button_cell.h" | 5 #include "chrome/browser/ui/cocoa/gradient_button_cell.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 597 const CGFloat lineWidth = [controlView cr_lineWidth]; | 597 const CGFloat lineWidth = [controlView cr_lineWidth]; |
| 598 | 598 |
| 599 if (shouldTheme_) { | 599 if (shouldTheme_) { |
| 600 BOOL isTemplate = [[self image] isTemplate]; | 600 BOOL isTemplate = [[self image] isTemplate]; |
| 601 | 601 |
| 602 gfx::ScopedNSGraphicsContextSaveGState scopedGState; | 602 gfx::ScopedNSGraphicsContextSaveGState scopedGState; |
| 603 | 603 |
| 604 CGContextRef context = | 604 CGContextRef context = |
| 605 (CGContextRef)([[NSGraphicsContext currentContext] graphicsPort]); | 605 (CGContextRef)([[NSGraphicsContext currentContext] graphicsPort]); |
| 606 | 606 |
| 607 ThemeService* themeProvider = static_cast<ThemeService*>( | 607 ui::ThemeProvider* themeProvider = [[controlView window] themeProvider]; |
|
groby-ooo-7-16
2015/12/11 02:32:01
THANK YOU!
| |
| 608 [[controlView window] themeProvider]); | |
| 609 NSColor* color = themeProvider ? | 608 NSColor* color = themeProvider ? |
| 610 themeProvider->GetNSColorTint(ThemeProperties::TINT_BUTTONS) : | 609 themeProvider->GetNSColorTint(ThemeProperties::TINT_BUTTONS) : |
| 611 [NSColor blackColor]; | 610 [NSColor blackColor]; |
| 612 | 611 |
| 613 if (isTemplate && themeProvider && themeProvider->UsingDefaultTheme()) { | 612 if (isTemplate && themeProvider && themeProvider->UsingSystemTheme()) { |
| 614 base::scoped_nsobject<NSShadow> shadow([[NSShadow alloc] init]); | 613 base::scoped_nsobject<NSShadow> shadow([[NSShadow alloc] init]); |
| 615 [shadow.get() setShadowColor:themeProvider->GetNSColor( | 614 [shadow.get() setShadowColor:themeProvider->GetNSColor( |
| 616 ThemeProperties::COLOR_TOOLBAR_BEZEL)]; | 615 ThemeProperties::COLOR_TOOLBAR_BEZEL)]; |
| 617 [shadow.get() setShadowOffset:NSMakeSize(0.0, -lineWidth)]; | 616 [shadow.get() setShadowOffset:NSMakeSize(0.0, -lineWidth)]; |
| 618 [shadow setShadowBlurRadius:lineWidth]; | 617 [shadow setShadowBlurRadius:lineWidth]; |
| 619 [shadow set]; | 618 [shadow set]; |
| 620 } | 619 } |
| 621 | 620 |
| 622 CGContextBeginTransparencyLayer(context, 0); | 621 CGContextBeginTransparencyLayer(context, 0); |
| 623 NSRect imageRect = NSZeroRect; | 622 NSRect imageRect = NSZeroRect; |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 787 options:options | 786 options:options |
| 788 owner:self | 787 owner:self |
| 789 userInfo:nil]); | 788 userInfo:nil]); |
| 790 if (isMouseInside_ != mouseInView) { | 789 if (isMouseInside_ != mouseInView) { |
| 791 [self setMouseInside:mouseInView animate:NO]; | 790 [self setMouseInside:mouseInView animate:NO]; |
| 792 [controlView setNeedsDisplay:YES]; | 791 [controlView setNeedsDisplay:YES]; |
| 793 } | 792 } |
| 794 } | 793 } |
| 795 | 794 |
| 796 @end | 795 @end |
| OLD | NEW |