| 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 // We are temporary disabling exit fullscreen animation because it only |
| 1079 // works on OSX 10.10. |
| 1080 // TODO(spqchan): Fix exit fullscreen animation so that it works on all |
| 1081 // OSX versions. |
| 1082 if (!enterFullScreen) |
| 1083 return NO; |
| 1084 |
| 1078 if (base::mac::IsOSMountainLionOrEarlier()) | 1085 if (base::mac::IsOSMountainLionOrEarlier()) |
| 1079 return NO; | 1086 return NO; |
| 1080 | 1087 |
| 1081 NSView* root = [[self.window contentView] superview]; | 1088 NSView* root = [[self.window contentView] superview]; |
| 1082 if (!root.layer) | 1089 if (!root.layer) |
| 1083 return NO; | 1090 return NO; |
| 1084 | 1091 |
| 1085 // AppKit on OSX 10.9 has a bug for applications linked against OSX 10.8 SDK | 1092 // 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 | 1093 // and earlier. Under specific circumstances, it prevents the custom AppKit |
| 1087 // transition from working well. See http://crbug.com/396980 for more | 1094 // transition from working well. See http://crbug.com/396980 for more |
| 1088 // details. | 1095 // details. |
| 1089 if ([[self class] systemSettingsRequireMavericksAppKitFullscreenHack] && | 1096 if ([[self class] systemSettingsRequireMavericksAppKitFullscreenHack] && |
| 1090 ![[[self window] screen] isEqual:[[NSScreen screens] objectAtIndex:0]]) { | 1097 ![[[self window] screen] isEqual:[[NSScreen screens] objectAtIndex:0]]) { |
| 1091 return NO; | 1098 return NO; |
| 1092 } | 1099 } |
| 1093 | 1100 |
| 1094 return YES; | 1101 return YES; |
| 1095 } | 1102 } |
| 1096 | 1103 |
| 1097 - (NSArray*)customWindowsToEnterFullScreenForWindow:(NSWindow*)window { | 1104 - (NSArray*)customWindowsToEnterFullScreenForWindow:(NSWindow*)window { |
| 1098 DCHECK([window isEqual:self.window]); | 1105 DCHECK([window isEqual:self.window]); |
| 1099 | 1106 |
| 1100 if (![self shouldUseCustomAppKitFullscreenTransition]) | 1107 if (![self shouldUseCustomAppKitFullscreenTransition:YES]) |
| 1101 return nil; | 1108 return nil; |
| 1102 | 1109 |
| 1103 FramedBrowserWindow* framedBrowserWindow = | 1110 FramedBrowserWindow* framedBrowserWindow = |
| 1104 base::mac::ObjCCast<FramedBrowserWindow>([self window]); | 1111 base::mac::ObjCCast<FramedBrowserWindow>([self window]); |
| 1105 fullscreenTransition_.reset([[BrowserWindowFullscreenTransition alloc] | 1112 fullscreenTransition_.reset([[BrowserWindowFullscreenTransition alloc] |
| 1106 initEnterWithWindow:framedBrowserWindow]); | 1113 initEnterWithWindow:framedBrowserWindow]); |
| 1107 return [fullscreenTransition_ customWindowsForFullScreenTransition]; | 1114 return [fullscreenTransition_ customWindowsForFullScreenTransition]; |
| 1108 } | 1115 } |
| 1109 | 1116 |
| 1110 - (NSArray*)customWindowsToExitFullScreenForWindow:(NSWindow*)window { | 1117 - (NSArray*)customWindowsToExitFullScreenForWindow:(NSWindow*)window { |
| 1111 DCHECK([window isEqual:self.window]); | 1118 DCHECK([window isEqual:self.window]); |
| 1112 | 1119 |
| 1113 if (![self shouldUseCustomAppKitFullscreenTransition]) | 1120 if (![self shouldUseCustomAppKitFullscreenTransition:NO]) |
| 1114 return nil; | 1121 return nil; |
| 1115 | 1122 |
| 1116 FramedBrowserWindow* framedBrowserWindow = | 1123 FramedBrowserWindow* framedBrowserWindow = |
| 1117 base::mac::ObjCCast<FramedBrowserWindow>([self window]); | 1124 base::mac::ObjCCast<FramedBrowserWindow>([self window]); |
| 1118 fullscreenTransition_.reset([[BrowserWindowFullscreenTransition alloc] | 1125 fullscreenTransition_.reset([[BrowserWindowFullscreenTransition alloc] |
| 1119 initExitWithWindow:framedBrowserWindow | 1126 initExitWithWindow:framedBrowserWindow |
| 1120 frame:savedRegularWindowFrame_]); | 1127 frame:savedRegularWindowFrame_]); |
| 1121 | 1128 |
| 1122 return [fullscreenTransition_ customWindowsForFullScreenTransition]; | 1129 return [fullscreenTransition_ customWindowsForFullScreenTransition]; |
| 1123 } | 1130 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1146 return browser_->tab_strip_model()->GetActiveWebContents(); | 1153 return browser_->tab_strip_model()->GetActiveWebContents(); |
| 1147 } | 1154 } |
| 1148 | 1155 |
| 1149 - (PermissionBubbleManager*)permissionBubbleManager { | 1156 - (PermissionBubbleManager*)permissionBubbleManager { |
| 1150 if (WebContents* contents = [self webContents]) | 1157 if (WebContents* contents = [self webContents]) |
| 1151 return PermissionBubbleManager::FromWebContents(contents); | 1158 return PermissionBubbleManager::FromWebContents(contents); |
| 1152 return nil; | 1159 return nil; |
| 1153 } | 1160 } |
| 1154 | 1161 |
| 1155 @end // @implementation BrowserWindowController(Private) | 1162 @end // @implementation BrowserWindowController(Private) |
| OLD | NEW |