Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_controller_private.mm

Issue 523233002: mac: Remove simplified fullscreen. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@new_fullscreen2
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 CGFloat yOffset = 0; 199 CGFloat yOffset = 0;
200 if ([self isInFullscreenWithOmniboxSliding]) { 200 if ([self isInFullscreenWithOmniboxSliding]) {
201 switch (fullscreenStyle_) { 201 switch (fullscreenStyle_) {
202 case fullscreen_mac::OMNIBOX_TABS_PRESENT: 202 case fullscreen_mac::OMNIBOX_TABS_PRESENT:
203 // In system fullscreen mode, |yOffset| accounts for the extra offset 203 // In system fullscreen mode, |yOffset| accounts for the extra offset
204 // needed to dodge the menu bar. 204 // needed to dodge the menu bar.
205 yOffset = -std::floor( 205 yOffset = -std::floor(
206 (floatingBarShownFraction_) * 206 (floatingBarShownFraction_) *
207 [presentationModeController_ floatingBarVerticalOffset]); 207 [presentationModeController_ floatingBarVerticalOffset]);
208 break; 208 break;
209 case fullscreen_mac::OMNIBOX_PRESENT: {
210 // At rest: omnibox showing. yOffset should be tabstrip height
211 // When cursor is at top: everything shows. yOffset should be -menubar
212 // height.
213 CGFloat tabStripHeight = 0;
214 if ([self hasTabStrip])
215 tabStripHeight = NSHeight([[self tabStripView] frame]);
216 yOffset = std::floor(
217 (1 - floatingBarShownFraction_) * tabStripHeight -
218 floatingBarShownFraction_ *
219 [presentationModeController_ floatingBarVerticalOffset]);
220 break;
221 }
222 case fullscreen_mac::OMNIBOX_TABS_HIDDEN: 209 case fullscreen_mac::OMNIBOX_TABS_HIDDEN:
223 // In presentation mode, |yOffset| accounts for the sliding position of 210 // In presentation mode, |yOffset| accounts for the sliding position of
224 // the floating bar and the extra offset needed to dodge the menu bar. 211 // the floating bar and the extra offset needed to dodge the menu bar.
225 yOffset = 212 yOffset =
226 std::floor((1 - floatingBarShownFraction_) * floatingBarHeight) - 213 std::floor((1 - floatingBarShownFraction_) * floatingBarHeight) -
227 [presentationModeController_ floatingBarVerticalOffset]; 214 [presentationModeController_ floatingBarVerticalOffset];
228 break; 215 break;
229 } 216 }
230 } 217 }
231 218
(...skipping 30 matching lines...) Expand all
262 249
263 // Place the find bar immediately below the toolbar/attached bookmark bar. In 250 // Place the find bar immediately below the toolbar/attached bookmark bar. In
264 // presentation mode, it hangs off the top of the screen when the bar is 251 // presentation mode, it hangs off the top of the screen when the bar is
265 // hidden. 252 // hidden.
266 [findBarCocoaController_ positionFindBarViewAtMaxY:maxY maxWidth:width]; 253 [findBarCocoaController_ positionFindBarViewAtMaxY:maxY maxWidth:width];
267 [fullscreenExitBubbleController_ positionInWindowAtTop:maxY width:width]; 254 [fullscreenExitBubbleController_ positionInWindowAtTop:maxY width:width];
268 255
269 if ([self isInFullscreenWithOmniboxSliding]) { 256 if ([self isInFullscreenWithOmniboxSliding]) {
270 switch (fullscreenStyle_) { 257 switch (fullscreenStyle_) {
271 case fullscreen_mac::OMNIBOX_TABS_PRESENT: 258 case fullscreen_mac::OMNIBOX_TABS_PRESENT:
272 case fullscreen_mac::OMNIBOX_PRESENT: 259 // Do nothing in Canonical Fullscreen. All content slides.
273 // Do nothing in Canonical Fullscreen and Simplified Fullscreen. All
274 // content slides.
275 break; 260 break;
276 case fullscreen_mac::OMNIBOX_TABS_HIDDEN: 261 case fullscreen_mac::OMNIBOX_TABS_HIDDEN:
277 // If in presentation mode, reset |maxY| to top of screen, so that the 262 // If in presentation mode, reset |maxY| to top of screen, so that the
278 // floating bar slides over the things which appear to be in the content 263 // floating bar slides over the things which appear to be in the content
279 // area. 264 // area.
280 maxY = NSMaxY(contentBounds); 265 maxY = NSMaxY(contentBounds);
281 break; 266 break;
282 } 267 }
283 } 268 }
284 269
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 743
759 // Create the fullscreen window. 744 // Create the fullscreen window.
760 fullscreenWindow_.reset([[self createFullscreenWindow] retain]); 745 fullscreenWindow_.reset([[self createFullscreenWindow] retain]);
761 savedRegularWindow_ = [[self window] retain]; 746 savedRegularWindow_ = [[self window] retain];
762 savedRegularWindowFrame_ = [savedRegularWindow_ frame]; 747 savedRegularWindowFrame_ = [savedRegularWindow_ frame];
763 748
764 [self moveViewsForImmersiveFullscreen:YES 749 [self moveViewsForImmersiveFullscreen:YES
765 regularWindow:[self window] 750 regularWindow:[self window]
766 fullscreenWindow:fullscreenWindow_.get()]; 751 fullscreenWindow:fullscreenWindow_.get()];
767 752
768 // When simplified fullscreen is enabled, do not enter presentation mode. 753 fullscreen_mac::SlidingStyle style = fullscreen_mac::OMNIBOX_TABS_HIDDEN;
769 const CommandLine* command_line = CommandLine::ForCurrentProcess();
770 fullscreen_mac::SlidingStyle style;
771 if (command_line->HasSwitch(switches::kEnableSimplifiedFullscreen)) {
772 style = fullscreen_mac::OMNIBOX_PRESENT;
773 } else {
774 style = fullscreen_mac::OMNIBOX_TABS_HIDDEN;
775 }
776 [self adjustUIForSlidingFullscreenStyle:style]; 754 [self adjustUIForSlidingFullscreenStyle:style];
777 755
778 // AppKit is helpful and prevents NSWindows from having the same height as 756 // AppKit is helpful and prevents NSWindows from having the same height as
779 // the screen while the menu bar is showing. This only applies to windows on 757 // the screen while the menu bar is showing. This only applies to windows on
780 // a secondary screen, in a separate space. Calling [NSWindow 758 // a secondary screen, in a separate space. Calling [NSWindow
781 // setFrame:display:] with the screen's height will always reduce the 759 // setFrame:display:] with the screen's height will always reduce the
782 // height by the height of the MenuBar. Calling the method with any other 760 // height by the height of the MenuBar. Calling the method with any other
783 // height works fine. The relevant method in the 10.10 AppKit SDK is called: 761 // height works fine. The relevant method in the 10.10 AppKit SDK is called:
784 // _canAdjustSizeForScreensHaveSeparateSpacesIfFillingSecondaryScreen 762 // _canAdjustSizeForScreensHaveSeparateSpacesIfFillingSecondaryScreen
785 // 763 //
(...skipping 21 matching lines...) Expand all
807 const CGDisplayReservationInterval kFadeDurationSeconds = 0.6; 785 const CGDisplayReservationInterval kFadeDurationSeconds = 0.6;
808 Boolean didFadeOut = NO; 786 Boolean didFadeOut = NO;
809 CGDisplayFadeReservationToken token; 787 CGDisplayFadeReservationToken token;
810 if (CGAcquireDisplayFadeReservation(kFadeDurationSeconds, &token) 788 if (CGAcquireDisplayFadeReservation(kFadeDurationSeconds, &token)
811 == kCGErrorSuccess) { 789 == kCGErrorSuccess) {
812 didFadeOut = YES; 790 didFadeOut = YES;
813 CGDisplayFade(token, kFadeDurationSeconds / 2, kCGDisplayBlendNormal, 791 CGDisplayFade(token, kFadeDurationSeconds / 2, kCGDisplayBlendNormal,
814 kCGDisplayBlendSolidColor, 0.0, 0.0, 0.0, /*synchronous=*/true); 792 kCGDisplayBlendSolidColor, 0.0, 0.0, 0.0, /*synchronous=*/true);
815 } 793 }
816 794
817 // When simplified fullscreen is enabled, the menubar status is managed
818 // directly by BWC.
819 const CommandLine* command_line = CommandLine::ForCurrentProcess();
820 if (command_line->HasSwitch(switches::kEnableSimplifiedFullscreen)) {
821 // TODO(rohitrao): Add code to manage the menubar here.
822 }
823
824 [self windowWillExitFullScreen:nil]; 795 [self windowWillExitFullScreen:nil];
825 796
826 [self moveViewsForImmersiveFullscreen:NO 797 [self moveViewsForImmersiveFullscreen:NO
827 regularWindow:savedRegularWindow_ 798 regularWindow:savedRegularWindow_
828 fullscreenWindow:fullscreenWindow_.get()]; 799 fullscreenWindow:fullscreenWindow_.get()];
829 800
830 // When exiting fullscreen mode, we need to call layoutSubviews manually. 801 // When exiting fullscreen mode, we need to call layoutSubviews manually.
831 [savedRegularWindow_ autorelease]; 802 [savedRegularWindow_ autorelease];
832 savedRegularWindow_ = nil; 803 savedRegularWindow_ = nil;
833 fullscreenWindow_.reset(); 804 fullscreenWindow_.reset();
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 - (void)windowWillEnterFullScreen:(NSNotification*)notification { 881 - (void)windowWillEnterFullScreen:(NSNotification*)notification {
911 if (notification) // For System Fullscreen when non-nil. 882 if (notification) // For System Fullscreen when non-nil.
912 [self registerForContentViewResizeNotifications]; 883 [self registerForContentViewResizeNotifications];
913 884
914 NSWindow* window = [self window]; 885 NSWindow* window = [self window];
915 savedRegularWindowFrame_ = [window frame]; 886 savedRegularWindowFrame_ = [window frame];
916 BOOL mode = enteringPresentationMode_ || 887 BOOL mode = enteringPresentationMode_ ||
917 browser_->fullscreen_controller()->IsWindowFullscreenForTabOrPending(); 888 browser_->fullscreen_controller()->IsWindowFullscreenForTabOrPending();
918 enteringAppKitFullscreen_ = YES; 889 enteringAppKitFullscreen_ = YES;
919 890
920 fullscreen_mac::SlidingStyle style; 891 fullscreen_mac::SlidingStyle style =
921 const CommandLine* command_line = CommandLine::ForCurrentProcess(); 892 mode ? fullscreen_mac::OMNIBOX_TABS_HIDDEN
922 if (command_line->HasSwitch(switches::kEnableSimplifiedFullscreen)) 893 : fullscreen_mac::OMNIBOX_TABS_PRESENT;
923 style = fullscreen_mac::OMNIBOX_PRESENT;
924 else if (mode)
925 style = fullscreen_mac::OMNIBOX_TABS_HIDDEN;
926 else
927 style = fullscreen_mac::OMNIBOX_TABS_PRESENT;
928 894
929 [self adjustUIForSlidingFullscreenStyle:style]; 895 [self adjustUIForSlidingFullscreenStyle:style];
930 } 896 }
931 897
932 - (void)windowDidEnterFullScreen:(NSNotification*)notification { 898 - (void)windowDidEnterFullScreen:(NSNotification*)notification {
933 // In Yosemite, some combination of the titlebar and toolbar always show in 899 // In Yosemite, some combination of the titlebar and toolbar always show in
934 // full-screen mode. We do not want either to show. Search for the window that 900 // full-screen mode. We do not want either to show. Search for the window that
935 // contains the views, and hide it. There is no need to ever unhide the view. 901 // contains the views, and hide it. There is no need to ever unhide the view.
936 // http://crbug.com/380235 902 // http://crbug.com/380235
937 if (base::mac::IsOSYosemiteOrLater()) { 903 if (base::mac::IsOSYosemiteOrLater()) {
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 1125
1160 - (void)exitAppKitFullscreen { 1126 - (void)exitAppKitFullscreen {
1161 DCHECK(base::mac::IsOSLionOrLater()); 1127 DCHECK(base::mac::IsOSLionOrLater());
1162 if (FramedBrowserWindow* framedBrowserWindow = 1128 if (FramedBrowserWindow* framedBrowserWindow =
1163 base::mac::ObjCCast<FramedBrowserWindow>([self window])) { 1129 base::mac::ObjCCast<FramedBrowserWindow>([self window])) {
1164 [framedBrowserWindow toggleSystemFullScreen]; 1130 [framedBrowserWindow toggleSystemFullScreen];
1165 } 1131 }
1166 } 1132 }
1167 1133
1168 @end // @implementation BrowserWindowController(Private) 1134 @end // @implementation BrowserWindowController(Private)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698