Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: ash/common/system/chromeos/network/network_icon_animation.cc

Issue 2435903002: Move tray code from ui/chromeos/network/ (Closed)
Patch Set: Rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/chromeos/network/network_icon_animation.h" 5 #include "ash/common/system/chromeos/network/network_icon_animation.h"
6 6
7 #include "ui/chromeos/network/network_icon_animation_observer.h" 7 #include "ash/common/system/chromeos/network/network_icon_animation_observer.h"
8 8
9 namespace { 9 namespace {
10 const int kThrobDurationMs = 750; // Animation cycle length. 10 const int kThrobDurationMs = 750; // Animation cycle length.
11 } 11 }
12 12
13 namespace ui { 13 namespace ash {
14 namespace network_icon { 14 namespace network_icon {
15 15
16 NetworkIconAnimation::NetworkIconAnimation() 16 NetworkIconAnimation::NetworkIconAnimation() : animation_(this) {
17 : animation_(this) {
18 // Set up the animation throbber. 17 // Set up the animation throbber.
19 animation_.SetThrobDuration(kThrobDurationMs); 18 animation_.SetThrobDuration(kThrobDurationMs);
20 animation_.SetTweenType(gfx::Tween::LINEAR); 19 animation_.SetTweenType(gfx::Tween::LINEAR);
21 } 20 }
22 21
23 NetworkIconAnimation::~NetworkIconAnimation() { 22 NetworkIconAnimation::~NetworkIconAnimation() {}
24 }
25 23
26 void NetworkIconAnimation::AnimationProgressed( 24 void NetworkIconAnimation::AnimationProgressed(
27 const gfx::Animation* animation) { 25 const gfx::Animation* animation) {
28 if (animation != &animation_) 26 if (animation != &animation_)
29 return; 27 return;
30 for (AnimationObserver& observer : observers_) 28 for (AnimationObserver& observer : observers_)
31 observer.NetworkIconChanged(); 29 observer.NetworkIconChanged();
32 } 30 }
33 31
34 double NetworkIconAnimation::GetAnimation() { 32 double NetworkIconAnimation::GetAnimation() {
(...skipping 11 matching lines...) Expand all
46 } 44 }
47 45
48 void NetworkIconAnimation::RemoveObserver(AnimationObserver* observer) { 46 void NetworkIconAnimation::RemoveObserver(AnimationObserver* observer) {
49 observers_.RemoveObserver(observer); 47 observers_.RemoveObserver(observer);
50 if (!observers_.might_have_observers()) 48 if (!observers_.might_have_observers())
51 animation_.Reset(); // Stops the animation and resets the current value. 49 animation_.Reset(); // Stops the animation and resets the current value.
52 } 50 }
53 51
54 // static 52 // static
55 NetworkIconAnimation* NetworkIconAnimation::GetInstance() { 53 NetworkIconAnimation* NetworkIconAnimation::GetInstance() {
56 static NetworkIconAnimation* s_icon_animation = 54 static NetworkIconAnimation* s_icon_animation = new NetworkIconAnimation();
57 new NetworkIconAnimation();
58 return s_icon_animation; 55 return s_icon_animation;
59 } 56 }
60 57
61 } // namespace network_icon 58 } // namespace network_icon
62 } // namespace ui 59 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698