Skip to content

Commit

Permalink
[Mac] Fix regression where commands were disabled in full screen.
Browse files Browse the repository at this point in the history
This was caused by: https://codereview.chromium.org/1250403002

That CL moved where command validation happened, but the new
handler wasn't hooked up to the full screen window that gets
opened on 10.6.

Note: The 10.6 behavior can be simulated by changing the
return value of SupportsSystemFullscreen() to false.

BUG=569418
TEST=On Mac OS 10.6, check that cmd-shift-F can toggle full
screen back and forth.

Review URL: https://codereview.chromium.org/1520283003

Cr-Commit-Position: refs/heads/master@{#365375}
  • Loading branch information
asvitkine-chromium authored and Commit bot committed Dec 15, 2015
1 parent 994e93d commit 4d1e70c
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions chrome/browser/ui/cocoa/browser_window_controller.mm
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,17 @@
using content::RenderWidgetHostView;
using content::WebContents;

namespace {

void SetUpBrowserWindowCommandHandler(NSWindow* window) {
// Make the window handle browser window commands.
[base::mac::ObjCCastStrict<ChromeEventProcessingWindow>(window)
setCommandHandler:[[[BrowserWindowCommandHandler alloc] init]
autorelease]];
}

} // namespace

@interface NSWindow (NSPrivateApis)
// Note: These functions are private, use -[NSObject respondsToSelector:]
// before calling them.
Expand Down Expand Up @@ -227,10 +238,7 @@ - (id)initWithBrowser:(Browser*)browser takeOwnership:(BOOL)ownIt {
browser_.reset(browser);
ownsBrowser_ = ownIt;
NSWindow* window = [self window];
// Make the window handle browser window commands.
[base::mac::ObjCCastStrict<ChromeEventProcessingWindow>(window)
setCommandHandler:[[[BrowserWindowCommandHandler alloc] init]
autorelease]];
SetUpBrowserWindowCommandHandler(window);

// Make the content view for the window have a layer. This will make all
// sub-views have layers. This is necessary to ensure correct layer
Expand Down Expand Up @@ -1448,8 +1456,10 @@ - (void)addFindBar:(FindBarCocoaController*)findBarCocoaController {
}

- (NSWindow*)createFullscreenWindow {
return [[[FullscreenWindow alloc] initForScreen:[[self window] screen]]
autorelease];
NSWindow* window = [[[FullscreenWindow alloc]
initForScreen:[[self window] screen]] autorelease];
SetUpBrowserWindowCommandHandler(window);
return window;
}

- (NSInteger)numberOfTabs {
Expand Down

0 comments on commit 4d1e70c

Please sign in to comment.