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/background_gradient_view.h" | 5 #include "chrome/browser/ui/cocoa/background_gradient_view.h" |
6 | 6 |
7 #import "chrome/browser/themes/theme_service.h" | 7 #import "chrome/browser/themes/theme_service.h" |
8 #import "chrome/browser/ui/cocoa/nsview_additions.h" | 8 #import "chrome/browser/ui/cocoa/nsview_additions.h" |
9 #import "chrome/browser/ui/cocoa/themed_window.h" | 9 #import "chrome/browser/ui/cocoa/themed_window.h" |
10 #include "grit/theme_resources.h" | 10 #include "grit/theme_resources.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 } | 24 } |
25 | 25 |
26 - (id)initWithCoder:(NSCoder*)decoder { | 26 - (id)initWithCoder:(NSCoder*)decoder { |
27 if ((self = [super initWithCoder:decoder])) { | 27 if ((self = [super initWithCoder:decoder])) { |
28 showsDivider_ = YES; | 28 showsDivider_ = YES; |
29 } | 29 } |
30 return self; | 30 return self; |
31 } | 31 } |
32 | 32 |
33 - (void)setShowsDivider:(BOOL)show { | 33 - (void)setShowsDivider:(BOOL)show { |
| 34 if (showsDivider_ == show) |
| 35 return; |
34 showsDivider_ = show; | 36 showsDivider_ = show; |
35 [self setNeedsDisplay:YES]; | 37 [self setNeedsDisplay:YES]; |
36 } | 38 } |
37 | 39 |
38 - (void)drawBackgroundWithOpaque:(BOOL)opaque { | 40 - (void)drawBackgroundWithOpaque:(BOOL)opaque { |
39 const NSRect bounds = [self bounds]; | 41 const NSRect bounds = [self bounds]; |
40 | 42 |
41 if (opaque) { | 43 if (opaque) { |
42 // If the background image is semi transparent then we need something | 44 // If the background image is semi transparent then we need something |
43 // to blend against. Using 20% black gives us a color similar to Windows. | 45 // to blend against. Using 20% black gives us a color similar to Windows. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 NSColor* color = themeProvider->GetNSImageColorNamed( | 82 NSColor* color = themeProvider->GetNSImageColorNamed( |
81 IDR_THEME_TOOLBAR_INACTIVE, true); | 83 IDR_THEME_TOOLBAR_INACTIVE, true); |
82 if (color) | 84 if (color) |
83 return color; | 85 return color; |
84 } | 86 } |
85 | 87 |
86 return themeProvider->GetNSImageColorNamed(IDR_THEME_TOOLBAR, true); | 88 return themeProvider->GetNSImageColorNamed(IDR_THEME_TOOLBAR, true); |
87 } | 89 } |
88 | 90 |
89 @end | 91 @end |
OLD | NEW |