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 isInAnyFullscreenMode]) |
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 isInAnyFullscreenMode]) |
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 isInAnyFullscreenMode] || 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 = l10n_util::GetNSString( |
1089 [self isFullscreen] && ![self inPresentationMode] ? | 1089 [self isInAppKitFullscreen] && ![self inPresentationMode] |
1090 IDS_EXIT_FULLSCREEN_MAC : | 1090 ? IDS_EXIT_FULLSCREEN_MAC |
1091 IDS_ENTER_FULLSCREEN_MAC); | 1091 : IDS_ENTER_FULLSCREEN_MAC); |
1092 [menuItem setTitle:menuTitle]; | 1092 [menuItem setTitle:menuTitle]; |
1093 | 1093 |
1094 if (!chrome::mac::SupportsSystemFullscreen()) | 1094 if (!chrome::mac::SupportsSystemFullscreen()) |
1095 [menuItem setHidden:YES]; | 1095 [menuItem setHidden:YES]; |
1096 } | 1096 } |
1097 break; | 1097 break; |
1098 } | 1098 } |
1099 case IDC_PRESENTATION_MODE: { | 1099 case IDC_PRESENTATION_MODE: { |
1100 if (NSMenuItem* menuItem = base::mac::ObjCCast<NSMenuItem>(item)) { | 1100 if (NSMenuItem* menuItem = base::mac::ObjCCast<NSMenuItem>(item)) { |
1101 NSString* menuTitle = l10n_util::GetNSString( | 1101 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). | 1483 // into its own window (then the overlay window will be present). |
1484 return [[self tabStripController] isDragSessionActive] || | 1484 return [[self tabStripController] isDragSessionActive] || |
1485 [self overlayWindow] != nil; | 1485 [self overlayWindow] != nil; |
1486 } | 1486 } |
1487 | 1487 |
1488 - (BOOL)tabDraggingAllowed { | 1488 - (BOOL)tabDraggingAllowed { |
1489 return [tabStripController_ tabDraggingAllowed]; | 1489 return [tabStripController_ tabDraggingAllowed]; |
1490 } | 1490 } |
1491 | 1491 |
1492 - (BOOL)tabTearingAllowed { | 1492 - (BOOL)tabTearingAllowed { |
1493 return ![self isFullscreen]; | 1493 return ![self isInAnyFullscreenMode]; |
1494 } | 1494 } |
1495 | 1495 |
1496 - (BOOL)windowMovementAllowed { | 1496 - (BOOL)windowMovementAllowed { |
1497 return ![self isFullscreen]; | 1497 return ![self isInAnyFullscreenMode]; |
1498 } | 1498 } |
1499 | 1499 |
1500 - (BOOL)isTabFullyVisible:(TabView*)tab { | 1500 - (BOOL)isTabFullyVisible:(TabView*)tab { |
1501 return [tabStripController_ isTabFullyVisible:tab]; | 1501 return [tabStripController_ isTabFullyVisible:tab]; |
1502 } | 1502 } |
1503 | 1503 |
1504 - (void)showNewTabButton:(BOOL)show { | 1504 - (void)showNewTabButton:(BOOL)show { |
1505 [tabStripController_ showNewTabButton:show]; | 1505 [tabStripController_ showNewTabButton:show]; |
1506 } | 1506 } |
1507 | 1507 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1556 return downloadShelfController_; | 1556 return downloadShelfController_; |
1557 } | 1557 } |
1558 | 1558 |
1559 - (void)addFindBar:(FindBarCocoaController*)findBarCocoaController { | 1559 - (void)addFindBar:(FindBarCocoaController*)findBarCocoaController { |
1560 // Shouldn't call addFindBar twice. | 1560 // Shouldn't call addFindBar twice. |
1561 DCHECK(!findBarCocoaController_.get()); | 1561 DCHECK(!findBarCocoaController_.get()); |
1562 | 1562 |
1563 // Create a controller for the findbar. | 1563 // Create a controller for the findbar. |
1564 findBarCocoaController_.reset([findBarCocoaController retain]); | 1564 findBarCocoaController_.reset([findBarCocoaController retain]); |
1565 [self layoutSubviews]; | 1565 [self layoutSubviews]; |
1566 [self updateSubviewZOrder:[self inPresentationMode]]; | 1566 [self updateSubviewZOrder:[self isInFullscreenWithOmniboxSliding]]; |
1567 } | 1567 } |
1568 | 1568 |
1569 - (NSWindow*)createFullscreenWindow { | 1569 - (NSWindow*)createFullscreenWindow { |
1570 return [[[FullscreenWindow alloc] initForScreen:[[self window] screen]] | 1570 return [[[FullscreenWindow alloc] initForScreen:[[self window] screen]] |
1571 autorelease]; | 1571 autorelease]; |
1572 } | 1572 } |
1573 | 1573 |
1574 - (NSInteger)numberOfTabs { | 1574 - (NSInteger)numberOfTabs { |
1575 // count() includes pinned tabs. | 1575 // count() includes pinned tabs. |
1576 return browser_->tab_strip_model()->count(); | 1576 return browser_->tab_strip_model()->count(); |
1577 } | 1577 } |
1578 | 1578 |
1579 - (BOOL)hasLiveTabs { | 1579 - (BOOL)hasLiveTabs { |
1580 return !browser_->tab_strip_model()->empty(); | 1580 return !browser_->tab_strip_model()->empty(); |
1581 } | 1581 } |
1582 | 1582 |
1583 - (NSString*)activeTabTitle { | 1583 - (NSString*)activeTabTitle { |
1584 WebContents* contents = browser_->tab_strip_model()->GetActiveWebContents(); | 1584 WebContents* contents = browser_->tab_strip_model()->GetActiveWebContents(); |
1585 return base::SysUTF16ToNSString(contents->GetTitle()); | 1585 return base::SysUTF16ToNSString(contents->GetTitle()); |
1586 } | 1586 } |
1587 | 1587 |
1588 - (NSRect)regularWindowFrame { | 1588 - (NSRect)regularWindowFrame { |
1589 return [self isFullscreen] ? savedRegularWindowFrame_ : | 1589 return [self isInAnyFullscreenMode] ? savedRegularWindowFrame_ |
1590 [[self window] frame]; | 1590 : [[self window] frame]; |
1591 } | 1591 } |
1592 | 1592 |
1593 // (Override of |TabWindowController| method.) | 1593 // (Override of |TabWindowController| method.) |
1594 - (BOOL)hasTabStrip { | 1594 - (BOOL)hasTabStrip { |
1595 return [self supportsWindowFeature:Browser::FEATURE_TABSTRIP]; | 1595 return [self supportsWindowFeature:Browser::FEATURE_TABSTRIP]; |
1596 } | 1596 } |
1597 | 1597 |
1598 - (BOOL)isTabDraggable:(NSView*)tabView { | 1598 - (BOOL)isTabDraggable:(NSView*)tabView { |
1599 // TODO(avi, thakis): ConstrainedWindowSheetController has no api to move | 1599 // TODO(avi, thakis): ConstrainedWindowSheetController has no api to move |
1600 // tabsheets between windows. Until then, we have to prevent having to move a | 1600 // 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 | 2037 @end // @implementation BrowserWindowController |
2038 | 2038 |
2039 | 2039 |
2040 @implementation BrowserWindowController(Fullscreen) | 2040 @implementation BrowserWindowController(Fullscreen) |
2041 | 2041 |
2042 - (void)handleLionToggleFullscreen { | 2042 - (void)handleLionToggleFullscreen { |
2043 DCHECK(base::mac::IsOSLionOrLater()); | 2043 DCHECK(base::mac::IsOSLionOrLater()); |
2044 chrome::ExecuteCommand(browser_.get(), IDC_FULLSCREEN); | 2044 chrome::ExecuteCommand(browser_.get(), IDC_FULLSCREEN); |
2045 } | 2045 } |
2046 | 2046 |
2047 // Called to transition into or out of fullscreen mode. Only use System | 2047 - (void)enterFullscreenWithChrome { |
2048 // Fullscreen mode if the system supports it and we aren't trying to go | 2048 if (![self isInAppKitFullscreen]) { |
2049 // fullscreen for the renderer-initiated use cases. | 2049 // Invoking the AppKitFullscreen API by default uses Canonical Fullscreen. |
2050 // Discussion: http://crbug.com/179181 and http:/crbug.com/351252 | 2050 [self enterAppKitFullscreen]; |
2051 - (void)setFullscreen:(BOOL)fullscreen { | |
2052 if (fullscreen == [self isFullscreen]) | |
2053 return; | 2051 return; |
2052 } | |
2054 | 2053 |
2055 if (fullscreen) { | 2054 // If AppKitFullscreen is already enabled, then just switch to Canonical |
2056 const BOOL shouldUseSystemFullscreen = | 2055 // Fullscreen. |
2057 chrome::mac::SupportsSystemFullscreen() && !fullscreenWindow_ && | 2056 [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 } | 2057 } |
2087 | 2058 |
2088 - (void)updateFullscreenExitBubbleURL:(const GURL&)url | 2059 - (void)updateFullscreenExitBubbleURL:(const GURL&)url |
2089 bubbleType:(FullscreenExitBubbleType)bubbleType { | 2060 bubbleType:(FullscreenExitBubbleType)bubbleType { |
2090 fullscreenUrl_ = url; | 2061 fullscreenUrl_ = url; |
2091 fullscreenBubbleType_ = bubbleType; | 2062 fullscreenBubbleType_ = bubbleType; |
2092 [self layoutSubviews]; | 2063 [self layoutSubviews]; |
2093 [self showFullscreenExitBubbleIfNecessary]; | 2064 [self showFullscreenExitBubbleIfNecessary]; |
2094 } | 2065 } |
2095 | 2066 |
2096 - (BOOL)isFullscreen { | 2067 - (BOOL)isInAnyFullscreenMode { |
2097 return [self isInImmersiveFullscreen] || | 2068 return [self isInImmersiveFullscreen] || [self isInAppKitFullscreen]; |
2098 [self isInSystemFullscreen] || | |
2099 enteringFullscreen_; | |
2100 } | 2069 } |
2101 | 2070 |
2102 - (BOOL)isInImmersiveFullscreen { | 2071 - (BOOL)isInImmersiveFullscreen { |
2103 return fullscreenWindow_.get() != nil; | 2072 return fullscreenWindow_.get() != nil || enteringImmersiveFullscreen_; |
2104 } | 2073 } |
2105 | 2074 |
2106 - (BOOL)isInSystemFullscreen { | 2075 - (BOOL)isInAppKitFullscreen { |
2107 return ([[self window] styleMask] & NSFullScreenWindowMask) == | 2076 return ([[self window] styleMask] & NSFullScreenWindowMask) == |
2108 NSFullScreenWindowMask; | 2077 NSFullScreenWindowMask || |
2078 enteringAppKitFullscreen_; | |
2109 } | 2079 } |
2110 | 2080 |
2111 // On Lion, this function is called by either the presentation mode toggle | 2081 - (BOOL)isInFullscreenWithOmniboxSliding { |
2112 // button or the "Enter Presentation Mode" menu item. In the latter case, this | 2082 return presentationModeController_.get() != nil; |
2113 // function also triggers the Lion machinery to enter fullscreen mode as well as | 2083 //[presentationModeController_ inPresentationMode]); |
erikchen
2014/08/28 17:33:57
comment to self: oops, remove this.
erikchen
2014/08/29 20:50:38
Done.
| |
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 } | 2084 } |
2168 | 2085 |
2169 - (void)enterPresentationModeForURL:(const GURL&)url | 2086 - (void)enterPresentationModeForURL:(const GURL&)url |
2170 bubbleType:(FullscreenExitBubbleType)bubbleType { | 2087 bubbleType:(FullscreenExitBubbleType)bubbleType { |
2171 [self setPresentationMode:YES url:url bubbleType:bubbleType]; | 2088 DCHECK(chrome::mac::SupportsSystemFullscreen()); |
2089 fullscreenUrl_ = url; | |
2090 fullscreenBubbleType_ = bubbleType; | |
2091 | |
2092 if ([self isInAppKitFullscreen]) { | |
2093 // Already in AppKit Fullscreen. Adjust the UI to use Presentation Mode. | |
2094 [self | |
2095 adjustUIForSlidingFullscreenStyle:fullscreen_mac::OMNIBOX_TABS_HIDDEN]; | |
2096 } else { | |
2097 // Need to invoke AppKit Fullscreen API. Presentation mode will | |
2098 // automatically be enabled in |-windowWillEnterFullScreen:|. | |
2099 enteringPresentationMode_ = YES; | |
2100 [self enterAppKitFullscreen]; | |
2101 } | |
2172 } | 2102 } |
2173 | 2103 |
2174 - (void)exitPresentationMode { | 2104 - (void)enterHTML5FullscreenForURL:(const GURL&)url |
2175 // url: and bubbleType: are ignored when leaving presentation mode. | 2105 bubbleType:(FullscreenExitBubbleType)bubbleType { |
2176 [self setPresentationMode:NO url:GURL() bubbleType:FEB_TYPE_NONE]; | 2106 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
2107 if (command_line->HasSwitch(switches::kEnableSimplifiedFullscreen) || | |
2108 !chrome::mac::SupportsSystemFullscreen()) { | |
2109 [self enterImmersiveFullscreen]; | |
2110 if (!url.is_empty()) | |
2111 [self updateFullscreenExitBubbleURL:url bubbleType:bubbleType]; | |
2112 } else { | |
2113 [self enterPresentationModeForURL:url bubbleType:bubbleType]; | |
2114 } | |
2177 } | 2115 } |
2178 | 2116 |
2179 - (void)enterFullscreenForURL:(const GURL&)url | 2117 - (void)exitGenericFullscreen { |
2180 bubbleType:(FullscreenExitBubbleType)bubbleType { | 2118 if ([self isInAppKitFullscreen]) |
Robert Sesek
2014/08/29 20:22:42
This is where I think the bug I described is. Full
erikchen
2014/08/29 20:50:38
Added comment, with slightly more detailed wording
| |
2181 // This method may only be called in simplified fullscreen mode. | 2119 [self exitAppKitFullscreen]; |
2182 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 2120 if ([self isInImmersiveFullscreen]) |
2183 DCHECK(command_line->HasSwitch(switches::kEnableSimplifiedFullscreen)); | 2121 [self exitImmersiveFullscreen]; |
2184 | |
2185 [self enterImmersiveFullscreen]; | |
2186 [self updateFullscreenExitBubbleURL:url bubbleType:bubbleType]; | |
2187 } | 2122 } |
2188 | 2123 |
2189 - (BOOL)inPresentationMode { | 2124 - (BOOL)inPresentationMode { |
2190 return presentationModeController_.get() && | 2125 return presentationModeController_.get() && |
2191 [presentationModeController_ inPresentationMode]; | 2126 [presentationModeController_ inPresentationMode] && |
2127 fullscreenStyle_ == fullscreen_mac::OMNIBOX_TABS_HIDDEN; | |
2192 } | 2128 } |
2193 | 2129 |
2194 - (void)resizeFullscreenWindow { | 2130 - (void)resizeFullscreenWindow { |
2195 DCHECK([self isFullscreen]); | 2131 DCHECK([self isInAnyFullscreenMode]); |
2196 if (![self isFullscreen]) | 2132 if (![self isInAnyFullscreenMode]) |
2197 return; | 2133 return; |
2198 | 2134 |
2199 NSWindow* window = [self window]; | 2135 NSWindow* window = [self window]; |
2200 [window setFrame:[[window screen] frame] display:YES]; | 2136 [window setFrame:[[window screen] frame] display:YES]; |
2201 [self layoutSubviews]; | 2137 [self layoutSubviews]; |
2202 } | 2138 } |
2203 | 2139 |
2204 - (CGFloat)floatingBarShownFraction { | 2140 - (CGFloat)floatingBarShownFraction { |
2205 return floatingBarShownFraction_; | 2141 return floatingBarShownFraction_; |
2206 } | 2142 } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2274 | 2210 |
2275 - (BOOL)supportsBookmarkBar { | 2211 - (BOOL)supportsBookmarkBar { |
2276 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2212 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
2277 } | 2213 } |
2278 | 2214 |
2279 - (BOOL)isTabbedWindow { | 2215 - (BOOL)isTabbedWindow { |
2280 return browser_->is_type_tabbed(); | 2216 return browser_->is_type_tabbed(); |
2281 } | 2217 } |
2282 | 2218 |
2283 @end // @implementation BrowserWindowController(WindowType) | 2219 @end // @implementation BrowserWindowController(WindowType) |
OLD | NEW |