OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/ui/cocoa/chrome_browser_window.h" | 5 #import "chrome/browser/ui/cocoa/themed_browser_window.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #import "chrome/browser/ui/cocoa/themed_window.h" | 8 #import "chrome/browser/ui/cocoa/themed_window.h" |
9 #include "ui/base/theme_provider.h" | 9 #include "ui/base/theme_provider.h" |
10 | 10 |
11 @implementation ChromeBrowserWindow | 11 @implementation ThemedBrowserWindow |
12 | |
13 - (void)underlaySurfaceAdded { | |
14 DCHECK_GE(underlaySurfaceCount_, 0); | |
15 ++underlaySurfaceCount_; | |
16 | |
17 // We're having the OpenGL surface render under the window, so the window | |
18 // needs to be not opaque. | |
19 if (underlaySurfaceCount_ == 1) | |
20 [self setOpaque:NO]; | |
21 } | |
22 | |
23 - (void)underlaySurfaceRemoved { | |
24 --underlaySurfaceCount_; | |
25 DCHECK_GE(underlaySurfaceCount_, 0); | |
26 | |
27 if (underlaySurfaceCount_ == 0) | |
28 [self setOpaque:YES]; | |
29 } | |
30 | 12 |
31 - (ui::ThemeProvider*)themeProvider { | 13 - (ui::ThemeProvider*)themeProvider { |
32 id delegate = [self delegate]; | 14 id delegate = [self delegate]; |
33 if (![delegate respondsToSelector:@selector(themeProvider)]) | 15 if (![delegate respondsToSelector:@selector(themeProvider)]) |
34 return NULL; | 16 return NULL; |
35 return [delegate themeProvider]; | 17 return [delegate themeProvider]; |
36 } | 18 } |
37 | 19 |
38 - (ThemedWindowStyle)themedWindowStyle { | 20 - (ThemedWindowStyle)themedWindowStyle { |
39 id delegate = [self delegate]; | 21 id delegate = [self delegate]; |
40 if (![delegate respondsToSelector:@selector(themedWindowStyle)]) | 22 if (![delegate respondsToSelector:@selector(themedWindowStyle)]) |
41 return THEMED_NORMAL; | 23 return THEMED_NORMAL; |
42 return [delegate themedWindowStyle]; | 24 return [delegate themedWindowStyle]; |
43 } | 25 } |
44 | 26 |
45 - (NSPoint)themePatternPhase { | 27 - (NSPoint)themePatternPhase { |
46 id delegate = [self delegate]; | 28 id delegate = [self delegate]; |
47 if (![delegate respondsToSelector:@selector(themePatternPhase)]) | 29 if (![delegate respondsToSelector:@selector(themePatternPhase)]) |
48 return NSMakePoint(0, 0); | 30 return NSMakePoint(0, 0); |
49 return [delegate themePatternPhase]; | 31 return [delegate themePatternPhase]; |
50 } | 32 } |
51 | 33 |
52 @end | 34 @end |
OLD | NEW |