Chromium Code Reviews| 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 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/mac/bind_objc_block.h" | 10 #include "base/mac/bind_objc_block.h" |
| (...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1067 if (![[self class] systemSettingsRequireMavericksAppKitFullscreenHack]) | 1067 if (![[self class] systemSettingsRequireMavericksAppKitFullscreenHack]) |
| 1068 return NO; | 1068 return NO; |
| 1069 if (!enteringAppKitFullscreen_) | 1069 if (!enteringAppKitFullscreen_) |
| 1070 return NO; | 1070 return NO; |
| 1071 if (enteringAppKitFullscreenOnPrimaryScreen_) | 1071 if (enteringAppKitFullscreenOnPrimaryScreen_) |
| 1072 return NO; | 1072 return NO; |
| 1073 | 1073 |
| 1074 return YES; | 1074 return YES; |
| 1075 } | 1075 } |
| 1076 | 1076 |
| 1077 - (BOOL)shouldUseCustomAppKitFullscreenTransition { | 1077 - (BOOL)shouldUseCustomAppKitFullscreenTransition:(BOOL)enterFullScreen { |
| 1078 // TODO(spqchan): Fix exit fullscreen transition so that it works on other | |
| 1079 // OSX versions. | |
| 1080 if (!enterFullScreen && !base::mac::IsOSYosemite()) | |
|
erikchen
2015/09/11 22:30:22
This disables the fullscreen animation as well, is
spqchan1
2015/09/11 22:34:50
Yes, that was intentional. Sure, that would make s
erikchen
2015/09/12 01:07:33
Can you update your comment then, since it implies
| |
| 1081 return NO; | |
| 1082 | |
| 1078 if (base::mac::IsOSMountainLionOrEarlier()) | 1083 if (base::mac::IsOSMountainLionOrEarlier()) |
| 1079 return NO; | 1084 return NO; |
| 1080 | 1085 |
| 1081 NSView* root = [[self.window contentView] superview]; | 1086 NSView* root = [[self.window contentView] superview]; |
| 1082 if (!root.layer) | 1087 if (!root.layer) |
| 1083 return NO; | 1088 return NO; |
| 1084 | 1089 |
| 1085 // AppKit on OSX 10.9 has a bug for applications linked against OSX 10.8 SDK | 1090 // AppKit on OSX 10.9 has a bug for applications linked against OSX 10.8 SDK |
| 1086 // and earlier. Under specific circumstances, it prevents the custom AppKit | 1091 // and earlier. Under specific circumstances, it prevents the custom AppKit |
| 1087 // transition from working well. See http://crbug.com/396980 for more | 1092 // transition from working well. See http://crbug.com/396980 for more |
| 1088 // details. | 1093 // details. |
| 1089 if ([[self class] systemSettingsRequireMavericksAppKitFullscreenHack] && | 1094 if ([[self class] systemSettingsRequireMavericksAppKitFullscreenHack] && |
| 1090 ![[[self window] screen] isEqual:[[NSScreen screens] objectAtIndex:0]]) { | 1095 ![[[self window] screen] isEqual:[[NSScreen screens] objectAtIndex:0]]) { |
| 1091 return NO; | 1096 return NO; |
| 1092 } | 1097 } |
| 1093 | 1098 |
| 1094 return YES; | 1099 return YES; |
| 1095 } | 1100 } |
| 1096 | 1101 |
| 1097 - (NSArray*)customWindowsToEnterFullScreenForWindow:(NSWindow*)window { | 1102 - (NSArray*)customWindowsToEnterFullScreenForWindow:(NSWindow*)window { |
| 1098 DCHECK([window isEqual:self.window]); | 1103 DCHECK([window isEqual:self.window]); |
| 1099 | 1104 |
| 1100 if (![self shouldUseCustomAppKitFullscreenTransition]) | 1105 if (![self shouldUseCustomAppKitFullscreenTransition:YES]) |
| 1101 return nil; | 1106 return nil; |
| 1102 | 1107 |
| 1103 FramedBrowserWindow* framedBrowserWindow = | 1108 FramedBrowserWindow* framedBrowserWindow = |
| 1104 base::mac::ObjCCast<FramedBrowserWindow>([self window]); | 1109 base::mac::ObjCCast<FramedBrowserWindow>([self window]); |
| 1105 fullscreenTransition_.reset([[BrowserWindowFullscreenTransition alloc] | 1110 fullscreenTransition_.reset([[BrowserWindowFullscreenTransition alloc] |
| 1106 initEnterWithWindow:framedBrowserWindow]); | 1111 initEnterWithWindow:framedBrowserWindow]); |
| 1107 return [fullscreenTransition_ customWindowsForFullScreenTransition]; | 1112 return [fullscreenTransition_ customWindowsForFullScreenTransition]; |
| 1108 } | 1113 } |
| 1109 | 1114 |
| 1110 - (NSArray*)customWindowsToExitFullScreenForWindow:(NSWindow*)window { | 1115 - (NSArray*)customWindowsToExitFullScreenForWindow:(NSWindow*)window { |
| 1111 DCHECK([window isEqual:self.window]); | 1116 DCHECK([window isEqual:self.window]); |
| 1112 | 1117 |
| 1113 if (![self shouldUseCustomAppKitFullscreenTransition]) | 1118 if (![self shouldUseCustomAppKitFullscreenTransition:NO]) |
| 1114 return nil; | 1119 return nil; |
| 1115 | 1120 |
| 1116 FramedBrowserWindow* framedBrowserWindow = | 1121 FramedBrowserWindow* framedBrowserWindow = |
| 1117 base::mac::ObjCCast<FramedBrowserWindow>([self window]); | 1122 base::mac::ObjCCast<FramedBrowserWindow>([self window]); |
| 1118 fullscreenTransition_.reset([[BrowserWindowFullscreenTransition alloc] | 1123 fullscreenTransition_.reset([[BrowserWindowFullscreenTransition alloc] |
| 1119 initExitWithWindow:framedBrowserWindow | 1124 initExitWithWindow:framedBrowserWindow |
| 1120 frame:savedRegularWindowFrame_]); | 1125 frame:savedRegularWindowFrame_]); |
| 1121 | 1126 |
| 1122 return [fullscreenTransition_ customWindowsForFullScreenTransition]; | 1127 return [fullscreenTransition_ customWindowsForFullScreenTransition]; |
| 1123 } | 1128 } |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 1146 return browser_->tab_strip_model()->GetActiveWebContents(); | 1151 return browser_->tab_strip_model()->GetActiveWebContents(); |
| 1147 } | 1152 } |
| 1148 | 1153 |
| 1149 - (PermissionBubbleManager*)permissionBubbleManager { | 1154 - (PermissionBubbleManager*)permissionBubbleManager { |
| 1150 if (WebContents* contents = [self webContents]) | 1155 if (WebContents* contents = [self webContents]) |
| 1151 return PermissionBubbleManager::FromWebContents(contents); | 1156 return PermissionBubbleManager::FromWebContents(contents); |
| 1152 return nil; | 1157 return nil; |
| 1153 } | 1158 } |
| 1154 | 1159 |
| 1155 @end // @implementation BrowserWindowController(Private) | 1160 @end // @implementation BrowserWindowController(Private) |
| OLD | NEW |