| Index: chrome/browser/ui/cocoa/fullscreen_toolbar_controller.mm
|
| diff --git a/chrome/browser/ui/cocoa/fullscreen_toolbar_controller.mm b/chrome/browser/ui/cocoa/fullscreen_toolbar_controller.mm
|
| index e34cb4cb1cd6855e6bfc1b57bef253d304ea6508..fb409920e14788c1fa2cb102625790980464a15b 100644
|
| --- a/chrome/browser/ui/cocoa/fullscreen_toolbar_controller.mm
|
| +++ b/chrome/browser/ui/cocoa/fullscreen_toolbar_controller.mm
|
| @@ -191,6 +191,7 @@ OSStatus MenuBarRevealHandler(EventHandlerCallRef handler,
|
| browserController_ = controller;
|
| systemFullscreenMode_ = base::mac::kFullScreenModeNormal;
|
| slidingStyle_ = style;
|
| + menubarState_ = fullscreen_mac::MENUBAR_HIDDEN;
|
| }
|
|
|
| // Install the Carbon event handler for the menubar show, hide and
|
| @@ -267,6 +268,18 @@ OSStatus MenuBarRevealHandler(EventHandlerCallRef handler,
|
| return kFloatingBarVerticalOffset;
|
| }
|
|
|
| +- (void)lockBarVisibilityWithAnimation:(BOOL)animate {
|
| + isLockingBarVisibility_ = YES;
|
| + [self ensureOverlayShownWithAnimation:animate];
|
| + isLockingBarVisibility_ = NO;
|
| +}
|
| +
|
| +- (void)releaseBarVisibilityWithAnimation:(BOOL)animate {
|
| + isReleasingBarVisibility_ = YES;
|
| + [self ensureOverlayHiddenWithAnimation:animate];
|
| + isReleasingBarVisibility_ = NO;
|
| +}
|
| +
|
| - (void)ensureOverlayShownWithAnimation:(BOOL)animate {
|
| if (!inFullscreenMode_)
|
| return;
|
| @@ -288,6 +301,14 @@ OSStatus MenuBarRevealHandler(EventHandlerCallRef handler,
|
| if (self.slidingStyle != fullscreen_mac::OMNIBOX_TABS_HIDDEN)
|
| return;
|
|
|
| + if ([browserController_ isBarVisibilityLockedForOwner:nil])
|
| + return;
|
| +
|
| + if ([self mouseInsideTrackingArea] ||
|
| + menubarState_ == fullscreen_mac::MENUBAR_SHOWN) {
|
| + return;
|
| + }
|
| +
|
| [self cancelHideTimer];
|
| [self animateToolbarVisibility:NO];
|
| }
|
| @@ -331,8 +352,11 @@ OSStatus MenuBarRevealHandler(EventHandlerCallRef handler,
|
| DCHECK(inFullscreenMode_);
|
| DCHECK_EQ([event trackingArea], trackingArea_.get());
|
|
|
| + if ([browserController_ isBarVisibilityLockedForOwner:nil])
|
| + return;
|
| +
|
| // If the menubar is gone, animate the toolbar out.
|
| - if (IsCGFloatEqual(menubarFraction_, kHideFraction))
|
| + if (menubarState_ == fullscreen_mac::MENUBAR_HIDDEN)
|
| [self ensureOverlayHiddenWithAnimation:YES];
|
|
|
| [self removeTrackingAreaIfNecessary];
|
| @@ -368,9 +392,6 @@ OSStatus MenuBarRevealHandler(EventHandlerCallRef handler,
|
| }
|
|
|
| - (CGFloat)toolbarFraction {
|
| - if ([browserController_ isBarVisibilityLockedForOwner:nil])
|
| - return kShowFraction;
|
| -
|
| if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode))
|
| return kHideFraction;
|
|
|
| @@ -380,6 +401,18 @@ OSStatus MenuBarRevealHandler(EventHandlerCallRef handler,
|
| case fullscreen_mac::OMNIBOX_TABS_NONE:
|
| return kHideFraction;
|
| case fullscreen_mac::OMNIBOX_TABS_HIDDEN:
|
| + if (menubarState_ == fullscreen_mac::MENUBAR_SHOWN ||
|
| + menubarState_ == fullscreen_mac::MENUBAR_SHOWING) {
|
| + return toolbarFractionFromMenuProgress_;
|
| + }
|
| +
|
| + if (isLockingBarVisibility_)
|
| + return kHideFraction;
|
| + else if (isReleasingBarVisibility_)
|
| + return kShowFraction;
|
| + else if ([browserController_ isBarVisibilityLockedForOwner:nil])
|
| + return kShowFraction;
|
| +
|
| if (currentAnimation_.get())
|
| return [currentAnimation_ toolbarFraction];
|
|
|
| @@ -442,19 +475,32 @@ OSStatus MenuBarRevealHandler(EventHandlerCallRef handler,
|
| if (![self isMouseOnScreen] && progress > menubarFraction_)
|
| return;
|
|
|
| + if (IsCGFloatEqual(progress, kShowFraction))
|
| + menubarState_ = fullscreen_mac::MENUBAR_SHOWN;
|
| + else if (IsCGFloatEqual(progress, kHideFraction))
|
| + menubarState_ = fullscreen_mac::MENUBAR_HIDDEN;
|
| + else if (progress < menubarFraction_)
|
| + menubarState_ = fullscreen_mac::MENUBAR_HIDING;
|
| + else if (progress > menubarFraction_)
|
| + menubarState_ = fullscreen_mac::MENUBAR_SHOWING;
|
| +
|
| menubarFraction_ = progress;
|
|
|
| - if (self.slidingStyle == fullscreen_mac::OMNIBOX_TABS_HIDDEN) {
|
| - if (IsCGFloatEqual(menubarFraction_, kShowFraction))
|
| + if (slidingStyle_ == fullscreen_mac::OMNIBOX_TABS_HIDDEN) {
|
| + if (menubarState_ == fullscreen_mac::MENUBAR_SHOWN)
|
| [self setupTrackingArea];
|
|
|
| - // If the menubar is disappearing from the screen, check if the mouse
|
| - // is still interacting with the toolbar. If it is, don't set
|
| + // If the menubar is in the process of hiding from the screen, check if
|
| + // the user is still interacting with the toolbar. If not, don't set
|
| // |toolbarFractionFromMenuProgress_| so that the the toolbar will remain
|
| // on the screen.
|
| - BOOL isMenuBarDisappearing =
|
| - menubarFraction_ < toolbarFractionFromMenuProgress_;
|
| - if (!(isMenuBarDisappearing && [self mouseInsideTrackingArea]))
|
| + BOOL isMenubarGoneOrDisappear =
|
| + menubarState_ == fullscreen_mac::MENUBAR_HIDING ||
|
| + menubarState_ == fullscreen_mac::MENUBAR_HIDDEN;
|
| + BOOL isToolbarFocused =
|
| + [self mouseInsideTrackingArea] ||
|
| + [browserController_ isBarVisibilityLockedForOwner:nil];
|
| + if (!(isMenubarGoneOrDisappear && isToolbarFocused))
|
| toolbarFractionFromMenuProgress_ = progress;
|
| }
|
|
|
|
|