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