| Index: chrome/browser/ui/cocoa/browser_window_fullscreen_transition.mm
|
| diff --git a/chrome/browser/ui/cocoa/browser_window_fullscreen_transition.mm b/chrome/browser/ui/cocoa/browser_window_fullscreen_transition.mm
|
| index 409c4222dacb9594279d7079241c83589e82102b..f83f139c35564fb54870398f4be9f4fb34c5cba4 100644
|
| --- a/chrome/browser/ui/cocoa/browser_window_fullscreen_transition.mm
|
| +++ b/chrome/browser/ui/cocoa/browser_window_fullscreen_transition.mm
|
| @@ -22,8 +22,10 @@ NSString* const kSnapshotWindowAnimationID = @"SnapshotWindowAnimationID";
|
| NSString* const kAnimationIDKey = @"AnimationIDKey";
|
|
|
| // The fraction of the duration from AppKit's startCustomAnimation methods
|
| -// that we want our animation to run in.
|
| +// that we want our animation to run in. Yosemite's fraction is smaller
|
| +// since its fullscreen transition is significantly slower.
|
| CGFloat const kAnimationDurationFraction = 0.5;
|
| +CGFloat const kAnimationDurationFractionYosemite = 0.3;
|
|
|
| // This class has two simultaneous animations to resize and reposition layers.
|
| // These animations must use the same timing function, otherwise there will be
|
| @@ -131,6 +133,13 @@ class FrameAndStyleLock {
|
|
|
| // Locks and unlocks the FullSizeContentWindow.
|
| scoped_ptr<FrameAndStyleLock> lock_;
|
| +
|
| + // Flag that indicates if the animation was completed. Sets to true at the
|
| + // end of the animation.
|
| + BOOL completedTransition_;
|
| +
|
| + // Delegate that informs the state of the transition.
|
| + id<BrowserWindowFullscreenTransitionDelegate> delegate_; // weak
|
| }
|
|
|
| // Takes a snapshot of |primaryWindow_| and puts it in |snapshotLayer_|.
|
| @@ -193,9 +202,11 @@ class FrameAndStyleLock {
|
| return self;
|
| }
|
|
|
| -- (instancetype)initExitWithWindow:(FramedBrowserWindow*)window
|
| - frame:(NSRect)frame
|
| - tabStripBackgroundView:(NSView*)view {
|
| +- (instancetype)
|
| + initExitWithWindow:(FramedBrowserWindow*)window
|
| + delegate:(id<BrowserWindowFullscreenTransitionDelegate>)delegate
|
| + frame:(NSRect)frame
|
| +tabStripBackgroundView:(NSView*)view {
|
| DCHECK(window);
|
| DCHECK([self rootLayerOfWindow:window]);
|
| if ((self = [super init])) {
|
| @@ -204,6 +215,7 @@ class FrameAndStyleLock {
|
| isEnteringFullscreen_ = NO;
|
| finalFrame_ = frame;
|
| initialFrame_ = [[primaryWindow_ screen] frame];
|
| + delegate_ = delegate;
|
|
|
| lock_.reset(new FrameAndStyleLock(window));
|
| }
|
| @@ -216,8 +228,15 @@ class FrameAndStyleLock {
|
| return @[ primaryWindow_.get(), snapshotWindow_.get() ];
|
| }
|
|
|
| +- (BOOL)isTransitionCompleted {
|
| + return completedTransition_;
|
| +}
|
| +
|
| - (void)startCustomFullScreenAnimationWithDuration:(NSTimeInterval)duration {
|
| - CGFloat animationDuration = duration * kAnimationDurationFraction;
|
| + CGFloat durationFraction = base::mac::IsOSYosemite()
|
| + ? kAnimationDurationFractionYosemite
|
| + : kAnimationDurationFraction;
|
| + CGFloat animationDuration = duration * durationFraction;
|
| [self preparePrimaryWindowForAnimation];
|
| [self animatePrimaryWindowWithDuration:animationDuration];
|
| [self animateSnapshotWindowWithDuration:animationDuration];
|
| @@ -502,6 +521,11 @@ class FrameAndStyleLock {
|
| [root removeAnimationForKey:kPrimaryWindowAnimationID];
|
| root.opacity = 1;
|
| }
|
| +
|
| + completedTransition_ = YES;
|
| +
|
| + if (!isEnteringFullscreen_)
|
| + [delegate_ finishedExitingFullscreen];
|
| }
|
|
|
| - (CALayer*)rootLayerOfWindow:(NSWindow*)window {
|
|
|