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

Unified Diff: chrome/browser/ui/cocoa/browser_window_controller_private.mm

Issue 2679273002: [Mac] Retain location bar focus on switching to fullscreen and back. (Closed)
Patch Set: Undo previous change, add comment. Created 3 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/browser_window_controller_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4936bae19d9419395420a7237dccca59b4383d14..2f94f77149e1f2133bdbe48e49e1b2f0e7970ddb 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller_private.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller_private.mm
@@ -1011,6 +1011,21 @@ willPositionSheet:(NSWindow*)sheet
return;
}
+ // Removing the location bar from the window causes it to resign first
+ // responder. Remember the location bar's focus state in order to restore
+ // it before returning.
+ BOOL locationBarHadFocus = [toolbarController_ locationBarHasFocus];
+ FullscreenToolbarVisibilityLockController* visibilityLockController = nil;
+ if (locationBarHadFocus) {
+ // The location bar, by being focused, has a visibility lock on the toolbar,
+ // and the location bar's removal from the view hierarchy will allow the
+ // toolbar to hide. Create a temporary visibility lock on the toolbar for
+ // the duration of the view hierarchy change.
+ visibilityLockController = [self fullscreenToolbarVisibilityLockController];
+ [visibilityLockController lockToolbarVisibilityForOwner:self
+ withAnimation:NO];
+ }
+
// Remove all subviews that aren't the tabContentArea.
for (NSView* view in [[[self.chromeContentView subviews] copy] autorelease]) {
if (view != tabContentArea)
@@ -1033,6 +1048,14 @@ willPositionSheet:(NSWindow*)sheet
positioned:NSWindowAbove
relativeTo:nil];
}
+
+ // Restore the location bar's focus state and remove the temporary visibility
+ // lock.
+ if (locationBarHadFocus) {
+ [self focusLocationBar:YES];
+ [visibilityLockController releaseToolbarVisibilityForOwner:self
+ withAnimation:NO];
+ }
}
+ (BOOL)systemSettingsRequireMavericksAppKitFullscreenHack {
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/browser_window_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698