| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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.h" | 5 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <numeric> | 8 #include <numeric> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 | 367 |
| 368 // We don't want to try and show the bar before it gets placed in its parent | 368 // We don't want to try and show the bar before it gets placed in its parent |
| 369 // view, so this step shoudn't be inside the bookmark bar controller's | 369 // view, so this step shoudn't be inside the bookmark bar controller's |
| 370 // |-awakeFromNib|. | 370 // |-awakeFromNib|. |
| 371 windowShim_->BookmarkBarStateChanged( | 371 windowShim_->BookmarkBarStateChanged( |
| 372 BookmarkBar::DONT_ANIMATE_STATE_CHANGE); | 372 BookmarkBar::DONT_ANIMATE_STATE_CHANGE); |
| 373 | 373 |
| 374 // Allow bar visibility to be changed. | 374 // Allow bar visibility to be changed. |
| 375 [self enableBarVisibilityUpdates]; | 375 [self enableBarVisibilityUpdates]; |
| 376 | 376 |
| 377 // Force a relayout of all the various bars. | |
| 378 [self layoutSubviews]; | |
| 379 | |
| 380 // Set the window to participate in Lion Fullscreen mode. Setting this flag | 377 // Set the window to participate in Lion Fullscreen mode. Setting this flag |
| 381 // has no effect on Snow Leopard or earlier. Panels can share a fullscreen | 378 // has no effect on Snow Leopard or earlier. Panels can share a fullscreen |
| 382 // space with a tabbed window, but they can not be primary fullscreen | 379 // space with a tabbed window, but they can not be primary fullscreen |
| 383 // windows. Do this after |-layoutSubviews| so that the fullscreen button | 380 // windows. |
| 384 // can be adjusted in FramedBrowserWindow. | |
| 385 NSUInteger collectionBehavior = [window collectionBehavior]; | 381 NSUInteger collectionBehavior = [window collectionBehavior]; |
| 386 collectionBehavior |= | 382 collectionBehavior |= |
| 387 browser_->type() == Browser::TYPE_TABBED || | 383 browser_->type() == Browser::TYPE_TABBED || |
| 388 browser_->type() == Browser::TYPE_POPUP ? | 384 browser_->type() == Browser::TYPE_POPUP ? |
| 389 NSWindowCollectionBehaviorFullScreenPrimary : | 385 NSWindowCollectionBehaviorFullScreenPrimary : |
| 390 NSWindowCollectionBehaviorFullScreenAuxiliary; | 386 NSWindowCollectionBehaviorFullScreenAuxiliary; |
| 391 [window setCollectionBehavior:collectionBehavior]; | 387 |
| 388 if ([self shouldUseNewAvatarButton]) { |
| 389 // The new avatar button is to the left of the fullscreen button. |
| 390 // We need to call layoutSubviews after the fullscreen button is enabled |
| 391 // because the avatar button's position depends on it. |
| 392 [window setCollectionBehavior:collectionBehavior]; |
| 393 [self layoutSubviews]; |
| 394 } else { |
| 395 // The old avatar button is to the right of the fullscreen button. |
| 396 // We need to call layoutSubviews first because the fullscreen button's |
| 397 // position depends on it. |
| 398 // See -[FramedBrowserWindow fullScreenButtonOriginAdjustment]. |
| 399 [self layoutSubviews]; |
| 400 [window setCollectionBehavior:collectionBehavior]; |
| 401 } |
| 392 | 402 |
| 393 // For a popup window, |desiredContentRect| contains the desired height of | 403 // For a popup window, |desiredContentRect| contains the desired height of |
| 394 // the content, not of the whole window. Now that all the views are laid | 404 // the content, not of the whole window. Now that all the views are laid |
| 395 // out, measure the current content area size and grow if needed. The | 405 // out, measure the current content area size and grow if needed. The |
| 396 // window has not been placed onscreen yet, so this extra resize will not | 406 // window has not been placed onscreen yet, so this extra resize will not |
| 397 // cause visible jank. | 407 // cause visible jank. |
| 398 if (browser_->is_type_popup()) { | 408 if (browser_->is_type_popup()) { |
| 399 CGFloat deltaH = desiredContentRect.height() - | 409 CGFloat deltaH = desiredContentRect.height() - |
| 400 NSHeight([[self tabContentArea] frame]); | 410 NSHeight([[self tabContentArea] frame]); |
| 401 // Do not shrink the window, as that may break minimum size invariants. | 411 // Do not shrink the window, as that may break minimum size invariants. |
| (...skipping 1794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2196 | 2206 |
| 2197 - (BOOL)supportsBookmarkBar { | 2207 - (BOOL)supportsBookmarkBar { |
| 2198 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2208 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
| 2199 } | 2209 } |
| 2200 | 2210 |
| 2201 - (BOOL)isTabbedWindow { | 2211 - (BOOL)isTabbedWindow { |
| 2202 return browser_->is_type_tabbed(); | 2212 return browser_->is_type_tabbed(); |
| 2203 } | 2213 } |
| 2204 | 2214 |
| 2205 @end // @implementation BrowserWindowController(WindowType) | 2215 @end // @implementation BrowserWindowController(WindowType) |
| OLD | NEW |