Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(716)

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_controller.mm

Issue 7890056: FullscreenExitBubble temp UI for Mac. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: ready for review Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 it disappears.
1956 else 1960 BOOL fullscreen_for_tab = browser_->is_fullscreen_for_tab();
Nico 2011/09/15 04:37:32 Ah. Maybe "allow_tab_switching_in_fullscreen()"?
jeremya 2011/09/15 06:33:28 That's not quite it -- we still allow tab switchin
1957 [self exitFullscreenForSnowLeopardOrEarlier]; 1961 [self setShowFloatingChrome:fullscreen && !fullscreen_for_tab];
1962
1963 if (fullscreen && fullscreen_for_tab) {
1964 fullscreenExitBubbleController_.reset(
1965 [[FullscreenExitBubbleController alloc] initWithOwner:self
1966 browser:browser_.get()]);
1967 NSView *contentView = [[self window] contentView];
Nico 2011/09/15 04:37:32 space goes to the right of *, not left
jeremya 2011/09/15 06:33:28 Done.
1968 CGFloat maxY = [self placeBookmarkBarBelowInfoBar] ?
1969 NSMinY([[toolbarController_ view] frame]) :
1970 NSMinY([[bookmarkBarController_ view] frame]);
Nico 2011/09/15 04:37:32 Move this ?: construct into a well-named method
jeremya 2011/09/15 06:33:28 Done. ... actually, is there any reason I couldn'
1971 NSRect fsebFrame = [[fullscreenExitBubbleController_ animatableView] frame];
Nico 2011/09/15 04:37:32 no abbreviations. bubbleFrame?
Nico 2011/09/15 04:37:32 It feels like all this frame computation business
jeremya 2011/09/15 06:33:28 Done.
jeremya 2011/09/15 06:33:28 Done.
1972 CGFloat maxWidth = NSWidth([contentView frame]);
1973 fsebFrame.origin.x = (int)(maxWidth/2-NSWidth(fsebFrame)/2);
1974 fsebFrame.origin.y = maxY-NSHeight(fsebFrame);
1975 [[fullscreenExitBubbleController_ view] setFrame:fsebFrame];
1976 [contentView addSubview:[fullscreenExitBubbleController_ view]];
Nico 2011/09/15 04:37:32 Have you considered making the bubble a child wind
jeremya 2011/09/15 06:33:28 I hadn't seen that method until I saw the confirm_
Nico 2011/09/15 20:09:14 Most overlapping things are child windows (bookmar
1977 } else {
1978 [[fullscreenExitBubbleController_ view] removeFromSuperview];
1979 fullscreenExitBubbleController_.reset();
Nico 2011/09/15 04:37:32 so non-js fullscreen won't get the bubble? wasn't
jeremya 2011/09/15 06:33:28 Correct. I don't think we need to notify the user
Nico 2011/09/15 20:09:14 Yes…email chrome-ui-leads, and cc rsesek. Just say
1980 }
1958 } 1981 }
1959 1982
1960 - (BOOL)isFullscreen { 1983 - (BOOL)isFullscreen {
1961 return (fullscreenWindow_.get() != nil) || 1984 return (fullscreenWindow_.get() != nil) ||
1962 ([[self window] styleMask] & NSFullScreenWindowMask); 1985 ([[self window] styleMask] & NSFullScreenWindowMask);
1963 } 1986 }
1964 1987
1965 - (void)togglePresentationModeForLionOrLater:(id)sender { 1988 - (void)togglePresentationModeForLionOrLater:(id)sender {
1966 // Called only by the presentation mode toggle button. 1989 // Called only by the presentation mode toggle button.
1967 DCHECK(base::mac::IsOSLionOrLater()); 1990 DCHECK(base::mac::IsOSLionOrLater());
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
2044 2067
2045 - (CGFloat)floatingBarShownFraction { 2068 - (CGFloat)floatingBarShownFraction {
2046 return floatingBarShownFraction_; 2069 return floatingBarShownFraction_;
2047 } 2070 }
2048 2071
2049 - (void)setFloatingBarShownFraction:(CGFloat)fraction { 2072 - (void)setFloatingBarShownFraction:(CGFloat)fraction {
2050 floatingBarShownFraction_ = fraction; 2073 floatingBarShownFraction_ = fraction;
2051 [self layoutSubviews]; 2074 [self layoutSubviews];
2052 } 2075 }
2053 2076
2077 - (void)setShowFloatingChrome:(BOOL)showChrome {
Nico 2011/09/15 04:37:32 Do you want to DCHECK(showChrome ^ showFloating
jeremya 2011/09/15 06:33:28 Is layoutSubviews not idempotent? If not, perhaps
Nico 2011/09/15 20:09:14 I was thinking of two callers that don't know of e
2078 showFloatingChrome_ = showChrome;
2079 [self layoutSubviews];
2080 }
2081
2054 - (BOOL)isBarVisibilityLockedForOwner:(id)owner { 2082 - (BOOL)isBarVisibilityLockedForOwner:(id)owner {
2055 DCHECK(owner); 2083 DCHECK(owner);
2056 DCHECK(barVisibilityLocks_); 2084 DCHECK(barVisibilityLocks_);
2057 return [barVisibilityLocks_ containsObject:owner]; 2085 return [barVisibilityLocks_ containsObject:owner];
2058 } 2086 }
2059 2087
2060 - (void)lockBarVisibilityForOwner:(id)owner 2088 - (void)lockBarVisibilityForOwner:(id)owner
2061 withAnimation:(BOOL)animate 2089 withAnimation:(BOOL)animate
2062 delay:(BOOL)delay { 2090 delay:(BOOL)delay {
2063 if (![self isBarVisibilityLockedForOwner:owner]) { 2091 if (![self isBarVisibilityLockedForOwner:owner]) {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
2156 2184
2157 - (BOOL)supportsBookmarkBar { 2185 - (BOOL)supportsBookmarkBar {
2158 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; 2186 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR];
2159 } 2187 }
2160 2188
2161 - (BOOL)isTabbedWindow { 2189 - (BOOL)isTabbedWindow {
2162 return browser_->is_type_tabbed(); 2190 return browser_->is_type_tabbed();
2163 } 2191 }
2164 2192
2165 @end // @implementation BrowserWindowController(WindowType) 2193 @end // @implementation BrowserWindowController(WindowType)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698