Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(169)

Side by Side Diff: chrome/browser/ui/cocoa/fullscreen_window.mm

Issue 9187063: [Mac] Fix Cmd-W closing whole window under fullscreen. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "chrome/browser/ui/cocoa/fullscreen_window.h" 5 #import "chrome/browser/ui/cocoa/fullscreen_window.h"
6 6
7 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
7 #import "chrome/browser/ui/cocoa/themed_window.h" 8 #import "chrome/browser/ui/cocoa/themed_window.h"
8 9
9 @implementation FullscreenWindow 10 @implementation FullscreenWindow
10 11
11 // Make sure our designated initializer gets called. 12 // Make sure our designated initializer gets called.
12 - (id)init { 13 - (id)init {
13 return [self initForScreen:[NSScreen mainScreen]]; 14 return [self initForScreen:[NSScreen mainScreen]];
14 } 15 }
15 16
16 - (id)initForScreen:(NSScreen*)screen { 17 - (id)initForScreen:(NSScreen*)screen {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } 66 }
66 67
67 - (void)resignMainWindow { 68 - (void)resignMainWindow {
68 [super resignMainWindow]; 69 [super resignMainWindow];
69 [self setBackgroundColor:[NSColor windowBackgroundColor]]; 70 [self setBackgroundColor:[NSColor windowBackgroundColor]];
70 } 71 }
71 72
72 // We need our own version, since the default one wants to flash the close 73 // We need our own version, since the default one wants to flash the close
73 // button (and possibly other things), which results in nothing happening. 74 // button (and possibly other things), which results in nothing happening.
74 - (void)performClose:(id)sender { 75 - (void)performClose:(id)sender {
75 BOOL shouldClose = YES; 76 id delegate = [self delegate];
77
78 // Route -performClose: to -commandDispatch: on the delegate when coming from
79 // the "close tab" menu item. See comment in chrome_browser_window.mm.
80 if ([self performCloseShouldRouteToCommandDispatch:sender]) {
81 [delegate commandDispatch:sender];
82 return;
83 }
76 84
77 // If applicable, check if this window should close. 85 // If applicable, check if this window should close.
78 id delegate = [self delegate]; 86 BOOL shouldClose = YES;
79 if ([delegate respondsToSelector:@selector(windowShouldClose:)]) 87 if ([delegate respondsToSelector:@selector(windowShouldClose:)])
80 shouldClose = [delegate windowShouldClose:self]; 88 shouldClose = [delegate windowShouldClose:self];
81 89
82 if (shouldClose) { 90 if (shouldClose) {
83 [self close]; 91 [self close];
84 } 92 }
85 } 93 }
86 94
87 - (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item { 95 - (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item {
88 SEL action = [item action]; 96 SEL action = [item action];
89 97
90 // Explicitly enable |-performClose:| (see above); otherwise the fact that 98 // Explicitly enable |-performClose:| (see above); otherwise the fact that
91 // this window does not have a close button results in it being disabled. 99 // this window does not have a close button results in it being disabled.
92 if (action == @selector(performClose:)) 100 if (action == @selector(performClose:))
93 return YES; 101 return YES;
94 102
95 return [super validateUserInterfaceItem:item]; 103 return [super validateUserInterfaceItem:item];
96 } 104 }
97 105
98 @end 106 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698