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 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 // Called right after our window became the main window. | 607 // Called right after our window became the main window. |
608 - (void)windowDidBecomeMain:(NSNotification*)notification { | 608 - (void)windowDidBecomeMain:(NSNotification*)notification { |
609 BrowserList::SetLastActive(browser_.get()); | 609 BrowserList::SetLastActive(browser_.get()); |
610 [self saveWindowPositionIfNeeded]; | 610 [self saveWindowPositionIfNeeded]; |
611 | 611 |
612 // TODO(dmaclach): Instead of redrawing the whole window, views that care | 612 // TODO(dmaclach): Instead of redrawing the whole window, views that care |
613 // about the active window state should be registering for notifications. | 613 // about the active window state should be registering for notifications. |
614 [[self window] setViewsNeedDisplay:YES]; | 614 [[self window] setViewsNeedDisplay:YES]; |
615 | 615 |
616 // TODO(viettrungluu): For some reason, the above doesn't suffice. | 616 // TODO(viettrungluu): For some reason, the above doesn't suffice. |
617 if ([self isFullscreen]) | 617 if ([self isInAnyFullscreenMode]) |
618 [floatingBarBackingView_ setNeedsDisplay:YES]; // Okay even if nil. | 618 [floatingBarBackingView_ setNeedsDisplay:YES]; // Okay even if nil. |
619 } | 619 } |
620 | 620 |
621 - (void)windowDidResignMain:(NSNotification*)notification { | 621 - (void)windowDidResignMain:(NSNotification*)notification { |
622 // TODO(dmaclach): Instead of redrawing the whole window, views that care | 622 // TODO(dmaclach): Instead of redrawing the whole window, views that care |
623 // about the active window state should be registering for notifications. | 623 // about the active window state should be registering for notifications. |
624 [[self window] setViewsNeedDisplay:YES]; | 624 [[self window] setViewsNeedDisplay:YES]; |
625 | 625 |
626 // TODO(viettrungluu): For some reason, the above doesn't suffice. | 626 // TODO(viettrungluu): For some reason, the above doesn't suffice. |
627 if ([self isFullscreen]) | 627 if ([self isInAnyFullscreenMode]) |
628 [floatingBarBackingView_ setNeedsDisplay:YES]; // Okay even if nil. | 628 [floatingBarBackingView_ setNeedsDisplay:YES]; // Okay even if nil. |
629 } | 629 } |
630 | 630 |
631 // Called when we are activated (when we gain focus). | 631 // Called when we are activated (when we gain focus). |
632 - (void)windowDidBecomeKey:(NSNotification*)notification { | 632 - (void)windowDidBecomeKey:(NSNotification*)notification { |
633 // We need to activate the controls (in the "WebView"). To do this, get the | 633 // We need to activate the controls (in the "WebView"). To do this, get the |
634 // selected WebContents's RenderWidgetHostView and tell it to activate. | 634 // selected WebContents's RenderWidgetHostView and tell it to activate. |
635 if (WebContents* contents = | 635 if (WebContents* contents = |
636 browser_->tab_strip_model()->GetActiveWebContents()) { | 636 browser_->tab_strip_model()->GetActiveWebContents()) { |
637 | 637 |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 } | 838 } |
839 | 839 |
840 // If it wasn't reasonable, return NO. | 840 // If it wasn't reasonable, return NO. |
841 return NO; | 841 return NO; |
842 } | 842 } |
843 | 843 |
844 // Adjusts the window height by the given amount. | 844 // Adjusts the window height by the given amount. |
845 - (BOOL)adjustWindowHeightBy:(CGFloat)deltaH { | 845 - (BOOL)adjustWindowHeightBy:(CGFloat)deltaH { |
846 // By not adjusting the window height when initializing, we can ensure that | 846 // By not adjusting the window height when initializing, we can ensure that |
847 // the window opens with the same size that was saved on close. | 847 // the window opens with the same size that was saved on close. |
848 if (initializing_ || [self isFullscreen] || deltaH == 0) | 848 if (initializing_ || [self isInAnyFullscreenMode] || deltaH == 0) |
849 return NO; | 849 return NO; |
850 | 850 |
851 NSWindow* window = [self window]; | 851 NSWindow* window = [self window]; |
852 NSRect windowFrame = [window frame]; | 852 NSRect windowFrame = [window frame]; |
853 NSRect workarea = [[window screen] visibleFrame]; | 853 NSRect workarea = [[window screen] visibleFrame]; |
854 | 854 |
855 // If the window is not already fully in the workarea, do not adjust its frame | 855 // If the window is not already fully in the workarea, do not adjust its frame |
856 // at all. | 856 // at all. |
857 if (!NSContainsRect(workarea, windowFrame)) | 857 if (!NSContainsRect(workarea, windowFrame)) |
858 return NO; | 858 return NO; |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1080 // Disable "close tab" if the receiving window is not tabbed. | 1080 // Disable "close tab" if the receiving window is not tabbed. |
1081 // We simply check whether the item has a keyboard shortcut set here; | 1081 // We simply check whether the item has a keyboard shortcut set here; |
1082 // app_controller_mac.mm actually determines whether the item should | 1082 // app_controller_mac.mm actually determines whether the item should |
1083 // be enabled. | 1083 // be enabled. |
1084 if (NSMenuItem* menuItem = base::mac::ObjCCast<NSMenuItem>(item)) | 1084 if (NSMenuItem* menuItem = base::mac::ObjCCast<NSMenuItem>(item)) |
1085 enable &= !![[menuItem keyEquivalent] length]; | 1085 enable &= !![[menuItem keyEquivalent] length]; |
1086 break; | 1086 break; |
1087 case IDC_FULLSCREEN: { | 1087 case IDC_FULLSCREEN: { |
1088 if (NSMenuItem* menuItem = base::mac::ObjCCast<NSMenuItem>(item)) { | 1088 if (NSMenuItem* menuItem = base::mac::ObjCCast<NSMenuItem>(item)) { |
1089 NSString* menuTitle = l10n_util::GetNSString( | 1089 NSString* menuTitle = l10n_util::GetNSString( |
1090 [self isFullscreen] && ![self inPresentationMode] ? | 1090 [self isInAppKitFullscreen] && ![self inPresentationMode] |
1091 IDS_EXIT_FULLSCREEN_MAC : | 1091 ? IDS_EXIT_FULLSCREEN_MAC |
1092 IDS_ENTER_FULLSCREEN_MAC); | 1092 : IDS_ENTER_FULLSCREEN_MAC); |
1093 [menuItem setTitle:menuTitle]; | 1093 [menuItem setTitle:menuTitle]; |
1094 | 1094 |
1095 if (!chrome::mac::SupportsSystemFullscreen()) | 1095 if (!chrome::mac::SupportsSystemFullscreen()) |
1096 [menuItem setHidden:YES]; | 1096 [menuItem setHidden:YES]; |
1097 } | 1097 } |
1098 break; | 1098 break; |
1099 } | 1099 } |
1100 case IDC_PRESENTATION_MODE: { | 1100 case IDC_PRESENTATION_MODE: { |
1101 if (NSMenuItem* menuItem = base::mac::ObjCCast<NSMenuItem>(item)) { | 1101 if (NSMenuItem* menuItem = base::mac::ObjCCast<NSMenuItem>(item)) { |
1102 NSString* menuTitle = l10n_util::GetNSString( | 1102 NSString* menuTitle = l10n_util::GetNSString( |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1484 // into its own window (then the overlay window will be present). | 1484 // into its own window (then the overlay window will be present). |
1485 return [[self tabStripController] isDragSessionActive] || | 1485 return [[self tabStripController] isDragSessionActive] || |
1486 [self overlayWindow] != nil; | 1486 [self overlayWindow] != nil; |
1487 } | 1487 } |
1488 | 1488 |
1489 - (BOOL)tabDraggingAllowed { | 1489 - (BOOL)tabDraggingAllowed { |
1490 return [tabStripController_ tabDraggingAllowed]; | 1490 return [tabStripController_ tabDraggingAllowed]; |
1491 } | 1491 } |
1492 | 1492 |
1493 - (BOOL)tabTearingAllowed { | 1493 - (BOOL)tabTearingAllowed { |
1494 return ![self isFullscreen]; | 1494 return ![self isInAnyFullscreenMode]; |
1495 } | 1495 } |
1496 | 1496 |
1497 - (BOOL)windowMovementAllowed { | 1497 - (BOOL)windowMovementAllowed { |
1498 return ![self isFullscreen]; | 1498 return ![self isInAnyFullscreenMode]; |
1499 } | 1499 } |
1500 | 1500 |
1501 - (BOOL)isTabFullyVisible:(TabView*)tab { | 1501 - (BOOL)isTabFullyVisible:(TabView*)tab { |
1502 return [tabStripController_ isTabFullyVisible:tab]; | 1502 return [tabStripController_ isTabFullyVisible:tab]; |
1503 } | 1503 } |
1504 | 1504 |
1505 - (void)showNewTabButton:(BOOL)show { | 1505 - (void)showNewTabButton:(BOOL)show { |
1506 [tabStripController_ showNewTabButton:show]; | 1506 [tabStripController_ showNewTabButton:show]; |
1507 } | 1507 } |
1508 | 1508 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1557 return downloadShelfController_; | 1557 return downloadShelfController_; |
1558 } | 1558 } |
1559 | 1559 |
1560 - (void)addFindBar:(FindBarCocoaController*)findBarCocoaController { | 1560 - (void)addFindBar:(FindBarCocoaController*)findBarCocoaController { |
1561 // Shouldn't call addFindBar twice. | 1561 // Shouldn't call addFindBar twice. |
1562 DCHECK(!findBarCocoaController_.get()); | 1562 DCHECK(!findBarCocoaController_.get()); |
1563 | 1563 |
1564 // Create a controller for the findbar. | 1564 // Create a controller for the findbar. |
1565 findBarCocoaController_.reset([findBarCocoaController retain]); | 1565 findBarCocoaController_.reset([findBarCocoaController retain]); |
1566 [self layoutSubviews]; | 1566 [self layoutSubviews]; |
1567 [self updateSubviewZOrder:[self inPresentationMode]]; | 1567 [self updateSubviewZOrder:[self isInFullscreenWithOmniboxSliding]]; |
1568 } | 1568 } |
1569 | 1569 |
1570 - (NSWindow*)createFullscreenWindow { | 1570 - (NSWindow*)createFullscreenWindow { |
1571 return [[[FullscreenWindow alloc] initForScreen:[[self window] screen]] | 1571 return [[[FullscreenWindow alloc] initForScreen:[[self window] screen]] |
1572 autorelease]; | 1572 autorelease]; |
1573 } | 1573 } |
1574 | 1574 |
1575 - (NSInteger)numberOfTabs { | 1575 - (NSInteger)numberOfTabs { |
1576 // count() includes pinned tabs. | 1576 // count() includes pinned tabs. |
1577 return browser_->tab_strip_model()->count(); | 1577 return browser_->tab_strip_model()->count(); |
1578 } | 1578 } |
1579 | 1579 |
1580 - (BOOL)hasLiveTabs { | 1580 - (BOOL)hasLiveTabs { |
1581 return !browser_->tab_strip_model()->empty(); | 1581 return !browser_->tab_strip_model()->empty(); |
1582 } | 1582 } |
1583 | 1583 |
1584 - (NSString*)activeTabTitle { | 1584 - (NSString*)activeTabTitle { |
1585 WebContents* contents = browser_->tab_strip_model()->GetActiveWebContents(); | 1585 WebContents* contents = browser_->tab_strip_model()->GetActiveWebContents(); |
1586 return base::SysUTF16ToNSString(contents->GetTitle()); | 1586 return base::SysUTF16ToNSString(contents->GetTitle()); |
1587 } | 1587 } |
1588 | 1588 |
1589 - (NSRect)regularWindowFrame { | 1589 - (NSRect)regularWindowFrame { |
1590 return [self isFullscreen] ? savedRegularWindowFrame_ : | 1590 return [self isInAnyFullscreenMode] ? savedRegularWindowFrame_ |
1591 [[self window] frame]; | 1591 : [[self window] frame]; |
1592 } | 1592 } |
1593 | 1593 |
1594 // (Override of |TabWindowController| method.) | 1594 // (Override of |TabWindowController| method.) |
1595 - (BOOL)hasTabStrip { | 1595 - (BOOL)hasTabStrip { |
1596 return [self supportsWindowFeature:Browser::FEATURE_TABSTRIP]; | 1596 return [self supportsWindowFeature:Browser::FEATURE_TABSTRIP]; |
1597 } | 1597 } |
1598 | 1598 |
1599 - (BOOL)isTabDraggable:(NSView*)tabView { | 1599 - (BOOL)isTabDraggable:(NSView*)tabView { |
1600 // TODO(avi, thakis): ConstrainedWindowSheetController has no api to move | 1600 // TODO(avi, thakis): ConstrainedWindowSheetController has no api to move |
1601 // tabsheets between windows. Until then, we have to prevent having to move a | 1601 // tabsheets between windows. Until then, we have to prevent having to move a |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2033 @end // @implementation BrowserWindowController | 2033 @end // @implementation BrowserWindowController |
2034 | 2034 |
2035 | 2035 |
2036 @implementation BrowserWindowController(Fullscreen) | 2036 @implementation BrowserWindowController(Fullscreen) |
2037 | 2037 |
2038 - (void)handleLionToggleFullscreen { | 2038 - (void)handleLionToggleFullscreen { |
2039 DCHECK(base::mac::IsOSLionOrLater()); | 2039 DCHECK(base::mac::IsOSLionOrLater()); |
2040 chrome::ExecuteCommand(browser_.get(), IDC_FULLSCREEN); | 2040 chrome::ExecuteCommand(browser_.get(), IDC_FULLSCREEN); |
2041 } | 2041 } |
2042 | 2042 |
2043 // Called to transition into or out of fullscreen mode. Only use System | 2043 - (void)enterFullscreenWithChrome { |
2044 // Fullscreen mode if the system supports it and we aren't trying to go | 2044 if (![self isInAppKitFullscreen]) { |
2045 // fullscreen for the renderer-initiated use cases. | 2045 // Invoking the AppKitFullscreen API by default uses Canonical Fullscreen. |
2046 // Discussion: http://crbug.com/179181 and http:/crbug.com/351252 | 2046 [self enterAppKitFullscreen]; |
2047 - (void)setFullscreen:(BOOL)fullscreen { | |
2048 if (fullscreen == [self isFullscreen]) | |
2049 return; | 2047 return; |
| 2048 } |
2050 | 2049 |
2051 if (fullscreen) { | 2050 // If AppKitFullscreen is already enabled, then just switch to Canonical |
2052 const BOOL shouldUseSystemFullscreen = | 2051 // Fullscreen. |
2053 chrome::mac::SupportsSystemFullscreen() && !fullscreenWindow_ && | 2052 [self adjustUIForSlidingFullscreenStyle:fullscreen_mac::OMNIBOX_TABS_PRESENT]; |
2054 !browser_->fullscreen_controller()->IsWindowFullscreenForTabOrPending(); | |
2055 if (shouldUseSystemFullscreen) { | |
2056 if (FramedBrowserWindow* framedBrowserWindow = | |
2057 base::mac::ObjCCast<FramedBrowserWindow>([self window])) { | |
2058 [framedBrowserWindow toggleSystemFullScreen]; | |
2059 } | |
2060 } else { | |
2061 [self enterImmersiveFullscreen]; | |
2062 } | |
2063 } else { | |
2064 if ([self isInSystemFullscreen]) { | |
2065 if (FramedBrowserWindow* framedBrowserWindow = | |
2066 base::mac::ObjCCast<FramedBrowserWindow>([self window])) { | |
2067 [framedBrowserWindow toggleSystemFullScreen]; | |
2068 } | |
2069 } else { | |
2070 DCHECK(fullscreenWindow_.get()); | |
2071 [self exitImmersiveFullscreen]; | |
2072 } | |
2073 } | |
2074 } | |
2075 | |
2076 - (void)enterFullscreen { | |
2077 [self setFullscreen:YES]; | |
2078 } | |
2079 | |
2080 - (void)exitFullscreen { | |
2081 [self setFullscreen:NO]; | |
2082 } | 2053 } |
2083 | 2054 |
2084 - (void)updateFullscreenExitBubbleURL:(const GURL&)url | 2055 - (void)updateFullscreenExitBubbleURL:(const GURL&)url |
2085 bubbleType:(FullscreenExitBubbleType)bubbleType { | 2056 bubbleType:(FullscreenExitBubbleType)bubbleType { |
2086 fullscreenUrl_ = url; | 2057 fullscreenUrl_ = url; |
2087 fullscreenBubbleType_ = bubbleType; | 2058 fullscreenBubbleType_ = bubbleType; |
2088 [self layoutSubviews]; | 2059 [self layoutSubviews]; |
2089 [self showFullscreenExitBubbleIfNecessary]; | 2060 [self showFullscreenExitBubbleIfNecessary]; |
2090 } | 2061 } |
2091 | 2062 |
2092 - (BOOL)isFullscreen { | 2063 - (BOOL)isInAnyFullscreenMode { |
2093 return [self isInImmersiveFullscreen] || | 2064 return [self isInImmersiveFullscreen] || [self isInAppKitFullscreen]; |
2094 [self isInSystemFullscreen] || | |
2095 enteringFullscreen_; | |
2096 } | 2065 } |
2097 | 2066 |
2098 - (BOOL)isInImmersiveFullscreen { | 2067 - (BOOL)isInImmersiveFullscreen { |
2099 return fullscreenWindow_.get() != nil; | 2068 return fullscreenWindow_.get() != nil || enteringImmersiveFullscreen_; |
2100 } | 2069 } |
2101 | 2070 |
2102 - (BOOL)isInSystemFullscreen { | 2071 - (BOOL)isInAppKitFullscreen { |
2103 return ([[self window] styleMask] & NSFullScreenWindowMask) == | 2072 return ([[self window] styleMask] & NSFullScreenWindowMask) == |
2104 NSFullScreenWindowMask; | 2073 NSFullScreenWindowMask || |
| 2074 enteringAppKitFullscreen_; |
2105 } | 2075 } |
2106 | 2076 |
2107 // On Lion, this function is called by either the presentation mode toggle | 2077 - (BOOL)isInFullscreenWithOmniboxSliding { |
2108 // button or the "Enter Presentation Mode" menu item. In the latter case, this | 2078 return presentationModeController_.get() != nil; |
2109 // function also triggers the Lion machinery to enter fullscreen mode as well as | |
2110 // set presentation mode. On Snow Leopard, this function is called by the | |
2111 // "Enter Presentation Mode" menu item, and triggering presentation mode always | |
2112 // moves the user into fullscreen mode. | |
2113 - (void)setPresentationMode:(BOOL)presentationMode | |
2114 url:(const GURL&)url | |
2115 bubbleType:(FullscreenExitBubbleType)bubbleType { | |
2116 fullscreenUrl_ = url; | |
2117 fullscreenBubbleType_ = bubbleType; | |
2118 | |
2119 // Presentation mode on systems without fullscreen support maps directly to | |
2120 // fullscreen mode. | |
2121 if (!chrome::mac::SupportsSystemFullscreen()) { | |
2122 [self setFullscreen:presentationMode]; | |
2123 return; | |
2124 } | |
2125 | |
2126 if (presentationMode) { | |
2127 BOOL fullscreen = [self isFullscreen]; | |
2128 enteringPresentationMode_ = YES; | |
2129 | |
2130 if (fullscreen) { | |
2131 // If already in fullscreen mode, just toggle the presentation mode | |
2132 // setting. Go through an elaborate dance to force the overlay to show, | |
2133 // then animate out once the mouse moves away. This helps draw attention | |
2134 // to the fact that the UI is in an overlay. Focus the tab contents | |
2135 // because the omnibox is the most likely source of bar visibility locks, | |
2136 // and taking focus away from the omnibox releases its lock. | |
2137 [self lockBarVisibilityForOwner:self withAnimation:NO delay:NO]; | |
2138 [self focusTabContents]; | |
2139 [self setPresentationModeInternal:YES forceDropdown:YES]; | |
2140 [self releaseBarVisibilityForOwner:self withAnimation:YES delay:YES]; | |
2141 // Since -windowDidEnterFullScreen: won't be called in the | |
2142 // fullscreen --> presentation mode case, manually show the exit bubble | |
2143 // and notify the change happened with WindowFullscreenStateChanged(). | |
2144 [self showFullscreenExitBubbleIfNecessary]; | |
2145 browser_->WindowFullscreenStateChanged(); | |
2146 } else { | |
2147 // Need to transition into fullscreen mode. Presentation mode will | |
2148 // automatically be enabled in |-windowWillEnterFullScreen:|. | |
2149 [self setFullscreen:YES]; | |
2150 } | |
2151 } else { | |
2152 // Exiting presentation mode does not exit system fullscreen; it merely | |
2153 // switches from presentation mode to normal fullscreen. | |
2154 [self setPresentationModeInternal:NO forceDropdown:NO]; | |
2155 | |
2156 // Since -windowDidExitFullScreen: won't be called in the | |
2157 // presentation mode --> normal fullscreen case, manually show the exit | |
2158 // bubble and notify the change happened with | |
2159 // WindowFullscreenStateChanged(). | |
2160 [self showFullscreenExitBubbleIfNecessary]; | |
2161 browser_->WindowFullscreenStateChanged(); | |
2162 } | |
2163 } | 2079 } |
2164 | 2080 |
2165 - (void)enterPresentationModeForURL:(const GURL&)url | 2081 - (void)enterPresentationModeForURL:(const GURL&)url |
2166 bubbleType:(FullscreenExitBubbleType)bubbleType { | 2082 bubbleType:(FullscreenExitBubbleType)bubbleType { |
2167 [self setPresentationMode:YES url:url bubbleType:bubbleType]; | 2083 DCHECK(chrome::mac::SupportsSystemFullscreen()); |
| 2084 fullscreenUrl_ = url; |
| 2085 fullscreenBubbleType_ = bubbleType; |
| 2086 |
| 2087 if ([self isInAppKitFullscreen]) { |
| 2088 // Already in AppKit Fullscreen. Adjust the UI to use Presentation Mode. |
| 2089 [self |
| 2090 adjustUIForSlidingFullscreenStyle:fullscreen_mac::OMNIBOX_TABS_HIDDEN]; |
| 2091 } else { |
| 2092 // Need to invoke AppKit Fullscreen API. Presentation mode will |
| 2093 // automatically be enabled in |-windowWillEnterFullScreen:|. |
| 2094 enteringPresentationMode_ = YES; |
| 2095 [self enterAppKitFullscreen]; |
| 2096 } |
2168 } | 2097 } |
2169 | 2098 |
2170 - (void)exitPresentationMode { | 2099 - (void)enterHTML5FullscreenForURL:(const GURL&)url |
2171 // url: and bubbleType: are ignored when leaving presentation mode. | 2100 bubbleType:(FullscreenExitBubbleType)bubbleType { |
2172 [self setPresentationMode:NO url:GURL() bubbleType:FEB_TYPE_NONE]; | 2101 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 2102 if (command_line->HasSwitch(switches::kEnableSimplifiedFullscreen) || |
| 2103 !chrome::mac::SupportsSystemFullscreen()) { |
| 2104 [self enterImmersiveFullscreen]; |
| 2105 if (!url.is_empty()) |
| 2106 [self updateFullscreenExitBubbleURL:url bubbleType:bubbleType]; |
| 2107 } else { |
| 2108 [self enterPresentationModeForURL:url bubbleType:bubbleType]; |
| 2109 } |
2173 } | 2110 } |
2174 | 2111 |
2175 - (void)enterFullscreenForURL:(const GURL&)url | 2112 - (void)exitAnyFullscreen { |
2176 bubbleType:(FullscreenExitBubbleType)bubbleType { | 2113 // TODO(erikchen): Fullscreen modes should stack. Should be able to exit |
2177 // This method may only be called in simplified fullscreen mode. | 2114 // Immersive Fullscreen and still be in AppKit Fullscreen. |
2178 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 2115 if ([self isInAppKitFullscreen]) |
2179 DCHECK(command_line->HasSwitch(switches::kEnableSimplifiedFullscreen)); | 2116 [self exitAppKitFullscreen]; |
2180 | 2117 if ([self isInImmersiveFullscreen]) |
2181 [self enterImmersiveFullscreen]; | 2118 [self exitImmersiveFullscreen]; |
2182 [self updateFullscreenExitBubbleURL:url bubbleType:bubbleType]; | |
2183 } | 2119 } |
2184 | 2120 |
2185 - (BOOL)inPresentationMode { | 2121 - (BOOL)inPresentationMode { |
2186 return presentationModeController_.get() && | 2122 return presentationModeController_.get() && |
2187 [presentationModeController_ inPresentationMode]; | 2123 [presentationModeController_ inPresentationMode] && |
| 2124 fullscreenStyle_ == fullscreen_mac::OMNIBOX_TABS_HIDDEN; |
2188 } | 2125 } |
2189 | 2126 |
2190 - (void)resizeFullscreenWindow { | 2127 - (void)resizeFullscreenWindow { |
2191 DCHECK([self isFullscreen]); | 2128 DCHECK([self isInAnyFullscreenMode]); |
2192 if (![self isFullscreen]) | 2129 if (![self isInAnyFullscreenMode]) |
2193 return; | 2130 return; |
2194 | 2131 |
2195 NSWindow* window = [self window]; | 2132 NSWindow* window = [self window]; |
2196 [window setFrame:[[window screen] frame] display:YES]; | 2133 [window setFrame:[[window screen] frame] display:YES]; |
2197 [self layoutSubviews]; | 2134 [self layoutSubviews]; |
2198 } | 2135 } |
2199 | 2136 |
2200 - (CGFloat)floatingBarShownFraction { | 2137 - (CGFloat)floatingBarShownFraction { |
2201 return floatingBarShownFraction_; | 2138 return floatingBarShownFraction_; |
2202 } | 2139 } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2270 | 2207 |
2271 - (BOOL)supportsBookmarkBar { | 2208 - (BOOL)supportsBookmarkBar { |
2272 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2209 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
2273 } | 2210 } |
2274 | 2211 |
2275 - (BOOL)isTabbedWindow { | 2212 - (BOOL)isTabbedWindow { |
2276 return browser_->is_type_tabbed(); | 2213 return browser_->is_type_tabbed(); |
2277 } | 2214 } |
2278 | 2215 |
2279 @end // @implementation BrowserWindowController(WindowType) | 2216 @end // @implementation BrowserWindowController(WindowType) |
OLD | NEW |