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 7a79c2d42937933878cdfc4b4815f2a843fc3d72..996e3d6b3ce3110895a4ad4dbf89adf27122978f 100644 |
--- a/chrome/browser/ui/cocoa/browser_window_controller_private.mm |
+++ b/chrome/browser/ui/cocoa/browser_window_controller_private.mm |
@@ -764,6 +764,11 @@ willPositionSheet:(NSWindow*)sheet |
if (fullscreenLowPowerCoordinator_) |
fullscreenLowPowerCoordinator_->SetInFullscreenTransition(false); |
+ |
+ if (shouldExitAfterEnteringFullscreen_) { |
+ shouldExitAfterEnteringFullscreen_ = NO; |
+ [self exitAppKitFullscreen]; |
+ } |
} |
- (void)windowWillExitFullScreen:(NSNotification*)notification { |
@@ -929,6 +934,15 @@ willPositionSheet:(NSWindow*)sheet |
- (void)exitAppKitFullscreen { |
if (FramedBrowserWindow* framedBrowserWindow = |
base::mac::ObjCCast<FramedBrowserWindow>([self window])) { |
+ |
+ // If we're in the process of entering fullscreen, toggleSystemFullscreen |
+ // will get ignored. Set |shouldExitAfterEnteringFullscreen_| to true so |
+ // the browser will exit fullscreen immediately after it enters it. |
+ if (enteringAppKitFullscreen_) { |
+ shouldExitAfterEnteringFullscreen_ = YES; |
+ return; |
+ } |
+ |
[framedBrowserWindow toggleSystemFullScreen]; |
} |
} |