OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_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 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 // Normally, we don't need to tell the toolbar whether or not to show the | 295 // Normally, we don't need to tell the toolbar whether or not to show the |
296 // divider, but things break down during animation. | 296 // divider, but things break down during animation. |
297 [toolbarController_ setDividerOpacity:[self toolbarDividerOpacity]]; | 297 [toolbarController_ setDividerOpacity:[self toolbarDividerOpacity]]; |
298 } | 298 } |
299 | 299 |
300 - (CGFloat)floatingBarHeight { | 300 - (CGFloat)floatingBarHeight { |
301 if (![self isInFullscreenWithOmniboxSliding]) | 301 if (![self isInFullscreenWithOmniboxSliding]) |
302 return 0; | 302 return 0; |
303 | 303 |
304 CGFloat totalHeight = 0; | 304 CGFloat totalHeight = 0; |
305 if (presentationModeController_) | |
306 totalHeight = [presentationModeController_ floatingBarVerticalOffset]; | |
307 | |
308 if ([self hasTabStrip]) | 305 if ([self hasTabStrip]) |
309 totalHeight += NSHeight([[self tabStripView] frame]); | 306 totalHeight += NSHeight([[self tabStripView] frame]); |
310 | 307 |
311 if ([self hasToolbar]) { | 308 if ([self hasToolbar]) { |
312 totalHeight += NSHeight([[toolbarController_ view] frame]); | 309 totalHeight += NSHeight([[toolbarController_ view] frame]); |
313 } else if ([self hasLocationBar]) { | 310 } else if ([self hasLocationBar]) { |
314 totalHeight += NSHeight([[toolbarController_ view] frame]) + | 311 totalHeight += NSHeight([[toolbarController_ view] frame]) + |
315 kLocBarTopInset + kLocBarBottomInset; | 312 kLocBarTopInset + kLocBarBottomInset; |
316 } | 313 } |
317 | 314 |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 presentationModeController_.reset(); | 720 presentationModeController_.reset(); |
724 | 721 |
725 // Force the bookmark bar z-order to update. | 722 // Force the bookmark bar z-order to update. |
726 [[bookmarkBarController_ view] removeFromSuperview]; | 723 [[bookmarkBarController_ view] removeFromSuperview]; |
727 [self layoutSubviews]; | 724 [self layoutSubviews]; |
728 } | 725 } |
729 | 726 |
730 - (void)adjustUIForSlidingFullscreenStyle:(fullscreen_mac::SlidingStyle)style { | 727 - (void)adjustUIForSlidingFullscreenStyle:(fullscreen_mac::SlidingStyle)style { |
731 if (!presentationModeController_) { | 728 if (!presentationModeController_) { |
732 presentationModeController_.reset( | 729 presentationModeController_.reset( |
733 [[PresentationModeController alloc] initWithBrowserController:self | 730 [self newPresentationModeControllerWithStyle:style]); |
734 style:style]); | |
735 [self configurePresentationModeController]; | 731 [self configurePresentationModeController]; |
736 } else { | 732 } else { |
737 presentationModeController_.get().slidingStyle = style; | 733 presentationModeController_.get().slidingStyle = style; |
738 } | 734 } |
739 | 735 |
740 if (!floatingBarBackingView_.get() && | 736 if (!floatingBarBackingView_.get() && |
741 ([self hasTabStrip] || [self hasToolbar] || [self hasLocationBar])) { | 737 ([self hasTabStrip] || [self hasToolbar] || [self hasLocationBar])) { |
742 floatingBarBackingView_.reset( | 738 floatingBarBackingView_.reset( |
743 [[FloatingBarBackingView alloc] initWithFrame:NSZeroRect]); | 739 [[FloatingBarBackingView alloc] initWithFrame:NSZeroRect]); |
744 [floatingBarBackingView_ | 740 [floatingBarBackingView_ |
745 setAutoresizingMask:(NSViewWidthSizable | NSViewMinYMargin)]; | 741 setAutoresizingMask:(NSViewWidthSizable | NSViewMinYMargin)]; |
746 } | 742 } |
747 | 743 |
748 // Force the bookmark bar z-order to update. | 744 // Force the bookmark bar z-order to update. |
749 [[bookmarkBarController_ view] removeFromSuperview]; | 745 [[bookmarkBarController_ view] removeFromSuperview]; |
750 [self layoutSubviews]; | 746 [self layoutSubviews]; |
751 } | 747 } |
752 | 748 |
| 749 - (PresentationModeController*)newPresentationModeControllerWithStyle: |
| 750 (fullscreen_mac::SlidingStyle)style { |
| 751 return [[PresentationModeController alloc] initWithBrowserController:self |
| 752 style:style]; |
| 753 } |
| 754 |
753 - (void)enterImmersiveFullscreen { | 755 - (void)enterImmersiveFullscreen { |
754 // Set to NO by |-windowDidEnterFullScreen:|. | 756 // Set to NO by |-windowDidEnterFullScreen:|. |
755 enteringImmersiveFullscreen_ = YES; | 757 enteringImmersiveFullscreen_ = YES; |
756 | 758 |
757 // Fade to black. | 759 // Fade to black. |
758 const CGDisplayReservationInterval kFadeDurationSeconds = 0.6; | 760 const CGDisplayReservationInterval kFadeDurationSeconds = 0.6; |
759 Boolean didFadeOut = NO; | 761 Boolean didFadeOut = NO; |
760 CGDisplayFadeReservationToken token; | 762 CGDisplayFadeReservationToken token; |
761 if (CGAcquireDisplayFadeReservation(kFadeDurationSeconds, &token) | 763 if (CGAcquireDisplayFadeReservation(kFadeDurationSeconds, &token) |
762 == kCGErrorSuccess) { | 764 == kCGErrorSuccess) { |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1179 | 1181 |
1180 - (void)exitAppKitFullscreen { | 1182 - (void)exitAppKitFullscreen { |
1181 DCHECK(base::mac::IsOSLionOrLater()); | 1183 DCHECK(base::mac::IsOSLionOrLater()); |
1182 if (FramedBrowserWindow* framedBrowserWindow = | 1184 if (FramedBrowserWindow* framedBrowserWindow = |
1183 base::mac::ObjCCast<FramedBrowserWindow>([self window])) { | 1185 base::mac::ObjCCast<FramedBrowserWindow>([self window])) { |
1184 [framedBrowserWindow toggleSystemFullScreen]; | 1186 [framedBrowserWindow toggleSystemFullScreen]; |
1185 } | 1187 } |
1186 } | 1188 } |
1187 | 1189 |
1188 @end // @implementation BrowserWindowController(Private) | 1190 @end // @implementation BrowserWindowController(Private) |
OLD | NEW |