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 #include "ui/views/controls/throbber.h" | 5 #include "ui/views/controls/throbber.h" |
6 | 6 |
| 7 #include "base/bind.h" |
| 8 #include "base/location.h" |
7 #include "ui/base/resource/resource_bundle.h" | 9 #include "ui/base/resource/resource_bundle.h" |
8 #include "ui/gfx/animation/tween.h" | 10 #include "ui/gfx/animation/tween.h" |
9 #include "ui/gfx/canvas.h" | 11 #include "ui/gfx/canvas.h" |
10 #include "ui/gfx/image/image.h" | 12 #include "ui/gfx/image/image.h" |
11 #include "ui/gfx/image/image_skia.h" | 13 #include "ui/gfx/image/image_skia.h" |
12 #include "ui/gfx/paint_throbber.h" | 14 #include "ui/gfx/paint_throbber.h" |
13 #include "ui/gfx/paint_vector_icon.h" | 15 #include "ui/gfx/paint_vector_icon.h" |
14 #include "ui/gfx/vector_icons_public.h" | 16 #include "ui/gfx/vector_icons_public.h" |
15 #include "ui/native_theme/common_theme.h" | 17 #include "ui/native_theme/common_theme.h" |
16 #include "ui/native_theme/native_theme.h" | 18 #include "ui/native_theme/native_theme.h" |
(...skipping 15 matching lines...) Expand all Loading... |
32 Throbber::~Throbber() { | 34 Throbber::~Throbber() { |
33 Stop(); | 35 Stop(); |
34 } | 36 } |
35 | 37 |
36 void Throbber::Start() { | 38 void Throbber::Start() { |
37 if (IsRunning()) | 39 if (IsRunning()) |
38 return; | 40 return; |
39 | 41 |
40 start_time_ = base::TimeTicks::Now(); | 42 start_time_ = base::TimeTicks::Now(); |
41 const int kFrameTimeMs = 30; | 43 const int kFrameTimeMs = 30; |
42 timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(kFrameTimeMs), this, | 44 timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(kFrameTimeMs), |
43 &Throbber::SchedulePaint); | 45 base::Bind(&Throbber::SchedulePaint, base::Unretained(this))); |
44 SchedulePaint(); // paint right away | 46 SchedulePaint(); // paint right away |
45 } | 47 } |
46 | 48 |
47 void Throbber::Stop() { | 49 void Throbber::Stop() { |
48 if (!IsRunning()) | 50 if (!IsRunning()) |
49 return; | 51 return; |
50 | 52 |
51 timer_.Stop(); | 53 timer_.Stop(); |
52 SchedulePaint(); | 54 SchedulePaint(); |
53 } | 55 } |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 stop_timer_.Start(FROM_HERE, | 124 stop_timer_.Start(FROM_HERE, |
123 base::TimeDelta::FromMilliseconds(stop_delay_ms_), this, | 125 base::TimeDelta::FromMilliseconds(stop_delay_ms_), this, |
124 &SmoothedThrobber::StopDelayOver); | 126 &SmoothedThrobber::StopDelayOver); |
125 } | 127 } |
126 | 128 |
127 void SmoothedThrobber::StopDelayOver() { | 129 void SmoothedThrobber::StopDelayOver() { |
128 Throbber::Stop(); | 130 Throbber::Stop(); |
129 } | 131 } |
130 | 132 |
131 } // namespace views | 133 } // namespace views |
OLD | NEW |