| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <Carbon/Carbon.h> | 7 #include <Carbon/Carbon.h> |
| 8 | 8 |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 #include <numeric> | 10 #include <numeric> |
| (...skipping 1930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1941 if (fullscreen == [self isFullscreen]) | 1941 if (fullscreen == [self isFullscreen]) |
| 1942 return; | 1942 return; |
| 1943 | 1943 |
| 1944 if (![self supportsFullscreen]) | 1944 if (![self supportsFullscreen]) |
| 1945 return; | 1945 return; |
| 1946 | 1946 |
| 1947 if (base::mac::IsOSLionOrLater()) { | 1947 if (base::mac::IsOSLionOrLater()) { |
| 1948 enteredPresentationModeFromFullscreen_ = YES; | 1948 enteredPresentationModeFromFullscreen_ = YES; |
| 1949 if ([[self window] isKindOfClass:[FramedBrowserWindow class]]) | 1949 if ([[self window] isKindOfClass:[FramedBrowserWindow class]]) |
| 1950 [static_cast<FramedBrowserWindow*>([self window]) toggleSystemFullScreen]; | 1950 [static_cast<FramedBrowserWindow*>([self window]) toggleSystemFullScreen]; |
| 1951 return; | 1951 } else { |
| 1952 if (fullscreen) |
| 1953 [self enterFullscreenForSnowLeopardOrEarlier]; |
| 1954 else |
| 1955 [self exitFullscreenForSnowLeopardOrEarlier]; |
| 1952 } | 1956 } |
| 1953 | 1957 |
| 1954 if (fullscreen) | 1958 // Disable the floating tab bar if this fullscreen request was from a page. |
| 1955 [self enterFullscreenForSnowLeopardOrEarlier]; | 1959 // It will be re-enabled by the FullscreenExitBubble after the user dismisses
the bubble. |
| 1956 else | 1960 [self setShowFloatingChrome:NO/*fullscreen && url.is_empty()*/]; |
| 1957 [self exitFullscreenForSnowLeopardOrEarlier]; | 1961 |
| 1962 if (fullscreen /*&& !url.is_empty()*/) { |
| 1963 fullscreenExitBubbleController_.reset( |
| 1964 [[FullscreenExitBubbleController alloc] initWithOwner:self browser:brows
er_.get()]); |
| 1965 NSView *contentView = [[self window] contentView]; |
| 1966 CGFloat maxY = [self placeBookmarkBarBelowInfoBar] ? |
| 1967 NSMinY([[toolbarController_ view] frame]) : |
| 1968 NSMinY([[bookmarkBarController_ view] frame]); |
| 1969 NSRect fsebFrame = [[fullscreenExitBubbleController_ animatableView] frame]; |
| 1970 CGFloat maxWidth = NSWidth([contentView frame]); |
| 1971 fsebFrame.origin.x = maxWidth/2-NSWidth(fsebFrame)/2; |
| 1972 fsebFrame.origin.y = maxY-NSHeight(fsebFrame); |
| 1973 [[fullscreenExitBubbleController_ view] setFrame:fsebFrame]; |
| 1974 [contentView addSubview:[fullscreenExitBubbleController_ view]]; |
| 1975 } else { |
| 1976 [[fullscreenExitBubbleController_ view] removeFromSuperview]; |
| 1977 fullscreenExitBubbleController_.reset(); |
| 1978 } |
| 1958 } | 1979 } |
| 1959 | 1980 |
| 1960 - (BOOL)isFullscreen { | 1981 - (BOOL)isFullscreen { |
| 1961 return (fullscreenWindow_.get() != nil) || | 1982 return (fullscreenWindow_.get() != nil) || |
| 1962 ([[self window] styleMask] & NSFullScreenWindowMask); | 1983 ([[self window] styleMask] & NSFullScreenWindowMask); |
| 1963 } | 1984 } |
| 1964 | 1985 |
| 1965 - (void)togglePresentationModeForLionOrLater:(id)sender { | 1986 - (void)togglePresentationModeForLionOrLater:(id)sender { |
| 1966 // Called only by the presentation mode toggle button. | 1987 // Called only by the presentation mode toggle button. |
| 1967 DCHECK(base::mac::IsOSLionOrLater()); | 1988 DCHECK(base::mac::IsOSLionOrLater()); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2044 | 2065 |
| 2045 - (CGFloat)floatingBarShownFraction { | 2066 - (CGFloat)floatingBarShownFraction { |
| 2046 return floatingBarShownFraction_; | 2067 return floatingBarShownFraction_; |
| 2047 } | 2068 } |
| 2048 | 2069 |
| 2049 - (void)setFloatingBarShownFraction:(CGFloat)fraction { | 2070 - (void)setFloatingBarShownFraction:(CGFloat)fraction { |
| 2050 floatingBarShownFraction_ = fraction; | 2071 floatingBarShownFraction_ = fraction; |
| 2051 [self layoutSubviews]; | 2072 [self layoutSubviews]; |
| 2052 } | 2073 } |
| 2053 | 2074 |
| 2075 - (void)setShowFloatingChrome:(BOOL)showChrome { |
| 2076 showFloatingChrome_ = showChrome; |
| 2077 [self layoutSubviews]; |
| 2078 } |
| 2079 |
| 2054 - (BOOL)isBarVisibilityLockedForOwner:(id)owner { | 2080 - (BOOL)isBarVisibilityLockedForOwner:(id)owner { |
| 2055 DCHECK(owner); | 2081 DCHECK(owner); |
| 2056 DCHECK(barVisibilityLocks_); | 2082 DCHECK(barVisibilityLocks_); |
| 2057 return [barVisibilityLocks_ containsObject:owner]; | 2083 return [barVisibilityLocks_ containsObject:owner]; |
| 2058 } | 2084 } |
| 2059 | 2085 |
| 2060 - (void)lockBarVisibilityForOwner:(id)owner | 2086 - (void)lockBarVisibilityForOwner:(id)owner |
| 2061 withAnimation:(BOOL)animate | 2087 withAnimation:(BOOL)animate |
| 2062 delay:(BOOL)delay { | 2088 delay:(BOOL)delay { |
| 2063 if (![self isBarVisibilityLockedForOwner:owner]) { | 2089 if (![self isBarVisibilityLockedForOwner:owner]) { |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2156 | 2182 |
| 2157 - (BOOL)supportsBookmarkBar { | 2183 - (BOOL)supportsBookmarkBar { |
| 2158 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2184 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
| 2159 } | 2185 } |
| 2160 | 2186 |
| 2161 - (BOOL)isTabbedWindow { | 2187 - (BOOL)isTabbedWindow { |
| 2162 return browser_->is_type_tabbed(); | 2188 return browser_->is_type_tabbed(); |
| 2163 } | 2189 } |
| 2164 | 2190 |
| 2165 @end // @implementation BrowserWindowController(WindowType) | 2191 @end // @implementation BrowserWindowController(WindowType) |
| OLD | NEW |