| Index: chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sheet.mm
|
| diff --git a/chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sheet.mm b/chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sheet.mm
|
| index ab67fc6804b9dea5550e579b8a0dac4039b480d0..a5128cacf57a6924afd64b7ccd7fcb845105a07b 100644
|
| --- a/chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sheet.mm
|
| +++ b/chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sheet.mm
|
| @@ -7,6 +7,9 @@
|
| #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.h"
|
| #import "ui/base/cocoa/constrained_window/constrained_window_animation.h"
|
|
|
| +// Length of the animation in seconds.
|
| +const NSTimeInterval kAnimationDuration = 0.18;
|
| +
|
| @implementation CustomConstrainedWindowSheet
|
|
|
| - (id)initWithCustomWindow:(NSWindow*)customWindow {
|
| @@ -17,20 +20,29 @@
|
| }
|
|
|
| - (void)showSheetForWindow:(NSWindow*)window {
|
| - base::scoped_nsobject<NSAnimation> animation(
|
| - [[ConstrainedWindowAnimationShow alloc] initWithWindow:customWindow_]);
|
| [window addChildWindow:customWindow_
|
| ordered:NSWindowAbove];
|
| [self unhideSheet];
|
| [self updateSheetPosition];
|
| [customWindow_ makeKeyAndOrderFront:nil];
|
| - [animation startAnimation];
|
| + [customWindow_ setAlphaValue:0.0];
|
| + [[NSAnimationContext currentContext] setDuration:kAnimationDuration];
|
| + [[customWindow_ animator] setAlphaValue:1.0];
|
| }
|
|
|
| - (void)closeSheetWithAnimation:(BOOL)withAnimation {
|
| if (withAnimation) {
|
| + // Use a blocking animation, rather than -[NSWindow animator].
|
| + NSArray* animationArray = @[
|
| + @{
|
| + NSViewAnimationTargetKey : customWindow_,
|
| + NSViewAnimationEffectKey : NSViewAnimationFadeOutEffect,
|
| + }
|
| + ];
|
| base::scoped_nsobject<NSAnimation> animation(
|
| - [[ConstrainedWindowAnimationHide alloc] initWithWindow:customWindow_]);
|
| + [[NSViewAnimation alloc] initWithViewAnimations:animationArray]);
|
| + [animation setDuration:kAnimationDuration];
|
| + [animation setAnimationBlockingMode:NSAnimationBlocking];
|
| [animation startAnimation];
|
| }
|
|
|
|
|