| OLD | NEW |
| 1 // Copyright (c) 2012 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 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 11 #include "base/timer/timer.h" | 11 #include "base/timer/timer.h" |
| 12 #include "ui/views/view.h" | 12 #include "ui/views/view.h" |
| 13 | 13 |
| 14 namespace gfx { |
| 15 class ImageSkia; |
| 16 } |
| 17 |
| 14 namespace views { | 18 namespace views { |
| 15 | 19 |
| 16 // Throbbers display an animation, usually used as a status indicator. | 20 // Throbbers display an animation, usually used as a status indicator. |
| 17 | 21 |
| 18 class VIEWS_EXPORT Throbber : public View { | 22 class VIEWS_EXPORT Throbber : public View { |
| 19 public: | 23 public: |
| 20 Throbber(); | 24 Throbber(); |
| 21 ~Throbber() override; | 25 ~Throbber() override; |
| 22 | 26 |
| 23 // Start and stop the throbber animation. | 27 // Start and stop the throbber animation. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 35 // Specifies whether the throbber is currently animating or not | 39 // Specifies whether the throbber is currently animating or not |
| 36 bool IsRunning() const; | 40 bool IsRunning() const; |
| 37 | 41 |
| 38 private: | 42 private: |
| 39 base::TimeTicks start_time_; // Time when Start was called. | 43 base::TimeTicks start_time_; // Time when Start was called. |
| 40 base::RepeatingTimer<Throbber> timer_; // Used to schedule Run calls. | 44 base::RepeatingTimer<Throbber> timer_; // Used to schedule Run calls. |
| 41 | 45 |
| 42 // Whether or not we should display a checkmark. | 46 // Whether or not we should display a checkmark. |
| 43 bool checked_; | 47 bool checked_; |
| 44 | 48 |
| 49 // The checkmark image. Will be null until it's used (if ever). |
| 50 const gfx::ImageSkia* checkmark_; |
| 51 |
| 45 DISALLOW_COPY_AND_ASSIGN(Throbber); | 52 DISALLOW_COPY_AND_ASSIGN(Throbber); |
| 46 }; | 53 }; |
| 47 | 54 |
| 48 // A SmoothedThrobber is a throbber that is representing potentially short | 55 // A SmoothedThrobber is a throbber that is representing potentially short |
| 49 // and nonoverlapping bursts of work. SmoothedThrobber ignores small | 56 // and nonoverlapping bursts of work. SmoothedThrobber ignores small |
| 50 // pauses in the work stops and starts, and only starts its throbber after | 57 // pauses in the work stops and starts, and only starts its throbber after |
| 51 // a small amount of work time has passed. | 58 // a small amount of work time has passed. |
| 52 class VIEWS_EXPORT SmoothedThrobber : public Throbber { | 59 class VIEWS_EXPORT SmoothedThrobber : public Throbber { |
| 53 public: | 60 public: |
| 54 SmoothedThrobber(); | 61 SmoothedThrobber(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 77 | 84 |
| 78 base::OneShotTimer<SmoothedThrobber> start_timer_; | 85 base::OneShotTimer<SmoothedThrobber> start_timer_; |
| 79 base::OneShotTimer<SmoothedThrobber> stop_timer_; | 86 base::OneShotTimer<SmoothedThrobber> stop_timer_; |
| 80 | 87 |
| 81 DISALLOW_COPY_AND_ASSIGN(SmoothedThrobber); | 88 DISALLOW_COPY_AND_ASSIGN(SmoothedThrobber); |
| 82 }; | 89 }; |
| 83 | 90 |
| 84 } // namespace views | 91 } // namespace views |
| 85 | 92 |
| 86 #endif // UI_VIEWS_CONTROLS_THROBBER_H_ | 93 #endif // UI_VIEWS_CONTROLS_THROBBER_H_ |
| OLD | NEW |