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