summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/fullscreen_window.mm
diff options
context:
space:
mode:
authorrohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-25 20:34:39 +0000
committerrohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-25 20:34:39 +0000
commitb12ed2fc8766a07fec27bc2dcad4b2ebaaa1bbdf (patch)
tree5e3b1940100116f3f0ab99d9875d9e8e8b10c9aa /chrome/browser/cocoa/fullscreen_window.mm
parent9c90deb6ab28f8043574331bb3d2ba6c624f5106 (diff)
downloadchromium_src-b12ed2fc8766a07fec27bc2dcad4b2ebaaa1bbdf.zip
chromium_src-b12ed2fc8766a07fec27bc2dcad4b2ebaaa1bbdf.tar.gz
chromium_src-b12ed2fc8766a07fec27bc2dcad4b2ebaaa1bbdf.tar.bz2
[Mac] Changes to enable performClose: for fullscreen windows.
(Changes really made by viettrungluu@chromium.org.) BUG=31638 TEST=None. (Unittests should still pass.) Review URL: http://codereview.chromium.org/552133 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37029 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/fullscreen_window.mm')
-rw-r--r--chrome/browser/cocoa/fullscreen_window.mm31
1 files changed, 29 insertions, 2 deletions
diff --git a/chrome/browser/cocoa/fullscreen_window.mm b/chrome/browser/cocoa/fullscreen_window.mm
index 3c5fbdb..28cf175 100644
--- a/chrome/browser/cocoa/fullscreen_window.mm
+++ b/chrome/browser/cocoa/fullscreen_window.mm
@@ -1,8 +1,10 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/cocoa/fullscreen_window.h"
+#import "chrome/browser/cocoa/fullscreen_window.h"
+
+#include "base/mac_util.h"
@implementation FullscreenWindow
@@ -40,4 +42,29 @@
return YES;
}
+// We need our own version, since the default one wants to flash the close
+// button (and possibly other things), which results in nothing happening.
+- (void)performClose:(id)sender {
+ BOOL shouldClose = YES;
+
+ // If applicable, check if this window should close.
+ id delegate = [self delegate];
+ if ([delegate respondsToSelector:@selector(windowShouldClose:)])
+ shouldClose = [delegate windowShouldClose:self];
+
+ if (shouldClose) {
+ [self close];
+ mac_util::ReleaseFullScreen();
+ }
+}
+
+- (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item {
+ // Explicitly enable |-performClose:| (see above); otherwise the fact that
+ // this window does not have a close button results in it being disabled.
+ if ([item action] == @selector(performClose:))
+ return YES;
+
+ return [super validateUserInterfaceItem:item];
+}
+
@end