Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(273)

Unified Diff: chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_controller.mm

Issue 2679273002: [Mac] Retain location bar focus on switching to fullscreen and back. (Closed)
Patch Set: Fix nits. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_controller.mm
diff --git a/chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_controller.mm b/chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_controller.mm
index f80e083fb15fb17e8d608eba1fa2eee3944f7475..6b553bbeb6dc3ffbfa6b67e4c07e9bba32254c8c 100644
--- a/chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_controller.mm
+++ b/chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_controller.mm
@@ -47,6 +47,14 @@ const CGFloat kShowFraction = 1.0;
DCHECK(!inFullscreenMode_);
inFullscreenMode_ = YES;
+ // If the location bar is the first responder, don't let the toolbar hide.
+ // This is a special signal to -mustShowFullscreenToolbar that the toolbar
+ // should remain visible during the transition to fullscreen.
+ if ([browserController_ locationBarHasFocus]) {
+ [visibilityLockController_ lockToolbarVisibilityForOwner:self
+ withAnimation:NO];
+ }
+
[self updateToolbarStyleExitingTabFullscreen:NO];
if ([browserController_ isInImmersiveFullscreen]) {
@@ -60,6 +68,11 @@ const CGFloat kShowFraction = 1.0;
initWithFullscreenToolbarController:self
animationController:animationController_.get()]);
}
+
+ // Let the location bar keep the toolbar locked in place from here on out
+ // (if it's the first responder).
+ [visibilityLockController_ releaseToolbarVisibilityForOwner:self
+ withAnimation:YES];
}
- (void)exitFullscreenMode {
@@ -132,6 +145,12 @@ const CGFloat kShowFraction = 1.0;
if (!inFullscreenMode_)
return NO;
+ // Check if the fullscreen toolbar controller wants the toolbar to remain
+ // visible.
+ if ([visibilityLockController_ isToolbarVisibilityLockedForOwner:self]) {
+ return YES;
+ }
+
if (toolbarStyle_ == FullscreenToolbarStyle::TOOLBAR_PRESENT)
return YES;

Powered by Google App Engine
This is Rietveld 408576698