Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_controller_private.mm

Issue 1876313002: Fixed a fullscreen race condition on OSX (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 exitingAppKitFullscreen_ = NO; 1178 exitingAppKitFullscreen_ = NO;
1170 isUsingCustomAnimation_ = NO; 1179 isUsingCustomAnimation_ = NO;
1171 } 1180 }
1172 1181
1173 - (NSArray*)customWindowsToEnterFullScreenForWindow:(NSWindow*)window { 1182 - (NSArray*)customWindowsToEnterFullScreenForWindow:(NSWindow*)window {
1174 DCHECK([window isEqual:self.window]); 1183 DCHECK([window isEqual:self.window]);
1175 1184
1176 if (![self shouldUseCustomAppKitFullscreenTransition:YES]) 1185 if (![self shouldUseCustomAppKitFullscreenTransition:YES])
1177 return nil; 1186 return nil;
1178 1187
1179 FramedBrowserWindow* framedBrowserWindow = 1188 fullscreenTransition_.reset(
1180 base::mac::ObjCCast<FramedBrowserWindow>([self window]); 1189 [[BrowserWindowFullscreenTransition alloc] initEnterWithController:self]);
1181 fullscreenTransition_.reset([[BrowserWindowFullscreenTransition alloc]
1182 initEnterWithWindow:framedBrowserWindow]);
1183 1190
1184 NSArray* customWindows = 1191 NSArray* customWindows =
1185 [fullscreenTransition_ customWindowsForFullScreenTransition]; 1192 [fullscreenTransition_ customWindowsForFullScreenTransition];
1186 isUsingCustomAnimation_ = customWindows != nil; 1193 isUsingCustomAnimation_ = customWindows != nil;
1187 return customWindows; 1194 return customWindows;
1188 } 1195 }
1189 1196
1190 - (NSArray*)customWindowsToExitFullScreenForWindow:(NSWindow*)window { 1197 - (NSArray*)customWindowsToExitFullScreenForWindow:(NSWindow*)window {
1191 DCHECK([window isEqual:self.window]); 1198 DCHECK([window isEqual:self.window]);
1192 1199
1193 if (![self shouldUseCustomAppKitFullscreenTransition:NO]) 1200 if (![self shouldUseCustomAppKitFullscreenTransition:NO])
1194 return nil; 1201 return nil;
1195 1202
1196 FramedBrowserWindow* framedBrowserWindow = 1203 fullscreenTransition_.reset(
1197 base::mac::ObjCCast<FramedBrowserWindow>([self window]); 1204 [[BrowserWindowFullscreenTransition alloc] initExitWithController:self]);
1198 fullscreenTransition_.reset([[BrowserWindowFullscreenTransition alloc]
1199 initExitWithWindow:framedBrowserWindow
1200 frame:savedRegularWindowFrame_
1201 tabStripBackgroundView:[self tabStripBackgroundView]]);
1202 1205
1203 NSArray* customWindows = 1206 NSArray* customWindows =
1204 [fullscreenTransition_ customWindowsForFullScreenTransition]; 1207 [fullscreenTransition_ customWindowsForFullScreenTransition];
1205 isUsingCustomAnimation_ = customWindows != nil; 1208 isUsingCustomAnimation_ = customWindows != nil;
1206 return customWindows; 1209 return customWindows;
1207 } 1210 }
1208 1211
1209 - (void)window:(NSWindow*)window 1212 - (void)window:(NSWindow*)window
1210 startCustomAnimationToEnterFullScreenWithDuration:(NSTimeInterval)duration { 1213 startCustomAnimationToEnterFullScreenWithDuration:(NSTimeInterval)duration {
1211 DCHECK([window isEqual:self.window]); 1214 DCHECK([window isEqual:self.window]);
(...skipping 27 matching lines...) Expand all
1239 return nil; 1242 return nil;
1240 } 1243 }
1241 1244
1242 - (BOOL)isFullscreenForTabContent { 1245 - (BOOL)isFullscreenForTabContent {
1243 return browser_->exclusive_access_manager() 1246 return browser_->exclusive_access_manager()
1244 ->fullscreen_controller() 1247 ->fullscreen_controller()
1245 ->IsWindowFullscreenForTabOrPending(); 1248 ->IsWindowFullscreenForTabOrPending();
1246 } 1249 }
1247 1250
1248 @end // @implementation BrowserWindowController(Private) 1251 @end // @implementation BrowserWindowController(Private)
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller.mm ('k') | chrome/browser/ui/cocoa/browser_window_fullscreen_transition.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698