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 2003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2014 CGFloat y = 0; | 2014 CGFloat y = 0; |
2015 if (NSMaxY(target) < NSMaxY(source)) | 2015 if (NSMaxY(target) < NSMaxY(source)) |
2016 y = NSMaxY(source) - NSMaxY(target); | 2016 y = NSMaxY(source) - NSMaxY(target); |
2017 else if (NSMinY(source) < NSMinY(target)) | 2017 else if (NSMinY(source) < NSMinY(target)) |
2018 y = NSMinY(source) - NSMinY(target); | 2018 y = NSMinY(source) - NSMinY(target); |
2019 | 2019 |
2020 return NSMakeSize(x, y); | 2020 return NSMakeSize(x, y); |
2021 } | 2021 } |
2022 | 2022 |
2023 // (Private/TestingAPI) | 2023 // (Private/TestingAPI) |
2024 - (FullscreenExitBubbleController*)fullscreenExitBubbleController { | 2024 - (ExclusiveAccessBubbleWindowController*) |
2025 return fullscreenExitBubbleController_.get(); | 2025 exclusiveAccessBubbleWindowController { |
| 2026 return exclusiveAccessBubbleWindowController_.get(); |
2026 } | 2027 } |
2027 | 2028 |
2028 - (NSRect)omniboxPopupAnchorRect { | 2029 - (NSRect)omniboxPopupAnchorRect { |
2029 // Start with toolbar rect. | 2030 // Start with toolbar rect. |
2030 NSView* toolbarView = [toolbarController_ view]; | 2031 NSView* toolbarView = [toolbarController_ view]; |
2031 NSRect anchorRect = [toolbarView frame]; | 2032 NSRect anchorRect = [toolbarView frame]; |
2032 | 2033 |
2033 // Adjust to account for height and possible bookmark bar. Compress by 1 | 2034 // Adjust to account for height and possible bookmark bar. Compress by 1 |
2034 // to account for the separator. | 2035 // to account for the separator. |
2035 anchorRect.origin.y = | 2036 anchorRect.origin.y = |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2084 } | 2085 } |
2085 } | 2086 } |
2086 | 2087 |
2087 - (void)updateFullscreenWithToolbar:(BOOL)withToolbar { | 2088 - (void)updateFullscreenWithToolbar:(BOOL)withToolbar { |
2088 [self adjustUIForSlidingFullscreenStyle: | 2089 [self adjustUIForSlidingFullscreenStyle: |
2089 withToolbar ? fullscreen_mac::OMNIBOX_TABS_PRESENT | 2090 withToolbar ? fullscreen_mac::OMNIBOX_TABS_PRESENT |
2090 : fullscreen_mac::OMNIBOX_TABS_HIDDEN]; | 2091 : fullscreen_mac::OMNIBOX_TABS_HIDDEN]; |
2091 } | 2092 } |
2092 | 2093 |
2093 - (void)updateFullscreenExitBubbleURL:(const GURL&)url | 2094 - (void)updateFullscreenExitBubbleURL:(const GURL&)url |
2094 bubbleType:(FullscreenExitBubbleType)bubbleType { | 2095 bubbleType:(ExclusiveAccessBubbleType)bubbleType { |
2095 fullscreenUrl_ = url; | 2096 fullscreenUrl_ = url; |
2096 fullscreenBubbleType_ = bubbleType; | 2097 exclusiveAccessBubbleType_ = bubbleType; |
2097 [self layoutSubviews]; | 2098 [self layoutSubviews]; |
2098 [self showFullscreenExitBubbleIfNecessary]; | 2099 [self showFullscreenExitBubbleIfNecessary]; |
2099 } | 2100 } |
2100 | 2101 |
2101 - (BOOL)isInAnyFullscreenMode { | 2102 - (BOOL)isInAnyFullscreenMode { |
2102 return [self isInImmersiveFullscreen] || [self isInAppKitFullscreen]; | 2103 return [self isInImmersiveFullscreen] || [self isInAppKitFullscreen]; |
2103 } | 2104 } |
2104 | 2105 |
2105 - (BOOL)isInImmersiveFullscreen { | 2106 - (BOOL)isInImmersiveFullscreen { |
2106 return fullscreenWindow_.get() != nil || enteringImmersiveFullscreen_; | 2107 return fullscreenWindow_.get() != nil || enteringImmersiveFullscreen_; |
2107 } | 2108 } |
2108 | 2109 |
2109 - (BOOL)isInAppKitFullscreen { | 2110 - (BOOL)isInAppKitFullscreen { |
2110 return ([[self window] styleMask] & NSFullScreenWindowMask) == | 2111 return ([[self window] styleMask] & NSFullScreenWindowMask) == |
2111 NSFullScreenWindowMask || | 2112 NSFullScreenWindowMask || |
2112 enteringAppKitFullscreen_; | 2113 enteringAppKitFullscreen_; |
2113 } | 2114 } |
2114 | 2115 |
2115 - (void)enterExtensionFullscreenForURL:(const GURL&)url | 2116 - (void)enterExtensionFullscreenForURL:(const GURL&)url |
2116 bubbleType:(FullscreenExitBubbleType)bubbleType { | 2117 bubbleType:(ExclusiveAccessBubbleType)bubbleType { |
2117 if (chrome::mac::SupportsSystemFullscreen()) { | 2118 if (chrome::mac::SupportsSystemFullscreen()) { |
2118 fullscreenUrl_ = url; | 2119 fullscreenUrl_ = url; |
2119 fullscreenBubbleType_ = bubbleType; | 2120 exclusiveAccessBubbleType_ = bubbleType; |
2120 [self enterBrowserFullscreenWithToolbar:NO]; | 2121 [self enterBrowserFullscreenWithToolbar:NO]; |
2121 } else { | 2122 } else { |
2122 [self enterImmersiveFullscreen]; | 2123 [self enterImmersiveFullscreen]; |
2123 DCHECK(!url.is_empty()); | 2124 DCHECK(!url.is_empty()); |
2124 [self updateFullscreenExitBubbleURL:url bubbleType:bubbleType]; | 2125 [self updateFullscreenExitBubbleURL:url bubbleType:bubbleType]; |
2125 } | 2126 } |
2126 } | 2127 } |
2127 | 2128 |
2128 - (void)enterWebContentFullscreenForURL:(const GURL&)url | 2129 - (void)enterWebContentFullscreenForURL:(const GURL&)url |
2129 bubbleType:(FullscreenExitBubbleType)bubbleType { | 2130 bubbleType:(ExclusiveAccessBubbleType)bubbleType { |
2130 [self enterImmersiveFullscreen]; | 2131 [self enterImmersiveFullscreen]; |
2131 if (!url.is_empty()) | 2132 if (!url.is_empty()) |
2132 [self updateFullscreenExitBubbleURL:url bubbleType:bubbleType]; | 2133 [self updateFullscreenExitBubbleURL:url bubbleType:bubbleType]; |
2133 } | 2134 } |
2134 | 2135 |
2135 - (void)exitAnyFullscreen { | 2136 - (void)exitAnyFullscreen { |
2136 // TODO(erikchen): Fullscreen modes should stack. Should be able to exit | 2137 // TODO(erikchen): Fullscreen modes should stack. Should be able to exit |
2137 // Immersive Fullscreen and still be in AppKit Fullscreen. | 2138 // Immersive Fullscreen and still be in AppKit Fullscreen. |
2138 if ([self isInAppKitFullscreen]) | 2139 if ([self isInAppKitFullscreen]) |
2139 [self exitAppKitFullscreen]; | 2140 [self exitAppKitFullscreen]; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2222 | 2223 |
2223 - (BOOL)supportsBookmarkBar { | 2224 - (BOOL)supportsBookmarkBar { |
2224 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2225 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
2225 } | 2226 } |
2226 | 2227 |
2227 - (BOOL)isTabbedWindow { | 2228 - (BOOL)isTabbedWindow { |
2228 return browser_->is_type_tabbed(); | 2229 return browser_->is_type_tabbed(); |
2229 } | 2230 } |
2230 | 2231 |
2231 @end // @implementation BrowserWindowController(WindowType) | 2232 @end // @implementation BrowserWindowController(WindowType) |
OLD | NEW |