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

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

Issue 10800011: [Mac] Changes to the behavior of Lion+ fullscreen and presentation mode. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: YES Created 8 years, 5 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 #import "base/memory/scoped_nsobject.h" 10 #import "base/memory/scoped_nsobject.h"
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 toolbarFrame.size.height = newHeight; 503 toolbarFrame.size.height = newHeight;
504 NSRect bookmarkFrame = [[bookmarkBarController_ view] frame]; 504 NSRect bookmarkFrame = [[bookmarkBarController_ view] frame];
505 bookmarkFrame.size.height = bookmarkFrame.size.height - deltaH; 505 bookmarkFrame.size.height = bookmarkFrame.size.height - deltaH;
506 [[toolbarController_ view] setFrame:toolbarFrame]; 506 [[toolbarController_ view] setFrame:toolbarFrame];
507 [[bookmarkBarController_ view] setFrame:bookmarkFrame]; 507 [[bookmarkBarController_ view] setFrame:bookmarkFrame];
508 [self layoutSubviews]; 508 [self layoutSubviews];
509 } 509 }
510 510
511 // Fullscreen and presentation mode methods 511 // Fullscreen and presentation mode methods
512 512
513 - (BOOL)shouldUsePresentationModeWhenEnteringFullscreen {
514 return browser_->profile()->GetPrefs()->GetBoolean(
515 prefs::kPresentationModeEnabled);
516 }
517
518 - (void)setShouldUsePresentationModeWhenEnteringFullscreen:(BOOL)flag {
519 browser_->profile()->GetPrefs()->SetBoolean(
520 prefs::kPresentationModeEnabled, flag);
521 }
522
523 - (BOOL)shouldShowPresentationModeToggle { 513 - (BOOL)shouldShowPresentationModeToggle {
524 return base::mac::IsOSLionOrLater() && [self isFullscreen]; 514 return base::mac::IsOSLionOrLater() && [self isFullscreen];
525 } 515 }
526 516
527 - (void)moveViewsForFullscreenForSnowLeopardOrEarlier:(BOOL)fullscreen 517 - (void)moveViewsForFullscreenForSnowLeopardOrEarlier:(BOOL)fullscreen
528 regularWindow:(NSWindow*)regularWindow 518 regularWindow:(NSWindow*)regularWindow
529 fullscreenWindow:(NSWindow*)fullscreenWindow { 519 fullscreenWindow:(NSWindow*)fullscreenWindow {
530 // This method is only for Snow Leopard and earlier. 520 // This method is only for Snow Leopard and earlier.
531 DCHECK(base::mac::IsOSSnowLeopardOrEarlier()); 521 DCHECK(base::mac::IsOSSnowLeopardOrEarlier());
532 522
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 return (opt | 792 return (opt |
803 NSApplicationPresentationAutoHideDock | 793 NSApplicationPresentationAutoHideDock |
804 NSApplicationPresentationAutoHideMenuBar); 794 NSApplicationPresentationAutoHideMenuBar);
805 } 795 }
806 796
807 - (void)windowWillEnterFullScreen:(NSNotification*)notification { 797 - (void)windowWillEnterFullScreen:(NSNotification*)notification {
808 [self registerForContentViewResizeNotifications]; 798 [self registerForContentViewResizeNotifications];
809 799
810 NSWindow* window = [self window]; 800 NSWindow* window = [self window];
811 savedRegularWindowFrame_ = [window frame]; 801 savedRegularWindowFrame_ = [window frame];
812 BOOL mode = [self shouldUsePresentationModeWhenEnteringFullscreen]; 802 BOOL mode = enteringPresentationMode_ ||
813 mode = mode || 803 browser_->fullscreen_controller()->IsFullscreenForTabOrPending();
814 browser_->fullscreen_controller()->IsFullscreenForTabOrPending();
815 enteringFullscreen_ = YES; 804 enteringFullscreen_ = YES;
816 [self setPresentationModeInternal:mode forceDropdown:NO]; 805 [self setPresentationModeInternal:mode forceDropdown:NO];
817 } 806 }
818 807
819 - (void)windowDidEnterFullScreen:(NSNotification*)notification { 808 - (void)windowDidEnterFullScreen:(NSNotification*)notification {
820 if (base::mac::IsOSLionOrLater()) 809 if (base::mac::IsOSLionOrLater())
821 [self deregisterForContentViewResizeNotifications]; 810 [self deregisterForContentViewResizeNotifications];
822 enteringFullscreen_ = NO; 811 enteringFullscreen_ = NO;
812 enteringPresentationMode_ = NO;
823 [self showFullscreenExitBubbleIfNecessary]; 813 [self showFullscreenExitBubbleIfNecessary];
824 browser_->WindowFullscreenStateChanged(); 814 browser_->WindowFullscreenStateChanged();
825 } 815 }
826 816
827 - (void)windowWillExitFullScreen:(NSNotification*)notification { 817 - (void)windowWillExitFullScreen:(NSNotification*)notification {
828 if (base::mac::IsOSLionOrLater()) 818 if (base::mac::IsOSLionOrLater())
829 [self registerForContentViewResizeNotifications]; 819 [self registerForContentViewResizeNotifications];
830 [self destroyFullscreenExitBubbleIfNecessary]; 820 [self destroyFullscreenExitBubbleIfNecessary];
831 [self setPresentationModeInternal:NO forceDropdown:NO]; 821 [self setPresentationModeInternal:NO forceDropdown:NO];
832 } 822 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 - (void)disableBarVisibilityUpdates { 859 - (void)disableBarVisibilityUpdates {
870 // Early escape if there's nothing to do. 860 // Early escape if there's nothing to do.
871 if (!barVisibilityUpdatesEnabled_) 861 if (!barVisibilityUpdatesEnabled_)
872 return; 862 return;
873 863
874 barVisibilityUpdatesEnabled_ = NO; 864 barVisibilityUpdatesEnabled_ = NO;
875 [presentationModeController_ cancelAnimationAndTimers]; 865 [presentationModeController_ cancelAnimationAndTimers];
876 } 866 }
877 867
878 @end // @implementation BrowserWindowController(Private) 868 @end // @implementation BrowserWindowController(Private)
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller_private.h ('k') | chrome/browser/ui/cocoa/presentation_mode_prefs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698