OLD | NEW |
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 #ifndef ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_ICON_ANIMATION_H_ | 5 #ifndef ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_ICON_ANIMATION_H_ |
6 #define ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_ICON_ANIMATION_H_ | 6 #define ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_ICON_ANIMATION_H_ |
7 | 7 |
8 #include <set> | |
9 #include <string> | |
10 | |
11 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
12 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
13 #include "ui/base/animation/animation_delegate.h" | 10 #include "ui/base/animation/animation_delegate.h" |
14 #include "ui/base/animation/throb_animation.h" | 11 #include "ui/base/animation/throb_animation.h" |
15 | 12 |
16 namespace ash { | 13 namespace ash { |
17 namespace network_icon { | 14 namespace network_icon { |
18 | 15 |
19 class AnimationObserver; | 16 class AnimationObserver; |
20 | 17 |
21 // Single instance class to handle icon animations and keep them in sync. | 18 // Single instance class to handle icon animations and keep them in sync. |
22 class ASH_EXPORT NetworkIconAnimation : public ui::AnimationDelegate { | 19 class ASH_EXPORT NetworkIconAnimation : public ui::AnimationDelegate { |
23 public: | 20 public: |
24 NetworkIconAnimation(); | 21 NetworkIconAnimation(); |
25 virtual ~NetworkIconAnimation(); | 22 virtual ~NetworkIconAnimation(); |
26 | 23 |
27 // Returns the current animation value, [0-1]. | 24 // Returns the current animation value, [0-1]. |
28 double GetAnimation(); | 25 double GetAnimation(); |
29 | 26 |
30 void AddObserver(AnimationObserver* observer); | 27 void AddObserver(AnimationObserver* observer); |
31 void RemoveObserver(AnimationObserver* observer); | 28 void RemoveObserver(AnimationObserver* observer); |
32 void AddNetwork(const std::string& network_id); | |
33 void RemoveNetwork(const std::string& network_id); | |
34 | 29 |
35 // ui::AnimationDelegate implementation. | 30 // ui::AnimationDelegate implementation. |
36 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | 31 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
37 | 32 |
38 static NetworkIconAnimation* GetInstance(); | 33 static NetworkIconAnimation* GetInstance(); |
39 | 34 |
40 private: | 35 private: |
41 ui::ThrobAnimation animation_; | 36 ui::ThrobAnimation animation_; |
42 ObserverList<AnimationObserver> observers_; | 37 ObserverList<AnimationObserver> observers_; |
43 std::set<std::string> networks_; | |
44 }; | 38 }; |
45 | 39 |
46 } // namespace network_icon | 40 } // namespace network_icon |
47 } // namespace ash | 41 } // namespace ash |
48 | 42 |
49 #endif // ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_ICON_ANIMATION_H_ | 43 #endif // ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_ICON_ANIMATION_H_ |
OLD | NEW |