OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/chromeos/status/network_menu_button.h" | 5 #include "chrome/browser/chromeos/status/network_menu_button.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 // static | 27 // static |
28 const int NetworkMenuButton::kThrobDuration = 1000; | 28 const int NetworkMenuButton::kThrobDuration = 1000; |
29 | 29 |
30 NetworkMenuButton::NetworkMenuButton(StatusAreaHost* host) | 30 NetworkMenuButton::NetworkMenuButton(StatusAreaHost* host) |
31 : StatusAreaButton(this), | 31 : StatusAreaButton(this), |
32 NetworkMenu(), | 32 NetworkMenu(), |
33 host_(host), | 33 host_(host), |
34 ALLOW_THIS_IN_INITIALIZER_LIST(animation_connecting_(this)) { | 34 ALLOW_THIS_IN_INITIALIZER_LIST(animation_connecting_(this)) { |
35 animation_connecting_.SetThrobDuration(kThrobDuration); | 35 animation_connecting_.SetThrobDuration(kThrobDuration); |
36 animation_connecting_.SetTweenType(Tween::EASE_IN_OUT); | 36 animation_connecting_.SetTweenType(ui::Tween::EASE_IN_OUT); |
37 OnNetworkManagerChanged(CrosLibrary::Get()->GetNetworkLibrary()); | 37 OnNetworkManagerChanged(CrosLibrary::Get()->GetNetworkLibrary()); |
38 CrosLibrary::Get()->GetNetworkLibrary()->AddNetworkManagerObserver(this); | 38 CrosLibrary::Get()->GetNetworkLibrary()->AddNetworkManagerObserver(this); |
39 CrosLibrary::Get()->GetNetworkLibrary()->AddCellularDataPlanObserver(this); | 39 CrosLibrary::Get()->GetNetworkLibrary()->AddCellularDataPlanObserver(this); |
40 } | 40 } |
41 | 41 |
42 NetworkMenuButton::~NetworkMenuButton() { | 42 NetworkMenuButton::~NetworkMenuButton() { |
43 NetworkLibrary* netlib = CrosLibrary::Get()->GetNetworkLibrary(); | 43 NetworkLibrary* netlib = CrosLibrary::Get()->GetNetworkLibrary(); |
44 netlib->RemoveNetworkManagerObserver(this); | 44 netlib->RemoveNetworkManagerObserver(this); |
45 netlib->RemoveObserverForAllNetworks(this); | 45 netlib->RemoveObserverForAllNetworks(this); |
46 netlib->RemoveCellularDataPlanObserver(this); | 46 netlib->RemoveCellularDataPlanObserver(this); |
47 } | 47 } |
48 | 48 |
49 //////////////////////////////////////////////////////////////////////////////// | 49 //////////////////////////////////////////////////////////////////////////////// |
50 // NetworkMenuButton, AnimationDelegate implementation: | 50 // NetworkMenuButton, ui::AnimationDelegate implementation: |
51 | 51 |
52 void NetworkMenuButton::AnimationProgressed(const Animation* animation) { | 52 void NetworkMenuButton::AnimationProgressed(const ui::Animation* animation) { |
53 if (animation == &animation_connecting_) { | 53 if (animation == &animation_connecting_) { |
54 SetIcon(IconForNetworkConnecting(animation_connecting_.GetCurrentValue(), | 54 SetIcon(IconForNetworkConnecting(animation_connecting_.GetCurrentValue(), |
55 false)); | 55 false)); |
56 // No need to set the badge here, because it should already be set. | 56 // No need to set the badge here, because it should already be set. |
57 SchedulePaint(); | 57 SchedulePaint(); |
58 } else { | 58 } else { |
59 MenuButton::AnimationProgressed(animation); | 59 MenuButton::AnimationProgressed(animation); |
60 } | 60 } |
61 } | 61 } |
62 | 62 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 cros->RemoveNetworkObserver(active_network_, this); | 195 cros->RemoveNetworkObserver(active_network_, this); |
196 } | 196 } |
197 if (!new_network.empty()) { | 197 if (!new_network.empty()) { |
198 cros->AddNetworkObserver(new_network, this); | 198 cros->AddNetworkObserver(new_network, this); |
199 } | 199 } |
200 active_network_ = new_network; | 200 active_network_ = new_network; |
201 } | 201 } |
202 } | 202 } |
203 | 203 |
204 } // namespace chromeos | 204 } // namespace chromeos |
OLD | NEW |