| OLD | NEW |
| 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 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 // We're done moving focus, so re-enable bar visibility changes. | 669 // We're done moving focus, so re-enable bar visibility changes. |
| 670 [self enableBarVisibilityUpdates]; | 670 [self enableBarVisibilityUpdates]; |
| 671 } | 671 } |
| 672 | 672 |
| 673 - (void)setPresentationModeInternal:(BOOL)presentationMode | 673 - (void)setPresentationModeInternal:(BOOL)presentationMode |
| 674 forceDropdown:(BOOL)forceDropdown { | 674 forceDropdown:(BOOL)forceDropdown { |
| 675 if (presentationMode == [self inPresentationMode]) | 675 if (presentationMode == [self inPresentationMode]) |
| 676 return; | 676 return; |
| 677 | 677 |
| 678 if (presentationMode) { | 678 if (presentationMode) { |
| 679 BOOL fullscreen_for_tab = browser_->IsFullscreenForTabOrPending(); | 679 BOOL fullscreen_for_tab = browser_->IsFullscreenForTab(); |
| 680 BOOL showDropdown = !fullscreen_for_tab && | 680 BOOL showDropdown = !fullscreen_for_tab && |
| 681 (forceDropdown || [self floatingBarHasFocus]); | 681 (forceDropdown || [self floatingBarHasFocus]); |
| 682 NSView* contentView = [[self window] contentView]; | 682 NSView* contentView = [[self window] contentView]; |
| 683 presentationModeController_.reset( | 683 presentationModeController_.reset( |
| 684 [[PresentationModeController alloc] initWithBrowserController:self]); | 684 [[PresentationModeController alloc] initWithBrowserController:self]); |
| 685 [presentationModeController_ enterPresentationModeForContentView:contentView | 685 [presentationModeController_ enterPresentationModeForContentView:contentView |
| 686 showDropdown:showDropdown]; | 686 showDropdown:showDropdown]; |
| 687 } else { | 687 } else { |
| 688 [presentationModeController_ exitPresentationMode]; | 688 [presentationModeController_ exitPresentationMode]; |
| 689 presentationModeController_.reset(); | 689 presentationModeController_.reset(); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 782 // mode, it needs to draw over the bookmark bar and part of the toolbar. | 782 // mode, it needs to draw over the bookmark bar and part of the toolbar. |
| 783 [[infoBarContainerController_ view] removeFromSuperview]; | 783 [[infoBarContainerController_ view] removeFromSuperview]; |
| 784 NSView* infoBarDest = [[self window] contentView]; | 784 NSView* infoBarDest = [[self window] contentView]; |
| 785 [infoBarDest addSubview:[infoBarContainerController_ view] | 785 [infoBarDest addSubview:[infoBarContainerController_ view] |
| 786 positioned:fullscreen ? NSWindowBelow : NSWindowAbove | 786 positioned:fullscreen ? NSWindowBelow : NSWindowAbove |
| 787 relativeTo:fullscreen ? nil | 787 relativeTo:fullscreen ? nil |
| 788 : [toolbarController_ view]]; | 788 : [toolbarController_ view]]; |
| 789 } | 789 } |
| 790 | 790 |
| 791 - (void)showFullscreenExitBubbleIfNecessary { | 791 - (void)showFullscreenExitBubbleIfNecessary { |
| 792 if (!browser_->IsFullscreenForTabOrPending()) { | 792 if (!browser_->IsFullscreenForTab()) { |
| 793 return; | 793 return; |
| 794 } | 794 } |
| 795 | 795 |
| 796 [presentationModeController_ ensureOverlayHiddenWithAnimation:NO delay:NO]; | 796 [presentationModeController_ ensureOverlayHiddenWithAnimation:NO delay:NO]; |
| 797 | 797 |
| 798 fullscreenExitBubbleController_.reset( | 798 fullscreenExitBubbleController_.reset( |
| 799 [[FullscreenExitBubbleController alloc] | 799 [[FullscreenExitBubbleController alloc] |
| 800 initWithOwner:self | 800 initWithOwner:self |
| 801 browser:browser_.get() | 801 browser:browser_.get() |
| 802 url:fullscreenUrl_ | 802 url:fullscreenUrl_ |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 NSApplicationPresentationAutoHideDock | | 844 NSApplicationPresentationAutoHideDock | |
| 845 NSApplicationPresentationAutoHideMenuBar); | 845 NSApplicationPresentationAutoHideMenuBar); |
| 846 } | 846 } |
| 847 | 847 |
| 848 - (void)windowWillEnterFullScreen:(NSNotification*)notification { | 848 - (void)windowWillEnterFullScreen:(NSNotification*)notification { |
| 849 [self registerForContentViewResizeNotifications]; | 849 [self registerForContentViewResizeNotifications]; |
| 850 | 850 |
| 851 NSWindow* window = [self window]; | 851 NSWindow* window = [self window]; |
| 852 savedRegularWindowFrame_ = [window frame]; | 852 savedRegularWindowFrame_ = [window frame]; |
| 853 BOOL mode = [self shouldUsePresentationModeWhenEnteringFullscreen]; | 853 BOOL mode = [self shouldUsePresentationModeWhenEnteringFullscreen]; |
| 854 mode = mode || browser_->IsFullscreenForTabOrPending(); | 854 mode = mode || browser_->IsFullscreenForTab(); |
| 855 enteringFullscreen_ = YES; | 855 enteringFullscreen_ = YES; |
| 856 [self setPresentationModeInternal:mode forceDropdown:NO]; | 856 [self setPresentationModeInternal:mode forceDropdown:NO]; |
| 857 } | 857 } |
| 858 | 858 |
| 859 - (void)windowDidEnterFullScreen:(NSNotification*)notification { | 859 - (void)windowDidEnterFullScreen:(NSNotification*)notification { |
| 860 if (base::mac::IsOSLionOrLater()) | 860 if (base::mac::IsOSLionOrLater()) |
| 861 [self deregisterForContentViewResizeNotifications]; | 861 [self deregisterForContentViewResizeNotifications]; |
| 862 enteringFullscreen_ = NO; | 862 enteringFullscreen_ = NO; |
| 863 [self showFullscreenExitBubbleIfNecessary]; | 863 [self showFullscreenExitBubbleIfNecessary]; |
| 864 } | 864 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 906 - (void)disableBarVisibilityUpdates { | 906 - (void)disableBarVisibilityUpdates { |
| 907 // Early escape if there's nothing to do. | 907 // Early escape if there's nothing to do. |
| 908 if (!barVisibilityUpdatesEnabled_) | 908 if (!barVisibilityUpdatesEnabled_) |
| 909 return; | 909 return; |
| 910 | 910 |
| 911 barVisibilityUpdatesEnabled_ = NO; | 911 barVisibilityUpdatesEnabled_ = NO; |
| 912 [presentationModeController_ cancelAnimationAndTimers]; | 912 [presentationModeController_ cancelAnimationAndTimers]; |
| 913 } | 913 } |
| 914 | 914 |
| 915 @end // @implementation BrowserWindowController(Private) | 915 @end // @implementation BrowserWindowController(Private) |
| OLD | NEW |