Index: chrome/browser/ui/cocoa/browser_window_controller.mm |
diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm |
index 380b36a43a41b53968fcb1007a5e847626cd374f..bac98473da88ab39c928ec0d7a53446fddcd1ca5 100644 |
--- a/chrome/browser/ui/cocoa/browser_window_controller.mm |
+++ b/chrome/browser/ui/cocoa/browser_window_controller.mm |
@@ -154,6 +154,19 @@ |
// Provide the forward-declarations of new 10.7 SDK symbols so they can be |
Mark Mentovai
2011/07/13 14:46:04
10.6, not 10.7.
|
// called when building with the 10.5 SDK. |
+#if !defined(MAC_OS_X_VERSION_10_6) || \ |
+ MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 |
+ |
+typedef NSUInteger NSApplicationPresentationOptions; |
+ |
+@interface NSApplication (LionSDKDeclarations) |
Mark Mentovai
2011/07/13 14:46:04
SnowLeopard, not Lion.
|
+- (NSApplicationPresentationOptions)currentSystemPresentationOptions; |
+@end |
+ |
+#endif // MAC_OS_X_VERSION_10_6 |
+ |
+// Provide the forward-declarations of new 10.7 SDK symbols so they can be |
+// called when building with the 10.5 SDK. |
#if !defined(MAC_OS_X_VERSION_10_7) || \ |
MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 |
@@ -161,6 +174,15 @@ |
- (void)setRestorable:(BOOL)flag; |
@end |
+enum { |
+ NSWindowCollectionBehaviorFullScreenPrimary = 1 << 7, |
+ NSWindowCollectionBehaviorFullScreenAuxiliary = 1 << 8 |
+}; |
+ |
+enum { |
+ NSApplicationPresentationFullScreen = 1 << 10 |
+}; |
+ |
#endif // MAC_OS_X_VERSION_10_7 |
@@ -364,7 +386,9 @@ |
if ([self hasToolbar]) // Do not create the buttons in popups. |
[toolbarController_ createBrowserActionButtons]; |
- [self setUpOSFullScreenButton]; |
+ NSWindowCollectionBehavior behavior = [[self window] collectionBehavior]; |
+ behavior |= NSWindowCollectionBehaviorFullScreenPrimary; |
+ [[self window] setCollectionBehavior:behavior]; |
// We are done initializing now. |
initializing_ = NO; |
@@ -1882,6 +1906,32 @@ willAnimateFromState:(bookmarks::VisualState)oldState |
@end // @implementation BrowserWindowController |
+@implementation BrowserWindowController(LionFullScreen) |
+ |
+- (NSSize)window:(NSWindow *)window |
+ willUseFullScreenContentSize:(NSSize)proposedSize { |
+ [window setFrame:NSMakeRect(0, 0, proposedSize.width, proposedSize.height) |
+ display:YES |
+ animate:NO]; |
+ [self layoutSubviews]; |
+ return proposedSize; |
+} |
+ |
+- (void)windowDidEnterFullScreen:(NSNotification *)notification { |
+ [self layoutSubviews]; |
+} |
+ |
+- (void)windowDidExitFullScreen:(NSNotification *)notification { |
+ [self layoutSubviews]; |
+} |
+ |
+- (BOOL)isLionFullScreen { |
+ return !!([NSApp currentSystemPresentationOptions] & |
+ NSApplicationPresentationFullScreen); |
+} |
+ |
+@end // @implementation BrowserWindowController(LionFullScreen) |
+ |
@implementation BrowserWindowController(Fullscreen) |
@@ -2036,10 +2086,6 @@ willAnimateFromState:(bookmarks::VisualState)oldState |
// We're done moving focus, so re-enable bar visibility changes. |
[self enableBarVisibilityUpdates]; |
- // This needs to be done when leaving full-screen mode to ensure that the |
- // button's action is set properly. |
- [self setUpOSFullScreenButton]; |
- |
// Fade back in. |
if (didFadeOut) { |
CGDisplayFade(token, kFadeDurationSeconds / 2, kCGDisplayBlendSolidColor, |