OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser_window_controller_private.h" | 5 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #import "base/auto_reset.h" | 9 #import "base/auto_reset.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 - (void)createTabStripController { | 117 - (void)createTabStripController { |
118 DCHECK([overlayableContentsController_ activeContainer]); | 118 DCHECK([overlayableContentsController_ activeContainer]); |
119 DCHECK([[overlayableContentsController_ activeContainer] window]); | 119 DCHECK([[overlayableContentsController_ activeContainer] window]); |
120 tabStripController_.reset([[TabStripController alloc] | 120 tabStripController_.reset([[TabStripController alloc] |
121 initWithView:[self tabStripView] | 121 initWithView:[self tabStripView] |
122 switchView:[overlayableContentsController_ activeContainer] | 122 switchView:[overlayableContentsController_ activeContainer] |
123 browser:browser_.get() | 123 browser:browser_.get() |
124 delegate:self]); | 124 delegate:self]); |
125 } | 125 } |
126 | 126 |
| 127 - (void)updateFullscreenCollectionBehavior { |
| 128 // Set the window to participate in Lion Fullscreen mode. Setting this flag |
| 129 // has no effect on Snow Leopard or earlier. Panels can share a fullscreen |
| 130 // space with a tabbed window, but they can not be primary fullscreen |
| 131 // windows. |
| 132 // This ensures the fullscreen button is appropriately positioned. It must |
| 133 // be done before calling layoutSubviews because the new avatar button's |
| 134 // position depends on the fullscreen button's position, as well as |
| 135 // TabStripController's rightIndentForControls. |
| 136 // The fullscreen button's position may depend on the old avatar button's |
| 137 // width, but that does not require calling layoutSubviews first. |
| 138 NSWindow* window = [self window]; |
| 139 NSUInteger collectionBehavior = [window collectionBehavior]; |
| 140 collectionBehavior &= ~NSWindowCollectionBehaviorFullScreenAuxiliary; |
| 141 collectionBehavior &= ~NSWindowCollectionBehaviorFullScreenPrimary; |
| 142 collectionBehavior |= browser_->type() == Browser::TYPE_TABBED || |
| 143 browser_->type() == Browser::TYPE_POPUP |
| 144 ? NSWindowCollectionBehaviorFullScreenPrimary |
| 145 : NSWindowCollectionBehaviorFullScreenAuxiliary; |
| 146 [window setCollectionBehavior:collectionBehavior]; |
| 147 } |
| 148 |
127 - (void)saveWindowPositionIfNeeded { | 149 - (void)saveWindowPositionIfNeeded { |
128 if (!chrome::ShouldSaveWindowPlacement(browser_.get())) | 150 if (!chrome::ShouldSaveWindowPlacement(browser_.get())) |
129 return; | 151 return; |
130 | 152 |
131 // If we're in fullscreen mode, save the position of the regular window | 153 // If we're in fullscreen mode, save the position of the regular window |
132 // instead. | 154 // instead. |
133 NSWindow* window = | 155 NSWindow* window = |
134 [self isInAnyFullscreenMode] ? savedRegularWindow_ : [self window]; | 156 [self isInAnyFullscreenMode] ? savedRegularWindow_ : [self window]; |
135 | 157 |
136 // Window positions are stored relative to the origin of the primary monitor. | 158 // Window positions are stored relative to the origin of the primary monitor. |
(...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1223 return nil; | 1245 return nil; |
1224 } | 1246 } |
1225 | 1247 |
1226 - (BOOL)isFullscreenForTabContent { | 1248 - (BOOL)isFullscreenForTabContent { |
1227 return browser_->exclusive_access_manager() | 1249 return browser_->exclusive_access_manager() |
1228 ->fullscreen_controller() | 1250 ->fullscreen_controller() |
1229 ->IsWindowFullscreenForTabOrPending(); | 1251 ->IsWindowFullscreenForTabOrPending(); |
1230 } | 1252 } |
1231 | 1253 |
1232 @end // @implementation BrowserWindowController(Private) | 1254 @end // @implementation BrowserWindowController(Private) |
OLD | NEW |