| 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 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 [self.chromeContentView setAutoresizesSubviews:NO]; | 771 [self.chromeContentView setAutoresizesSubviews:NO]; |
| 772 [self setSheetHiddenForFullscreenTransition:YES]; | 772 [self setSheetHiddenForFullscreenTransition:YES]; |
| 773 } else { | 773 } else { |
| 774 [self adjustUIForExitingFullscreen]; | 774 [self adjustUIForExitingFullscreen]; |
| 775 } | 775 } |
| 776 } | 776 } |
| 777 | 777 |
| 778 - (void)windowDidExitFullScreen:(NSNotification*)notification { | 778 - (void)windowDidExitFullScreen:(NSNotification*)notification { |
| 779 DCHECK(exitingAppKitFullscreen_); | 779 DCHECK(exitingAppKitFullscreen_); |
| 780 | 780 |
| 781 // If the custom transition isn't complete, then just set the flag and |
| 782 // return. Once the transition is completed, windowDidExitFullscreen will |
| 783 // be called again. |
| 784 if (isUsingCustomAnimation_ && |
| 785 ![fullscreenTransition_ isTransitionCompleted]) { |
| 786 appKitDidExitFullscreen_ = YES; |
| 787 return; |
| 788 } |
| 789 |
| 781 if (notification) // For System Fullscreen when non-nil. | 790 if (notification) // For System Fullscreen when non-nil. |
| 782 [self deregisterForContentViewResizeNotifications]; | 791 [self deregisterForContentViewResizeNotifications]; |
| 783 | 792 |
| 784 browser_->WindowFullscreenStateChanged(); | 793 browser_->WindowFullscreenStateChanged(); |
| 785 [self.chromeContentView setAutoresizesSubviews:YES]; | 794 [self.chromeContentView setAutoresizesSubviews:YES]; |
| 786 | 795 |
| 787 [self resetCustomAppKitFullscreenVariables]; | 796 [self resetCustomAppKitFullscreenVariables]; |
| 788 | 797 |
| 789 // Ensures that the permission bubble shows up properly at the front. | 798 // Ensures that the permission bubble shows up properly at the front. |
| 790 PermissionBubbleManager* manager = [self permissionBubbleManager]; | 799 PermissionBubbleManager* manager = [self permissionBubbleManager]; |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1168 exitingAppKitFullscreen_ = NO; | 1177 exitingAppKitFullscreen_ = NO; |
| 1169 isUsingCustomAnimation_ = NO; | 1178 isUsingCustomAnimation_ = NO; |
| 1170 } | 1179 } |
| 1171 | 1180 |
| 1172 - (NSArray*)customWindowsToEnterFullScreenForWindow:(NSWindow*)window { | 1181 - (NSArray*)customWindowsToEnterFullScreenForWindow:(NSWindow*)window { |
| 1173 DCHECK([window isEqual:self.window]); | 1182 DCHECK([window isEqual:self.window]); |
| 1174 | 1183 |
| 1175 if (![self shouldUseCustomAppKitFullscreenTransition:YES]) | 1184 if (![self shouldUseCustomAppKitFullscreenTransition:YES]) |
| 1176 return nil; | 1185 return nil; |
| 1177 | 1186 |
| 1178 FramedBrowserWindow* framedBrowserWindow = | 1187 fullscreenTransition_.reset( |
| 1179 base::mac::ObjCCast<FramedBrowserWindow>([self window]); | 1188 [[BrowserWindowFullscreenTransition alloc] initEnterWithController:self]); |
| 1180 fullscreenTransition_.reset([[BrowserWindowFullscreenTransition alloc] | |
| 1181 initEnterWithWindow:framedBrowserWindow]); | |
| 1182 | 1189 |
| 1183 NSArray* customWindows = | 1190 NSArray* customWindows = |
| 1184 [fullscreenTransition_ customWindowsForFullScreenTransition]; | 1191 [fullscreenTransition_ customWindowsForFullScreenTransition]; |
| 1185 isUsingCustomAnimation_ = customWindows != nil; | 1192 isUsingCustomAnimation_ = customWindows != nil; |
| 1186 return customWindows; | 1193 return customWindows; |
| 1187 } | 1194 } |
| 1188 | 1195 |
| 1189 - (NSArray*)customWindowsToExitFullScreenForWindow:(NSWindow*)window { | 1196 - (NSArray*)customWindowsToExitFullScreenForWindow:(NSWindow*)window { |
| 1190 DCHECK([window isEqual:self.window]); | 1197 DCHECK([window isEqual:self.window]); |
| 1191 | 1198 |
| 1192 if (![self shouldUseCustomAppKitFullscreenTransition:NO]) | 1199 if (![self shouldUseCustomAppKitFullscreenTransition:NO]) |
| 1193 return nil; | 1200 return nil; |
| 1194 | 1201 |
| 1195 FramedBrowserWindow* framedBrowserWindow = | 1202 fullscreenTransition_.reset( |
| 1196 base::mac::ObjCCast<FramedBrowserWindow>([self window]); | 1203 [[BrowserWindowFullscreenTransition alloc] initExitWithController:self]); |
| 1197 fullscreenTransition_.reset([[BrowserWindowFullscreenTransition alloc] | |
| 1198 initExitWithWindow:framedBrowserWindow | |
| 1199 frame:savedRegularWindowFrame_ | |
| 1200 tabStripBackgroundView:[self tabStripBackgroundView]]); | |
| 1201 | 1204 |
| 1202 NSArray* customWindows = | 1205 NSArray* customWindows = |
| 1203 [fullscreenTransition_ customWindowsForFullScreenTransition]; | 1206 [fullscreenTransition_ customWindowsForFullScreenTransition]; |
| 1204 isUsingCustomAnimation_ = customWindows != nil; | 1207 isUsingCustomAnimation_ = customWindows != nil; |
| 1205 return customWindows; | 1208 return customWindows; |
| 1206 } | 1209 } |
| 1207 | 1210 |
| 1208 - (void)window:(NSWindow*)window | 1211 - (void)window:(NSWindow*)window |
| 1209 startCustomAnimationToEnterFullScreenWithDuration:(NSTimeInterval)duration { | 1212 startCustomAnimationToEnterFullScreenWithDuration:(NSTimeInterval)duration { |
| 1210 DCHECK([window isEqual:self.window]); | 1213 DCHECK([window isEqual:self.window]); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1238 return nil; | 1241 return nil; |
| 1239 } | 1242 } |
| 1240 | 1243 |
| 1241 - (BOOL)isFullscreenForTabContent { | 1244 - (BOOL)isFullscreenForTabContent { |
| 1242 return browser_->exclusive_access_manager() | 1245 return browser_->exclusive_access_manager() |
| 1243 ->fullscreen_controller() | 1246 ->fullscreen_controller() |
| 1244 ->IsWindowFullscreenForTabOrPending(); | 1247 ->IsWindowFullscreenForTabOrPending(); |
| 1245 } | 1248 } |
| 1246 | 1249 |
| 1247 @end // @implementation BrowserWindowController(Private) | 1250 @end // @implementation BrowserWindowController(Private) |
| OLD | NEW |