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

Side by Side Diff: chrome/browser/ui/cocoa/spinner_view.mm

Issue 1917973002: mac: Remove IsOSLion(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 7 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 unified diff | Download patch
OLDNEW
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"
tapted 2016/04/25 21:25:46 probably unneeded
10 #include "base/mac/sdk_forward_declarations.h" 10 #include "base/mac/sdk_forward_declarations.h"
11 #include "base/mac/scoped_cftyperef.h" 11 #include "base/mac/scoped_cftyperef.h"
12 #include "skia/ext/skia_utils_mac.h" 12 #include "skia/ext/skia_utils_mac.h"
13 #include "ui/base/theme_provider.h" 13 #include "ui/base/theme_provider.h"
14 #include "ui/native_theme/native_theme.h" 14 #include "ui/native_theme/native_theme.h"
15 #include "ui/native_theme/native_theme_mac.h" 15 #include "ui/native_theme/native_theme_mac.h"
16 16
17 namespace { 17 namespace {
18 const CGFloat kDegrees90 = (M_PI / 2); 18 const CGFloat kDegrees90 = (M_PI / 2);
19 const CGFloat kDegrees180 = (M_PI); 19 const CGFloat kDegrees180 = (M_PI);
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 // shrinks over the course of each cycle, which the spinner achieves by drawing 171 // shrinks over the course of each cycle, which the spinner achieves by drawing
172 // the arc using a (solid) dashed line pattern and animating the "lineDashPhase" 172 // the arc using a (solid) dashed line pattern and animating the "lineDashPhase"
173 // property. 173 // property.
174 - (void)initializeAnimation { 174 - (void)initializeAnimation {
175 CGRect bounds = [self bounds]; 175 CGRect bounds = [self bounds];
176 CGFloat scaleFactor = bounds.size.width / kDesignWidth; 176 CGFloat scaleFactor = bounds.size.width / kDesignWidth;
177 177
178 // Make sure |shapeLayer_|'s content scale factor matches the window's 178 // Make sure |shapeLayer_|'s content scale factor matches the window's
179 // backing depth (e.g. it's 2.0 on Retina Macs). Don't worry about adjusting 179 // backing depth (e.g. it's 2.0 on Retina Macs). Don't worry about adjusting
180 // any other layers because |shapeLayer_| is the only one displaying content. 180 // any other layers because |shapeLayer_| is the only one displaying content.
181 if (base::mac::IsOSLionOrLater()) { 181 CGFloat backingScaleFactor = [[self window] backingScaleFactor];
182 CGFloat backingScaleFactor = [[self window] backingScaleFactor]; 182 [shapeLayer_ setContentsScale:backingScaleFactor];
183 [shapeLayer_ setContentsScale:backingScaleFactor];
184 }
185 183
186 // Create the first half of the arc animation, where it grows from a short 184 // Create the first half of the arc animation, where it grows from a short
187 // block to its full length. 185 // block to its full length.
188 base::scoped_nsobject<CAMediaTimingFunction> timingFunction( 186 base::scoped_nsobject<CAMediaTimingFunction> timingFunction(
189 [[CAMediaTimingFunction alloc] initWithControlPoints:0.4 :0.0 :0.2 :1]); 187 [[CAMediaTimingFunction alloc] initWithControlPoints:0.4 :0.0 :0.2 :1]);
190 base::scoped_nsobject<CAKeyframeAnimation> firstHalfAnimation( 188 base::scoped_nsobject<CAKeyframeAnimation> firstHalfAnimation(
191 [[CAKeyframeAnimation alloc] init]); 189 [[CAKeyframeAnimation alloc] init]);
192 [firstHalfAnimation setTimingFunction:timingFunction]; 190 [firstHalfAnimation setTimingFunction:timingFunction];
193 [firstHalfAnimation setKeyPath:@"lineDashPhase"]; 191 [firstHalfAnimation setKeyPath:@"lineDashPhase"];
194 // Begin the lineDashPhase animation just short of the full arc length, 192 // Begin the lineDashPhase animation just short of the full arc length,
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 [rotationLayer_ addAnimation:rotationAnimation_.get() 294 [rotationLayer_ addAnimation:rotationAnimation_.get()
297 forKey:kRotationAnimationName]; 295 forKey:kRotationAnimationName];
298 } 296 }
299 } else { 297 } else {
300 [shapeLayer_ removeAllAnimations]; 298 [shapeLayer_ removeAllAnimations];
301 [rotationLayer_ removeAllAnimations]; 299 [rotationLayer_ removeAllAnimations];
302 } 300 }
303 } 301 }
304 302
305 @end 303 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698