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_properties.h" | 7 #import "chrome/browser/themes/theme_properties.h" |
8 #import "chrome/browser/themes/theme_service.h" | 8 #import "chrome/browser/themes/theme_service.h" |
9 #import "chrome/browser/ui/cocoa/themed_window.h" | 9 #import "chrome/browser/ui/cocoa/themed_window.h" |
10 #include "chrome/grit/theme_resources.h" | 10 #include "chrome/grit/theme_resources.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 return; | 44 return; |
45 showsDivider_ = show; | 45 showsDivider_ = show; |
46 [self setNeedsDisplay:YES]; | 46 [self setNeedsDisplay:YES]; |
47 } | 47 } |
48 | 48 |
49 - (NSPoint)patternPhase { | 49 - (NSPoint)patternPhase { |
50 return [[self window] | 50 return [[self window] |
51 themeImagePositionForAlignment:THEME_IMAGE_ALIGN_WITH_TAB_STRIP]; | 51 themeImagePositionForAlignment:THEME_IMAGE_ALIGN_WITH_TAB_STRIP]; |
52 } | 52 } |
53 | 53 |
54 - (void)drawRect:(NSRect)dirtyRect { | 54 - (void)drawBackground:(NSRect)dirtyRect { |
55 [[NSGraphicsContext currentContext] | 55 [[NSGraphicsContext currentContext] |
56 cr_setPatternPhase:[self patternPhase] | 56 cr_setPatternPhase:[self patternPhase] |
57 forView:[self cr_viewBeingDrawnTo]]; | 57 forView:[self cr_viewBeingDrawnTo]]; |
58 | 58 |
59 const ui::ThemeProvider* themeProvider = [[self window] themeProvider]; | 59 const ui::ThemeProvider* themeProvider = [[self window] themeProvider]; |
60 if (themeProvider && !themeProvider->UsingSystemTheme()) { | 60 if (themeProvider && !themeProvider->UsingSystemTheme()) { |
61 // If the background image is semi transparent then we need something | 61 // If the background image is semi transparent then we need something |
62 // to blend against. Using 20% black gives us a color similar to Windows. | 62 // to blend against. Using 20% black gives us a color similar to Windows. |
63 [[NSColor colorWithCalibratedWhite:0.2 alpha:1.0] set]; | 63 [[NSColor colorWithCalibratedWhite:0.2 alpha:1.0] set]; |
64 NSRectFill(dirtyRect); | 64 NSRectFill(dirtyRect); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 | 175 |
176 - (void)windowDidChangeTheme { | 176 - (void)windowDidChangeTheme { |
177 [self setNeedsDisplay:YES]; | 177 [self setNeedsDisplay:YES]; |
178 } | 178 } |
179 | 179 |
180 - (void)windowDidChangeActive { | 180 - (void)windowDidChangeActive { |
181 [self setNeedsDisplay:YES]; | 181 [self setNeedsDisplay:YES]; |
182 } | 182 } |
183 | 183 |
184 @end | 184 @end |
OLD | NEW |