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" |
(...skipping 19 matching lines...) Expand all Loading... |
30 // Overridden from View: | 30 // Overridden from View: |
31 gfx::Size GetPreferredSize() const override; | 31 gfx::Size GetPreferredSize() const override; |
32 void OnPaint(gfx::Canvas* canvas) override; | 32 void OnPaint(gfx::Canvas* canvas) override; |
33 | 33 |
34 protected: | 34 protected: |
35 // Specifies whether the throbber is currently animating or not | 35 // Specifies whether the throbber is currently animating or not |
36 bool IsRunning() const; | 36 bool IsRunning() const; |
37 | 37 |
38 private: | 38 private: |
39 base::TimeTicks start_time_; // Time when Start was called. | 39 base::TimeTicks start_time_; // Time when Start was called. |
40 base::RepeatingTimer<Throbber> timer_; // Used to schedule Run calls. | 40 base::RepeatingTimer timer_; // Used to schedule Run calls. |
41 | 41 |
42 // Whether or not we should display a checkmark. | 42 // Whether or not we should display a checkmark. |
43 bool checked_; | 43 bool checked_; |
44 | 44 |
45 DISALLOW_COPY_AND_ASSIGN(Throbber); | 45 DISALLOW_COPY_AND_ASSIGN(Throbber); |
46 }; | 46 }; |
47 | 47 |
48 // A SmoothedThrobber is a throbber that is representing potentially short | 48 // A SmoothedThrobber is a throbber that is representing potentially short |
49 // and nonoverlapping bursts of work. SmoothedThrobber ignores small | 49 // and nonoverlapping bursts of work. SmoothedThrobber ignores small |
50 // 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 |
(...skipping 17 matching lines...) Expand all Loading... |
68 // Called when the shutdown-delay timer fires. | 68 // Called when the shutdown-delay timer fires. |
69 // This function stops the actual throbbing. | 69 // This function stops the actual throbbing. |
70 void StopDelayOver(); | 70 void StopDelayOver(); |
71 | 71 |
72 // Delay after work starts before starting throbber, in milliseconds. | 72 // Delay after work starts before starting throbber, in milliseconds. |
73 int start_delay_ms_; | 73 int start_delay_ms_; |
74 | 74 |
75 // Delay after work stops before stopping, in milliseconds. | 75 // Delay after work stops before stopping, in milliseconds. |
76 int stop_delay_ms_; | 76 int stop_delay_ms_; |
77 | 77 |
78 base::OneShotTimer<SmoothedThrobber> start_timer_; | 78 base::OneShotTimer start_timer_; |
79 base::OneShotTimer<SmoothedThrobber> stop_timer_; | 79 base::OneShotTimer stop_timer_; |
80 | 80 |
81 DISALLOW_COPY_AND_ASSIGN(SmoothedThrobber); | 81 DISALLOW_COPY_AND_ASSIGN(SmoothedThrobber); |
82 }; | 82 }; |
83 | 83 |
84 } // namespace views | 84 } // namespace views |
85 | 85 |
86 #endif // UI_VIEWS_CONTROLS_THROBBER_H_ | 86 #endif // UI_VIEWS_CONTROLS_THROBBER_H_ |
OLD | NEW |