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 3// found in the LICENSE file. 4 5#ifndef CHROME_BROWSER_UI_COCOA_SPRITE_VIEW_H_ 6#define CHROME_BROWSER_UI_COCOA_SPRITE_VIEW_H_ 7 8#import <Cocoa/Cocoa.h> 9 10#include "base/mac/scoped_nsobject.h" 11 12@class CAKeyframeAnimation; 13 14// A class that knows how to repeatedly animate sprites from an image containing 15// the sprites in the form of a horizontal strip. 16@interface SpriteView : NSView { 17 @private 18 base::scoped_nsobject<CAKeyframeAnimation> spriteAnimation_; 19 CALayer* imageLayer_; 20} 21 22// |image| contains square sprites in a horizontal strip. 23// The sprites will be animated, with each sprite shown for 30ms. 24// It is OK to pass in a single sprite (a square image), in which case there 25// will be no animation. 26- (void)setImage:(NSImage*)image; 27 28// Same as above, with a toast animation to transition to the new image. 29// The old image will animate to the bottom, and then the new image will 30// animate back up to position. 31- (void)setImage:(NSImage*)image withToastAnimation:(BOOL)animate; 32 33@end 34 35#endif // CHROME_BROWSER_UI_COCOA_TABS_THROBBER_VIEW_H_ 36