| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #ifndef CHROME_BROWSER_COCOA_THROBBER_VIEW_H_ | 5 #ifndef CHROME_BROWSER_COCOA_THROBBER_VIEW_H_ |
| 6 #define CHROME_BROWSER_COCOA_THROBBER_VIEW_H_ | 6 #define CHROME_BROWSER_COCOA_THROBBER_VIEW_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include "base/scoped_nsobject.h" | 10 #include "base/scoped_nsobject.h" |
| 11 | 11 |
| 12 @class ThrobberTimerTarget; | |
| 13 @protocol ThrobberDataDelegate; | 12 @protocol ThrobberDataDelegate; |
| 14 | 13 |
| 15 // A class that knows how to draw an animated state to indicate progress. | 14 // A class that knows how to draw an animated state to indicate progress. |
| 16 // Creating the class starts the animation, destroying it stops it. There are | 15 // Creating the class starts the animation, destroying it stops it. There are |
| 17 // two types: | 16 // two types: |
| 18 // | 17 // |
| 19 // - Filmstrip: Draws via a sequence of frames in an image. There is no state | 18 // - Filmstrip: Draws via a sequence of frames in an image. There is no state |
| 20 // where the class is frozen on an image and not animating. The image needs to | 19 // where the class is frozen on an image and not animating. The image needs to |
| 21 // be made of squares such that the height divides evenly into the width. | 20 // be made of squares such that the height divides evenly into the width. |
| 22 // | 21 // |
| 23 // - Toast: Draws an image animating down to the bottom and then another image | 22 // - Toast: Draws an image animating down to the bottom and then another image |
| 24 // animating up from the bottom. Stops once the animation is complete. | 23 // animating up from the bottom. Stops once the animation is complete. |
| 25 | 24 |
| 26 @interface ThrobberView : NSView { | 25 @interface ThrobberView : NSView { |
| 27 @private | 26 @private |
| 28 scoped_nsobject<ThrobberTimerTarget> target_; // Target of animation timer. | |
| 29 id<ThrobberDataDelegate> dataDelegate_; | 27 id<ThrobberDataDelegate> dataDelegate_; |
| 30 NSTimer* timer_; // Animation timer. Weak, owned by runloop. | 28 NSTimer* timer_; // Animation timer. Weak, owned by runloop. |
| 31 } | 29 } |
| 32 | 30 |
| 33 // Creates a filmstrip view with |frame| and image |image|. | 31 // Creates a filmstrip view with |frame| and image |image|. |
| 34 + (id)filmstripThrobberViewWithFrame:(NSRect)frame | 32 + (id)filmstripThrobberViewWithFrame:(NSRect)frame |
| 35 image:(NSImage*)image; | 33 image:(NSImage*)image; |
| 36 | 34 |
| 37 // Creates a toast view with |frame| and specified images. | 35 // Creates a toast view with |frame| and specified images. |
| 38 + (id)toastThrobberViewWithFrame:(NSRect)frame | 36 + (id)toastThrobberViewWithFrame:(NSRect)frame |
| 39 beforeImage:(NSImage*)beforeImage | 37 beforeImage:(NSImage*)beforeImage |
| 40 afterImage:(NSImage*)afterImage; | 38 afterImage:(NSImage*)afterImage; |
| 41 | 39 |
| 42 @end | 40 @end |
| 43 | 41 |
| 44 #endif // CHROME_BROWSER_COCOA_THROBBER_VIEW_H_ | 42 #endif // CHROME_BROWSER_COCOA_THROBBER_VIEW_H_ |
| OLD | NEW |