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

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: Rebase against top of tree. 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 // Update z-order. The code below depends on this. 195 // Update z-order. The code below depends on this.
196 [self updateSubviewZOrder:[self isInFullscreenWithOmniboxSliding]]; 196 [self updateSubviewZOrder:[self isInFullscreenWithOmniboxSliding]];
197 197
198 CGFloat floatingBarHeight = [self floatingBarHeight]; 198 CGFloat floatingBarHeight = [self floatingBarHeight];
199 CGFloat yOffset = 0; 199 CGFloat yOffset = 0;
200 if ([self isInFullscreenWithOmniboxSliding]) { 200 if ([self isInFullscreenWithOmniboxSliding]) {
201 yOffset += [presentationModeController_ menubarOffset]; 201 yOffset += [presentationModeController_ menubarOffset];
202 switch (presentationModeController_.get().slidingStyle) { 202 switch (presentationModeController_.get().slidingStyle) {
203 case fullscreen_mac::OMNIBOX_TABS_PRESENT: 203 case fullscreen_mac::OMNIBOX_TABS_PRESENT:
204 break; 204 break;
205 case fullscreen_mac::OMNIBOX_PRESENT: {
206 // At rest: omnibox showing. yOffset should be tabstrip height
207 // When cursor is at top: everything shows. yOffset should be -menubar
208 // height.
209 CGFloat tabStripHeight = 0;
210 if ([self hasTabStrip])
211 tabStripHeight = NSHeight([[self tabStripView] frame]);
212 yOffset +=
213 std::floor((1 - presentationModeController_.get().toolbarFraction) *
214 tabStripHeight);
215 break;
216 }
217 case fullscreen_mac::OMNIBOX_TABS_HIDDEN: 205 case fullscreen_mac::OMNIBOX_TABS_HIDDEN:
218 // In presentation mode, |yOffset| accounts for the sliding position of 206 // In presentation mode, |yOffset| accounts for the sliding position of
219 // the floating bar and the extra offset needed to dodge the menu bar. 207 // the floating bar and the extra offset needed to dodge the menu bar.
220 yOffset += 208 yOffset +=
221 std::floor((1 - presentationModeController_.get().toolbarFraction) * 209 std::floor((1 - presentationModeController_.get().toolbarFraction) *
222 floatingBarHeight); 210 floatingBarHeight);
223 break; 211 break;
224 } 212 }
225 } 213 }
226 214
(...skipping 30 matching lines...) Expand all
257 245
258 // Place the find bar immediately below the toolbar/attached bookmark bar. In 246 // Place the find bar immediately below the toolbar/attached bookmark bar. In
259 // presentation mode, it hangs off the top of the screen when the bar is 247 // presentation mode, it hangs off the top of the screen when the bar is
260 // hidden. 248 // hidden.
261 [findBarCocoaController_ positionFindBarViewAtMaxY:maxY maxWidth:width]; 249 [findBarCocoaController_ positionFindBarViewAtMaxY:maxY maxWidth:width];
262 [fullscreenExitBubbleController_ positionInWindowAtTop:maxY width:width]; 250 [fullscreenExitBubbleController_ positionInWindowAtTop:maxY width:width];
263 251
264 if ([self isInFullscreenWithOmniboxSliding]) { 252 if ([self isInFullscreenWithOmniboxSliding]) {
265 switch (presentationModeController_.get().slidingStyle) { 253 switch (presentationModeController_.get().slidingStyle) {
266 case fullscreen_mac::OMNIBOX_TABS_PRESENT: 254 case fullscreen_mac::OMNIBOX_TABS_PRESENT:
267 case fullscreen_mac::OMNIBOX_PRESENT: 255 // Do nothing in Canonical Fullscreen. All content slides.
268 // Do nothing in Canonical Fullscreen and Simplified Fullscreen. All
269 // content slides.
270 break; 256 break;
271 case fullscreen_mac::OMNIBOX_TABS_HIDDEN: 257 case fullscreen_mac::OMNIBOX_TABS_HIDDEN:
272 // If in presentation mode, reset |maxY| to top of screen, so that the 258 // If in presentation mode, reset |maxY| to top of screen, so that the
273 // floating bar slides over the things which appear to be in the content 259 // floating bar slides over the things which appear to be in the content
274 // area. 260 // area.
275 maxY = NSMaxY(contentBounds); 261 maxY = NSMaxY(contentBounds);
276 break; 262 break;
277 } 263 }
278 } 264 }
279 265
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 741
756 // Create the fullscreen window. 742 // Create the fullscreen window.
757 fullscreenWindow_.reset([[self createFullscreenWindow] retain]); 743 fullscreenWindow_.reset([[self createFullscreenWindow] retain]);
758 savedRegularWindow_ = [[self window] retain]; 744 savedRegularWindow_ = [[self window] retain];
759 savedRegularWindowFrame_ = [savedRegularWindow_ frame]; 745 savedRegularWindowFrame_ = [savedRegularWindow_ frame];
760 746
761 [self moveViewsForImmersiveFullscreen:YES 747 [self moveViewsForImmersiveFullscreen:YES
762 regularWindow:[self window] 748 regularWindow:[self window]
763 fullscreenWindow:fullscreenWindow_.get()]; 749 fullscreenWindow:fullscreenWindow_.get()];
764 750
765 // When simplified fullscreen is enabled, do not enter presentation mode. 751 fullscreen_mac::SlidingStyle style = fullscreen_mac::OMNIBOX_TABS_HIDDEN;
766 const CommandLine* command_line = CommandLine::ForCurrentProcess();
767 fullscreen_mac::SlidingStyle style;
768 if (command_line->HasSwitch(switches::kEnableSimplifiedFullscreen)) {
769 style = fullscreen_mac::OMNIBOX_PRESENT;
770 } else {
771 style = fullscreen_mac::OMNIBOX_TABS_HIDDEN;
772 }
773 [self adjustUIForSlidingFullscreenStyle:style]; 752 [self adjustUIForSlidingFullscreenStyle:style];
774 753
775 // AppKit is helpful and prevents NSWindows from having the same height as 754 // AppKit is helpful and prevents NSWindows from having the same height as
776 // the screen while the menu bar is showing. This only applies to windows on 755 // the screen while the menu bar is showing. This only applies to windows on
777 // a secondary screen, in a separate space. Calling [NSWindow 756 // a secondary screen, in a separate space. Calling [NSWindow
778 // setFrame:display:] with the screen's height will always reduce the 757 // setFrame:display:] with the screen's height will always reduce the
779 // height by the height of the MenuBar. Calling the method with any other 758 // height by the height of the MenuBar. Calling the method with any other
780 // height works fine. The relevant method in the 10.10 AppKit SDK is called: 759 // height works fine. The relevant method in the 10.10 AppKit SDK is called:
781 // _canAdjustSizeForScreensHaveSeparateSpacesIfFillingSecondaryScreen 760 // _canAdjustSizeForScreensHaveSeparateSpacesIfFillingSecondaryScreen
782 // 761 //
(...skipping 21 matching lines...) Expand all
804 const CGDisplayReservationInterval kFadeDurationSeconds = 0.6; 783 const CGDisplayReservationInterval kFadeDurationSeconds = 0.6;
805 Boolean didFadeOut = NO; 784 Boolean didFadeOut = NO;
806 CGDisplayFadeReservationToken token; 785 CGDisplayFadeReservationToken token;
807 if (CGAcquireDisplayFadeReservation(kFadeDurationSeconds, &token) 786 if (CGAcquireDisplayFadeReservation(kFadeDurationSeconds, &token)
808 == kCGErrorSuccess) { 787 == kCGErrorSuccess) {
809 didFadeOut = YES; 788 didFadeOut = YES;
810 CGDisplayFade(token, kFadeDurationSeconds / 2, kCGDisplayBlendNormal, 789 CGDisplayFade(token, kFadeDurationSeconds / 2, kCGDisplayBlendNormal,
811 kCGDisplayBlendSolidColor, 0.0, 0.0, 0.0, /*synchronous=*/true); 790 kCGDisplayBlendSolidColor, 0.0, 0.0, 0.0, /*synchronous=*/true);
812 } 791 }
813 792
814 // When simplified fullscreen is enabled, the menubar status is managed
815 // directly by BWC.
816 const CommandLine* command_line = CommandLine::ForCurrentProcess();
817 if (command_line->HasSwitch(switches::kEnableSimplifiedFullscreen)) {
818 // TODO(rohitrao): Add code to manage the menubar here.
819 }
820
821 [self windowWillExitFullScreen:nil]; 793 [self windowWillExitFullScreen:nil];
822 794
823 [self moveViewsForImmersiveFullscreen:NO 795 [self moveViewsForImmersiveFullscreen:NO
824 regularWindow:savedRegularWindow_ 796 regularWindow:savedRegularWindow_
825 fullscreenWindow:fullscreenWindow_.get()]; 797 fullscreenWindow:fullscreenWindow_.get()];
826 798
827 // When exiting fullscreen mode, we need to call layoutSubviews manually. 799 // When exiting fullscreen mode, we need to call layoutSubviews manually.
828 [savedRegularWindow_ autorelease]; 800 [savedRegularWindow_ autorelease];
829 savedRegularWindow_ = nil; 801 savedRegularWindow_ = nil;
830 fullscreenWindow_.reset(); 802 fullscreenWindow_.reset();
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 - (void)windowWillEnterFullScreen:(NSNotification*)notification { 879 - (void)windowWillEnterFullScreen:(NSNotification*)notification {
908 if (notification) // For System Fullscreen when non-nil. 880 if (notification) // For System Fullscreen when non-nil.
909 [self registerForContentViewResizeNotifications]; 881 [self registerForContentViewResizeNotifications];
910 882
911 NSWindow* window = [self window]; 883 NSWindow* window = [self window];
912 savedRegularWindowFrame_ = [window frame]; 884 savedRegularWindowFrame_ = [window frame];
913 BOOL mode = enteringPresentationMode_ || 885 BOOL mode = enteringPresentationMode_ ||
914 browser_->fullscreen_controller()->IsWindowFullscreenForTabOrPending(); 886 browser_->fullscreen_controller()->IsWindowFullscreenForTabOrPending();
915 enteringAppKitFullscreen_ = YES; 887 enteringAppKitFullscreen_ = YES;
916 888
917 fullscreen_mac::SlidingStyle style; 889 fullscreen_mac::SlidingStyle style =
918 const CommandLine* command_line = CommandLine::ForCurrentProcess(); 890 mode ? fullscreen_mac::OMNIBOX_TABS_HIDDEN
919 if (command_line->HasSwitch(switches::kEnableSimplifiedFullscreen)) 891 : fullscreen_mac::OMNIBOX_TABS_PRESENT;
920 style = fullscreen_mac::OMNIBOX_PRESENT;
921 else if (mode)
922 style = fullscreen_mac::OMNIBOX_TABS_HIDDEN;
923 else
924 style = fullscreen_mac::OMNIBOX_TABS_PRESENT;
925 892
926 [self adjustUIForSlidingFullscreenStyle:style]; 893 [self adjustUIForSlidingFullscreenStyle:style];
927 } 894 }
928 895
929 - (void)windowDidEnterFullScreen:(NSNotification*)notification { 896 - (void)windowDidEnterFullScreen:(NSNotification*)notification {
930 // In Yosemite, some combination of the titlebar and toolbar always show in 897 // In Yosemite, some combination of the titlebar and toolbar always show in
931 // full-screen mode. We do not want either to show. Search for the window that 898 // full-screen mode. We do not want either to show. Search for the window that
932 // contains the views, and hide it. There is no need to ever unhide the view. 899 // contains the views, and hide it. There is no need to ever unhide the view.
933 // http://crbug.com/380235 900 // http://crbug.com/380235
934 if (base::mac::IsOSYosemiteOrLater()) { 901 if (base::mac::IsOSYosemiteOrLater()) {
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 1134
1168 - (void)exitAppKitFullscreen { 1135 - (void)exitAppKitFullscreen {
1169 DCHECK(base::mac::IsOSLionOrLater()); 1136 DCHECK(base::mac::IsOSLionOrLater());
1170 if (FramedBrowserWindow* framedBrowserWindow = 1137 if (FramedBrowserWindow* framedBrowserWindow =
1171 base::mac::ObjCCast<FramedBrowserWindow>([self window])) { 1138 base::mac::ObjCCast<FramedBrowserWindow>([self window])) {
1172 [framedBrowserWindow toggleSystemFullScreen]; 1139 [framedBrowserWindow toggleSystemFullScreen];
1173 } 1140 }
1174 } 1141 }
1175 1142
1176 @end // @implementation BrowserWindowController(Private) 1143 @end // @implementation BrowserWindowController(Private)
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller.mm ('k') | chrome/browser/ui/cocoa/presentation_mode_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698