| 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 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 2083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2094 - (BOOL)isInAppKitFullscreen { | 2094 - (BOOL)isInAppKitFullscreen { |
| 2095 return ([[self window] styleMask] & NSFullScreenWindowMask) == | 2095 return ([[self window] styleMask] & NSFullScreenWindowMask) == |
| 2096 NSFullScreenWindowMask || | 2096 NSFullScreenWindowMask || |
| 2097 enteringAppKitFullscreen_; | 2097 enteringAppKitFullscreen_; |
| 2098 } | 2098 } |
| 2099 | 2099 |
| 2100 - (BOOL)isInFullscreenWithOmniboxSliding { | 2100 - (BOOL)isInFullscreenWithOmniboxSliding { |
| 2101 return presentationModeController_.get() != nil; | 2101 return presentationModeController_.get() != nil; |
| 2102 } | 2102 } |
| 2103 | 2103 |
| 2104 - (void)enterPresentationModeForURL:(const GURL&)url | 2104 - (void)enterPresentationMode { |
| 2105 bubbleType:(FullscreenExitBubbleType)bubbleType { | 2105 if (!chrome::mac::SupportsSystemFullscreen()) { |
| 2106 DCHECK(chrome::mac::SupportsSystemFullscreen()); | 2106 [self enterImmersiveFullscreen]; |
| 2107 fullscreenUrl_ = url; | 2107 return; |
| 2108 fullscreenBubbleType_ = bubbleType; | 2108 } |
| 2109 | 2109 |
| 2110 if ([self isInAppKitFullscreen]) { | 2110 if ([self isInAppKitFullscreen]) { |
| 2111 // Already in AppKit Fullscreen. Adjust the UI to use Presentation Mode. | 2111 // Already in AppKit Fullscreen. Adjust the UI to use Presentation Mode. |
| 2112 [self | 2112 [self |
| 2113 adjustUIForSlidingFullscreenStyle:fullscreen_mac::OMNIBOX_TABS_HIDDEN]; | 2113 adjustUIForSlidingFullscreenStyle:fullscreen_mac::OMNIBOX_TABS_HIDDEN]; |
| 2114 } else { | 2114 } else { |
| 2115 // Need to invoke AppKit Fullscreen API. Presentation mode will | 2115 // Need to invoke AppKit Fullscreen API. Presentation mode will |
| 2116 // automatically be enabled in |-windowWillEnterFullScreen:|. | 2116 // automatically be enabled in |-windowWillEnterFullScreen:|. |
| 2117 enteringPresentationMode_ = YES; | 2117 enteringPresentationMode_ = YES; |
| 2118 [self enterAppKitFullscreen]; | 2118 [self enterAppKitFullscreen]; |
| 2119 } | 2119 } |
| 2120 } | 2120 } |
| 2121 | 2121 |
| 2122 - (void)enterHTML5FullscreenForURL:(const GURL&)url | 2122 - (void)enterExtensionFullscreenForURL:(const GURL&)url |
| 2123 bubbleType:(FullscreenExitBubbleType)bubbleType { | 2123 bubbleType:(FullscreenExitBubbleType)bubbleType { |
| 2124 if (chrome::mac::SupportsSystemFullscreen()) { |
| 2125 fullscreenUrl_ = url; |
| 2126 fullscreenBubbleType_ = bubbleType; |
| 2127 [self enterPresentationMode]; |
| 2128 } else { |
| 2129 [self enterImmersiveFullscreen]; |
| 2130 DCHECK(!url.is_empty()); |
| 2131 [self updateFullscreenExitBubbleURL:url bubbleType:bubbleType]; |
| 2132 } |
| 2133 } |
| 2134 |
| 2135 - (void)enterWebContentFullscreenForURL:(const GURL&)url |
| 2136 bubbleType:(FullscreenExitBubbleType)bubbleType { |
| 2124 [self enterImmersiveFullscreen]; | 2137 [self enterImmersiveFullscreen]; |
| 2125 if (!url.is_empty()) | 2138 if (!url.is_empty()) |
| 2126 [self updateFullscreenExitBubbleURL:url bubbleType:bubbleType]; | 2139 [self updateFullscreenExitBubbleURL:url bubbleType:bubbleType]; |
| 2127 } | 2140 } |
| 2128 | 2141 |
| 2129 - (void)exitAnyFullscreen { | 2142 - (void)exitAnyFullscreen { |
| 2130 // TODO(erikchen): Fullscreen modes should stack. Should be able to exit | 2143 // TODO(erikchen): Fullscreen modes should stack. Should be able to exit |
| 2131 // Immersive Fullscreen and still be in AppKit Fullscreen. | 2144 // Immersive Fullscreen and still be in AppKit Fullscreen. |
| 2132 if ([self isInAppKitFullscreen]) | 2145 if ([self isInAppKitFullscreen]) |
| 2133 [self exitAppKitFullscreen]; | 2146 [self exitAppKitFullscreen]; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2216 | 2229 |
| 2217 - (BOOL)supportsBookmarkBar { | 2230 - (BOOL)supportsBookmarkBar { |
| 2218 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2231 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
| 2219 } | 2232 } |
| 2220 | 2233 |
| 2221 - (BOOL)isTabbedWindow { | 2234 - (BOOL)isTabbedWindow { |
| 2222 return browser_->is_type_tabbed(); | 2235 return browser_->is_type_tabbed(); |
| 2223 } | 2236 } |
| 2224 | 2237 |
| 2225 @end // @implementation BrowserWindowController(WindowType) | 2238 @end // @implementation BrowserWindowController(WindowType) |
| OLD | NEW |