Roll src/third_party/WebKit d67e6d4:0cefbbd (svn 194847:194848)
[chromium-blink-merge.git] / ui / chromeos / network / network_icon_animation.h
blob56ed2a2ed908392397bee4edd4000911271671fc
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
3 // found in the LICENSE file.
5 #ifndef UI_CHROMEOS_NETWORK_NETWORK_ICON_ANIMATION_H_
6 #define UI_CHROMEOS_NETWORK_NETWORK_ICON_ANIMATION_H_
8 #include <set>
9 #include <string>
11 #include "base/observer_list.h"
12 #include "ui/chromeos/ui_chromeos_export.h"
13 #include "ui/gfx/animation/animation_delegate.h"
14 #include "ui/gfx/animation/throb_animation.h"
16 namespace ui {
17 namespace network_icon {
19 class AnimationObserver;
21 // Single instance class to handle icon animations and keep them in sync.
22 class UI_CHROMEOS_EXPORT NetworkIconAnimation : public gfx::AnimationDelegate {
23 public:
24 NetworkIconAnimation();
25 ~NetworkIconAnimation() override;
27 // Returns the current animation value, [0-1].
28 double GetAnimation();
30 // The animation stops when all observers have been removed.
31 // Be sure to remove observers when no associated icons are animating.
32 void AddObserver(AnimationObserver* observer);
33 void RemoveObserver(AnimationObserver* observer);
35 // gfx::AnimationDelegate implementation.
36 void AnimationProgressed(const gfx::Animation* animation) override;
38 static NetworkIconAnimation* GetInstance();
40 private:
41 gfx::ThrobAnimation animation_;
42 ObserverList<AnimationObserver> observers_;
45 } // namespace network_icon
46 } // namespace ui
48 #endif // UI_CHROMEOS_NETWORK_NETWORK_ICON_ANIMATION_H_