diff options
author | rohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-11 22:38:24 +0000 |
---|---|---|
committer | rohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-11 22:38:24 +0000 |
commit | dc818ae3e3e573115aff37330ed61169eebee184 (patch) | |
tree | 8bec7fe26af826063a9543fb3dfa31bcf6ab9d45 /chrome/browser/cocoa | |
parent | deab99363c103d267e7fa9d8d9237bf73d96ded3 (diff) | |
download | chromium_src-dc818ae3e3e573115aff37330ed61169eebee184.zip chromium_src-dc818ae3e3e573115aff37330ed61169eebee184.tar.gz chromium_src-dc818ae3e3e573115aff37330ed61169eebee184.tar.bz2 |
[Mac] Do not hide the menubar if going fullscreen on a secondary monitor.
BUG=37989
TEST=Go fullscreen on a secondary monitor. Should not hide the menubar.
Review URL: http://codereview.chromium.org/872003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41327 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa')
-rw-r--r-- | chrome/browser/cocoa/fullscreen_controller.h | 13 | ||||
-rw-r--r-- | chrome/browser/cocoa/fullscreen_controller.mm | 18 |
2 files changed, 20 insertions, 11 deletions
diff --git a/chrome/browser/cocoa/fullscreen_controller.h b/chrome/browser/cocoa/fullscreen_controller.h index 832d3de..9161905 100644 --- a/chrome/browser/cocoa/fullscreen_controller.h +++ b/chrome/browser/cocoa/fullscreen_controller.h @@ -61,11 +61,12 @@ // Tracks the currently requested fullscreen mode. This should be // |kFullScreenModeNormal| when the window is not main or not fullscreen, // |kFullScreenModeHideAll| while the overlay is hidden, and - // |kFullScreenModeHideDock| while the overlay is shown. This value can get - // out of sync with the correct state if we miss a notification (which can - // happen when a fullscreen window is closed). Used to track the current - // state and make sure we properly restore the menubar when this controller is - // destroyed. + // |kFullScreenModeHideDock| while the overlay is shown. If the window is not + // on the primary screen, this should always be |kFullScreenModeNormal|. This + // value can get out of sync with the correct state if we miss a notification + // (which can happen when a fullscreen window is closed). Used to track the + // current state and make sure we properly restore the menu bar when this + // controller is destroyed. mac_util::FullScreenMode currentFullscreenMode_; } @@ -105,7 +106,7 @@ - (CGFloat)floatingBarShownFraction; // Sets a new current floating bar shown fraction. NOTE: This function has side -// effects, such as modifying the fullscreen mode (menubar shown state). +// effects, such as modifying the fullscreen mode (menu bar shown state). - (void)changeFloatingBarShownFraction:(CGFloat)fraction; @end diff --git a/chrome/browser/cocoa/fullscreen_controller.mm b/chrome/browser/cocoa/fullscreen_controller.mm index 5d657f9..90186bd 100644 --- a/chrome/browser/cocoa/fullscreen_controller.mm +++ b/chrome/browser/cocoa/fullscreen_controller.mm @@ -91,6 +91,11 @@ const CGFloat kFloatingBarVerticalOffset = 22; // Returns YES if the fullscreen window is on the primary screen. - (BOOL)isWindowOnPrimaryScreen; +// Returns YES if it is ok to show and hide the menu bar in response to the +// overlay opening and closing. Will return NO if the window is not main or not +// on the primary monitor. +- (BOOL)shouldToggleMenuBar; + // Returns |kFullScreenModeHideAll| when the overlay is hidden and // |kFullScreenModeHideDock| when the overlay is shown. - (mac_util::FullScreenMode)desiredFullscreenMode; @@ -142,7 +147,7 @@ const CGFloat kFloatingBarVerticalOffset = 22; - (void)cleanup; // Shows and hides the UI associated with this window being active (having main -// status). This includes hiding the menubar and displaying the "Exit +// status). This includes hiding the menu bar and displaying the "Exit // Fullscreen" button. These functions are called when the window gains or // loses main status as well as in |-cleanup|. - (void)showActiveWindowUI; @@ -289,8 +294,7 @@ const CGFloat kFloatingBarVerticalOffset = 22; [browserController_ setFloatingBarShownFraction:fraction]; mac_util::FullScreenMode desiredMode = [self desiredFullscreenMode]; - if (desiredMode != currentFullscreenMode_ && - [[browserController_ window] isMainWindow]) { + if (desiredMode != currentFullscreenMode_ && [self shouldToggleMenuBar]) { if (currentFullscreenMode_ == mac_util::kFullScreenModeNormal) mac_util::RequestFullScreen(desiredMode); else @@ -374,6 +378,11 @@ const CGFloat kFloatingBarVerticalOffset = 22; return (screen == primaryScreen); } +- (BOOL)shouldToggleMenuBar { + return [self isWindowOnPrimaryScreen] && + [[browserController_ window] isMainWindow]; +} + - (mac_util::FullScreenMode)desiredFullscreenMode { if ([browserController_ floatingBarShownFraction] >= 1.0) return mac_util::kFullScreenModeHideDock; @@ -578,8 +587,7 @@ const CGFloat kFloatingBarVerticalOffset = 22; if (currentFullscreenMode_ != mac_util::kFullScreenModeNormal) return; - // Only hide the menubar if the window is on the primary screen. - if ([self isWindowOnPrimaryScreen]) { + if ([self shouldToggleMenuBar]) { mac_util::FullScreenMode desiredMode = [self desiredFullscreenMode]; mac_util::RequestFullScreen(desiredMode); currentFullscreenMode_ = desiredMode; |