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

Unified Diff: ui/base/cocoa/window_animator.h

Issue 952793002: Mac: Make ui/base/cocoa WindowAnimator Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git add Created 5 years, 10 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
« no previous file with comments | « chrome/browser/ui/cocoa/info_bubble_window.mm ('k') | ui/base/cocoa/window_animator.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « chrome/browser/ui/cocoa/info_bubble_window.mm ('k') | ui/base/cocoa/window_animator.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698