| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "chrome/browser/ui/cocoa/animatable_image.h" | 5 #import "chrome/browser/ui/cocoa/animatable_image.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #import "base/mac/sdk_forward_declarations.h" |
| 8 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMNSAnimation+Duration.h
" | 9 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMNSAnimation+Duration.h
" |
| 9 | 10 |
| 11 @interface AnimatableImage (Private) <CAAnimationDelegate> |
| 12 @end |
| 13 |
| 10 @implementation AnimatableImage | 14 @implementation AnimatableImage |
| 11 | 15 |
| 12 @synthesize startFrame = startFrame_; | 16 @synthesize startFrame = startFrame_; |
| 13 @synthesize endFrame = endFrame_; | 17 @synthesize endFrame = endFrame_; |
| 14 @synthesize startOpacity = startOpacity_; | 18 @synthesize startOpacity = startOpacity_; |
| 15 @synthesize endOpacity = endOpacity_; | 19 @synthesize endOpacity = endOpacity_; |
| 16 @synthesize duration = duration_; | 20 @synthesize duration = duration_; |
| 17 | 21 |
| 18 - (id)initWithImage:(NSImage*)image | 22 - (id)initWithImage:(NSImage*)image |
| 19 animationFrame:(NSRect)animationFrame { | 23 animationFrame:(NSRect)animationFrame { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 [CATransaction setValue:[NSNumber numberWithFloat:[self duration]] | 118 [CATransaction setValue:[NSNumber numberWithFloat:[self duration]] |
| 115 forKey:kCATransactionAnimationDuration]; | 119 forKey:kCATransactionAnimationDuration]; |
| 116 if (boundsAnimation) { | 120 if (boundsAnimation) { |
| 117 [layer addAnimation:boundsAnimation forKey:@"bounds"]; | 121 [layer addAnimation:boundsAnimation forKey:@"bounds"]; |
| 118 } | 122 } |
| 119 [layer addAnimation:positionAnimation forKey:@"position"]; | 123 [layer addAnimation:positionAnimation forKey:@"position"]; |
| 120 [layer addAnimation:opacityAnimation forKey:@"opacity"]; | 124 [layer addAnimation:opacityAnimation forKey:@"opacity"]; |
| 121 [CATransaction commit]; | 125 [CATransaction commit]; |
| 122 } | 126 } |
| 123 | 127 |
| 128 - (void)animationDidStart:(CAAnimation*)animation { |
| 129 } |
| 130 |
| 124 // CAAnimation delegate method called when the animation is complete. | 131 // CAAnimation delegate method called when the animation is complete. |
| 125 - (void)animationDidStop:(CAAnimation*)animation finished:(BOOL)flag { | 132 - (void)animationDidStop:(CAAnimation*)animation finished:(BOOL)flag { |
| 126 // Close the window, releasing self. | 133 // Close the window, releasing self. |
| 127 [self close]; | 134 [self close]; |
| 128 } | 135 } |
| 129 | 136 |
| 130 @end | 137 @end |
| OLD | NEW |