| 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/dom_ui/internet_options_handler.h" | 5 #include "chrome/browser/chromeos/dom_ui/internet_options_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 network->Append(Value::CreateBooleanValue(remembered)); | 218 network->Append(Value::CreateBooleanValue(remembered)); |
| 219 return network; | 219 return network; |
| 220 } | 220 } |
| 221 | 221 |
| 222 ListValue* InternetOptionsHandler::GetWiredList() { | 222 ListValue* InternetOptionsHandler::GetWiredList() { |
| 223 chromeos::NetworkLibrary* cros = | 223 chromeos::NetworkLibrary* cros = |
| 224 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); | 224 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); |
| 225 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 225 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 226 ListValue* list = new ListValue(); | 226 ListValue* list = new ListValue(); |
| 227 | 227 |
| 228 const chromeos::EthernetNetwork& ethernet_network = cros->ethernet_network(); | 228 // If ethernet is not enabled, then don't add anything. |
| 229 SkBitmap icon = *rb.GetBitmapNamed(IDR_STATUSBAR_WIRED_BLACK); | 229 if (cros->ethernet_enabled()) { |
| 230 if (!ethernet_network.connecting() && | 230 const chromeos::EthernetNetwork& ethernet_network = |
| 231 !ethernet_network.connected()) { | 231 cros->ethernet_network(); |
| 232 icon = chromeos::NetworkMenuButton::IconForDisplay(icon, | 232 SkBitmap icon = *rb.GetBitmapNamed(IDR_STATUSBAR_WIRED_BLACK); |
| 233 *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_DISCONNECTED)); | 233 if (!ethernet_network.connecting() && |
| 234 !ethernet_network.connected()) { |
| 235 icon = chromeos::NetworkMenuButton::IconForDisplay(icon, |
| 236 *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_DISCONNECTED)); |
| 237 } |
| 238 list->Append(GetNetwork( |
| 239 ethernet_network.service_path(), |
| 240 icon, |
| 241 l10n_util::GetStringUTF8(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET), |
| 242 ethernet_network.connecting(), |
| 243 ethernet_network.connected(), |
| 244 chromeos::TYPE_ETHERNET, |
| 245 false)); |
| 234 } | 246 } |
| 235 list->Append(GetNetwork( | |
| 236 ethernet_network.service_path(), | |
| 237 icon, | |
| 238 l10n_util::GetStringUTF8(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET), | |
| 239 ethernet_network.connecting(), | |
| 240 ethernet_network.connected(), | |
| 241 chromeos::TYPE_ETHERNET, | |
| 242 false)); | |
| 243 return list; | 247 return list; |
| 244 } | 248 } |
| 245 | 249 |
| 246 ListValue* InternetOptionsHandler::GetWirelessList() { | 250 ListValue* InternetOptionsHandler::GetWirelessList() { |
| 247 chromeos::NetworkLibrary* cros = | 251 chromeos::NetworkLibrary* cros = |
| 248 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); | 252 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); |
| 249 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 253 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 250 ListValue* list = new ListValue(); | 254 ListValue* list = new ListValue(); |
| 251 | 255 |
| 252 const chromeos::WifiNetworkVector& wifi_networks = cros->wifi_networks(); | 256 const chromeos::WifiNetworkVector& wifi_networks = cros->wifi_networks(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 279 list->Append(GetNetwork( | 283 list->Append(GetNetwork( |
| 280 it->service_path(), | 284 it->service_path(), |
| 281 icon, | 285 icon, |
| 282 it->name(), | 286 it->name(), |
| 283 it->connecting(), | 287 it->connecting(), |
| 284 it->connected(), | 288 it->connected(), |
| 285 chromeos::TYPE_CELLULAR, | 289 chromeos::TYPE_CELLULAR, |
| 286 false)); | 290 false)); |
| 287 } | 291 } |
| 288 | 292 |
| 289 list->Append(GetNetwork( | 293 // Add "Other..." if wifi is enabled. |
| 290 kOtherNetworksFakePath, | 294 if (cros->wifi_enabled()) { |
| 291 SkBitmap(), | 295 list->Append(GetNetwork( |
| 292 l10n_util::GetStringUTF8(IDS_OPTIONS_SETTINGS_OTHER_NETWORKS), | 296 kOtherNetworksFakePath, |
| 293 false, | 297 SkBitmap(), |
| 294 false, | 298 l10n_util::GetStringUTF8(IDS_OPTIONS_SETTINGS_OTHER_NETWORKS), |
| 295 chromeos::TYPE_WIFI, | 299 false, |
| 296 false)); | 300 false, |
| 301 chromeos::TYPE_WIFI, |
| 302 false)); |
| 303 } |
| 297 | 304 |
| 298 return list; | 305 return list; |
| 299 } | 306 } |
| 300 | 307 |
| 301 ListValue* InternetOptionsHandler::GetRememberedList() { | 308 ListValue* InternetOptionsHandler::GetRememberedList() { |
| 302 chromeos::NetworkLibrary* cros = | 309 chromeos::NetworkLibrary* cros = |
| 303 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); | 310 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); |
| 304 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 311 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 305 ListValue* list = new ListValue(); | 312 ListValue* list = new ListValue(); |
| 306 | 313 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 335 icon, | 342 icon, |
| 336 it->name(), | 343 it->name(), |
| 337 it->connecting(), | 344 it->connecting(), |
| 338 it->connected(), | 345 it->connected(), |
| 339 chromeos::TYPE_CELLULAR, | 346 chromeos::TYPE_CELLULAR, |
| 340 true)); | 347 true)); |
| 341 } | 348 } |
| 342 | 349 |
| 343 return list; | 350 return list; |
| 344 } | 351 } |
| OLD | NEW |