Index: chrome/browser/ui/cocoa/browser_window_controller_private.mm |
diff --git a/chrome/browser/ui/cocoa/browser_window_controller_private.mm b/chrome/browser/ui/cocoa/browser_window_controller_private.mm |
index e1b7885bd2a795e90f310c1899a97478ede4af75..484e0271f182ebfee893a70ec79efe6e26c93ecc 100644 |
--- a/chrome/browser/ui/cocoa/browser_window_controller_private.mm |
+++ b/chrome/browser/ui/cocoa/browser_window_controller_private.mm |
@@ -37,6 +37,7 @@ |
#import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" |
#import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" |
#import "chrome/browser/ui/cocoa/version_independent_window.h" |
+#import "chrome/browser/ui/cocoa/website_settings/permission_bubble_cocoa.h" |
#include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
#include "chrome/browser/ui/tabs/tab_strip_model.h" |
#include "chrome/common/chrome_switches.h" |
@@ -635,6 +636,18 @@ willPositionSheet:(NSWindow*)sheet |
[self enableBarVisibilityUpdates]; |
} |
+- (void)permissionBubbleWindowWillClose:(NSNotification*)notification { |
+ DCHECK(permissionBubbleCocoa_); |
+ |
+ NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; |
+ [center removeObserver:self |
+ name:NSWindowWillCloseNotification |
+ object:[notification object]]; |
+ [self releaseBarVisibilityForOwner:[notification object] |
+ withAnimation:YES |
+ delay:YES]; |
+} |
+ |
- (void)setPresentationModeInternal:(BOOL)presentationMode |
forceDropdown:(BOOL)forceDropdown { |
if (presentationMode == [self inPresentationMode]) |
@@ -648,9 +661,36 @@ willPositionSheet:(NSWindow*)sheet |
BOOL showDropdown = !fullscreen_for_tab && |
!kiosk_mode && |
(forceDropdown || [self floatingBarHasFocus]); |
- NSView* contentView = [[self window] contentView]; |
presentationModeController_.reset( |
[[PresentationModeController alloc] initWithBrowserController:self]); |
+ |
+ if (permissionBubbleCocoa_ && permissionBubbleCocoa_->IsVisible()) { |
+ DCHECK(permissionBubbleCocoa_->window()); |
+ // A visible permission bubble will force the dropdown to remain visible. |
+ [self lockBarVisibilityForOwner:permissionBubbleCocoa_->window() |
+ withAnimation:NO |
+ delay:NO]; |
+ showDropdown = YES; |
+ // Register to be notified when the permission bubble is closed, to |
+ // allow fullscreen to hide the dropdown. |
+ NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; |
+ [center addObserver:self |
+ selector:@selector(permissionBubbleWindowWillClose:) |
+ name:NSWindowWillCloseNotification |
+ object:permissionBubbleCocoa_->window()]; |
+ } |
+ if (showDropdown) { |
+ // Turn on layered mode for the window's root view for the entry |
+ // animation. Without this, the OS fullscreen animation for entering |
+ // fullscreen mode does not correctly draw the tab strip. |
+ // It will be turned off (set back to NO) when the animation finishes, |
+ // in -windowDidEnterFullScreen:. |
+ // Leaving wantsLayer on for the duration of presentation mode causes |
+ // performance issues when the dropdown is animated in/out. It also does |
+ // not seem to be required for the exit animation. |
+ [[[self window] cr_windowView] setWantsLayer:YES]; |
+ } |
+ NSView* contentView = [[self window] contentView]; |
[presentationModeController_ enterPresentationModeForContentView:contentView |
showDropdown:showDropdown]; |
} else { |
@@ -777,7 +817,7 @@ willPositionSheet:(NSWindow*)sheet |
if (enteringFullscreen_) |
return; |
- [presentationModeController_ ensureOverlayHiddenWithAnimation:NO delay:NO]; |
+ [self hideOverlayIfPossibleWithAnimation:NO delay:NO]; |
if (fullscreenBubbleType_ == FEB_TYPE_NONE || |
fullscreenBubbleType_ == FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION) { |
@@ -871,6 +911,7 @@ willPositionSheet:(NSWindow*)sheet |
[self showFullscreenExitBubbleIfNecessary]; |
browser_->WindowFullscreenStateChanged(); |
+ [[[self window] cr_windowView] setWantsLayer:NO]; |
} |
- (void)windowWillExitFullScreen:(NSNotification*)notification { |
@@ -925,6 +966,13 @@ willPositionSheet:(NSWindow*)sheet |
[presentationModeController_ cancelAnimationAndTimers]; |
} |
+- (void)hideOverlayIfPossibleWithAnimation:(BOOL)animation delay:(BOOL)delay { |
+ if (!barVisibilityUpdatesEnabled_ || [barVisibilityLocks_ count]) |
+ return; |
+ [presentationModeController_ ensureOverlayHiddenWithAnimation:animation |
+ delay:delay]; |
+} |
+ |
- (CGFloat)toolbarDividerOpacity { |
return [bookmarkBarController_ toolbarDividerOpacity]; |
} |