| Index: ui/base/cocoa/window_animator.h
|
| diff --git a/ui/base/cocoa/window_animator.h b/ui/base/cocoa/window_animator.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..edf2fb1915b6a3d4bfa5e28d6c8b8fb8c8848e5c
|
| --- /dev/null
|
| +++ b/ui/base/cocoa/window_animator.h
|
| @@ -0,0 +1,54 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#import <Cocoa/Cocoa.h>
|
| +
|
| +#import "base/mac/scoped_nsobject.h"
|
| +#include "base/callback.h"
|
| +#include "ui/base/ui_base_export.h"
|
| +
|
| +// Controller for animations that show or hide an NSWindow. Used for cases where
|
| +// -[NSWindow setAnimationBehavior:] is unable to provide the necessary
|
| +// characteristics. For example WindowAnimationController allows the animation
|
| +// to be canceled, and works for windows containing remote CALayers.
|
| +UI_BASE_EXPORT
|
| +@interface WindowAnimationController : NSObject<NSAnimationDelegate> {
|
| + @private
|
| + // When closing, the window to close. Retained until the animation ends.
|
| + base::scoped_nsobject<NSWindow> window_;
|
| +
|
| + // The animation started and owned by |self|. Reset when the animation ends.
|
| + base::scoped_nsobject<NSViewAnimation> animation_;
|
| +
|
| + // If non-null, callback triggered when the animation completes. Then reset.
|
| + base::Closure callback_;
|
| +
|
| + // Animation durations. Default is 0.2 seconds.
|
| + NSTimeInterval orderInDuration_;
|
| + NSTimeInterval orderOutDuration_;
|
| +}
|
| +
|
| +@property(assign, nonatomic) NSTimeInterval orderInDuration;
|
| +@property(assign, nonatomic) NSTimeInterval orderOutDuration;
|
| +
|
| +// Returns whether |window_| is scheduled to be closed when the animation ends.
|
| +- (BOOL)isClosing;
|
| +
|
| +// Animate |window| to show or close it, after canceling any current animation.
|
| +// Translates from the current location to |targetOrigin| and fades out (if
|
| +// closing), or fades in. Note: If a previous animation is canceled in this way
|
| +// any previous |callback_| is NOT run (and the window is not closed). That is,
|
| +// the close is effectively interrupted, allowing the window to be shown again.
|
| +// Also note that canceling an animation moves it to the end frame, which can
|
| +// cause a jump.
|
| +- (void)animateWindow:(NSWindow*)window
|
| + targetOrigin:(NSPoint)targetOrigin
|
| + closing:(BOOL)closing
|
| + callback:(const base::Closure&)callback;
|
| +
|
| +// Stops the animation (moving to the end frame), closes |window_| (if set) and
|
| +// runs |callback_|.
|
| +- (void)cancelAnimationWithCallback;
|
| +
|
| +@end
|
|
|