| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #import "base/memory/scoped_nsobject.h" | 10 #import "base/memory/scoped_nsobject.h" |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 [(id)window setShouldHideTitle:![self hasTitleBar]]; | 208 [(id)window setShouldHideTitle:![self hasTitleBar]]; |
| 209 | 209 |
| 210 BOOL inPresentationMode = [self inPresentationMode]; | 210 BOOL inPresentationMode = [self inPresentationMode]; |
| 211 CGFloat floatingBarHeight = [self floatingBarHeight]; | 211 CGFloat floatingBarHeight = [self floatingBarHeight]; |
| 212 // In presentation mode, |yOffset| accounts for the sliding position of the | 212 // In presentation mode, |yOffset| accounts for the sliding position of the |
| 213 // floating bar and the extra offset needed to dodge the menu bar. | 213 // floating bar and the extra offset needed to dodge the menu bar. |
| 214 CGFloat yOffset = inPresentationMode ? | 214 CGFloat yOffset = inPresentationMode ? |
| 215 (std::floor((1 - floatingBarShownFraction_) * floatingBarHeight) - | 215 (std::floor((1 - floatingBarShownFraction_) * floatingBarHeight) - |
| 216 [presentationModeController_ floatingBarVerticalOffset]) : 0; | 216 [presentationModeController_ floatingBarVerticalOffset]) : 0; |
| 217 CGFloat maxY = NSMaxY(contentBounds) + yOffset; | 217 CGFloat maxY = NSMaxY(contentBounds) + yOffset; |
| 218 CGFloat startMaxY = maxY; | |
| 219 | 218 |
| 220 CGFloat overlayMaxY = | 219 CGFloat overlayMaxY = |
| 221 NSMaxY([window frame]) + | 220 NSMaxY([window frame]) + |
| 222 std::floor((1 - floatingBarShownFraction_) * floatingBarHeight); | 221 std::floor((1 - floatingBarShownFraction_) * floatingBarHeight); |
| 223 [self layoutPresentationModeToggleAtOverlayMaxX:NSMaxX([window frame]) | 222 [self layoutPresentationModeToggleAtOverlayMaxX:NSMaxX([window frame]) |
| 224 overlayMaxY:overlayMaxY]; | 223 overlayMaxY:overlayMaxY]; |
| 225 | 224 |
| 226 if ([self hasTabStrip]) { | 225 if ([self hasTabStrip]) { |
| 227 // If we need to lay out the top tab strip, replace |maxY| and |startMaxY| | 226 // If we need to lay out the top tab strip, replace |maxY| with a higher |
| 228 // with higher values, and then lay out the tab strip. | 227 // value, and then lay out the tab strip. |
| 229 NSRect windowFrame = [contentView convertRect:[window frame] fromView:nil]; | |
| 230 startMaxY = maxY = NSHeight(windowFrame) + yOffset; | |
| 231 maxY = [self layoutTabStripAtMaxY:maxY | 228 maxY = [self layoutTabStripAtMaxY:maxY |
| 232 width:width | 229 width:width |
| 233 fullscreen:[self isFullscreen]]; | 230 fullscreen:[self isFullscreen]]; |
| 234 } | 231 } |
| 235 | 232 |
| 236 // Sanity-check |maxY|. | 233 // Sanity-check |maxY|. |
| 237 DCHECK_GE(maxY, minY); | 234 DCHECK_GE(maxY, minY); |
| 238 DCHECK_LE(maxY, NSMaxY(contentBounds) + yOffset); | 235 DCHECK_LE(maxY, NSMaxY(contentBounds) + yOffset); |
| 239 | 236 |
| 240 // Place the toolbar at the top of the reserved area. | 237 // Place the toolbar at the top of the reserved area. |
| (...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 890 - (void)disableBarVisibilityUpdates { | 887 - (void)disableBarVisibilityUpdates { |
| 891 // Early escape if there's nothing to do. | 888 // Early escape if there's nothing to do. |
| 892 if (!barVisibilityUpdatesEnabled_) | 889 if (!barVisibilityUpdatesEnabled_) |
| 893 return; | 890 return; |
| 894 | 891 |
| 895 barVisibilityUpdatesEnabled_ = NO; | 892 barVisibilityUpdatesEnabled_ = NO; |
| 896 [presentationModeController_ cancelAnimationAndTimers]; | 893 [presentationModeController_ cancelAnimationAndTimers]; |
| 897 } | 894 } |
| 898 | 895 |
| 899 @end // @implementation BrowserWindowController(Private) | 896 @end // @implementation BrowserWindowController(Private) |
| OLD | NEW |