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