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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 void SetChecked(bool checked); | 105 void SetChecked(bool checked); |
106 | 106 |
107 void set_preferred_diameter(int diameter) { preferred_diameter_ = diameter; } | 107 void set_preferred_diameter(int diameter) { preferred_diameter_ = diameter; } |
108 | 108 |
109 // View implementation. | 109 // View implementation. |
110 gfx::Size GetPreferredSize() const override; | 110 gfx::Size GetPreferredSize() const override; |
111 int GetHeightForWidth(int w) const override; | 111 int GetHeightForWidth(int w) const override; |
112 void OnPaint(gfx::Canvas* canvas) override; | 112 void OnPaint(gfx::Canvas* canvas) override; |
113 | 113 |
114 private: | 114 private: |
| 115 // Paints this throbber in the "waiting" state, for example when waiting for |
| 116 // an initial network response. |
| 117 void PaintWaiting(gfx::Canvas* canvas); |
| 118 |
| 119 // Paints this throbber in its normal state. Corresponds to MD throbber. |
| 120 void PaintSpinning(gfx::Canvas* canvas); |
| 121 |
| 122 // Common painting code for PaintWaiting and PaintSpinning. |
| 123 void PaintArc(gfx::Canvas* canvas, SkScalar start_angle, SkScalar sweep); |
| 124 |
115 // The preferred width and height for this view. Zero indicates the size is | 125 // The preferred width and height for this view. Zero indicates the size is |
116 // set by the parent class (i.e. matches the size of the pre-material | 126 // set by the parent class (i.e. matches the size of the pre-material |
117 // sprites). | 127 // sprites). |
118 int preferred_diameter_; | 128 int preferred_diameter_; |
119 | 129 |
120 // Whether or not we should display a checkmark. | 130 // Whether or not we should display a checkmark. |
121 bool checked_; | 131 bool checked_; |
122 | 132 |
123 // The checkmark image. Will be null until it's used (if ever). | 133 // The checkmark image. Will be null until it's used (if ever). |
124 const gfx::ImageSkia* checkmark_; | 134 const gfx::ImageSkia* checkmark_; |
125 | 135 |
126 DISALLOW_COPY_AND_ASSIGN(MaterialThrobber); | 136 DISALLOW_COPY_AND_ASSIGN(MaterialThrobber); |
127 }; | 137 }; |
128 | 138 |
129 } // namespace views | 139 } // namespace views |
130 | 140 |
131 #endif // UI_VIEWS_CONTROLS_THROBBER_H_ | 141 #endif // UI_VIEWS_CONTROLS_THROBBER_H_ |
OLD | NEW |