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

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: 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 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 toolbarFrame.size.height = newHeight; 516 toolbarFrame.size.height = newHeight;
517 NSRect bookmarkFrame = [[bookmarkBarController_ view] frame]; 517 NSRect bookmarkFrame = [[bookmarkBarController_ view] frame];
518 bookmarkFrame.size.height = bookmarkFrame.size.height - deltaH; 518 bookmarkFrame.size.height = bookmarkFrame.size.height - deltaH;
519 [[toolbarController_ view] setFrame:toolbarFrame]; 519 [[toolbarController_ view] setFrame:toolbarFrame];
520 [[bookmarkBarController_ view] setFrame:bookmarkFrame]; 520 [[bookmarkBarController_ view] setFrame:bookmarkFrame];
521 [self layoutSubviews]; 521 [self layoutSubviews];
522 } 522 }
523 523
524 // Fullscreen and presentation mode methods 524 // Fullscreen and presentation mode methods
525 525
526 - (BOOL)shouldUsePresentationModeWhenEnteringFullscreen {
527 return browser_->profile()->GetPrefs()->GetBoolean(
528 prefs::kPresentationModeEnabled);
529 }
530
531 - (void)setShouldUsePresentationModeWhenEnteringFullscreen:(BOOL)flag {
532 browser_->profile()->GetPrefs()->SetBoolean(
533 prefs::kPresentationModeEnabled, flag);
534 }
535
536 - (BOOL)shouldShowPresentationModeToggle { 526 - (BOOL)shouldShowPresentationModeToggle {
537 return base::mac::IsOSLionOrLater() && [self isFullscreen]; 527 return base::mac::IsOSLionOrLater() && [self isFullscreen];
538 } 528 }
539 529
540 - (void)moveViewsForFullscreenForSnowLeopardOrEarlier:(BOOL)fullscreen 530 - (void)moveViewsForFullscreenForSnowLeopardOrEarlier:(BOOL)fullscreen
541 regularWindow:(NSWindow*)regularWindow 531 regularWindow:(NSWindow*)regularWindow
542 fullscreenWindow:(NSWindow*)fullscreenWindow { 532 fullscreenWindow:(NSWindow*)fullscreenWindow {
543 // This method is only for Snow Leopard and earlier. 533 // This method is only for Snow Leopard and earlier.
544 DCHECK(base::mac::IsOSSnowLeopardOrEarlier()); 534 DCHECK(base::mac::IsOSSnowLeopardOrEarlier());
545 535
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 return (opt | 805 return (opt |
816 NSApplicationPresentationAutoHideDock | 806 NSApplicationPresentationAutoHideDock |
817 NSApplicationPresentationAutoHideMenuBar); 807 NSApplicationPresentationAutoHideMenuBar);
818 } 808 }
819 809
820 - (void)windowWillEnterFullScreen:(NSNotification*)notification { 810 - (void)windowWillEnterFullScreen:(NSNotification*)notification {
821 [self registerForContentViewResizeNotifications]; 811 [self registerForContentViewResizeNotifications];
822 812
823 NSWindow* window = [self window]; 813 NSWindow* window = [self window];
824 savedRegularWindowFrame_ = [window frame]; 814 savedRegularWindowFrame_ = [window frame];
825 BOOL mode = [self shouldUsePresentationModeWhenEnteringFullscreen]; 815 BOOL mode = enteringPresentationMode_ ||
rohitrao (ping after 24h) 2012/07/22 11:50:44 Is this variable basically replacing the functiona
Robert Sesek 2012/07/23 17:57:53 Yes. I switched it to an ivar because there's also
826 mode = mode || 816 browser_->fullscreen_controller()->IsFullscreenForTabOrPending();
827 browser_->fullscreen_controller()->IsFullscreenForTabOrPending();
828 enteringFullscreen_ = YES; 817 enteringFullscreen_ = YES;
829 [self setPresentationModeInternal:mode forceDropdown:NO]; 818 [self setPresentationModeInternal:mode forceDropdown:NO];
830 } 819 }
831 820
832 - (void)windowDidEnterFullScreen:(NSNotification*)notification { 821 - (void)windowDidEnterFullScreen:(NSNotification*)notification {
833 if (base::mac::IsOSLionOrLater()) 822 if (base::mac::IsOSLionOrLater())
834 [self deregisterForContentViewResizeNotifications]; 823 [self deregisterForContentViewResizeNotifications];
835 enteringFullscreen_ = NO; 824 enteringFullscreen_ = NO;
825 enteringPresentationMode_ = NO;
836 [self showFullscreenExitBubbleIfNecessary]; 826 [self showFullscreenExitBubbleIfNecessary];
837 browser_->WindowFullscreenStateChanged(); 827 browser_->WindowFullscreenStateChanged();
838 } 828 }
839 829
840 - (void)windowWillExitFullScreen:(NSNotification*)notification { 830 - (void)windowWillExitFullScreen:(NSNotification*)notification {
841 if (base::mac::IsOSLionOrLater()) 831 if (base::mac::IsOSLionOrLater())
842 [self registerForContentViewResizeNotifications]; 832 [self registerForContentViewResizeNotifications];
843 [self destroyFullscreenExitBubbleIfNecessary]; 833 [self destroyFullscreenExitBubbleIfNecessary];
844 [self setPresentationModeInternal:NO forceDropdown:NO]; 834 [self setPresentationModeInternal:NO forceDropdown:NO];
845 } 835 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 - (void)disableBarVisibilityUpdates { 872 - (void)disableBarVisibilityUpdates {
883 // Early escape if there's nothing to do. 873 // Early escape if there's nothing to do.
884 if (!barVisibilityUpdatesEnabled_) 874 if (!barVisibilityUpdatesEnabled_)
885 return; 875 return;
886 876
887 barVisibilityUpdatesEnabled_ = NO; 877 barVisibilityUpdatesEnabled_ = NO;
888 [presentationModeController_ cancelAnimationAndTimers]; 878 [presentationModeController_ cancelAnimationAndTimers];
889 } 879 }
890 880
891 @end // @implementation BrowserWindowController(Private) 881 @end // @implementation BrowserWindowController(Private)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698