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

Unified Diff: chrome/browser/chromeos/status/network_dropdown_button.cc

Issue 4235005: Push for ers:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/status/network_dropdown_button.cc
===================================================================
--- chrome/browser/chromeos/status/network_dropdown_button.cc (revision 64886)
+++ chrome/browser/chromeos/status/network_dropdown_button.cc (working copy)
@@ -34,12 +34,12 @@
parent_window_(parent_window) {
animation_connecting_.SetThrobDuration(kThrobDuration);
animation_connecting_.SetTweenType(Tween::LINEAR);
- NetworkChanged(CrosLibrary::Get()->GetNetworkLibrary());
- CrosLibrary::Get()->GetNetworkLibrary()->AddObserver(this);
+ OnNetworkManagerChanged(CrosLibrary::Get()->GetNetworkLibrary());
+ CrosLibrary::Get()->GetNetworkLibrary()->AddNetworkManagerObserver(this);
}
NetworkDropdownButton::~NetworkDropdownButton() {
- CrosLibrary::Get()->GetNetworkLibrary()->RemoveObserver(this);
+ CrosLibrary::Get()->GetNetworkLibrary()->RemoveNetworkManagerObserver(this);
}
////////////////////////////////////////////////////////////////////////////////
@@ -62,13 +62,13 @@
}
void NetworkDropdownButton::Refresh() {
- NetworkChanged(CrosLibrary::Get()->GetNetworkLibrary());
+ OnNetworkManagerChanged(CrosLibrary::Get()->GetNetworkLibrary());
}
////////////////////////////////////////////////////////////////////////////////
-// NetworkDropdownButton, NetworkLibrary::Observer implementation:
+// NetworkDropdownButton, NetworkLibrary::NetworkManagerObserver implementation:
-void NetworkDropdownButton::NetworkChanged(NetworkLibrary* cros) {
+void NetworkDropdownButton::OnNetworkManagerChanged(NetworkLibrary* cros) {
// Show network that we will actually use. It could be another network than
// user selected. For example user selected WiFi network but we have Ethernet
// connection and Chrome OS device will actually use Ethernet.
@@ -78,28 +78,27 @@
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
if (CrosLibrary::Get()->EnsureLoaded()) {
- // Always show the higher priority connection first. Ethernet then wifi.
- if (cros->ethernet_connected()) {
+ // Always show the active network, if any
+ const Network* active_network = cros->active_network();
+ const WirelessNetwork* wireless;
+ if (active_network != NULL) {
animation_connecting_.Stop();
- SetIcon(*rb.GetBitmapNamed(IDR_STATUSBAR_WIRED));
- SetText(l10n_util::GetString(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET));
- } else if (cros->wifi_connected()) {
- animation_connecting_.Stop();
- SetIcon(IconForNetworkStrength(
- cros->wifi_network()->strength(), true));
- SetText(ASCIIToWide(cros->wifi_network()->name()));
- } else if (cros->cellular_connected()) {
- animation_connecting_.Stop();
- SetIcon(IconForNetworkStrength(
- cros->cellular_network()->strength(), false));
- SetText(ASCIIToWide(cros->cellular_network()->name()));
+ if (active_network->type() == TYPE_ETHERNET) {
+ SetIcon(*rb.GetBitmapNamed(IDR_STATUSBAR_WIRED));
+ SetText(l10n_util::GetString(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET));
+ } else {
+ DCHECK(active_network->type() == TYPE_WIFI ||
+ active_network->type() == TYPE_CELLULAR);
+ wireless = static_cast<const WirelessNetwork*>(active_network);
+ SetIcon(IconForNetworkStrength(wireless->strength(), false));
+ SetText(ASCIIToWide(wireless->name()));
+ }
} else if (cros->wifi_connecting() || cros->cellular_connecting()) {
if (!animation_connecting_.is_animating()) {
animation_connecting_.Reset();
animation_connecting_.StartThrobbing(-1);
SetIcon(*rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_BARS1_BLACK));
}
-
if (cros->wifi_connecting())
SetText(ASCIIToWide(cros->wifi_network()->name()));
else if (cros->cellular_connecting())
« no previous file with comments | « chrome/browser/chromeos/status/network_dropdown_button.h ('k') | chrome/browser/chromeos/status/network_menu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698