| 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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 // The floating bar backing view doesn't actually add any height. | 249 // The floating bar backing view doesn't actually add any height. |
| 250 NSRect floatingBarBackingRect = | 250 NSRect floatingBarBackingRect = |
| 251 NSMakeRect(minX, maxY, width, floatingBarHeight); | 251 NSMakeRect(minX, maxY, width, floatingBarHeight); |
| 252 [self layoutFloatingBarBackingView:floatingBarBackingRect | 252 [self layoutFloatingBarBackingView:floatingBarBackingRect |
| 253 presentationMode:inPresentationMode]; | 253 presentationMode:inPresentationMode]; |
| 254 | 254 |
| 255 // Place the find bar immediately below the toolbar/attached bookmark bar. In | 255 // Place the find bar immediately below the toolbar/attached bookmark bar. In |
| 256 // presentation mode, it hangs off the top of the screen when the bar is | 256 // presentation mode, it hangs off the top of the screen when the bar is |
| 257 // hidden. The find bar is unaffected by the side tab positioning. | 257 // hidden. The find bar is unaffected by the side tab positioning. |
| 258 [findBarCocoaController_ positionFindBarViewAtMaxY:maxY maxWidth:width]; | 258 [findBarCocoaController_ positionFindBarViewAtMaxY:maxY maxWidth:width]; |
| 259 [fullscreenExitBubbleController_ positionInWindowAtTop:maxY width:width]; |
| 259 | 260 |
| 260 // If in presentation mode, reset |maxY| to top of screen, so that the | 261 // If in presentation mode, reset |maxY| to top of screen, so that the |
| 261 // floating bar slides over the things which appear to be in the content area. | 262 // floating bar slides over the things which appear to be in the content area. |
| 262 if (inPresentationMode) | 263 if (inPresentationMode) |
| 263 maxY = NSMaxY(contentBounds); | 264 maxY = NSMaxY(contentBounds); |
| 264 | 265 |
| 265 // Also place the infobar container immediate below the toolbar, except in | 266 // Also place the infobar container immediate below the toolbar, except in |
| 266 // presentation mode in which case it's at the top of the visual content area. | 267 // presentation mode in which case it's at the top of the visual content area. |
| 267 maxY = [self layoutInfoBarAtMinX:minX maxY:maxY width:width]; | 268 maxY = [self layoutInfoBarAtMinX:minX maxY:maxY width:width]; |
| 268 | 269 |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 // top chrome elements so it only sits atop the web contents. When in normal | 773 // top chrome elements so it only sits atop the web contents. When in normal |
| 773 // mode, it needs to draw over the bookmark bar and part of the toolbar. | 774 // mode, it needs to draw over the bookmark bar and part of the toolbar. |
| 774 [[infoBarContainerController_ view] removeFromSuperview]; | 775 [[infoBarContainerController_ view] removeFromSuperview]; |
| 775 NSView* infoBarDest = [[self window] contentView]; | 776 NSView* infoBarDest = [[self window] contentView]; |
| 776 [infoBarDest addSubview:[infoBarContainerController_ view] | 777 [infoBarDest addSubview:[infoBarContainerController_ view] |
| 777 positioned:fullscreen ? NSWindowBelow : NSWindowAbove | 778 positioned:fullscreen ? NSWindowBelow : NSWindowAbove |
| 778 relativeTo:fullscreen ? nil | 779 relativeTo:fullscreen ? nil |
| 779 : [toolbarController_ view]]; | 780 : [toolbarController_ view]]; |
| 780 } | 781 } |
| 781 | 782 |
| 782 - (void)showFullscreenExitBubbleIfNecessary { | 783 - (void)showFullscreenExitBubbleIfNecessaryWithURL:(const GURL&)url |
| 784 showButtons:(BOOL)show_buttons { |
| 783 if (!browser_->is_fullscreen_for_tab()) { | 785 if (!browser_->is_fullscreen_for_tab()) { |
| 784 return; | 786 return; |
| 785 } | 787 } |
| 786 | 788 |
| 787 [presentationModeController_ ensureOverlayHiddenWithAnimation:NO delay:NO]; | 789 [presentationModeController_ ensureOverlayHiddenWithAnimation:NO delay:NO]; |
| 788 | 790 |
| 789 fullscreenExitBubbleController_.reset( | 791 fullscreenExitBubbleController_.reset( |
| 790 [[FullscreenExitBubbleController alloc] initWithOwner:self | 792 [[FullscreenExitBubbleController alloc] initWithOwner:self |
| 791 browser:browser_.get()]); | 793 browser:browser_.get() |
| 794 forURL:url |
| 795 showButtons:show_buttons]); |
| 792 NSView* contentView = [[self window] contentView]; | 796 NSView* contentView = [[self window] contentView]; |
| 793 CGFloat maxWidth = NSWidth([contentView frame]); | 797 CGFloat maxWidth = NSWidth([contentView frame]); |
| 794 CGFloat maxY = NSMaxY([[[self window] contentView] frame]); | 798 CGFloat maxY = NSMaxY([[[self window] contentView] frame]); |
| 795 [fullscreenExitBubbleController_ | 799 [fullscreenExitBubbleController_ |
| 796 positionInWindowAtTop:maxY width:maxWidth]; | 800 positionInWindowAtTop:maxY width:maxWidth]; |
| 797 [contentView addSubview:[fullscreenExitBubbleController_ view] | 801 [fullscreenExitBubbleController_ showWindow]; |
| 798 positioned:NSWindowAbove relativeTo:[self tabContentArea]]; | |
| 799 } | 802 } |
| 800 | 803 |
| 801 - (void)destroyFullscreenExitBubbleIfNecessary { | 804 - (void)destroyFullscreenExitBubbleIfNecessary { |
| 802 [[fullscreenExitBubbleController_ view] removeFromSuperview]; | 805 [fullscreenExitBubbleController_ close]; |
| 803 fullscreenExitBubbleController_.reset(); | 806 fullscreenExitBubbleController_.reset(); |
| 804 } | 807 } |
| 805 | 808 |
| 806 - (void)contentViewDidResize:(NSNotification*)notification { | 809 - (void)contentViewDidResize:(NSNotification*)notification { |
| 807 [self layoutSubviews]; | 810 [self layoutSubviews]; |
| 808 } | 811 } |
| 809 | 812 |
| 810 - (void)registerForContentViewResizeNotifications { | 813 - (void)registerForContentViewResizeNotifications { |
| 811 [[NSNotificationCenter defaultCenter] | 814 [[NSNotificationCenter defaultCenter] |
| 812 addObserver:self | 815 addObserver:self |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 885 - (void)disableBarVisibilityUpdates { | 888 - (void)disableBarVisibilityUpdates { |
| 886 // Early escape if there's nothing to do. | 889 // Early escape if there's nothing to do. |
| 887 if (!barVisibilityUpdatesEnabled_) | 890 if (!barVisibilityUpdatesEnabled_) |
| 888 return; | 891 return; |
| 889 | 892 |
| 890 barVisibilityUpdatesEnabled_ = NO; | 893 barVisibilityUpdatesEnabled_ = NO; |
| 891 [presentationModeController_ cancelAnimationAndTimers]; | 894 [presentationModeController_ cancelAnimationAndTimers]; |
| 892 } | 895 } |
| 893 | 896 |
| 894 @end // @implementation BrowserWindowController(Private) | 897 @end // @implementation BrowserWindowController(Private) |
| OLD | NEW |