| 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_dropdown_button.h" | 5 #include "chrome/browser/chromeos/status/network_dropdown_button.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/chromeos/cros/cros_library.h" | 10 #include "chrome/browser/chromeos/cros/cros_library.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 NetworkDropdownButton::NetworkDropdownButton(bool browser_mode, | 26 NetworkDropdownButton::NetworkDropdownButton(bool browser_mode, |
| 27 gfx::NativeWindow parent_window) | 27 gfx::NativeWindow parent_window) |
| 28 : DropDownButton(NULL, | 28 : DropDownButton(NULL, |
| 29 l10n_util::GetString(IDS_STATUSBAR_NO_NETWORKS_MESSAGE), | 29 l10n_util::GetString(IDS_STATUSBAR_NO_NETWORKS_MESSAGE), |
| 30 this, | 30 this, |
| 31 true), | 31 true), |
| 32 browser_mode_(browser_mode), | 32 browser_mode_(browser_mode), |
| 33 ALLOW_THIS_IN_INITIALIZER_LIST(animation_connecting_(this)), | 33 ALLOW_THIS_IN_INITIALIZER_LIST(animation_connecting_(this)), |
| 34 parent_window_(parent_window) { | 34 parent_window_(parent_window) { |
| 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 CrosLibrary::Get()->GetNetworkLibrary()->AddNetworkManagerObserver(this); | 37 CrosLibrary::Get()->GetNetworkLibrary()->AddNetworkManagerObserver(this); |
| 38 // The initial state will be updated on Refresh. | 38 // The initial state will be updated on Refresh. |
| 39 // See network_selection_view.cc. | 39 // See network_selection_view.cc. |
| 40 } | 40 } |
| 41 | 41 |
| 42 NetworkDropdownButton::~NetworkDropdownButton() { | 42 NetworkDropdownButton::~NetworkDropdownButton() { |
| 43 CrosLibrary::Get()->GetNetworkLibrary()->RemoveNetworkManagerObserver(this); | 43 CrosLibrary::Get()->GetNetworkLibrary()->RemoveNetworkManagerObserver(this); |
| 44 } | 44 } |
| 45 | 45 |
| 46 //////////////////////////////////////////////////////////////////////////////// | 46 //////////////////////////////////////////////////////////////////////////////// |
| 47 // NetworkMenuButton, AnimationDelegate implementation: | 47 // NetworkMenuButton, ui::AnimationDelegate implementation: |
| 48 | 48 |
| 49 void NetworkDropdownButton::AnimationProgressed(const Animation* animation) { | 49 void NetworkDropdownButton::AnimationProgressed( |
| 50 const ui::Animation* animation) { |
| 50 if (animation == &animation_connecting_) { | 51 if (animation == &animation_connecting_) { |
| 51 SetIcon(IconForNetworkConnecting(animation_connecting_.GetCurrentValue(), | 52 SetIcon(IconForNetworkConnecting(animation_connecting_.GetCurrentValue(), |
| 52 true)); | 53 true)); |
| 53 SchedulePaint(); | 54 SchedulePaint(); |
| 54 } else { | 55 } else { |
| 55 MenuButton::AnimationProgressed(animation); | 56 MenuButton::AnimationProgressed(animation); |
| 56 } | 57 } |
| 57 } | 58 } |
| 58 | 59 |
| 59 void NetworkDropdownButton::Refresh() { | 60 void NetworkDropdownButton::Refresh() { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 animation_connecting_.Stop(); | 115 animation_connecting_.Stop(); |
| 115 SetIcon(SkBitmap()); | 116 SetIcon(SkBitmap()); |
| 116 SetText(l10n_util::GetString(IDS_STATUSBAR_NO_NETWORKS_MESSAGE)); | 117 SetText(l10n_util::GetString(IDS_STATUSBAR_NO_NETWORKS_MESSAGE)); |
| 117 } | 118 } |
| 118 | 119 |
| 119 SchedulePaint(); | 120 SchedulePaint(); |
| 120 UpdateMenu(); | 121 UpdateMenu(); |
| 121 } | 122 } |
| 122 | 123 |
| 123 } // namespace chromeos | 124 } // namespace chromeos |
| OLD | NEW |