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