summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-13 17:55:44 +0000
committermark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-13 17:55:44 +0000
commitbd3f0a5cb3382ede6fea0455bcfadc62d4a132df (patch)
tree65d80f85ff3dabc29e96cb6799f1e4f81d6d4cc3
parent8b442f459a6ab534c7142efb5c5b100c9b1147bf (diff)
downloadchromium_src-bd3f0a5cb3382ede6fea0455bcfadc62d4a132df.zip
chromium_src-bd3f0a5cb3382ede6fea0455bcfadc62d4a132df.tar.gz
chromium_src-bd3f0a5cb3382ede6fea0455bcfadc62d4a132df.tar.bz2
Merge trunk r88533 to the 12.0.742 branch
Fix OS full-screen button on FutureCat. The full-screen button should trigger Chrome's full-screen mode. This should work properly even on subsequent clicks, when a window was already full-screened and then not-full-screened. BUG=85196 TEST=On FutureCat, use the full-screen button to go full-screen, then exit full-screen, then re-enter full-screen with the OS button again. Both times, Chrome's full-screen mode should be activated in the same way. Review URL: http://codereview.chromium.org/7003036 TBR=mark@chromium.org Review URL: http://codereview.chromium.org/7046113 git-svn-id: svn://svn.chromium.org/chrome/branches/742/src@88848 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/ui/cocoa/browser_window_controller.mm29
-rw-r--r--chrome/browser/ui/cocoa/browser_window_controller_private.h8
-rw-r--r--chrome/browser/ui/cocoa/browser_window_controller_private.mm51
3 files changed, 47 insertions, 41 deletions
diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm
index d0bfe00..8ba6eae 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller.mm
@@ -156,19 +156,9 @@
MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
@interface NSWindow (LionSDKDeclarations)
-- (void)toggleFullScreen:(id)sender;
- (void)setRestorable:(BOOL)flag;
@end
-enum {
- NSWindowCollectionBehaviorFullScreenPrimary = 1 << 7,
- NSWindowCollectionBehaviorFullScreenAuxiliary = 1 << 8
-};
-
-enum {
- NSWindowFullScreenButton = 7
-};
-
#endif // MAC_OS_X_VERSION_10_7
// IncognitoImageView subclasses NSView to allow mouse events to pass through it
@@ -417,20 +407,7 @@ enum {
if ([self hasToolbar]) // Do not create the buttons in popups.
[toolbarController_ createBrowserActionButtons];
- // For versions of Mac OS that provide an "enter fullscreen" button, make
- // one appear (in a rather hacky manner). http://crbug.com/74065 : When
- // switching the fullscreen implementation to the new API, revisit how much
- // of this hacky code is necessary.
- if ([window respondsToSelector:@selector(toggleFullScreen:)]) {
- NSWindowCollectionBehavior behavior = [window collectionBehavior];
- behavior |= NSWindowCollectionBehaviorFullScreenPrimary;
- [window setCollectionBehavior:behavior];
-
- NSButton* fullscreenButton =
- [window standardWindowButton:NSWindowFullScreenButton];
- [fullscreenButton setAction:@selector(enterFullscreen:)];
- [fullscreenButton setTarget:self];
- }
+ [self setUpOSFullScreenButton];
// We are done initializing now.
initializing_ = NO;
@@ -2057,6 +2034,10 @@ willAnimateFromState:(bookmarks::VisualState)oldState
// We're done moving focus, so re-enable bar visibility changes.
[self enableBarVisibilityUpdates];
+ // This needs to be done when leaving full-screen mode to ensure that the
+ // button's action is set properly.
+ [self setUpOSFullScreenButton];
+
// Fade back in.
if (didFadeOut) {
CGDisplayFade(token, kFadeDurationSeconds / 2, kCGDisplayBlendSolidColor,
diff --git a/chrome/browser/ui/cocoa/browser_window_controller_private.h b/chrome/browser/ui/cocoa/browser_window_controller_private.h
index 87571262..48d39f6 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller_private.h
+++ b/chrome/browser/ui/cocoa/browser_window_controller_private.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -113,6 +113,12 @@
- (void)enableBarVisibilityUpdates;
- (void)disableBarVisibilityUpdates;
+// For versions of Mac OS that provide an "enter fullscreen" button, make one
+// appear (in a rather hacky manner). http://crbug.com/74065 : When switching
+// the fullscreen implementation to the new API, revisit how much of this
+// hacky code is necessary.
+- (void)setUpOSFullScreenButton;
+
@end // @interface BrowserWindowController(Private)
diff --git a/chrome/browser/ui/cocoa/browser_window_controller_private.mm b/chrome/browser/ui/cocoa/browser_window_controller_private.mm
index 2eac331..52532cc 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller_private.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller_private.mm
@@ -28,6 +28,26 @@
#include "content/browser/tab_contents/tab_contents.h"
#include "content/browser/tab_contents/tab_contents_view.h"
+// Provide the forward-declarations of new 10.7 SDK symbols so they can be
+// called when building with the 10.5 SDK.
+#if !defined(MAC_OS_X_VERSION_10_7) || \
+ MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
+
+@interface NSWindow (LionSDKDeclarations)
+- (void)toggleFullScreen:(id)sender;
+@end
+
+enum {
+ NSWindowCollectionBehaviorFullScreenPrimary = 1 << 7,
+ NSWindowCollectionBehaviorFullScreenAuxiliary = 1 << 8
+};
+
+enum {
+ NSWindowFullScreenButton = 7
+};
+
+#endif // MAC_OS_X_VERSION_10_7
+
namespace {
// Space between the incognito badge and the right edge of the window.
@@ -40,22 +60,7 @@ const CGFloat kLocBarLeftRightInset = 1;
const CGFloat kLocBarTopInset = 0;
const CGFloat kLocBarBottomInset = 1;
-} // end namespace
-
-// 10.7 adds public APIs for full-screen support. Provide the declaration so it
-// can be called below when building with the 10.5 SDK.
-#if !defined(MAC_OS_X_VERSION_10_7) || \
-MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
-
-@interface NSWindow (LionSDKDeclarations)
-- (void)toggleFullScreen:(id)sender;
-@end
-
-enum {
- NSWindowFullScreenButton = 7
-};
-
-#endif // MAC_OS_X_VERSION_10_7
+} // namespace
@implementation BrowserWindowController(Private)
@@ -537,4 +542,18 @@ willPositionSheet:(NSWindow*)sheet
[fullscreenController_ cancelAnimationAndTimers];
}
+- (void)setUpOSFullScreenButton {
+ NSWindow* window = [self window];
+ if ([window respondsToSelector:@selector(toggleFullScreen:)]) {
+ NSWindowCollectionBehavior behavior = [window collectionBehavior];
+ behavior |= NSWindowCollectionBehaviorFullScreenPrimary;
+ [window setCollectionBehavior:behavior];
+
+ NSButton* fullscreenButton =
+ [window standardWindowButton:NSWindowFullScreenButton];
+ [fullscreenButton setAction:@selector(enterFullscreen:)];
+ [fullscreenButton setTarget:self];
+ }
+}
+
@end // @implementation BrowserWindowController(Private)