OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "base/scoped_nsobject.h" | 5 #import "base/scoped_nsobject.h" |
6 #import "chrome/browser/cocoa/tab_cell.h" | 6 #import "chrome/browser/cocoa/tab_cell.h" |
7 #import "third_party/GTM/AppKit/GTMTheme.h" | 7 #import "third_party/GTM/AppKit/GTMTheme.h" |
8 #import "third_party/GTM/AppKit/GTMNSColor+Luminance.h" | 8 #import "third_party/GTM/AppKit/GTMNSColor+Luminance.h" |
9 | 9 |
10 | 10 |
(...skipping 28 matching lines...) Expand all Loading... |
39 inView:controlView]; | 39 inView:controlView]; |
40 } | 40 } |
41 | 41 |
42 - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView { | 42 - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView { |
43 GTMTheme* theme = [[self controlView] gtm_theme]; | 43 GTMTheme* theme = [[self controlView] gtm_theme]; |
44 NSColor* textColor = [theme textColorForStyle:GTMThemeStyleToolBar | 44 NSColor* textColor = [theme textColorForStyle:GTMThemeStyleToolBar |
45 state:[self isHighlighted]]; | 45 state:[self isHighlighted]]; |
46 | 46 |
47 scoped_nsobject<NSShadow> textShadow([[NSShadow alloc] init]); | 47 scoped_nsobject<NSShadow> textShadow([[NSShadow alloc] init]); |
48 [textShadow setShadowBlurRadius:0.0f]; | 48 [textShadow setShadowBlurRadius:0.0f]; |
49 [textShadow setShadowColor:[textColor gtm_legibleTextColor]]; | 49 [textShadow.get() setShadowColor:[textColor gtm_legibleTextColor]]; |
50 [textShadow setShadowOffset:NSMakeSize(0.0f, -1.0f)]; | 50 [textShadow.get() setShadowOffset:NSMakeSize(0.0f, -1.0f)]; |
51 | 51 |
52 NSDictionary* attributes = | 52 NSDictionary* attributes = |
53 [NSDictionary dictionaryWithObjectsAndKeys: | 53 [NSDictionary dictionaryWithObjectsAndKeys: |
54 [self font], NSFontAttributeName, | 54 [self font], NSFontAttributeName, |
55 textColor, NSForegroundColorAttributeName, | 55 textColor, NSForegroundColorAttributeName, |
56 textShadow.get(), NSShadowAttributeName, | 56 textShadow.get(), NSShadowAttributeName, |
57 nil]; | 57 nil]; |
58 | 58 |
59 [[self title] drawInRect:[self titleRectForBounds:cellFrame] | 59 [[self title] drawInRect:[self titleRectForBounds:cellFrame] |
60 withAttributes:attributes]; | 60 withAttributes:attributes]; |
61 | 61 |
62 NSRect imageBounds = NSZeroRect; | 62 NSRect imageBounds = NSZeroRect; |
63 imageBounds.size = [[self image] size]; | 63 imageBounds.size = [[self image] size]; |
64 [[self image] drawInRect:[self imageRectForBounds:cellFrame] | 64 [[self image] drawInRect:[self imageRectForBounds:cellFrame] |
65 fromRect:imageBounds | 65 fromRect:imageBounds |
66 operation:NSCompositeSourceOver | 66 operation:NSCompositeSourceOver |
67 fraction:1.0]; | 67 fraction:1.0]; |
68 } | 68 } |
69 | 69 |
70 - (void)highlight:(BOOL)flag | 70 - (void)highlight:(BOOL)flag |
71 withFrame:(NSRect)cellFrame | 71 withFrame:(NSRect)cellFrame |
72 inView:(NSView *)controlView { | 72 inView:(NSView *)controlView { |
73 // Don't do normal highlighting | 73 // Don't do normal highlighting |
74 } | 74 } |
75 | 75 |
76 @end | 76 @end |
OLD | NEW |