| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/cocoa/gradient_button_cell.h" | 5 #include "chrome/browser/cocoa/gradient_button_cell.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #import "base/scoped_nsobject.h" | 8 #import "base/scoped_nsobject.h" |
| 9 #import "chrome/browser/browser_theme_provider.h" | 9 #import "chrome/browser/browser_theme_provider.h" |
| 10 #import "chrome/browser/cocoa/image_utils.h" | 10 #import "chrome/browser/cocoa/image_utils.h" |
| (...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 | 563 |
| 564 - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView*)controlView { | 564 - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView*)controlView { |
| 565 if (shouldTheme_) { | 565 if (shouldTheme_) { |
| 566 BOOL isTemplate = [[self image] isTemplate]; | 566 BOOL isTemplate = [[self image] isTemplate]; |
| 567 | 567 |
| 568 [NSGraphicsContext saveGraphicsState]; | 568 [NSGraphicsContext saveGraphicsState]; |
| 569 | 569 |
| 570 CGContextRef context = | 570 CGContextRef context = |
| 571 (CGContextRef)([[NSGraphicsContext currentContext] graphicsPort]); | 571 (CGContextRef)([[NSGraphicsContext currentContext] graphicsPort]); |
| 572 | 572 |
| 573 ThemeProvider* themeProvider = [[controlView window] themeProvider]; | 573 BrowserThemeProvider* themeProvider = static_cast<BrowserThemeProvider*>( |
| 574 [[controlView window] themeProvider]); |
| 574 NSColor* color = themeProvider ? | 575 NSColor* color = themeProvider ? |
| 575 themeProvider->GetNSColorTint(BrowserThemeProvider::TINT_BUTTONS, | 576 themeProvider->GetNSColorTint(BrowserThemeProvider::TINT_BUTTONS, |
| 576 true) : | 577 true) : |
| 577 [NSColor blackColor]; | 578 [NSColor blackColor]; |
| 578 | 579 |
| 579 if (isTemplate) { | 580 if (isTemplate && themeProvider && themeProvider->UsingDefaultTheme()) { |
| 580 scoped_nsobject<NSShadow> shadow([[NSShadow alloc] init]); | 581 scoped_nsobject<NSShadow> shadow([[NSShadow alloc] init]); |
| 581 [shadow setShadowColor:[NSColor colorWithCalibratedWhite:0.96 alpha:1.0]]; | 582 [shadow setShadowColor:themeProvider->GetNSColor( |
| 583 BrowserThemeProvider::COLOR_TOOLBAR_BEZEL, true)]; |
| 582 [shadow setShadowOffset:NSMakeSize(0.0, -1.0)]; | 584 [shadow setShadowOffset:NSMakeSize(0.0, -1.0)]; |
| 583 [shadow setShadowBlurRadius:1.0]; | 585 [shadow setShadowBlurRadius:1.0]; |
| 584 [shadow set]; | 586 [shadow set]; |
| 585 } | 587 } |
| 586 | 588 |
| 587 CGContextBeginTransparencyLayer(context, 0); | 589 CGContextBeginTransparencyLayer(context, 0); |
| 588 NSRect imageRect = NSZeroRect; | 590 NSRect imageRect = NSZeroRect; |
| 589 imageRect.size = [[self image] size]; | 591 imageRect.size = [[self image] size]; |
| 590 NSRect drawRect = [self imageRectForBounds:cellFrame]; | 592 NSRect drawRect = [self imageRectForBounds:cellFrame]; |
| 591 [[self image] drawInRect:drawRect | 593 [[self image] drawInRect:drawRect |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 NSBezierPath* boundingPath = nil; | 699 NSBezierPath* boundingPath = nil; |
| 698 [self getDrawParamsForFrame:cellFrame | 700 [self getDrawParamsForFrame:cellFrame |
| 699 inView:controlView | 701 inView:controlView |
| 700 innerFrame:NULL | 702 innerFrame:NULL |
| 701 innerPath:NULL | 703 innerPath:NULL |
| 702 clipPath:&boundingPath]; | 704 clipPath:&boundingPath]; |
| 703 return boundingPath; | 705 return boundingPath; |
| 704 } | 706 } |
| 705 | 707 |
| 706 @end | 708 @end |
| OLD | NEW |