| 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 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 // top chrome elements so it only sits atop the web contents. When in normal | 775 // top chrome elements so it only sits atop the web contents. When in normal |
| 775 // mode, it needs to draw over the bookmark bar and part of the toolbar. | 776 // mode, it needs to draw over the bookmark bar and part of the toolbar. |
| 776 [[infoBarContainerController_ view] removeFromSuperview]; | 777 [[infoBarContainerController_ view] removeFromSuperview]; |
| 777 NSView* infoBarDest = [[self window] contentView]; | 778 NSView* infoBarDest = [[self window] contentView]; |
| 778 [infoBarDest addSubview:[infoBarContainerController_ view] | 779 [infoBarDest addSubview:[infoBarContainerController_ view] |
| 779 positioned:fullscreen ? NSWindowBelow : NSWindowAbove | 780 positioned:fullscreen ? NSWindowBelow : NSWindowAbove |
| 780 relativeTo:fullscreen ? nil | 781 relativeTo:fullscreen ? nil |
| 781 : [toolbarController_ view]]; | 782 : [toolbarController_ view]]; |
| 782 } | 783 } |
| 783 | 784 |
| 784 - (void)showFullscreenExitBubbleIfNecessary { | 785 - (void)showFullscreenExitBubbleIfNecessaryWithURL:(const GURL&)url |
| 786 askPermission:(BOOL)ask_permission { |
| 785 if (!browser_->is_fullscreen_for_tab()) { | 787 if (!browser_->is_fullscreen_for_tab()) { |
| 786 return; | 788 return; |
| 787 } | 789 } |
| 788 | 790 |
| 789 [presentationModeController_ ensureOverlayHiddenWithAnimation:NO delay:NO]; | 791 [presentationModeController_ ensureOverlayHiddenWithAnimation:NO delay:NO]; |
| 790 | 792 |
| 791 fullscreenExitBubbleController_.reset( | 793 fullscreenExitBubbleController_.reset( |
| 792 [[FullscreenExitBubbleController alloc] initWithOwner:self | 794 [[FullscreenExitBubbleController alloc] initWithOwner:self |
| 793 browser:browser_.get()]); | 795 browser:browser_.get() |
| 796 forURL:url |
| 797 askPermission:ask_permission]); |
| 794 NSView* contentView = [[self window] contentView]; | 798 NSView* contentView = [[self window] contentView]; |
| 795 CGFloat maxWidth = NSWidth([contentView frame]); | 799 CGFloat maxWidth = NSWidth([contentView frame]); |
| 796 CGFloat maxY = NSMaxY([[[self window] contentView] frame]); | 800 CGFloat maxY = NSMaxY([[[self window] contentView] frame]); |
| 797 [fullscreenExitBubbleController_ | 801 [fullscreenExitBubbleController_ |
| 798 positionInWindowAtTop:maxY width:maxWidth]; | 802 positionInWindowAtTop:maxY width:maxWidth]; |
| 799 [contentView addSubview:[fullscreenExitBubbleController_ view] | 803 [fullscreenExitBubbleController_ showWindow]; |
| 800 positioned:NSWindowAbove relativeTo:[self tabContentArea]]; | |
| 801 } | 804 } |
| 802 | 805 |
| 803 - (void)destroyFullscreenExitBubbleIfNecessary { | 806 - (void)destroyFullscreenExitBubbleIfNecessary { |
| 804 [[fullscreenExitBubbleController_ view] removeFromSuperview]; | 807 [fullscreenExitBubbleController_ close]; |
| 805 fullscreenExitBubbleController_.reset(); | 808 fullscreenExitBubbleController_.reset(); |
| 806 } | 809 } |
| 807 | 810 |
| 808 - (void)contentViewDidResize:(NSNotification*)notification { | 811 - (void)contentViewDidResize:(NSNotification*)notification { |
| 809 [self layoutSubviews]; | 812 [self layoutSubviews]; |
| 810 } | 813 } |
| 811 | 814 |
| 812 - (void)registerForContentViewResizeNotifications { | 815 - (void)registerForContentViewResizeNotifications { |
| 813 [[NSNotificationCenter defaultCenter] | 816 [[NSNotificationCenter defaultCenter] |
| 814 addObserver:self | 817 addObserver:self |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 887 - (void)disableBarVisibilityUpdates { | 890 - (void)disableBarVisibilityUpdates { |
| 888 // Early escape if there's nothing to do. | 891 // Early escape if there's nothing to do. |
| 889 if (!barVisibilityUpdatesEnabled_) | 892 if (!barVisibilityUpdatesEnabled_) |
| 890 return; | 893 return; |
| 891 | 894 |
| 892 barVisibilityUpdatesEnabled_ = NO; | 895 barVisibilityUpdatesEnabled_ = NO; |
| 893 [presentationModeController_ cancelAnimationAndTimers]; | 896 [presentationModeController_ cancelAnimationAndTimers]; |
| 894 } | 897 } |
| 895 | 898 |
| 896 @end // @implementation BrowserWindowController(Private) | 899 @end // @implementation BrowserWindowController(Private) |
| OLD | NEW |