| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 } | 66 } |
| 67 | 67 |
| 68 //////////////////////////////////////////////////////////////////////////////// | 68 //////////////////////////////////////////////////////////////////////////////// |
| 69 // NetworkDropdownButton, NetworkLibrary::Observer implementation: | 69 // NetworkDropdownButton, NetworkLibrary::Observer implementation: |
| 70 | 70 |
| 71 void NetworkDropdownButton::NetworkChanged(NetworkLibrary* cros) { | 71 void NetworkDropdownButton::NetworkChanged(NetworkLibrary* cros) { |
| 72 // Show network that we will actually use. It could be another network than | 72 // Show network that we will actually use. It could be another network than |
| 73 // user selected. For example user selected WiFi network but we have Ethernet | 73 // user selected. For example user selected WiFi network but we have Ethernet |
| 74 // connection and Chrome OS device will actually use Ethernet. | 74 // connection and Chrome OS device will actually use Ethernet. |
| 75 | 75 |
| 76 // This gets called on initialization, so any changes should be reflected |
| 77 // in CrosMock::SetNetworkLibraryStatusAreaExpectations(). |
| 78 |
| 76 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 79 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 77 if (CrosLibrary::Get()->EnsureLoaded()) { | 80 if (CrosLibrary::Get()->EnsureLoaded()) { |
| 78 // Always show the higher priority connection first. Ethernet then wifi. | 81 // Always show the higher priority connection first. Ethernet then wifi. |
| 79 if (cros->ethernet_connected()) { | 82 if (cros->ethernet_connected()) { |
| 80 animation_connecting_.Stop(); | 83 animation_connecting_.Stop(); |
| 81 SetIcon(*rb.GetBitmapNamed(IDR_STATUSBAR_WIRED)); | 84 SetIcon(*rb.GetBitmapNamed(IDR_STATUSBAR_WIRED)); |
| 82 SetText(l10n_util::GetString(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET)); | 85 SetText(l10n_util::GetString(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET)); |
| 83 } else if (cros->wifi_connected()) { | 86 } else if (cros->wifi_connected()) { |
| 84 animation_connecting_.Stop(); | 87 animation_connecting_.Stop(); |
| 85 SetIcon(IconForNetworkStrength(cros->wifi_strength(), true)); | 88 SetIcon(IconForNetworkStrength(cros->wifi_strength(), true)); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 109 } else { | 112 } else { |
| 110 animation_connecting_.Stop(); | 113 animation_connecting_.Stop(); |
| 111 SetIcon(SkBitmap()); | 114 SetIcon(SkBitmap()); |
| 112 SetText(l10n_util::GetString(IDS_STATUSBAR_NO_NETWORKS_MESSAGE)); | 115 SetText(l10n_util::GetString(IDS_STATUSBAR_NO_NETWORKS_MESSAGE)); |
| 113 } | 116 } |
| 114 | 117 |
| 115 SchedulePaint(); | 118 SchedulePaint(); |
| 116 } | 119 } |
| 117 | 120 |
| 118 } // namespace chromeos | 121 } // namespace chromeos |
| OLD | NEW |