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/mac_util.h" | 9 #include "base/mac/mac_util.h" |
10 #include "base/mac/sdk_forward_declarations.h" | 10 #include "base/mac/sdk_forward_declarations.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 } else { | 114 } else { |
115 lineWidth = kArcStrokeWidth + (scaledDiameter - kArcDiameter) / 11.0; | 115 lineWidth = kArcStrokeWidth + (scaledDiameter - kArcDiameter) / 11.0; |
116 } | 116 } |
117 [shapeLayer_ setLineWidth:lineWidth]; | 117 [shapeLayer_ setLineWidth:lineWidth]; |
118 [shapeLayer_ setLineCap:kCALineCapRound]; | 118 [shapeLayer_ setLineCap:kCALineCapRound]; |
119 [shapeLayer_ setLineDashPattern:@[ @(kArcLength * scaleFactor) ]]; | 119 [shapeLayer_ setLineDashPattern:@[ @(kArcLength * scaleFactor) ]]; |
120 [shapeLayer_ setFillColor:NULL]; | 120 [shapeLayer_ setFillColor:NULL]; |
121 ui::NativeTheme* nativeTheme = ui::NativeThemeMac::instance(); | 121 ui::NativeTheme* nativeTheme = ui::NativeThemeMac::instance(); |
122 SkColor throbberBlueColor = nativeTheme->GetSystemColor( | 122 SkColor throbberBlueColor = nativeTheme->GetSystemColor( |
123 ui::NativeTheme::kColorId_ThrobberSpinningColor); | 123 ui::NativeTheme::kColorId_ThrobberSpinningColor); |
124 CGColorRef blueColor = gfx::CGColorCreateFromSkColor(throbberBlueColor); | 124 CGColorRef blueColor = skia::CGColorCreateFromSkColor(throbberBlueColor); |
125 [shapeLayer_ setStrokeColor:blueColor]; | 125 [shapeLayer_ setStrokeColor:blueColor]; |
126 CGColorRelease(blueColor); | 126 CGColorRelease(blueColor); |
127 | 127 |
128 // Create the arc that, when stroked, creates the spinner. | 128 // Create the arc that, when stroked, creates the spinner. |
129 base::ScopedCFTypeRef<CGMutablePathRef> shapePath(CGPathCreateMutable()); | 129 base::ScopedCFTypeRef<CGMutablePathRef> shapePath(CGPathCreateMutable()); |
130 CGPathAddArc(shapePath, NULL, bounds.size.width / 2.0, | 130 CGPathAddArc(shapePath, NULL, bounds.size.width / 2.0, |
131 bounds.size.height / 2.0, kArcRadius * scaleFactor, | 131 bounds.size.height / 2.0, kArcRadius * scaleFactor, |
132 kArcStartAngle, kArcEndAngle, 0); | 132 kArcStartAngle, kArcEndAngle, 0); |
133 [shapeLayer_ setPath:shapePath]; | 133 [shapeLayer_ setPath:shapePath]; |
134 | 134 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 [rotationLayer_ addAnimation:rotationAnimation_.get() | 296 [rotationLayer_ addAnimation:rotationAnimation_.get() |
297 forKey:kRotationAnimationName]; | 297 forKey:kRotationAnimationName]; |
298 } | 298 } |
299 } else { | 299 } else { |
300 [shapeLayer_ removeAllAnimations]; | 300 [shapeLayer_ removeAllAnimations]; |
301 [rotationLayer_ removeAllAnimations]; | 301 [rotationLayer_ removeAllAnimations]; |
302 } | 302 } |
303 } | 303 } |
304 | 304 |
305 @end | 305 @end |
OLD | NEW |