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..edbbedb489630a362a738d3b8533c6e7b47b0bd5 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" |
| @@ -706,7 +706,7 @@ willPositionSheet:(NSWindow*)sheet |
| } |
| - (void)windowDidEnterFullScreen:(NSNotification*)notification { |
| - enterFullscreenTransition_.reset(); |
| + fullscreenTransition_.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 |
| @@ -761,25 +761,36 @@ 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 { |
| + DCHECK(exitingAppKitFullscreen_); |
| + |
| if (notification) // For System Fullscreen when non-nil. |
| [self deregisterForContentViewResizeNotifications]; |
| + |
| + [self layoutSubviews]; |
|
erikchen
2015/08/12 22:08:52
Why is this necessary? Shouldn't all the subviews
spqchan1
2015/08/13 20:38:48
We want to make sure that the subviews are layout
|
| browser_->WindowFullscreenStateChanged(); |
| + |
| + exitingAppKitFullscreen_ = NO; |
| + fullscreenTransition_.reset(); |
| } |
| - (void)windowDidFailToEnterFullScreen:(NSWindow*)window { |
| [self deregisterForContentViewResizeNotifications]; |
| enteringAppKitFullscreen_ = NO; |
| + fullscreenTransition_.reset(); |
| [self adjustUIForExitingFullscreenAndStopOmniboxSliding]; |
| } |
| - (void)windowDidFailToExitFullScreen:(NSWindow*)window { |
| [self deregisterForContentViewResizeNotifications]; |
| - |
| + exitingAppKitFullscreen_ = NO; |
| + fullscreenTransition_.reset(); |
| // Force a relayout to try and get the window back into a reasonable state. |
| [self layoutSubviews]; |
| } |
| @@ -876,7 +887,12 @@ willPositionSheet:(NSWindow*)sheet |
| - (void)updateLayoutParameters:(BrowserWindowLayout*)layout { |
| [layout setContentViewSize:[[[self window] contentView] bounds].size]; |
| - [layout setWindowSize:[[self window] frame].size]; |
| + |
| + NSSize windowSize = (fullscreenTransition_.get()) |
| + ? [fullscreenTransition_ getDesiredWindowLayoutSize] |
| + : [[self window] frame].size; |
| + |
| + [layout setWindowSize:windowSize]; |
| [layout setInAnyFullscreen:[self isInAnyFullscreenMode]]; |
| [layout setFullscreenSlidingStyle: |
| @@ -1094,21 +1110,43 @@ willPositionSheet:(NSWindow*)sheet |
| if (![self shouldUseCustomAppKitFullscreenTransition]) |
| return nil; |
| - enterFullscreenTransition_.reset( |
| - [[BrowserWindowEnterFullscreenTransition alloc] |
| - initWithWindow:self.window]); |
| - return [enterFullscreenTransition_ customWindowsToEnterFullScreen]; |
| + FramedBrowserWindow* framedBrowserWindow = |
| + base::mac::ObjCCast<FramedBrowserWindow>([self window]); |
| + fullscreenTransition_.reset([[BrowserWindowFullscreenTransition alloc] |
| + initEnterWithWindow:framedBrowserWindow]); |
| + return [fullscreenTransition_ customWindowsForFullScreenTransition]; |
| +} |
| + |
| +- (NSArray*)customWindowsToExitFullScreenForWindow:(NSWindow*)window { |
| + DCHECK([window isEqual:self.window]); |
| + |
| + if (![self shouldUseCustomAppKitFullscreenTransition]) |
| + return nil; |
| + |
| + FramedBrowserWindow* framedBrowserWindow = |
| + base::mac::ObjCCast<FramedBrowserWindow>([self window]); |
| + fullscreenTransition_.reset([[BrowserWindowFullscreenTransition alloc] |
| + initExitWithWindow:framedBrowserWindow |
| + frame:savedRegularWindowFrame_]); |
| + |
| + return [fullscreenTransition_ customWindowsForFullScreenTransition]; |
| } |
| - (void)window:(NSWindow*)window |
| startCustomAnimationToEnterFullScreenWithDuration:(NSTimeInterval)duration { |
| DCHECK([window isEqual:self.window]); |
| - [enterFullscreenTransition_ |
| - startCustomAnimationToEnterFullScreenWithDuration:duration]; |
| + [fullscreenTransition_ startCustomFullScreenAnimationWithDuration:duration]; |
| +} |
| + |
| +- (void)window:(NSWindow*)window |
| + startCustomAnimationToExitFullScreenWithDuration:(NSTimeInterval)duration { |
| + DCHECK([window isEqual:self.window]); |
| + |
| + [fullscreenTransition_ startCustomFullScreenAnimationWithDuration:duration]; |
| } |
| - (BOOL)shouldConstrainFrameRect { |
| - if ([enterFullscreenTransition_ shouldWindowBeUnconstrained]) |
| + if ([fullscreenTransition_ shouldWindowBeUnconstrained]) |
| return NO; |
| return [super shouldConstrainFrameRect]; |