| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/spinner_view.h" | 5 #import "chrome/browser/ui/cocoa/spinner_view.h" |
| 6 | 6 |
| 7 #import <QuartzCore/QuartzCore.h> | 7 #import <QuartzCore/QuartzCore.h> |
| 8 | 8 |
| 9 #include "base/mac/sdk_forward_declarations.h" | 9 #include "base/mac/sdk_forward_declarations.h" |
| 10 #include "base/mac/scoped_cftyperef.h" | 10 #include "base/mac/scoped_cftyperef.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 const CGFloat kArcLength = 58.9; | 24 const CGFloat kArcLength = 58.9; |
| 25 const CGFloat kArcStrokeWidth = 3.0; | 25 const CGFloat kArcStrokeWidth = 3.0; |
| 26 const CGFloat kArcAnimationTime = 1.333; | 26 const CGFloat kArcAnimationTime = 1.333; |
| 27 const CGFloat kArcStartAngle = kDegrees180; | 27 const CGFloat kArcStartAngle = kDegrees180; |
| 28 const CGFloat kArcEndAngle = (kArcStartAngle + kDegrees270); | 28 const CGFloat kArcEndAngle = (kArcStartAngle + kDegrees270); |
| 29 const CGFloat kRotationTime = 1.56863; | 29 const CGFloat kRotationTime = 1.56863; |
| 30 NSString* const kSpinnerAnimationName = @"SpinnerAnimationName"; | 30 NSString* const kSpinnerAnimationName = @"SpinnerAnimationName"; |
| 31 NSString* const kRotationAnimationName = @"RotationAnimationName"; | 31 NSString* const kRotationAnimationName = @"RotationAnimationName"; |
| 32 } | 32 } |
| 33 | 33 |
| 34 @interface SpinnerView () { | 34 @interface SpinnerView () <CALayerDelegate> { |
| 35 base::scoped_nsobject<CAAnimationGroup> spinnerAnimation_; | 35 base::scoped_nsobject<CAAnimationGroup> spinnerAnimation_; |
| 36 base::scoped_nsobject<CABasicAnimation> rotationAnimation_; | 36 base::scoped_nsobject<CABasicAnimation> rotationAnimation_; |
| 37 CAShapeLayer* shapeLayer_; // Weak. | 37 CAShapeLayer* shapeLayer_; // Weak. |
| 38 CALayer* rotationLayer_; // Weak. | 38 CALayer* rotationLayer_; // Weak. |
| 39 } | 39 } |
| 40 @end | 40 @end |
| 41 | 41 |
| 42 | 42 |
| 43 @implementation SpinnerView | 43 @implementation SpinnerView |
| 44 | 44 |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 [rotationLayer_ addAnimation:rotationAnimation_.get() | 293 [rotationLayer_ addAnimation:rotationAnimation_.get() |
| 294 forKey:kRotationAnimationName]; | 294 forKey:kRotationAnimationName]; |
| 295 } | 295 } |
| 296 } else { | 296 } else { |
| 297 [shapeLayer_ removeAllAnimations]; | 297 [shapeLayer_ removeAllAnimations]; |
| 298 [rotationLayer_ removeAllAnimations]; | 298 [rotationLayer_ removeAllAnimations]; |
| 299 } | 299 } |
| 300 } | 300 } |
| 301 | 301 |
| 302 @end | 302 @end |
| OLD | NEW |