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

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

Issue 8423035: Split out fullscreen logic from Browser into FullscreenController. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 // We're done moving focus, so re-enable bar visibility changes. 665 // We're done moving focus, so re-enable bar visibility changes.
666 [self enableBarVisibilityUpdates]; 666 [self enableBarVisibilityUpdates];
667 } 667 }
668 668
669 - (void)setPresentationModeInternal:(BOOL)presentationMode 669 - (void)setPresentationModeInternal:(BOOL)presentationMode
670 forceDropdown:(BOOL)forceDropdown { 670 forceDropdown:(BOOL)forceDropdown {
671 if (presentationMode == [self inPresentationMode]) 671 if (presentationMode == [self inPresentationMode])
672 return; 672 return;
673 673
674 if (presentationMode) { 674 if (presentationMode) {
675 BOOL fullscreen_for_tab = browser_->is_fullscreen_for_tab(); 675 BOOL fullscreen_for_tab = browser_->IsFullscreenForTab();
676 BOOL showDropdown = !fullscreen_for_tab && 676 BOOL showDropdown = !fullscreen_for_tab &&
677 (forceDropdown || [self floatingBarHasFocus]); 677 (forceDropdown || [self floatingBarHasFocus]);
678 NSView* contentView = [[self window] contentView]; 678 NSView* contentView = [[self window] contentView];
679 presentationModeController_.reset( 679 presentationModeController_.reset(
680 [[PresentationModeController alloc] initWithBrowserController:self]); 680 [[PresentationModeController alloc] initWithBrowserController:self]);
681 [presentationModeController_ enterPresentationModeForContentView:contentView 681 [presentationModeController_ enterPresentationModeForContentView:contentView
682 showDropdown:showDropdown]; 682 showDropdown:showDropdown];
683 } else { 683 } else {
684 [presentationModeController_ exitPresentationMode]; 684 [presentationModeController_ exitPresentationMode];
685 presentationModeController_.reset(); 685 presentationModeController_.reset();
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 // mode, it needs to draw over the bookmark bar and part of the toolbar. 778 // mode, it needs to draw over the bookmark bar and part of the toolbar.
779 [[infoBarContainerController_ view] removeFromSuperview]; 779 [[infoBarContainerController_ view] removeFromSuperview];
780 NSView* infoBarDest = [[self window] contentView]; 780 NSView* infoBarDest = [[self window] contentView];
781 [infoBarDest addSubview:[infoBarContainerController_ view] 781 [infoBarDest addSubview:[infoBarContainerController_ view]
782 positioned:fullscreen ? NSWindowBelow : NSWindowAbove 782 positioned:fullscreen ? NSWindowBelow : NSWindowAbove
783 relativeTo:fullscreen ? nil 783 relativeTo:fullscreen ? nil
784 : [toolbarController_ view]]; 784 : [toolbarController_ view]];
785 } 785 }
786 786
787 - (void)showFullscreenExitBubbleIfNecessary { 787 - (void)showFullscreenExitBubbleIfNecessary {
788 if (!browser_->is_fullscreen_for_tab()) { 788 if (!browser_->IsFullscreenForTab()) {
789 return; 789 return;
790 } 790 }
791 791
792 [presentationModeController_ ensureOverlayHiddenWithAnimation:NO delay:NO]; 792 [presentationModeController_ ensureOverlayHiddenWithAnimation:NO delay:NO];
793 793
794 fullscreenExitBubbleController_.reset( 794 fullscreenExitBubbleController_.reset(
795 [[FullscreenExitBubbleController alloc] 795 [[FullscreenExitBubbleController alloc]
796 initWithOwner:self 796 initWithOwner:self
797 browser:browser_.get() 797 browser:browser_.get()
798 url:fullscreenUrl_ 798 url:fullscreenUrl_
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 NSApplicationPresentationAutoHideDock | 840 NSApplicationPresentationAutoHideDock |
841 NSApplicationPresentationAutoHideMenuBar); 841 NSApplicationPresentationAutoHideMenuBar);
842 } 842 }
843 843
844 - (void)windowWillEnterFullScreen:(NSNotification*)notification { 844 - (void)windowWillEnterFullScreen:(NSNotification*)notification {
845 [self registerForContentViewResizeNotifications]; 845 [self registerForContentViewResizeNotifications];
846 846
847 NSWindow* window = [self window]; 847 NSWindow* window = [self window];
848 savedRegularWindowFrame_ = [window frame]; 848 savedRegularWindowFrame_ = [window frame];
849 BOOL mode = [self shouldUsePresentationModeWhenEnteringFullscreen]; 849 BOOL mode = [self shouldUsePresentationModeWhenEnteringFullscreen];
850 mode = mode || browser_->is_fullscreen_for_tab(); 850 mode = mode || browser_->IsFullscreenForTab();
851 enteringFullscreen_ = YES; 851 enteringFullscreen_ = YES;
852 [self setPresentationModeInternal:mode forceDropdown:NO]; 852 [self setPresentationModeInternal:mode forceDropdown:NO];
853 } 853 }
854 854
855 - (void)windowDidEnterFullScreen:(NSNotification*)notification { 855 - (void)windowDidEnterFullScreen:(NSNotification*)notification {
856 if (base::mac::IsOSLionOrLater()) 856 if (base::mac::IsOSLionOrLater())
857 [self deregisterForContentViewResizeNotifications]; 857 [self deregisterForContentViewResizeNotifications];
858 enteringFullscreen_ = NO; 858 enteringFullscreen_ = NO;
859 [self showFullscreenExitBubbleIfNecessary]; 859 [self showFullscreenExitBubbleIfNecessary];
860 } 860 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 - (void)disableBarVisibilityUpdates { 899 - (void)disableBarVisibilityUpdates {
900 // Early escape if there's nothing to do. 900 // Early escape if there's nothing to do.
901 if (!barVisibilityUpdatesEnabled_) 901 if (!barVisibilityUpdatesEnabled_)
902 return; 902 return;
903 903
904 barVisibilityUpdatesEnabled_ = NO; 904 barVisibilityUpdatesEnabled_ = NO;
905 [presentationModeController_ cancelAnimationAndTimers]; 905 [presentationModeController_ cancelAnimationAndTimers];
906 } 906 }
907 907
908 @end // @implementation BrowserWindowController(Private) 908 @end // @implementation BrowserWindowController(Private)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698