Chromium Code Reviews| 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..7d780c0298c4d31e51dcc99ca392b978fc7e9514 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,16 @@ willPositionSheet:(NSWindow*)sheet |
| [self enableBarVisibilityUpdates]; |
| } |
| +- (void)permissionBubbleWindowWillClose:(NSNotification*)notification { |
|
Robert Sesek
2014/07/14 14:13:32
This needs to be declared in the .h
leng
2014/07/14 18:17:24
Done.
|
| + DCHECK(permissionBubbleCocoa_); |
| + |
| + NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; |
| + [center removeObserver:self |
| + name:NSWindowWillCloseNotification |
| + object:[notification object]]; |
| + [presentationModeController_ setAlwaysShowDropdown:NO]; |
| +} |
| + |
| - (void)setPresentationModeInternal:(BOOL)presentationMode |
| forceDropdown:(BOOL)forceDropdown { |
| if (presentationMode == [self inPresentationMode]) |
| @@ -648,9 +659,34 @@ 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. |
| + [presentationModeController_ setAlwaysShowDropdown:YES]; |
| + 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 { |
| @@ -871,6 +907,7 @@ willPositionSheet:(NSWindow*)sheet |
| [self showFullscreenExitBubbleIfNecessary]; |
| browser_->WindowFullscreenStateChanged(); |
| + [[[self window] cr_windowView] setWantsLayer:NO]; |
| } |
| - (void)windowWillExitFullScreen:(NSNotification*)notification { |