| OLD | NEW | 
|---|
| 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 420 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 431     if ([self hasToolbar])  // Do not create the buttons in popups. | 431     if ([self hasToolbar])  // Do not create the buttons in popups. | 
| 432       [toolbarController_ createBrowserActionButtons]; | 432       [toolbarController_ createBrowserActionButtons]; | 
| 433 | 433 | 
| 434     extension_keybinding_registry_.reset( | 434     extension_keybinding_registry_.reset( | 
| 435         new ExtensionKeybindingRegistryCocoa(browser_->profile(), | 435         new ExtensionKeybindingRegistryCocoa(browser_->profile(), | 
| 436             [self window], | 436             [self window], | 
| 437             extensions::ExtensionKeybindingRegistry::ALL_EXTENSIONS, | 437             extensions::ExtensionKeybindingRegistry::ALL_EXTENSIONS, | 
| 438             windowShim_.get())); | 438             windowShim_.get())); | 
| 439 | 439 | 
| 440     PrefService* prefs = browser_->profile()->GetPrefs(); | 440     PrefService* prefs = browser_->profile()->GetPrefs(); | 
| 441     shouldHideFullscreenToolbar_ = | 441     shouldShowFullscreenToolbar_ = | 
| 442         prefs->GetBoolean(prefs::kHideFullscreenToolbar); | 442         prefs->GetBoolean(prefs::kShowFullscreenToolbar); | 
| 443 |  | 
| 444     blockLayoutSubviews_ = NO; | 443     blockLayoutSubviews_ = NO; | 
| 445 | 444 | 
| 446     // We are done initializing now. | 445     // We are done initializing now. | 
| 447     initializing_ = NO; | 446     initializing_ = NO; | 
| 448   } | 447   } | 
| 449   return self; | 448   return self; | 
| 450 } | 449 } | 
| 451 | 450 | 
| 452 - (void)dealloc { | 451 - (void)dealloc { | 
| 453   browser_->tab_strip_model()->CloseAllTabs(); | 452   browser_->tab_strip_model()->CloseAllTabs(); | 
| (...skipping 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1984 - (BOOL)exitExtensionFullscreenIfPossible { | 1983 - (BOOL)exitExtensionFullscreenIfPossible { | 
| 1985   if (browser_->exclusive_access_manager() | 1984   if (browser_->exclusive_access_manager() | 
| 1986           ->fullscreen_controller() | 1985           ->fullscreen_controller() | 
| 1987           ->IsExtensionFullscreenOrPending()) { | 1986           ->IsExtensionFullscreenOrPending()) { | 
| 1988     browser_->extension_window_controller()->SetFullscreenMode(NO, GURL()); | 1987     browser_->extension_window_controller()->SetFullscreenMode(NO, GURL()); | 
| 1989     return YES; | 1988     return YES; | 
| 1990   } | 1989   } | 
| 1991   return NO; | 1990   return NO; | 
| 1992 } | 1991 } | 
| 1993 | 1992 | 
| 1994 - (void)setFullscreenToolbarHidden:(BOOL)shouldHide { | 1993 - (void)setFullscreenToolbarVisible:(BOOL)visible { | 
| 1995   if (shouldHideFullscreenToolbar_ == shouldHide) | 1994   if (shouldShowFullscreenToolbar_ == visible) | 
| 1996     return; | 1995     return; | 
| 1997 | 1996 | 
| 1998   [presentationModeController_ setToolbarFraction:0.0]; | 1997   [presentationModeController_ setToolbarFraction:0.0]; | 
| 1999   shouldHideFullscreenToolbar_ = shouldHide; | 1998   shouldShowFullscreenToolbar_ = visible; | 
| 2000   if ([self isInAppKitFullscreen]) | 1999   if ([self isInAppKitFullscreen]) | 
| 2001     [self updateFullscreenWithToolbar:!shouldHideFullscreenToolbar_]; | 2000     [self updateFullscreenWithToolbar:shouldShowFullscreenToolbar_]; | 
| 2002 } | 2001 } | 
| 2003 | 2002 | 
| 2004 - (BOOL)isInAnyFullscreenMode { | 2003 - (BOOL)isInAnyFullscreenMode { | 
| 2005   return [self isInImmersiveFullscreen] || [self isInAppKitFullscreen]; | 2004   return [self isInImmersiveFullscreen] || [self isInAppKitFullscreen]; | 
| 2006 } | 2005 } | 
| 2007 | 2006 | 
| 2008 - (BOOL)isInImmersiveFullscreen { | 2007 - (BOOL)isInImmersiveFullscreen { | 
| 2009   return fullscreenWindow_.get() != nil || enteringImmersiveFullscreen_; | 2008   return fullscreenWindow_.get() != nil || enteringImmersiveFullscreen_; | 
| 2010 } | 2009 } | 
| 2011 | 2010 | 
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2054     [self exitImmersiveFullscreen]; | 2053     [self exitImmersiveFullscreen]; | 
| 2055 } | 2054 } | 
| 2056 | 2055 | 
| 2057 - (BOOL)inPresentationMode { | 2056 - (BOOL)inPresentationMode { | 
| 2058   return presentationModeController_.get() && | 2057   return presentationModeController_.get() && | 
| 2059          [presentationModeController_ inPresentationMode] && | 2058          [presentationModeController_ inPresentationMode] && | 
| 2060          presentationModeController_.get().slidingStyle == | 2059          presentationModeController_.get().slidingStyle == | 
| 2061              fullscreen_mac::OMNIBOX_TABS_HIDDEN; | 2060              fullscreen_mac::OMNIBOX_TABS_HIDDEN; | 
| 2062 } | 2061 } | 
| 2063 | 2062 | 
| 2064 - (BOOL)shouldHideFullscreenToolbar { | 2063 - (BOOL)shouldShowFullscreenToolbar { | 
| 2065   return shouldHideFullscreenToolbar_; | 2064   return shouldShowFullscreenToolbar_; | 
| 2066 } | 2065 } | 
| 2067 | 2066 | 
| 2068 - (void)resizeFullscreenWindow { | 2067 - (void)resizeFullscreenWindow { | 
| 2069   DCHECK([self isInAnyFullscreenMode]); | 2068   DCHECK([self isInAnyFullscreenMode]); | 
| 2070   if (![self isInAnyFullscreenMode]) | 2069   if (![self isInAnyFullscreenMode]) | 
| 2071     return; | 2070     return; | 
| 2072 | 2071 | 
| 2073   NSWindow* window = [self window]; | 2072   NSWindow* window = [self window]; | 
| 2074   [window setFrame:[[window screen] frame] display:YES]; | 2073   [window setFrame:[[window screen] frame] display:YES]; | 
| 2075   [self layoutSubviews]; | 2074   [self layoutSubviews]; | 
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2143 | 2142 | 
| 2144 - (BOOL)supportsBookmarkBar { | 2143 - (BOOL)supportsBookmarkBar { | 
| 2145   return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2144   return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 
| 2146 } | 2145 } | 
| 2147 | 2146 | 
| 2148 - (BOOL)isTabbedWindow { | 2147 - (BOOL)isTabbedWindow { | 
| 2149   return browser_->is_type_tabbed(); | 2148   return browser_->is_type_tabbed(); | 
| 2150 } | 2149 } | 
| 2151 | 2150 | 
| 2152 @end  // @implementation BrowserWindowController(WindowType) | 2151 @end  // @implementation BrowserWindowController(WindowType) | 
| OLD | NEW | 
|---|