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