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

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

Issue 1813693003: Fixed a fullscreen race condition on OSX (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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"
11 #include "base/mac/bind_objc_block.h" 11 #include "base/mac/bind_objc_block.h"
12 #include "base/mac/foundation_util.h" 12 #include "base/mac/foundation_util.h"
13 #include "base/mac/mac_util.h" 13 #include "base/mac/mac_util.h"
14 #import "base/mac/scoped_nsobject.h" 14 #import "base/mac/scoped_nsobject.h"
15 #import "base/mac/sdk_forward_declarations.h" 15 #import "base/mac/sdk_forward_declarations.h"
16 #include "base/metrics/histogram.h" 16 #include "base/metrics/histogram.h"
17 #include "chrome/browser/browser_process.h" 17 #include "chrome/browser/browser_process.h"
18 #include "chrome/browser/fullscreen.h" 18 #include "chrome/browser/fullscreen.h"
19 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/browser/profiles/profile_avatar_icon_util.h" 20 #include "chrome/browser/profiles/profile_avatar_icon_util.h"
21 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" 21 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h"
22 #include "chrome/browser/ui/browser.h" 22 #include "chrome/browser/ui/browser.h"
23 #include "chrome/browser/ui/browser_window_state.h" 23 #include "chrome/browser/ui/browser_window_state.h"
24 #import "chrome/browser/ui/cocoa/browser_window_fullscreen_transition.h"
25 #import "chrome/browser/ui/cocoa/browser_window_layout.h" 24 #import "chrome/browser/ui/cocoa/browser_window_layout.h"
26 #import "chrome/browser/ui/cocoa/browser/exclusive_access_controller_views.h" 25 #import "chrome/browser/ui/cocoa/browser/exclusive_access_controller_views.h"
27 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_con troller.h" 26 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_con troller.h"
28 #import "chrome/browser/ui/cocoa/custom_frame_view.h" 27 #import "chrome/browser/ui/cocoa/custom_frame_view.h"
29 #import "chrome/browser/ui/cocoa/dev_tools_controller.h" 28 #import "chrome/browser/ui/cocoa/dev_tools_controller.h"
30 #import "chrome/browser/ui/cocoa/fast_resize_view.h" 29 #import "chrome/browser/ui/cocoa/fast_resize_view.h"
31 #import "chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.h" 30 #import "chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.h"
32 #import "chrome/browser/ui/cocoa/floating_bar_backing_view.h" 31 #import "chrome/browser/ui/cocoa/floating_bar_backing_view.h"
33 #import "chrome/browser/ui/cocoa/framed_browser_window.h" 32 #import "chrome/browser/ui/cocoa/framed_browser_window.h"
34 #import "chrome/browser/ui/cocoa/fullscreen_window.h" 33 #import "chrome/browser/ui/cocoa/fullscreen_window.h"
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 [self.chromeContentView setAutoresizesSubviews:NO]; 770 [self.chromeContentView setAutoresizesSubviews:NO];
772 [self setSheetHiddenForFullscreenTransition:YES]; 771 [self setSheetHiddenForFullscreenTransition:YES];
773 } else { 772 } else {
774 [self adjustUIForExitingFullscreen]; 773 [self adjustUIForExitingFullscreen];
775 } 774 }
776 } 775 }
777 776
778 - (void)windowDidExitFullScreen:(NSNotification*)notification { 777 - (void)windowDidExitFullScreen:(NSNotification*)notification {
779 DCHECK(exitingAppKitFullscreen_); 778 DCHECK(exitingAppKitFullscreen_);
780 779
780 // If the custom transition isn't complete, then just set the flag and
781 // return. Once the transition is completed, windowDidExitFullscreen will
782 // be called again.
783 if (isUsingCustomAnimation_ &&
784 ![fullscreenTransition_ isTransitionCompleted]) {
785 appKitDidExitFullscreen_ = YES;
786 return;
787 }
788
781 if (notification) // For System Fullscreen when non-nil. 789 if (notification) // For System Fullscreen when non-nil.
782 [self deregisterForContentViewResizeNotifications]; 790 [self deregisterForContentViewResizeNotifications];
783 791
784 browser_->WindowFullscreenStateChanged(); 792 browser_->WindowFullscreenStateChanged();
785 [self.chromeContentView setAutoresizesSubviews:YES]; 793 [self.chromeContentView setAutoresizesSubviews:YES];
786 794
787 [self resetCustomAppKitFullscreenVariables]; 795 [self resetCustomAppKitFullscreenVariables];
788 796
789 // Ensures that the permission bubble shows up properly at the front. 797 // Ensures that the permission bubble shows up properly at the front.
790 PermissionBubbleManager* manager = [self permissionBubbleManager]; 798 PermissionBubbleManager* manager = [self permissionBubbleManager];
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 - (NSArray*)customWindowsToExitFullScreenForWindow:(NSWindow*)window { 1197 - (NSArray*)customWindowsToExitFullScreenForWindow:(NSWindow*)window {
1190 DCHECK([window isEqual:self.window]); 1198 DCHECK([window isEqual:self.window]);
1191 1199
1192 if (![self shouldUseCustomAppKitFullscreenTransition:NO]) 1200 if (![self shouldUseCustomAppKitFullscreenTransition:NO])
1193 return nil; 1201 return nil;
1194 1202
1195 FramedBrowserWindow* framedBrowserWindow = 1203 FramedBrowserWindow* framedBrowserWindow =
1196 base::mac::ObjCCast<FramedBrowserWindow>([self window]); 1204 base::mac::ObjCCast<FramedBrowserWindow>([self window]);
1197 fullscreenTransition_.reset([[BrowserWindowFullscreenTransition alloc] 1205 fullscreenTransition_.reset([[BrowserWindowFullscreenTransition alloc]
1198 initExitWithWindow:framedBrowserWindow 1206 initExitWithWindow:framedBrowserWindow
1207 delegate:self
1199 frame:savedRegularWindowFrame_ 1208 frame:savedRegularWindowFrame_
1200 tabStripBackgroundView:[self tabStripBackgroundView]]); 1209 tabStripBackgroundView:[self tabStripBackgroundView]]);
1201 1210
1202 NSArray* customWindows = 1211 NSArray* customWindows =
1203 [fullscreenTransition_ customWindowsForFullScreenTransition]; 1212 [fullscreenTransition_ customWindowsForFullScreenTransition];
1204 isUsingCustomAnimation_ = customWindows != nil; 1213 isUsingCustomAnimation_ = customWindows != nil;
1205 return customWindows; 1214 return customWindows;
1206 } 1215 }
1207 1216
1208 - (void)window:(NSWindow*)window 1217 - (void)window:(NSWindow*)window
(...skipping 29 matching lines...) Expand all
1238 return nil; 1247 return nil;
1239 } 1248 }
1240 1249
1241 - (BOOL)isFullscreenForTabContent { 1250 - (BOOL)isFullscreenForTabContent {
1242 return browser_->exclusive_access_manager() 1251 return browser_->exclusive_access_manager()
1243 ->fullscreen_controller() 1252 ->fullscreen_controller()
1244 ->IsWindowFullscreenForTabOrPending(); 1253 ->IsWindowFullscreenForTabOrPending();
1245 } 1254 }
1246 1255
1247 @end // @implementation BrowserWindowController(Private) 1256 @end // @implementation BrowserWindowController(Private)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698