Chromium Code Reviews| 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" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 | 66 |
| 67 - (void)viewDidMoveToWindow { | 67 - (void)viewDidMoveToWindow { |
| 68 [self updateAnimation:nil]; | 68 [self updateAnimation:nil]; |
| 69 } | 69 } |
| 70 | 70 |
| 71 - (void)updateAnimation:(NSNotification*)notification { | 71 - (void)updateAnimation:(NSNotification*)notification { |
| 72 if (spriteAnimation_.get()) { | 72 if (spriteAnimation_.get()) { |
| 73 // Only animate the sprites if we are attached to a window, and that window | 73 // Only animate the sprites if we are attached to a window, and that window |
| 74 // is not currently minimized or in the middle of a minimize animation. | 74 // is not currently minimized or in the middle of a minimize animation. |
| 75 // http://crbug.com/350329 | 75 // http://crbug.com/350329 |
| 76 if ([self window] && ![[self window] isMiniaturized]) { | 76 if ([self window] && ![[self window] isMiniaturized] && |
|
Andre
2015/04/02 21:25:52
This checks if the window is miniaturized. I think
| |
| 77 if ([imageLayer_ animationForKey:[spriteAnimation_ keyPath]] == nil) | 77 ![[notification name] isEqualToString: |
| 78 NSWindowWillMiniaturizeNotification]) { | |
| 79 if ([imageLayer_ animationForKey:[spriteAnimation_ keyPath]] == nil) { | |
| 78 [imageLayer_ addAnimation:spriteAnimation_.get() | 80 [imageLayer_ addAnimation:spriteAnimation_.get() |
| 79 forKey:[spriteAnimation_ keyPath]]; | 81 forKey:[spriteAnimation_ keyPath]]; |
| 82 } | |
| 80 } else { | 83 } else { |
| 81 [imageLayer_ removeAnimationForKey:[spriteAnimation_ keyPath]]; | 84 [imageLayer_ removeAnimationForKey:[spriteAnimation_ keyPath]]; |
| 82 } | 85 } |
| 83 } | 86 } |
| 84 } | 87 } |
| 85 | 88 |
| 86 - (void)setImage:(NSImage*)image { | 89 - (void)setImage:(NSImage*)image { |
| 87 ScopedCAActionDisabler disabler; | 90 ScopedCAActionDisabler disabler; |
| 88 | 91 |
| 89 if (spriteAnimation_.get()) { | 92 if (spriteAnimation_.get()) { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 160 } | 163 } |
| 161 } | 164 } |
| 162 | 165 |
| 163 - (BOOL)layer:(CALayer*)layer | 166 - (BOOL)layer:(CALayer*)layer |
| 164 shouldInheritContentsScale:(CGFloat)scale | 167 shouldInheritContentsScale:(CGFloat)scale |
| 165 fromWindow:(NSWindow*)window { | 168 fromWindow:(NSWindow*)window { |
| 166 return YES; | 169 return YES; |
| 167 } | 170 } |
| 168 | 171 |
| 169 @end | 172 @end |
| OLD | NEW |