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

Unified Diff: chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sheet.mm

Issue 1794023004: More boring fade in/out animations for constrained windows Base URL: https://chromium.googlesource.com/chromium/src.git@20160314-Cocoa-SetWindowWarp-erikcl
Patch Set: Created 4 years, 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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];
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698