OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_private.h" | 5 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #import "base/auto_reset.h" | 9 #import "base/auto_reset.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 [self adjustUIForEnteringFullscreen]; | 673 [self adjustUIForEnteringFullscreen]; |
674 } | 674 } |
675 | 675 |
676 - (void)windowDidEnterFullScreen:(NSNotification*)notification { | 676 - (void)windowDidEnterFullScreen:(NSNotification*)notification { |
677 [tabStripController_ setVisualEffectsDisabledForFullscreen:YES]; | 677 [tabStripController_ setVisualEffectsDisabledForFullscreen:YES]; |
678 | 678 |
679 // In Yosemite, some combination of the titlebar and toolbar always show in | 679 // In Yosemite, some combination of the titlebar and toolbar always show in |
680 // full-screen mode. We do not want either to show. Search for the window that | 680 // full-screen mode. We do not want either to show. Search for the window that |
681 // contains the views, and hide it. There is no need to ever unhide the view. | 681 // contains the views, and hide it. There is no need to ever unhide the view. |
682 // http://crbug.com/380235 | 682 // http://crbug.com/380235 |
683 if (base::mac::IsOSYosemiteOrLater()) { | 683 if (base::mac::IsAtLeastOS10_10()) { |
684 for (NSWindow* window in [[NSApplication sharedApplication] windows]) { | 684 for (NSWindow* window in [[NSApplication sharedApplication] windows]) { |
685 if ([window | 685 if ([window |
686 isKindOfClass:NSClassFromString(@"NSToolbarFullScreenWindow")]) { | 686 isKindOfClass:NSClassFromString(@"NSToolbarFullScreenWindow")]) { |
687 // Hide the toolbar if it is for a FramedBrowserWindow. | 687 // Hide the toolbar if it is for a FramedBrowserWindow. |
688 if ([window respondsToSelector:@selector(_windowForToolbar)]) { | 688 if ([window respondsToSelector:@selector(_windowForToolbar)]) { |
689 if ([[window _windowForToolbar] | 689 if ([[window _windowForToolbar] |
690 isKindOfClass:[FramedBrowserWindow class]]) | 690 isKindOfClass:[FramedBrowserWindow class]]) |
691 [[window contentView] setHidden:YES]; | 691 [[window contentView] setHidden:YES]; |
692 } | 692 } |
693 } | 693 } |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1109 // Add in the subviews above the tabContentArea. | 1109 // Add in the subviews above the tabContentArea. |
1110 for (NSUInteger i = index + 1; i < [subviews count]; ++i) { | 1110 for (NSUInteger i = index + 1; i < [subviews count]; ++i) { |
1111 NSView* view = [subviews objectAtIndex:i]; | 1111 NSView* view = [subviews objectAtIndex:i]; |
1112 [self.chromeContentView addSubview:view | 1112 [self.chromeContentView addSubview:view |
1113 positioned:NSWindowAbove | 1113 positioned:NSWindowAbove |
1114 relativeTo:nil]; | 1114 relativeTo:nil]; |
1115 } | 1115 } |
1116 } | 1116 } |
1117 | 1117 |
1118 + (BOOL)systemSettingsRequireMavericksAppKitFullscreenHack { | 1118 + (BOOL)systemSettingsRequireMavericksAppKitFullscreenHack { |
1119 if (!base::mac::IsOSMavericks()) | 1119 if (!base::mac::IsOS10_9()) |
1120 return NO; | 1120 return NO; |
1121 return [NSScreen respondsToSelector:@selector(screensHaveSeparateSpaces)] && | 1121 return [NSScreen respondsToSelector:@selector(screensHaveSeparateSpaces)] && |
1122 [NSScreen screensHaveSeparateSpaces]; | 1122 [NSScreen screensHaveSeparateSpaces]; |
1123 } | 1123 } |
1124 | 1124 |
1125 - (BOOL)shouldUseMavericksAppKitFullscreenHack { | 1125 - (BOOL)shouldUseMavericksAppKitFullscreenHack { |
1126 if (![[self class] systemSettingsRequireMavericksAppKitFullscreenHack]) | 1126 if (![[self class] systemSettingsRequireMavericksAppKitFullscreenHack]) |
1127 return NO; | 1127 return NO; |
1128 if (!enteringAppKitFullscreen_) | 1128 if (!enteringAppKitFullscreen_) |
1129 return NO; | 1129 return NO; |
1130 if (enteringAppKitFullscreenOnPrimaryScreen_) | 1130 if (enteringAppKitFullscreenOnPrimaryScreen_) |
1131 return NO; | 1131 return NO; |
1132 | 1132 |
1133 return YES; | 1133 return YES; |
1134 } | 1134 } |
1135 | 1135 |
1136 - (BOOL)shouldUseCustomAppKitFullscreenTransition:(BOOL)enterFullScreen { | 1136 - (BOOL)shouldUseCustomAppKitFullscreenTransition:(BOOL)enterFullScreen { |
1137 // Disable the custom exit animation in OSX 10.9: http://crbug.com/526327#c3. | 1137 // Disable the custom exit animation in OSX 10.9: http://crbug.com/526327#c3. |
1138 if (base::mac::IsOSMavericks() && !enterFullScreen) | 1138 if (base::mac::IsOS10_9() && !enterFullScreen) |
1139 return NO; | 1139 return NO; |
1140 | 1140 |
1141 NSView* root = [[self.window contentView] superview]; | 1141 NSView* root = [[self.window contentView] superview]; |
1142 if (!root.layer) | 1142 if (!root.layer) |
1143 return NO; | 1143 return NO; |
1144 | 1144 |
1145 // AppKit on OSX 10.9 has a bug for applications linked against OSX 10.8 SDK | 1145 // AppKit on OSX 10.9 has a bug for applications linked against OSX 10.8 SDK |
1146 // and earlier. Under specific circumstances, it prevents the custom AppKit | 1146 // and earlier. Under specific circumstances, it prevents the custom AppKit |
1147 // transition from working well. See http://crbug.com/396980 for more | 1147 // transition from working well. See http://crbug.com/396980 for more |
1148 // details. | 1148 // details. |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1268 if (fullscreenLowPowerCoordinator_) | 1268 if (fullscreenLowPowerCoordinator_) |
1269 fullscreenLowPowerCoordinator_->SetHasActiveSheet(false); | 1269 fullscreenLowPowerCoordinator_->SetHasActiveSheet(false); |
1270 } | 1270 } |
1271 | 1271 |
1272 - (void)childWindowsDidChange { | 1272 - (void)childWindowsDidChange { |
1273 if (fullscreenLowPowerCoordinator_) | 1273 if (fullscreenLowPowerCoordinator_) |
1274 fullscreenLowPowerCoordinator_->ChildWindowsChanged(); | 1274 fullscreenLowPowerCoordinator_->ChildWindowsChanged(); |
1275 } | 1275 } |
1276 | 1276 |
1277 @end // @implementation BrowserWindowController(Private) | 1277 @end // @implementation BrowserWindowController(Private) |
OLD | NEW |