Index: chrome/browser/ui/cocoa/browser_window_controller_private.mm |
=================================================================== |
--- chrome/browser/ui/cocoa/browser_window_controller_private.mm (revision 88138) |
+++ chrome/browser/ui/cocoa/browser_window_controller_private.mm (working copy) |
@@ -30,6 +30,26 @@ |
#include "content/browser/tab_contents/tab_contents.h" |
#include "content/browser/tab_contents/tab_contents_view.h" |
+// 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 |
+ |
+@interface NSWindow (LionSDKDeclarations) |
+- (void)toggleFullScreen:(id)sender; |
+@end |
+ |
+enum { |
+ NSWindowCollectionBehaviorFullScreenPrimary = 1 << 7, |
+ NSWindowCollectionBehaviorFullScreenAuxiliary = 1 << 8 |
+}; |
+ |
+enum { |
+ NSWindowFullScreenButton = 7 |
+}; |
+ |
+#endif // MAC_OS_X_VERSION_10_7 |
+ |
namespace { |
// Space between the incognito badge and the right edge of the window. |
@@ -42,23 +62,8 @@ |
const CGFloat kLocBarTopInset = 0; |
const CGFloat kLocBarBottomInset = 1; |
-} // end namespace |
+} // namespace |
-// 10.7 adds public APIs for full-screen support. Provide the declaration so it |
-// can be called below 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 |
- |
-@interface NSWindow (LionSDKDeclarations) |
-- (void)toggleFullScreen:(id)sender; |
-@end |
- |
-enum { |
- NSWindowFullScreenButton = 7 |
-}; |
- |
-#endif // MAC_OS_X_VERSION_10_7 |
- |
@implementation BrowserWindowController(Private) |
// Create the appropriate tab strip controller based on whether or not side |
@@ -538,4 +543,18 @@ |
[fullscreenController_ cancelAnimationAndTimers]; |
} |
+- (void)setUpOSFullScreenButton { |
+ NSWindow* window = [self window]; |
+ if ([window respondsToSelector:@selector(toggleFullScreen:)]) { |
+ NSWindowCollectionBehavior behavior = [window collectionBehavior]; |
+ behavior |= NSWindowCollectionBehaviorFullScreenPrimary; |
+ [window setCollectionBehavior:behavior]; |
+ |
+ NSButton* fullscreenButton = |
+ [window standardWindowButton:NSWindowFullScreenButton]; |
+ [fullscreenButton setAction:@selector(enterFullscreen:)]; |
+ [fullscreenButton setTarget:self]; |
+ } |
+} |
+ |
@end // @implementation BrowserWindowController(Private) |