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