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

Unified Diff: ui/views/cocoa/views_nswindow_close_animator.mm

Issue 2061693003: MacViews: Suppress visibility changes during an asynchronous close. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Neater, but Linux, Windows disagree on WidgetTest.DesktopNativeWidgetVisibilityAfterCloseTest Created 4 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
« no previous file with comments | « ui/views/cocoa/views_nswindow_close_animator.h ('k') | ui/views/views.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/cocoa/views_nswindow_close_animator.mm
diff --git a/ui/views/cocoa/views_nswindow_close_animator.mm b/ui/views/cocoa/views_nswindow_close_animator.mm
new file mode 100644
index 0000000000000000000000000000000000000000..66764973251619de9ae71e6fbcfd42a976f81b23
--- /dev/null
+++ b/ui/views/cocoa/views_nswindow_close_animator.mm
@@ -0,0 +1,47 @@
+// Copyright 2016 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 "ui/views/cocoa/views_nswindow_close_animator.h"
+
+#import <AppKit/AppKit.h>
+
+#import "ui/base/cocoa/constrained_window/constrained_window_animation.h"
+
+@interface ViewsNSWindowCloseAnimator : NSObject<NSAnimationDelegate>
+- (id)initWithWindow:(NSWindow*)window;
+@end
+
+namespace views {
+
+void CloseNativeWindowWithAnimation(NSWindow* window) {
+ [[ViewsNSWindowCloseAnimator alloc] initWithWindow:window];
+}
+
+} // namespace views
+
+@implementation ViewsNSWindowCloseAnimator {
+ @private
+ base::scoped_nsobject<NSWindow> window_;
+ base::scoped_nsobject<NSAnimation> animation_;
+}
+
+- (id)initWithWindow:(NSWindow*)window {
+ if ((self = [super init])) {
+ window_.reset([window retain]);
+ animation_.reset(
+ [[ConstrainedWindowAnimationHide alloc] initWithWindow:window]);
+ [animation_ setDelegate:self];
+ [animation_ setAnimationBlockingMode:NSAnimationNonblocking];
+ [animation_ startAnimation];
+ }
+ return self;
+}
+
+- (void)animationDidEnd:(NSAnimation*)animation {
+ [window_ close];
+ [animation_ setDelegate:nil];
+ [self release];
+}
+
+@end
« no previous file with comments | « ui/views/cocoa/views_nswindow_close_animator.h ('k') | ui/views/views.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698