From 4d1e70c750dc009ce1c23e76b8c2009264dba0ef Mon Sep 17 00:00:00 2001 From: asvitkine Date: Tue, 15 Dec 2015 15:12:03 -0800 Subject: [Mac] Fix regression where commands were disabled in full screen. 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} --- .../browser/ui/cocoa/browser_window_controller.mm | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'chrome/browser/ui/cocoa/browser_window_controller.mm') diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm index ee3004e..40172b4 100644 --- a/chrome/browser/ui/cocoa/browser_window_controller.mm +++ b/chrome/browser/ui/cocoa/browser_window_controller.mm @@ -184,6 +184,17 @@ using content::Referrer; using content::RenderWidgetHostView; using content::WebContents; +namespace { + +void SetUpBrowserWindowCommandHandler(NSWindow* window) { + // Make the window handle browser window commands. + [base::mac::ObjCCastStrict(window) + setCommandHandler:[[[BrowserWindowCommandHandler alloc] init] + autorelease]]; +} + +} // namespace + @interface NSWindow (NSPrivateApis) // Note: These functions are private, use -[NSObject respondsToSelector:] // before calling them. @@ -227,10 +238,7 @@ using content::WebContents; browser_.reset(browser); ownsBrowser_ = ownIt; NSWindow* window = [self window]; - // Make the window handle browser window commands. - [base::mac::ObjCCastStrict(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 @@ -1448,8 +1456,10 @@ using content::WebContents; } - (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 { -- cgit v1.1