| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "ash/system/chromeos/network/network_observer.h" | 5 #include "ash/system/chromeos/network/network_observer.h" |
| 6 | 6 |
| 7 #include "chromeos/network/network_state.h" | 7 #include "chromeos/network/network_state.h" |
| 8 #include "third_party/cros_system_api/dbus/service_constants.h" | 8 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 9 | 9 |
| 10 namespace ash { | 10 namespace ash { |
| 11 | 11 |
| 12 //static | 12 //static |
| 13 NetworkObserver::NetworkType NetworkObserver::GetNetworkTypeForNetworkState( | 13 NetworkObserver::NetworkType NetworkObserver::GetNetworkTypeForNetworkState( |
| 14 const chromeos::NetworkState* network) { | 14 const chromeos::NetworkState* network) { |
| 15 if (!network) | 15 if (!network) |
| 16 return NETWORK_UNKNOWN; | 16 return NETWORK_UNKNOWN; |
| 17 const std::string& type = network->type(); | 17 const std::string& type = network->type(); |
| 18 if (type == flimflam::kTypeCellular) { | 18 if (type == flimflam::kTypeCellular) { |
| 19 if (network->technology() == flimflam::kNetworkTechnologyLte || | 19 const std::string& technology = network->network_technology(); |
| 20 network->technology() == flimflam::kNetworkTechnologyLteAdvanced) | 20 if (technology == flimflam::kNetworkTechnologyLte || |
| 21 technology == flimflam::kNetworkTechnologyLteAdvanced) |
| 21 return NETWORK_CELLULAR_LTE; | 22 return NETWORK_CELLULAR_LTE; |
| 22 else | 23 else |
| 23 return NETWORK_CELLULAR; | 24 return NETWORK_CELLULAR; |
| 24 } | 25 } |
| 25 if (type == flimflam::kTypeEthernet) | 26 if (type == flimflam::kTypeEthernet) |
| 26 return NETWORK_ETHERNET; | 27 return NETWORK_ETHERNET; |
| 27 if (type == flimflam::kTypeWifi) | 28 if (type == flimflam::kTypeWifi) |
| 28 return NETWORK_WIFI; | 29 return NETWORK_WIFI; |
| 29 if (type == flimflam::kTypeBluetooth) | 30 if (type == flimflam::kTypeBluetooth) |
| 30 return NETWORK_BLUETOOTH; | 31 return NETWORK_BLUETOOTH; |
| 31 return NETWORK_UNKNOWN; | 32 return NETWORK_UNKNOWN; |
| 32 } | 33 } |
| 33 | 34 |
| 34 } // namespace ash | 35 } // namespace ash |
| OLD | NEW |