| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_VIEWS_CONTROLS_THROBBER_H_ | 5 #ifndef UI_VIEWS_CONTROLS_THROBBER_H_ |
| 6 #define UI_VIEWS_CONTROLS_THROBBER_H_ | 6 #define UI_VIEWS_CONTROLS_THROBBER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/time.h" | 11 #include "base/time.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 // Start and stop the throbber animation | 31 // Start and stop the throbber animation |
| 32 virtual void Start(); | 32 virtual void Start(); |
| 33 virtual void Stop(); | 33 virtual void Stop(); |
| 34 | 34 |
| 35 // Set custom throbber frames. Otherwise IDR_THROBBER is loaded. | 35 // Set custom throbber frames. Otherwise IDR_THROBBER is loaded. |
| 36 void SetFrames(SkBitmap* frames); | 36 void SetFrames(SkBitmap* frames); |
| 37 | 37 |
| 38 // overridden from View | 38 // overridden from View |
| 39 virtual gfx::Size GetPreferredSize() OVERRIDE; | 39 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 40 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 40 virtual void OnPaint(gfx::CanvasSkia* canvas) OVERRIDE; |
| 41 | 41 |
| 42 protected: | 42 protected: |
| 43 // Specifies whether the throbber is currently animating or not | 43 // Specifies whether the throbber is currently animating or not |
| 44 bool running_; | 44 bool running_; |
| 45 | 45 |
| 46 private: | 46 private: |
| 47 void Run(); | 47 void Run(); |
| 48 | 48 |
| 49 bool paint_while_stopped_; | 49 bool paint_while_stopped_; |
| 50 int frame_count_; // How many frames we have. | 50 int frame_count_; // How many frames we have. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 // | 100 // |
| 101 class VIEWS_EXPORT CheckmarkThrobber : public Throbber { | 101 class VIEWS_EXPORT CheckmarkThrobber : public Throbber { |
| 102 public: | 102 public: |
| 103 CheckmarkThrobber(); | 103 CheckmarkThrobber(); |
| 104 | 104 |
| 105 // If checked is true, the throbber stops spinning and displays a checkmark. | 105 // If checked is true, the throbber stops spinning and displays a checkmark. |
| 106 // If checked is false, the throbber stops spinning and displays nothing. | 106 // If checked is false, the throbber stops spinning and displays nothing. |
| 107 void SetChecked(bool checked); | 107 void SetChecked(bool checked); |
| 108 | 108 |
| 109 // Overridden from Throbber: | 109 // Overridden from Throbber: |
| 110 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 110 virtual void OnPaint(gfx::CanvasSkia* canvas) OVERRIDE; |
| 111 | 111 |
| 112 private: | 112 private: |
| 113 static const int kFrameTimeMs = 30; | 113 static const int kFrameTimeMs = 30; |
| 114 | 114 |
| 115 static void InitClass(); | 115 static void InitClass(); |
| 116 | 116 |
| 117 // Whether or not we should display a checkmark. | 117 // Whether or not we should display a checkmark. |
| 118 bool checked_; | 118 bool checked_; |
| 119 | 119 |
| 120 // The checkmark image. | 120 // The checkmark image. |
| 121 static SkBitmap* checkmark_; | 121 static SkBitmap* checkmark_; |
| 122 | 122 |
| 123 DISALLOW_COPY_AND_ASSIGN(CheckmarkThrobber); | 123 DISALLOW_COPY_AND_ASSIGN(CheckmarkThrobber); |
| 124 }; | 124 }; |
| 125 | 125 |
| 126 } // namespace views | 126 } // namespace views |
| 127 | 127 |
| 128 #endif // UI_VIEWS_CONTROLS_THROBBER_H_ | 128 #endif // UI_VIEWS_CONTROLS_THROBBER_H_ |
| OLD | NEW |