| Index: chrome/browser/cocoa/browser_window_controller_private.mm
|
| ===================================================================
|
| --- chrome/browser/cocoa/browser_window_controller_private.mm (revision 58173)
|
| +++ chrome/browser/cocoa/browser_window_controller_private.mm (working copy)
|
| @@ -159,10 +159,12 @@
|
|
|
| BOOL isFullscreen = [self isFullscreen];
|
| CGFloat floatingBarHeight = [self floatingBarHeight];
|
| + CGFloat floatingBarShownFraction =
|
| + isFullscreen ? [fullscreenController_ floatingBarShownFraction] : 0;
|
| // In fullscreen mode, |yOffset| accounts for the sliding position of the
|
| // floating bar and the extra offset needed to dodge the menu bar.
|
| CGFloat yOffset = isFullscreen ?
|
| - (floor((1 - floatingBarShownFraction_) * floatingBarHeight) -
|
| + (floor((1 - floatingBarShownFraction) * floatingBarHeight) -
|
| [fullscreenController_ floatingBarVerticalOffset]) : 0;
|
| CGFloat maxY = NSMaxY(contentBounds) + yOffset;
|
| CGFloat startMaxY = maxY;
|
| @@ -242,6 +244,11 @@
|
| if (![self isFullscreen])
|
| return 0;
|
|
|
| + // If there's nothing in the floating bar, it has zero height.
|
| + // TODO(rohitrao): Should be possible to check [subviews count] here.
|
| + if (!([self hasLocationBar] || [self hasTabStrip] || [self hasToolbar]))
|
| + return 0;
|
| +
|
| CGFloat totalHeight = [fullscreenController_ floatingBarVerticalOffset];
|
|
|
| if ([self hasTabStrip])
|
| @@ -358,38 +365,30 @@
|
| - (void)layoutFloatingBarBackingView:(NSRect)frame
|
| fullscreen:(BOOL)fullscreen {
|
| // Only display when in fullscreen mode.
|
| - if (fullscreen) {
|
| - // For certain window types such as app windows (e.g., the dev tools
|
| - // window), there's no actual overlay. (Displaying one would result in an
|
| - // overly sliding in only under the menu, which gives an ugly effect.)
|
| - if (floatingBarBackingView_.get()) {
|
| - BOOL aboveBookmarkBar = [self placeBookmarkBarBelowInfoBar];
|
| + if (!fullscreen)
|
| + return;
|
|
|
| - // Insert it into the view hierarchy if necessary.
|
| - if (![floatingBarBackingView_ superview] ||
|
| - aboveBookmarkBar != floatingBarAboveBookmarkBar_) {
|
| - NSView* contentView = [[self window] contentView];
|
| - // z-order gets messed up unless we explicitly remove the floatingbar
|
| - // view and re-add it.
|
| - [floatingBarBackingView_ removeFromSuperview];
|
| - [contentView addSubview:floatingBarBackingView_
|
| - positioned:(aboveBookmarkBar ?
|
| - NSWindowAbove : NSWindowBelow)
|
| - relativeTo:[bookmarkBarController_ view]];
|
| - floatingBarAboveBookmarkBar_ = aboveBookmarkBar;
|
| - }
|
| + NSView* floatingBarBackingView =
|
| + [fullscreenController_ floatingBarBackingView];
|
| + BOOL aboveBookmarkBar = [self placeBookmarkBarBelowInfoBar];
|
|
|
| - // Set its frame.
|
| - [floatingBarBackingView_ setFrame:frame];
|
| - }
|
| -
|
| - // But we want the logic to work as usual (for show/hide/etc. purposes).
|
| - [fullscreenController_ overlayFrameChanged:frame];
|
| - } else {
|
| - // Okay to call even if |floatingBarBackingView_| is nil.
|
| - if ([floatingBarBackingView_ superview])
|
| - [floatingBarBackingView_ removeFromSuperview];
|
| + // Insert it into the view hierarchy if necessary.
|
| + if (![floatingBarBackingView superview] ||
|
| + aboveBookmarkBar != floatingBarAboveBookmarkBar_) {
|
| + NSView* contentView = [[self window] contentView];
|
| + // z-order gets messed up unless we explicitly remove the floatingbar
|
| + // view and re-add it.
|
| + [floatingBarBackingView removeFromSuperview];
|
| + [contentView addSubview:floatingBarBackingView
|
| + positioned:(aboveBookmarkBar ?
|
| + NSWindowAbove : NSWindowBelow)
|
| + relativeTo:[bookmarkBarController_ view]];
|
| + floatingBarAboveBookmarkBar_ = aboveBookmarkBar;
|
| }
|
| +
|
| + // Set its frame.
|
| + [floatingBarBackingView setFrame:frame];
|
| + [fullscreenController_ overlayFrameChanged:frame];
|
| }
|
|
|
| - (CGFloat)layoutInfoBarAtMinX:(CGFloat)minX
|
| @@ -469,16 +468,7 @@
|
| [self layoutSubviews];
|
| }
|
|
|
| -// TODO(rohitrao): This function has shrunk into uselessness, and
|
| -// |-setFullscreen:| has grown rather large. Find a good way to break up
|
| -// |-setFullscreen:| into smaller pieces. http://crbug.com/36449
|
| - (void)adjustUIForFullscreen:(BOOL)fullscreen {
|
| - // Create the floating bar backing view if necessary.
|
| - if (fullscreen && !floatingBarBackingView_.get() &&
|
| - ([self hasTabStrip] || [self hasToolbar] || [self hasLocationBar])) {
|
| - floatingBarBackingView_.reset(
|
| - [[FloatingBarBackingView alloc] initWithFrame:NSZeroRect]);
|
| - }
|
| }
|
|
|
| - (void)enableBarVisibilityUpdates {
|
|
|