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

Unified Diff: chrome/browser/ui/cocoa/browser_window_controller_private.mm

Issue 1276383004: Implemented fullscreen exit animation with AppKit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed extra include Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/browser_window_controller_private.mm
diff --git a/chrome/browser/ui/cocoa/browser_window_controller_private.mm b/chrome/browser/ui/cocoa/browser_window_controller_private.mm
index 4d02ca5a9d775444404b2ad90fb15fccdfb5749f..4d97af49fa0a82b810515aae8efafdf04b0c7937 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller_private.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller_private.mm
@@ -22,7 +22,7 @@
#include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window_state.h"
-#import "chrome/browser/ui/cocoa/browser_window_enter_fullscreen_transition.h"
+#import "chrome/browser/ui/cocoa/browser_window_fullscreen_transition.h"
#import "chrome/browser/ui/cocoa/browser_window_layout.h"
#import "chrome/browser/ui/cocoa/custom_frame_view.h"
#import "chrome/browser/ui/cocoa/dev_tools_controller.h"
@@ -706,7 +706,7 @@ willPositionSheet:(NSWindow*)sheet
}
- (void)windowDidEnterFullScreen:(NSNotification*)notification {
- enterFullscreenTransition_.reset();
+ fullscreenTransition_.reset();
// In Yosemite, some combination of the titlebar and toolbar always show in
// full-screen mode. We do not want either to show. Search for the window that
@@ -761,25 +761,38 @@ willPositionSheet:(NSWindow*)sheet
- (void)windowWillExitFullScreen:(NSNotification*)notification {
if (notification) // For System Fullscreen when non-nil.
[self registerForContentViewResizeNotifications];
+ exitingAppKitFullscreen_ = YES;
+
[self destroyFullscreenExitBubbleIfNecessary];
[self adjustUIForExitingFullscreenAndStopOmniboxSliding];
}
- (void)windowDidExitFullScreen:(NSNotification*)notification {
+ DCHECK(exitingAppKitFullscreen_);
+
if (notification) // For System Fullscreen when non-nil.
[self deregisterForContentViewResizeNotifications];
+
+ // Since the content view was forcefully resized during the transition, we
+ // want to ensure that the subviews are layout correctly after it ended.
+ [self layoutSubviews];
browser_->WindowFullscreenStateChanged();
+
+ exitingAppKitFullscreen_ = NO;
+ fullscreenTransition_.reset();
}
- (void)windowDidFailToEnterFullScreen:(NSWindow*)window {
[self deregisterForContentViewResizeNotifications];
enteringAppKitFullscreen_ = NO;
+ fullscreenTransition_.reset();
[self adjustUIForExitingFullscreenAndStopOmniboxSliding];
}
- (void)windowDidFailToExitFullScreen:(NSWindow*)window {
[self deregisterForContentViewResizeNotifications];
-
+ exitingAppKitFullscreen_ = NO;
+ fullscreenTransition_.reset();
// Force a relayout to try and get the window back into a reasonable state.
[self layoutSubviews];
}
@@ -876,7 +889,12 @@ willPositionSheet:(NSWindow*)sheet
- (void)updateLayoutParameters:(BrowserWindowLayout*)layout {
[layout setContentViewSize:[[[self window] contentView] bounds].size];
- [layout setWindowSize:[[self window] frame].size];
+
+ NSSize windowSize = (fullscreenTransition_.get())
+ ? [fullscreenTransition_ desiredWindowLayoutSize]
+ : [[self window] frame].size;
+
+ [layout setWindowSize:windowSize];
[layout setInAnyFullscreen:[self isInAnyFullscreenMode]];
[layout setFullscreenSlidingStyle:
@@ -1094,21 +1112,43 @@ willPositionSheet:(NSWindow*)sheet
if (![self shouldUseCustomAppKitFullscreenTransition])
return nil;
- enterFullscreenTransition_.reset(
- [[BrowserWindowEnterFullscreenTransition alloc]
- initWithWindow:self.window]);
- return [enterFullscreenTransition_ customWindowsToEnterFullScreen];
+ FramedBrowserWindow* framedBrowserWindow =
+ base::mac::ObjCCast<FramedBrowserWindow>([self window]);
+ fullscreenTransition_.reset([[BrowserWindowFullscreenTransition alloc]
+ initEnterWithWindow:framedBrowserWindow]);
+ return [fullscreenTransition_ customWindowsForFullScreenTransition];
+}
+
+- (NSArray*)customWindowsToExitFullScreenForWindow:(NSWindow*)window {
+ DCHECK([window isEqual:self.window]);
+
+ if (![self shouldUseCustomAppKitFullscreenTransition])
+ return nil;
+
+ FramedBrowserWindow* framedBrowserWindow =
+ base::mac::ObjCCast<FramedBrowserWindow>([self window]);
+ fullscreenTransition_.reset([[BrowserWindowFullscreenTransition alloc]
+ initExitWithWindow:framedBrowserWindow
+ frame:savedRegularWindowFrame_]);
+
+ return [fullscreenTransition_ customWindowsForFullScreenTransition];
}
- (void)window:(NSWindow*)window
startCustomAnimationToEnterFullScreenWithDuration:(NSTimeInterval)duration {
DCHECK([window isEqual:self.window]);
- [enterFullscreenTransition_
- startCustomAnimationToEnterFullScreenWithDuration:duration];
+ [fullscreenTransition_ startCustomFullScreenAnimationWithDuration:duration];
+}
+
+- (void)window:(NSWindow*)window
+ startCustomAnimationToExitFullScreenWithDuration:(NSTimeInterval)duration {
+ DCHECK([window isEqual:self.window]);
+
+ [fullscreenTransition_ startCustomFullScreenAnimationWithDuration:duration];
}
- (BOOL)shouldConstrainFrameRect {
- if ([enterFullscreenTransition_ shouldWindowBeUnconstrained])
+ if ([fullscreenTransition_ shouldWindowBeUnconstrained])
return NO;
return [super shouldConstrainFrameRect];

Powered by Google App Engine
This is Rietveld 408576698