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

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_controller.mm

Issue 2339663002: [Mac] Fullscreen Toolbar Bar Visibility Edge Cases (Closed)
Patch Set: Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/browser_window_controller_browsertest.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 5 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <numeric> 8 #include <numeric>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 1859 matching lines...) Expand 10 before | Expand all | Expand 10 after
1870 @implementation BrowserWindowController(Fullscreen) 1870 @implementation BrowserWindowController(Fullscreen)
1871 1871
1872 - (void)enterBrowserFullscreen { 1872 - (void)enterBrowserFullscreen {
1873 [self enterAppKitFullscreen]; 1873 [self enterAppKitFullscreen];
1874 } 1874 }
1875 1875
1876 - (void)updateUIForTabFullscreen: 1876 - (void)updateUIForTabFullscreen:
1877 (ExclusiveAccessContext::TabFullscreenState)state { 1877 (ExclusiveAccessContext::TabFullscreenState)state {
1878 DCHECK([self isInAnyFullscreenMode]); 1878 DCHECK([self isInAnyFullscreenMode]);
1879 if (state == ExclusiveAccessContext::STATE_ENTER_TAB_FULLSCREEN) { 1879 if (state == ExclusiveAccessContext::STATE_ENTER_TAB_FULLSCREEN) {
1880 [self adjustUIForSlidingFullscreenStyle:fullscreen_mac::OMNIBOX_TABS_NONE]; 1880 [self adjustUIForSlidingFullscreenStyle:FullscreenSlidingStyle::
1881 OMNIBOX_TABS_NONE];
1881 return; 1882 return;
1882 } 1883 }
1883 1884
1884 [self adjustUIForSlidingFullscreenStyle: 1885 [self adjustUIForSlidingFullscreenStyle:
1885 shouldShowFullscreenToolbar_ ? fullscreen_mac::OMNIBOX_TABS_PRESENT 1886 shouldShowFullscreenToolbar_
1886 : fullscreen_mac::OMNIBOX_TABS_HIDDEN]; 1887 ? FullscreenSlidingStyle::OMNIBOX_TABS_PRESENT
1888 : FullscreenSlidingStyle::OMNIBOX_TABS_HIDDEN];
1887 } 1889 }
1888 1890
1889 - (void)updateFullscreenExitBubble { 1891 - (void)updateFullscreenExitBubble {
1890 [self layoutSubviews]; 1892 [self layoutSubviews];
1891 [self showFullscreenExitBubbleIfNecessary]; 1893 [self showFullscreenExitBubbleIfNecessary];
1892 } 1894 }
1893 1895
1894 - (BOOL)exitExtensionFullscreenIfPossible { 1896 - (BOOL)exitExtensionFullscreenIfPossible {
1895 if (browser_->exclusive_access_manager() 1897 if (browser_->exclusive_access_manager()
1896 ->fullscreen_controller() 1898 ->fullscreen_controller()
1897 ->IsExtensionFullscreenOrPending()) { 1899 ->IsExtensionFullscreenOrPending()) {
1898 browser_->extension_window_controller()->SetFullscreenMode(NO, GURL()); 1900 browser_->extension_window_controller()->SetFullscreenMode(NO, GURL());
1899 return YES; 1901 return YES;
1900 } 1902 }
1901 return NO; 1903 return NO;
1902 } 1904 }
1903 1905
1904 - (void)setFullscreenToolbarVisible:(BOOL)visible { 1906 - (void)setFullscreenToolbarVisible:(BOOL)visible {
1905 if (shouldShowFullscreenToolbar_ == visible) 1907 if (shouldShowFullscreenToolbar_ == visible)
1906 return; 1908 return;
1907 1909
1908 shouldShowFullscreenToolbar_ = visible; 1910 shouldShowFullscreenToolbar_ = visible;
1909 [self adjustUIForSlidingFullscreenStyle: 1911 [self adjustUIForSlidingFullscreenStyle:
1910 shouldShowFullscreenToolbar_ ? fullscreen_mac::OMNIBOX_TABS_PRESENT 1912 shouldShowFullscreenToolbar_
1911 : fullscreen_mac::OMNIBOX_TABS_HIDDEN]; 1913 ? FullscreenSlidingStyle::OMNIBOX_TABS_PRESENT
1914 : FullscreenSlidingStyle::OMNIBOX_TABS_HIDDEN];
1912 } 1915 }
1913 1916
1914 - (BOOL)isInAnyFullscreenMode { 1917 - (BOOL)isInAnyFullscreenMode {
1915 return [self isInImmersiveFullscreen] || [self isInAppKitFullscreen]; 1918 return [self isInImmersiveFullscreen] || [self isInAppKitFullscreen];
1916 } 1919 }
1917 1920
1918 - (BOOL)isInImmersiveFullscreen { 1921 - (BOOL)isInImmersiveFullscreen {
1919 return fullscreenWindow_.get() != nil || enteringImmersiveFullscreen_; 1922 return fullscreenWindow_.get() != nil || enteringImmersiveFullscreen_;
1920 } 1923 }
1921 1924
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1984 : [barVisibilityLocks_ count]; 1987 : [barVisibilityLocks_ count];
1985 } 1988 }
1986 1989
1987 - (void)lockBarVisibilityForOwner:(id)owner withAnimation:(BOOL)animate { 1990 - (void)lockBarVisibilityForOwner:(id)owner withAnimation:(BOOL)animate {
1988 if (![self isBarVisibilityLockedForOwner:owner]) { 1991 if (![self isBarVisibilityLockedForOwner:owner]) {
1989 [barVisibilityLocks_ addObject:owner]; 1992 [barVisibilityLocks_ addObject:owner];
1990 1993
1991 // If enabled, show the overlay if necessary (and if the fullscreen 1994 // If enabled, show the overlay if necessary (and if the fullscreen
1992 // toolbar is hidden). 1995 // toolbar is hidden).
1993 if (barVisibilityUpdatesEnabled_) { 1996 if (barVisibilityUpdatesEnabled_) {
1994 [fullscreenToolbarController_ ensureOverlayShownWithAnimation:animate]; 1997 [fullscreenToolbarController_ lockBarVisibilityWithAnimation:animate];
1995 } 1998 }
1996 } 1999 }
1997 } 2000 }
1998 2001
1999 - (void)releaseBarVisibilityForOwner:(id)owner withAnimation:(BOOL)animate { 2002 - (void)releaseBarVisibilityForOwner:(id)owner withAnimation:(BOOL)animate {
2000 if ([self isBarVisibilityLockedForOwner:owner]) { 2003 if ([self isBarVisibilityLockedForOwner:owner]) {
2001 [barVisibilityLocks_ removeObject:owner]; 2004 [barVisibilityLocks_ removeObject:owner];
2002 2005
2003 // If enabled, hide the overlay if necessary (and if the fullscreen 2006 // If enabled, hide the overlay if necessary (and if the fullscreen
2004 // toolbar is hidden). 2007 // toolbar is hidden).
2005 if (barVisibilityUpdatesEnabled_ && 2008 if (barVisibilityUpdatesEnabled_ &&
2006 ![barVisibilityLocks_ count]) { 2009 ![barVisibilityLocks_ count]) {
2007 [fullscreenToolbarController_ ensureOverlayHiddenWithAnimation:animate]; 2010 [fullscreenToolbarController_ releaseBarVisibilityWithAnimation:animate];
2008 } 2011 }
2009 } 2012 }
2010 } 2013 }
2011 2014
2012 - (BOOL)floatingBarHasFocus { 2015 - (BOOL)floatingBarHasFocus {
2013 NSResponder* focused = [[self window] firstResponder]; 2016 NSResponder* focused = [[self window] firstResponder];
2014 return [focused isKindOfClass:[AutocompleteTextFieldEditor class]]; 2017 return [focused isKindOfClass:[AutocompleteTextFieldEditor class]];
2015 } 2018 }
2016 2019
2017 - (ExclusiveAccessController*)exclusiveAccessController { 2020 - (ExclusiveAccessController*)exclusiveAccessController {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
2050 2053
2051 - (NSRect)savedRegularWindowFrame { 2054 - (NSRect)savedRegularWindowFrame {
2052 return savedRegularWindowFrame_; 2055 return savedRegularWindowFrame_;
2053 } 2056 }
2054 2057
2055 - (BOOL)isFullscreenTransitionInProgress { 2058 - (BOOL)isFullscreenTransitionInProgress {
2056 return enteringAppKitFullscreen_ || exitingAppKitFullscreen_; 2059 return enteringAppKitFullscreen_ || exitingAppKitFullscreen_;
2057 } 2060 }
2058 2061
2059 @end // @implementation BrowserWindowController(WindowType) 2062 @end // @implementation BrowserWindowController(WindowType)
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/browser_window_controller_browsertest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698