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

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

Issue 2467833003: [Mac] Move the fullscreen toolbar style to FullscreenToolbarController (Closed)
Patch Set: fix for rsesek Created 4 years, 1 month 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
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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 // on the window bounds to determine whether to show buttons or not. 376 // on the window bounds to determine whether to show buttons or not.
377 if ([self hasToolbar]) // Do not create the buttons in popups. 377 if ([self hasToolbar]) // Do not create the buttons in popups.
378 [toolbarController_ createBrowserActionButtons]; 378 [toolbarController_ createBrowserActionButtons];
379 379
380 extensionKeybindingRegistry_.reset( 380 extensionKeybindingRegistry_.reset(
381 new ExtensionKeybindingRegistryCocoa(browser_->profile(), 381 new ExtensionKeybindingRegistryCocoa(browser_->profile(),
382 [self window], 382 [self window],
383 extensions::ExtensionKeybindingRegistry::ALL_EXTENSIONS, 383 extensions::ExtensionKeybindingRegistry::ALL_EXTENSIONS,
384 windowShim_.get())); 384 windowShim_.get()));
385 385
386 PrefService* prefs = browser_->profile()->GetPrefs();
387 shouldShowFullscreenToolbar_ =
388 prefs->GetBoolean(prefs::kShowFullscreenToolbar);
389 blockLayoutSubviews_ = NO; 386 blockLayoutSubviews_ = NO;
390 387
391 // We are done initializing now. 388 // We are done initializing now.
392 initializing_ = NO; 389 initializing_ = NO;
393 } 390 }
394 return self; 391 return self;
395 } 392 }
396 393
397 - (void)dealloc { 394 - (void)dealloc {
398 browser_->tab_strip_model()->CloseAllTabs(); 395 browser_->tab_strip_model()->CloseAllTabs();
399 396
400 // Explicitly release |fullscreenToolbarController_| here, as it may call back 397 // Explicitly release |fullscreenToolbarController_| here, as it may call
401 // to this BWC in |-dealloc|. We are required to call |-exitFullscreenMode| 398 // back to this BWC in |-dealloc|.
402 // before releasing the controller.
403 [fullscreenToolbarController_ exitFullscreenMode]; 399 [fullscreenToolbarController_ exitFullscreenMode];
404 fullscreenToolbarController_.reset(); 400 fullscreenToolbarController_.reset();
405 401
406 // Explicitly release |fullscreenTransition_| here since it may call back to 402 // Explicitly release |fullscreenTransition_| here since it may call back to
407 // this BWC in |-dealloc|. Reset the fullscreen variables. 403 // this BWC in |-dealloc|. Reset the fullscreen variables.
408 if (fullscreenTransition_) { 404 if (fullscreenTransition_) {
409 [fullscreenTransition_ browserWillBeDestroyed]; 405 [fullscreenTransition_ browserWillBeDestroyed];
410 [self resetCustomAppKitFullscreenVariables]; 406 [self resetCustomAppKitFullscreenVariables];
411 } 407 }
412 408
(...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after
1821 1817
1822 @implementation BrowserWindowController(Fullscreen) 1818 @implementation BrowserWindowController(Fullscreen)
1823 1819
1824 - (void)enterBrowserFullscreen { 1820 - (void)enterBrowserFullscreen {
1825 [self enterAppKitFullscreen]; 1821 [self enterAppKitFullscreen];
1826 } 1822 }
1827 1823
1828 - (void)updateUIForTabFullscreen: 1824 - (void)updateUIForTabFullscreen:
1829 (ExclusiveAccessContext::TabFullscreenState)state { 1825 (ExclusiveAccessContext::TabFullscreenState)state {
1830 DCHECK([self isInAnyFullscreenMode]); 1826 DCHECK([self isInAnyFullscreenMode]);
1831 if (state == ExclusiveAccessContext::STATE_ENTER_TAB_FULLSCREEN) { 1827 [fullscreenToolbarController_ updateToolbarStyle];
1832 [self adjustUIForSlidingFullscreenStyle:FullscreenSlidingStyle::
1833 OMNIBOX_TABS_NONE];
1834 return;
1835 }
1836
1837 [self adjustUIForSlidingFullscreenStyle:
1838 shouldShowFullscreenToolbar_
1839 ? FullscreenSlidingStyle::OMNIBOX_TABS_PRESENT
1840 : FullscreenSlidingStyle::OMNIBOX_TABS_HIDDEN];
1841 } 1828 }
1842 1829
1843 - (void)updateFullscreenExitBubble { 1830 - (void)updateFullscreenExitBubble {
1844 [self showFullscreenExitBubbleIfNecessary]; 1831 [self showFullscreenExitBubbleIfNecessary];
1845 } 1832 }
1846 1833
1847 - (BOOL)exitExtensionFullscreenIfPossible { 1834 - (BOOL)exitExtensionFullscreenIfPossible {
1848 if (browser_->exclusive_access_manager() 1835 if (browser_->exclusive_access_manager()
1849 ->fullscreen_controller() 1836 ->fullscreen_controller()
1850 ->IsExtensionFullscreenOrPending()) { 1837 ->IsExtensionFullscreenOrPending()) {
1851 browser_->extension_window_controller()->SetFullscreenMode(NO, GURL()); 1838 browser_->extension_window_controller()->SetFullscreenMode(NO, GURL());
1852 return YES; 1839 return YES;
1853 } 1840 }
1854 return NO; 1841 return NO;
1855 } 1842 }
1856 1843
1857 - (void)setFullscreenToolbarVisible:(BOOL)visible {
1858 if (shouldShowFullscreenToolbar_ == visible)
1859 return;
1860
1861 shouldShowFullscreenToolbar_ = visible;
1862 [self adjustUIForSlidingFullscreenStyle:
1863 shouldShowFullscreenToolbar_
1864 ? FullscreenSlidingStyle::OMNIBOX_TABS_PRESENT
1865 : FullscreenSlidingStyle::OMNIBOX_TABS_HIDDEN];
1866 }
1867
1868 - (BOOL)isInAnyFullscreenMode { 1844 - (BOOL)isInAnyFullscreenMode {
1869 return [self isInImmersiveFullscreen] || [self isInAppKitFullscreen]; 1845 return [self isInImmersiveFullscreen] || [self isInAppKitFullscreen];
1870 } 1846 }
1871 1847
1872 - (BOOL)isInImmersiveFullscreen { 1848 - (BOOL)isInImmersiveFullscreen {
1873 return fullscreenWindow_.get() != nil || enteringImmersiveFullscreen_; 1849 return fullscreenWindow_.get() != nil || enteringImmersiveFullscreen_;
1874 } 1850 }
1875 1851
1876 - (BOOL)isInAppKitFullscreen { 1852 - (BOOL)isInAppKitFullscreen {
1877 return !exitingAppKitFullscreen_ && 1853 return !exitingAppKitFullscreen_ &&
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
1950 [self fullscreenToolbarVisibilityLockController]; 1926 [self fullscreenToolbarVisibilityLockController];
1951 [visibilityController releaseToolbarVisibilityForOwner:owner 1927 [visibilityController releaseToolbarVisibilityForOwner:owner
1952 withAnimation:animate]; 1928 withAnimation:animate];
1953 } 1929 }
1954 1930
1955 - (BOOL)floatingBarHasFocus { 1931 - (BOOL)floatingBarHasFocus {
1956 NSResponder* focused = [[self window] firstResponder]; 1932 NSResponder* focused = [[self window] firstResponder];
1957 return [focused isKindOfClass:[AutocompleteTextFieldEditor class]]; 1933 return [focused isKindOfClass:[AutocompleteTextFieldEditor class]];
1958 } 1934 }
1959 1935
1936 - (BOOL)isFullscreenForTabContentOrExtension {
1937 FullscreenController* controller =
1938 browser_->exclusive_access_manager()->fullscreen_controller();
1939 return controller->IsWindowFullscreenForTabOrPending() ||
1940 controller->IsExtensionFullscreenOrPending();
1941 }
1942
1960 - (ExclusiveAccessController*)exclusiveAccessController { 1943 - (ExclusiveAccessController*)exclusiveAccessController {
1961 return exclusiveAccessController_.get(); 1944 return exclusiveAccessController_.get();
1962 } 1945 }
1963 1946
1964 @end // @implementation BrowserWindowController(Fullscreen) 1947 @end // @implementation BrowserWindowController(Fullscreen)
1965 1948
1966 1949
1967 @implementation BrowserWindowController(WindowType) 1950 @implementation BrowserWindowController(WindowType)
1968 1951
1969 - (BOOL)supportsWindowFeature:(int)feature { 1952 - (BOOL)supportsWindowFeature:(int)feature {
(...skipping 23 matching lines...) Expand all
1993 1976
1994 - (NSRect)savedRegularWindowFrame { 1977 - (NSRect)savedRegularWindowFrame {
1995 return savedRegularWindowFrame_; 1978 return savedRegularWindowFrame_;
1996 } 1979 }
1997 1980
1998 - (BOOL)isFullscreenTransitionInProgress { 1981 - (BOOL)isFullscreenTransitionInProgress {
1999 return enteringAppKitFullscreen_ || exitingAppKitFullscreen_; 1982 return enteringAppKitFullscreen_ || exitingAppKitFullscreen_;
2000 } 1983 }
2001 1984
2002 @end // @implementation BrowserWindowController(WindowType) 1985 @end // @implementation BrowserWindowController(WindowType)
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller.h ('k') | chrome/browser/ui/cocoa/browser_window_controller_browsertest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698