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

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

Issue 12218116: Revert 181806 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 10 months 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 | Annotate | Revision Log
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 "ash/system/chromeos/network/network_icon_animation.h" 5 #include "ash/system/chromeos/network/network_icon_animation.h"
6 6
7 #include "ash/system/chromeos/network/network_icon_animation_observer.h" 7 #include "ash/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.
(...skipping 30 matching lines...) Expand all
41 void NetworkIconAnimation::AddObserver(AnimationObserver* observer) { 41 void NetworkIconAnimation::AddObserver(AnimationObserver* observer) {
42 observers_.AddObserver(observer); 42 observers_.AddObserver(observer);
43 } 43 }
44 44
45 void NetworkIconAnimation::RemoveObserver(AnimationObserver* observer) { 45 void NetworkIconAnimation::RemoveObserver(AnimationObserver* observer) {
46 observers_.RemoveObserver(observer); 46 observers_.RemoveObserver(observer);
47 if (observers_.size() == 0) 47 if (observers_.size() == 0)
48 animation_.Stop(); 48 animation_.Stop();
49 } 49 }
50 50
51 void NetworkIconAnimation::AddNetwork(const std::string& network_id) {
52 networks_.insert(network_id);
53 // Animation will start (if stopped) when GetAnimation is called.
54 }
55
56 void NetworkIconAnimation::RemoveNetwork(const std::string& network_id) {
57 networks_.erase(network_id);
58 if (networks_.empty())
59 animation_.Reset();
60 }
61
62 // static 51 // static
63 NetworkIconAnimation* NetworkIconAnimation::GetInstance() { 52 NetworkIconAnimation* NetworkIconAnimation::GetInstance() {
64 static NetworkIconAnimation* s_icon_animation = 53 static NetworkIconAnimation* s_icon_animation =
65 new NetworkIconAnimation(); 54 new NetworkIconAnimation();
66 return s_icon_animation; 55 return s_icon_animation;
67 } 56 }
68 57
69 } // namespace network_icon 58 } // namespace network_icon
70 } // namespace ash 59 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/chromeos/network/network_icon_animation.h ('k') | ash/system/chromeos/network/network_state_list_detailed_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698