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 3// found in the LICENSE file. 4 5#import "chrome/browser/ui/cocoa/chrome_browser_window.h" 6 7#include "base/logging.h" 8#import "chrome/browser/ui/cocoa/themed_window.h" 9#include "ui/base/theme_provider.h" 10 11@implementation ChromeBrowserWindow 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 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 53