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 2089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2100 - (BOOL)isInAppKitFullscreen { | 2100 - (BOOL)isInAppKitFullscreen { |
2101 return ([[self window] styleMask] & NSFullScreenWindowMask) == | 2101 return ([[self window] styleMask] & NSFullScreenWindowMask) == |
2102 NSFullScreenWindowMask || | 2102 NSFullScreenWindowMask || |
2103 enteringAppKitFullscreen_; | 2103 enteringAppKitFullscreen_; |
2104 } | 2104 } |
2105 | 2105 |
2106 - (BOOL)isInFullscreenWithOmniboxSliding { | 2106 - (BOOL)isInFullscreenWithOmniboxSliding { |
2107 return presentationModeController_.get() != nil; | 2107 return presentationModeController_.get() != nil; |
2108 } | 2108 } |
2109 | 2109 |
2110 - (void)enterPresentationModeForURL:(const GURL&)url | 2110 - (void)enterPresentationMode { |
2111 bubbleType:(FullscreenExitBubbleType)bubbleType { | 2111 if (!chrome::mac::SupportsSystemFullscreen()) { |
2112 DCHECK(chrome::mac::SupportsSystemFullscreen()); | 2112 [self enterImmersiveFullscreen]; |
2113 fullscreenUrl_ = url; | 2113 return; |
2114 fullscreenBubbleType_ = bubbleType; | 2114 } |
2115 | 2115 |
2116 if ([self isInAppKitFullscreen]) { | 2116 if ([self isInAppKitFullscreen]) { |
2117 // Already in AppKit Fullscreen. Adjust the UI to use Presentation Mode. | 2117 // Already in AppKit Fullscreen. Adjust the UI to use Presentation Mode. |
2118 [self | 2118 [self |
2119 adjustUIForSlidingFullscreenStyle:fullscreen_mac::OMNIBOX_TABS_HIDDEN]; | 2119 adjustUIForSlidingFullscreenStyle:fullscreen_mac::OMNIBOX_TABS_HIDDEN]; |
2120 } else { | 2120 } else { |
2121 // Need to invoke AppKit Fullscreen API. Presentation mode will | 2121 // Need to invoke AppKit Fullscreen API. Presentation mode will |
2122 // automatically be enabled in |-windowWillEnterFullScreen:|. | 2122 // automatically be enabled in |-windowWillEnterFullScreen:|. |
2123 enteringPresentationMode_ = YES; | 2123 enteringPresentationMode_ = YES; |
2124 [self enterAppKitFullscreen]; | 2124 [self enterAppKitFullscreen]; |
2125 } | 2125 } |
2126 } | 2126 } |
2127 | 2127 |
2128 - (void)enterHTML5FullscreenForURL:(const GURL&)url | 2128 - (void)enterExtensionFullscreenForURL:(const GURL&)url |
erikchen
2014/09/15 23:55:37
I've intentionally separated out this logic from e
| |
2129 bubbleType:(FullscreenExitBubbleType)bubbleType { | 2129 bubbleType:(FullscreenExitBubbleType)bubbleType { |
2130 if (chrome::mac::SupportsSystemFullscreen()) { | |
2131 fullscreenUrl_ = url; | |
2132 fullscreenBubbleType_ = bubbleType; | |
2133 [self enterPresentationMode]; | |
Robert Sesek
2014/09/16 15:49:02
Does this call -updateFullscreenExitBubble:?
erikchen
2014/09/16 17:12:36
The relevant method is -showFullscreenExitBubbleIf
| |
2134 } else { | |
2135 [self enterImmersiveFullscreen]; | |
2136 DCHECK(!url.is_empty()); | |
2137 [self updateFullscreenExitBubbleURL:url bubbleType:bubbleType]; | |
2138 } | |
2139 } | |
2140 | |
2141 - (void)enterWebContentFullscreenForURL:(const GURL&)url | |
2142 bubbleType:(FullscreenExitBubbleType)bubbleType { | |
2130 [self enterImmersiveFullscreen]; | 2143 [self enterImmersiveFullscreen]; |
2131 if (!url.is_empty()) | 2144 if (!url.is_empty()) |
2132 [self updateFullscreenExitBubbleURL:url bubbleType:bubbleType]; | 2145 [self updateFullscreenExitBubbleURL:url bubbleType:bubbleType]; |
2133 } | 2146 } |
2134 | 2147 |
2135 - (void)exitAnyFullscreen { | 2148 - (void)exitAnyFullscreen { |
2136 // TODO(erikchen): Fullscreen modes should stack. Should be able to exit | 2149 // TODO(erikchen): Fullscreen modes should stack. Should be able to exit |
2137 // Immersive Fullscreen and still be in AppKit Fullscreen. | 2150 // Immersive Fullscreen and still be in AppKit Fullscreen. |
2138 if ([self isInAppKitFullscreen]) | 2151 if ([self isInAppKitFullscreen]) |
2139 [self exitAppKitFullscreen]; | 2152 [self exitAppKitFullscreen]; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2222 | 2235 |
2223 - (BOOL)supportsBookmarkBar { | 2236 - (BOOL)supportsBookmarkBar { |
2224 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2237 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
2225 } | 2238 } |
2226 | 2239 |
2227 - (BOOL)isTabbedWindow { | 2240 - (BOOL)isTabbedWindow { |
2228 return browser_->is_type_tabbed(); | 2241 return browser_->is_type_tabbed(); |
2229 } | 2242 } |
2230 | 2243 |
2231 @end // @implementation BrowserWindowController(WindowType) | 2244 @end // @implementation BrowserWindowController(WindowType) |
OLD | NEW |