| 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 3874f2005a146a1393b43bd605710d18c9cbd265..0396108693c7032360f5e2b965316780aa80be26 100644
|
| --- a/chrome/browser/ui/cocoa/browser_window_controller_private.mm
|
| +++ b/chrome/browser/ui/cocoa/browser_window_controller_private.mm
|
| @@ -7,6 +7,7 @@
|
| #include <cmath>
|
|
|
| #include "base/command_line.h"
|
| +#include "base/mac/bind_objc_block.h"
|
| #include "base/mac/mac_util.h"
|
| #import "base/mac/scoped_nsobject.h"
|
| #import "base/mac/sdk_forward_declarations.h"
|
| @@ -682,6 +683,8 @@ willPositionSheet:(NSWindow*)sheet
|
| BOOL mode = enteringPresentationMode_ ||
|
| browser_->fullscreen_controller()->IsWindowFullscreenForTabOrPending();
|
| enteringAppKitFullscreen_ = YES;
|
| + enteringAppKitFullscreenOnPrimaryScreen_ =
|
| + [[[self window] screen] isEqual:[[NSScreen screens] objectAtIndex:0]];
|
|
|
| fullscreen_mac::SlidingStyle style =
|
| mode ? fullscreen_mac::OMNIBOX_TABS_HIDDEN
|
| @@ -704,6 +707,32 @@ willPositionSheet:(NSWindow*)sheet
|
| }
|
| }
|
|
|
| + if ([self shouldUseMavericksAppKitFullscreenHack]) {
|
| + // Apply a hack to fix the size of the window. This is the last run of the
|
| + // MessageLoop where the hack will not work, so dispatch the hack to the
|
| + // top of the MessageLoop.
|
| + base::Callback<void(void)> callback = base::BindBlock(^{
|
| + if (![self isInAppKitFullscreen])
|
| + return;
|
| +
|
| + // The window's frame should be exactly 22 points too short.
|
| + CGFloat kExpectedHeightDifference = 22;
|
| + NSRect currentFrame = [[self window] frame];
|
| + NSRect expectedFrame = [[[self window] screen] frame];
|
| + if (!NSEqualPoints(currentFrame.origin, expectedFrame.origin))
|
| + return;
|
| + if (currentFrame.size.width != expectedFrame.size.width)
|
| + return;
|
| + CGFloat heightDelta =
|
| + expectedFrame.size.height - currentFrame.size.height;
|
| + if (fabs(heightDelta - kExpectedHeightDifference) > 0.01)
|
| + return;
|
| +
|
| + [[self window] setFrame:expectedFrame display:YES];
|
| + });
|
| + base::MessageLoop::current()->PostTask(FROM_HERE, callback);
|
| + }
|
| +
|
| if (notification) // For System Fullscreen when non-nil.
|
| [self deregisterForContentViewResizeNotifications];
|
| enteringAppKitFullscreen_ = NO;
|
| @@ -1049,4 +1078,19 @@ willPositionSheet:(NSWindow*)sheet
|
| }
|
| }
|
|
|
| +- (BOOL)shouldUseMavericksAppKitFullscreenHack {
|
| + if (!base::mac::IsOSMavericks())
|
| + return NO;
|
| + if (![NSScreen respondsToSelector:@selector(screensHaveSeparateSpaces)] ||
|
| + ![NSScreen screensHaveSeparateSpaces]) {
|
| + return NO;
|
| + }
|
| + if (!enteringAppKitFullscreen_)
|
| + return NO;
|
| + if (enteringAppKitFullscreenOnPrimaryScreen_)
|
| + return NO;
|
| +
|
| + return YES;
|
| +}
|
| +
|
| @end // @implementation BrowserWindowController(Private)
|
|
|