Index: chrome/browser/ui/cocoa/browser_window_controller_private.mm |
diff --git a/chrome/browser/ui/cocoa/browser_window_controller_private.mm b/chrome/browser/ui/cocoa/browser_window_controller_private.mm |
index 64adb652fc7812a436cdc08055a387bb71ab9a8c..87aa090af6ebf5f0e0ab370d8601708f1af926c7 100644 |
--- a/chrome/browser/ui/cocoa/browser_window_controller_private.mm |
+++ b/chrome/browser/ui/cocoa/browser_window_controller_private.mm |
@@ -124,6 +124,28 @@ void RecordFullscreenStyle(FullscreenStyle style) { |
delegate:self]); |
} |
+- (void)updateFullscreenCollectionBehavior { |
+ // Set the window to participate in Lion Fullscreen mode. Setting this flag |
+ // has no effect on Snow Leopard or earlier. Panels can share a fullscreen |
+ // space with a tabbed window, but they can not be primary fullscreen |
+ // windows. |
+ // This ensures the fullscreen button is appropriately positioned. It must |
+ // be done before calling layoutSubviews because the new avatar button's |
+ // position depends on the fullscreen button's position, as well as |
+ // TabStripController's rightIndentForControls. |
+ // The fullscreen button's position may depend on the old avatar button's |
+ // width, but that does not require calling layoutSubviews first. |
+ NSWindow* window = [self window]; |
+ NSUInteger collectionBehavior = [window collectionBehavior]; |
+ collectionBehavior &= ~NSWindowCollectionBehaviorFullScreenAuxiliary; |
+ collectionBehavior &= ~NSWindowCollectionBehaviorFullScreenPrimary; |
+ collectionBehavior |= browser_->type() == Browser::TYPE_TABBED || |
+ browser_->type() == Browser::TYPE_POPUP |
+ ? NSWindowCollectionBehaviorFullScreenPrimary |
+ : NSWindowCollectionBehaviorFullScreenAuxiliary; |
+ [window setCollectionBehavior:collectionBehavior]; |
+} |
+ |
- (void)saveWindowPositionIfNeeded { |
if (!chrome::ShouldSaveWindowPlacement(browser_.get())) |
return; |