| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 Loading... |
| 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 [self setPresentationModeInternal:mode forceDropdown:NO]; | 851 [self setPresentationModeInternal:mode forceDropdown:NO]; |
| 852 } | 852 } |
| 853 | 853 |
| 854 - (void)windowDidEnterFullScreen:(NSNotification*)notification { | 854 - (void)windowDidEnterFullScreen:(NSNotification*)notification { |
| 855 if (base::mac::IsOSLionOrLater()) | 855 if (base::mac::IsOSLionOrLater()) |
| 856 [self deregisterForContentViewResizeNotifications]; | 856 [self deregisterForContentViewResizeNotifications]; |
| 857 [self showFullscreenExitBubbleIfNecessary]; | 857 [self showFullscreenExitBubbleIfNecessary]; |
| 858 } | 858 } |
| 859 | 859 |
| 860 - (void)windowWillExitFullScreen:(NSNotification*)notification { | 860 - (void)windowWillExitFullScreen:(NSNotification*)notification { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 896 - (void)disableBarVisibilityUpdates { | 896 - (void)disableBarVisibilityUpdates { |
| 897 // Early escape if there's nothing to do. | 897 // Early escape if there's nothing to do. |
| 898 if (!barVisibilityUpdatesEnabled_) | 898 if (!barVisibilityUpdatesEnabled_) |
| 899 return; | 899 return; |
| 900 | 900 |
| 901 barVisibilityUpdatesEnabled_ = NO; | 901 barVisibilityUpdatesEnabled_ = NO; |
| 902 [presentationModeController_ cancelAnimationAndTimers]; | 902 [presentationModeController_ cancelAnimationAndTimers]; |
| 903 } | 903 } |
| 904 | 904 |
| 905 @end // @implementation BrowserWindowController(Private) | 905 @end // @implementation BrowserWindowController(Private) |
| OLD | NEW |