Chromium Code Reviews| Index: chrome/browser/ui/cocoa/browser_window_controller_private.mm |
| diff --git a/chrome/browser/ui/cocoa/browser_window_controller_private.mm b/chrome/browser/ui/cocoa/browser_window_controller_private.mm |
| index 4d02ca5a9d775444404b2ad90fb15fccdfb5749f..92b3399c8958e9635bc89b09bb2db69ecf1b7cd1 100644 |
| --- a/chrome/browser/ui/cocoa/browser_window_controller_private.mm |
| +++ b/chrome/browser/ui/cocoa/browser_window_controller_private.mm |
| @@ -22,7 +22,7 @@ |
| #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
| #include "chrome/browser/ui/browser.h" |
| #include "chrome/browser/ui/browser_window_state.h" |
| -#import "chrome/browser/ui/cocoa/browser_window_enter_fullscreen_transition.h" |
| +#import "chrome/browser/ui/cocoa/browser_window_fullscreen_transition.h" |
| #import "chrome/browser/ui/cocoa/browser_window_layout.h" |
| #import "chrome/browser/ui/cocoa/custom_frame_view.h" |
| #import "chrome/browser/ui/cocoa/dev_tools_controller.h" |
| @@ -38,6 +38,7 @@ |
| #import "chrome/browser/ui/cocoa/profiles/avatar_icon_controller.h" |
| #import "chrome/browser/ui/cocoa/status_bubble_mac.h" |
| #import "chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller.h" |
| +#import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h" |
| #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" |
| #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" |
| #import "chrome/browser/ui/cocoa/website_settings/permission_bubble_cocoa.h" |
| @@ -221,6 +222,7 @@ willPositionSheet:(NSWindow*)sheet |
| [(id)self.window setShouldHideTitle:![self hasTitleBar]]; |
| [bookmarkBarController_ updateHiddenState]; |
| + |
| [self updateSubviewZOrder]; |
| base::scoped_nsobject<BrowserWindowLayout> layout( |
| @@ -540,7 +542,6 @@ willPositionSheet:(NSWindow*)sheet |
| // Create the fullscreen window. |
| fullscreenWindow_.reset([[self createFullscreenWindow] retain]); |
| savedRegularWindow_ = [[self window] retain]; |
| - savedRegularWindowFrame_ = [savedRegularWindow_ frame]; |
| [self moveViewsForImmersiveFullscreen:YES |
| regularWindow:[self window] |
| @@ -688,8 +689,6 @@ willPositionSheet:(NSWindow*)sheet |
| if (notification) // For System Fullscreen when non-nil. |
| [self registerForContentViewResizeNotifications]; |
| - NSWindow* window = [self window]; |
| - savedRegularWindowFrame_ = [window frame]; |
| BOOL mode = enteringPresentationMode_ || |
| browser_->exclusive_access_manager() |
| ->fullscreen_controller() |
| @@ -706,8 +705,6 @@ willPositionSheet:(NSWindow*)sheet |
| } |
| - (void)windowDidEnterFullScreen:(NSNotification*)notification { |
| - enterFullscreenTransition_.reset(); |
| - |
| // In Yosemite, some combination of the titlebar and toolbar always show in |
| // full-screen mode. We do not want either to show. Search for the window that |
| // contains the views, and hide it. There is no need to ever unhide the view. |
| @@ -761,25 +758,40 @@ willPositionSheet:(NSWindow*)sheet |
| - (void)windowWillExitFullScreen:(NSNotification*)notification { |
| if (notification) // For System Fullscreen when non-nil. |
| [self registerForContentViewResizeNotifications]; |
| + exitingAppKitFullscreen_ = YES; |
| + |
| [self destroyFullscreenExitBubbleIfNecessary]; |
| [self adjustUIForExitingFullscreenAndStopOmniboxSliding]; |
| } |
| - (void)windowDidExitFullScreen:(NSNotification*)notification { |
| + fullscreenTransition_.reset(); |
| if (notification) // For System Fullscreen when non-nil. |
| [self deregisterForContentViewResizeNotifications]; |
| + |
| + FramedBrowserWindow* framedWindow = (FramedBrowserWindow*)[self window]; |
| + [framedWindow setFrameAndStyleLock:NO]; |
| + |
| + if (exitingAppKitFullscreen_) { |
| + [self layoutSubviews]; |
| + } |
| + exitingAppKitFullscreen_ = NO; |
| + |
| browser_->WindowFullscreenStateChanged(); |
| } |
| - (void)windowDidFailToEnterFullScreen:(NSWindow*)window { |
| [self deregisterForContentViewResizeNotifications]; |
| enteringAppKitFullscreen_ = NO; |
| + FramedBrowserWindow* framedWindow = (FramedBrowserWindow*)[self window]; |
| + [framedWindow setFrameAndStyleLock:NO]; |
|
spqchan1
2015/08/12 19:34:41
Removed the lock here because reset() should get r
|
| [self adjustUIForExitingFullscreenAndStopOmniboxSliding]; |
| + |
| } |
| - (void)windowDidFailToExitFullScreen:(NSWindow*)window { |
| [self deregisterForContentViewResizeNotifications]; |
| - |
| + exitingAppKitFullscreen_ = NO; |
| // Force a relayout to try and get the window back into a reasonable state. |
| [self layoutSubviews]; |
| } |
| @@ -876,7 +888,10 @@ willPositionSheet:(NSWindow*)sheet |
| - (void)updateLayoutParameters:(BrowserWindowLayout*)layout { |
| [layout setContentViewSize:[[[self window] contentView] bounds].size]; |
| - [layout setWindowSize:[[self window] frame].size]; |
| + |
| + NSSize windowSize = (exitingAppKitFullscreen_) ? |
| + [[[self window] contentView] bounds].size : [[self window] frame].size; |
| + [layout setWindowSize:windowSize]; |
| [layout setInAnyFullscreen:[self isInAnyFullscreenMode]]; |
| [layout setFullscreenSlidingStyle: |
| @@ -963,10 +978,11 @@ willPositionSheet:(NSWindow*)sheet |
| } |
| - (void)updateSubviewZOrder { |
| - if ([self isInAnyFullscreenMode]) |
| + if ([self isInAnyFullscreenMode]) { |
| [self updateSubviewZOrderFullscreen]; |
| - else |
| + } else { |
| [self updateSubviewZOrderNormal]; |
| + } |
| } |
| - (void)updateSubviewZOrderNormal { |
| @@ -1091,24 +1107,49 @@ willPositionSheet:(NSWindow*)sheet |
| - (NSArray*)customWindowsToEnterFullScreenForWindow:(NSWindow*)window { |
| DCHECK([window isEqual:self.window]); |
| - if (![self shouldUseCustomAppKitFullscreenTransition]) |
| - return nil; |
| + windowInitialFrame_ = window.frame; |
| + |
| + if (![self shouldUseCustomAppKitFullscreenTransition]) { |
| + return nil; |
| + } |
| + |
| + FramedBrowserWindow* framedBrowserWindow = |
| + base::mac::ObjCCast<FramedBrowserWindow>([self window]); |
| + fullscreenTransition_.reset( |
| + [[BrowserWindowFullscreenTransition alloc] |
| + initWithWindow:framedBrowserWindow]); |
| + return [fullscreenTransition_ customWindowsToEnterFullScreenTransition]; |
| +} |
| + |
| +- (NSArray*)customWindowsToExitFullScreenForWindow:(NSWindow*)window { |
| + DCHECK([window isEqual:self.window]); |
| + |
| + if (![self shouldUseCustomAppKitFullscreenTransition]) { |
| + return nil; |
| + } |
| - enterFullscreenTransition_.reset( |
| - [[BrowserWindowEnterFullscreenTransition alloc] |
| - initWithWindow:self.window]); |
| - return [enterFullscreenTransition_ customWindowsToEnterFullScreen]; |
| + return [fullscreenTransition_ customWindowsToExitFullScreenTransition]; |
| } |
| + |
| - (void)window:(NSWindow*)window |
| startCustomAnimationToEnterFullScreenWithDuration:(NSTimeInterval)duration { |
| DCHECK([window isEqual:self.window]); |
| - [enterFullscreenTransition_ |
| - startCustomAnimationToEnterFullScreenWithDuration:duration]; |
| + [fullscreenTransition_ |
| + startCustomEnterFullScreenAnimationWithDuration:duration]; |
| } |
| +- (void)window:(NSWindow*)window |
| + startCustomAnimationToExitFullScreenWithDuration:(NSTimeInterval)duration { |
| + DCHECK([window isEqual:self.window]); |
| + |
| + [fullscreenTransition_ |
| + startCustomExitFullScreenAnimationWithDuration:duration]; |
| +} |
| + |
| + |
| - (BOOL)shouldConstrainFrameRect { |
| - if ([enterFullscreenTransition_ shouldWindowBeUnconstrained]) |
| + if ([fullscreenTransition_ shouldWindowBeUnconstrained]) |
| return NO; |
| return [super shouldConstrainFrameRect]; |