OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/sprite_view.h" | 5 #import "chrome/browser/ui/cocoa/sprite_view.h" |
6 | 6 |
7 #import <QuartzCore/CAAnimation.h> | 7 #import <QuartzCore/CAAnimation.h> |
8 #import <QuartzCore/CATransaction.h> | 8 #import <QuartzCore/CATransaction.h> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #import "base/mac/sdk_forward_declarations.h" |
11 #include "ui/base/cocoa/animation_utils.h" | 12 #include "ui/base/cocoa/animation_utils.h" |
12 | 13 |
13 static const CGFloat kFrameDuration = 0.03; // 30ms for each animation frame. | 14 static const CGFloat kFrameDuration = 0.03; // 30ms for each animation frame. |
14 | 15 |
| 16 @interface SpriteView (Private) <CALayerDelegate> |
| 17 @end |
| 18 |
15 @implementation SpriteView | 19 @implementation SpriteView |
16 | 20 |
17 - (instancetype)initWithFrame:(NSRect)frame { | 21 - (instancetype)initWithFrame:(NSRect)frame { |
18 if (self = [super initWithFrame:frame]) { | 22 if (self = [super initWithFrame:frame]) { |
19 // A layer-hosting view. It will clip its sublayers, | 23 // A layer-hosting view. It will clip its sublayers, |
20 // if they exceed the boundary. | 24 // if they exceed the boundary. |
21 CALayer* layer = [CALayer layer]; | 25 CALayer* layer = [CALayer layer]; |
22 layer.masksToBounds = YES; | 26 layer.masksToBounds = YES; |
23 | 27 |
24 imageLayer_ = [CALayer layer]; | 28 imageLayer_ = [CALayer layer]; |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 } | 167 } |
164 } | 168 } |
165 | 169 |
166 - (BOOL)layer:(CALayer*)layer | 170 - (BOOL)layer:(CALayer*)layer |
167 shouldInheritContentsScale:(CGFloat)scale | 171 shouldInheritContentsScale:(CGFloat)scale |
168 fromWindow:(NSWindow*)window { | 172 fromWindow:(NSWindow*)window { |
169 return YES; | 173 return YES; |
170 } | 174 } |
171 | 175 |
172 @end | 176 @end |
OLD | NEW |