| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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 "net/base/net_util_linux.h" | 5 #include "net/base/net_util_linux.h" |
| 6 | 6 |
| 7 #if !defined(OS_ANDROID) | 7 #if !defined(OS_ANDROID) |
| 8 #include <linux/ethtool.h> | 8 #include <linux/ethtool.h> |
| 9 #endif // !defined(OS_ANDROID) | 9 #endif // !defined(OS_ANDROID) |
| 10 #include <linux/if.h> | 10 #include <linux/if.h> |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 } | 61 } |
| 62 | 62 |
| 63 return true; | 63 return true; |
| 64 } | 64 } |
| 65 | 65 |
| 66 } // namespace | 66 } // namespace |
| 67 | 67 |
| 68 namespace internal { | 68 namespace internal { |
| 69 | 69 |
| 70 inline const unsigned char* GetIPAddressData(const IPAddressNumber& ip) { | 70 inline const unsigned char* GetIPAddressData(const IPAddressNumber& ip) { |
| 71 #if defined(OS_ANDROID) | |
| 72 return ip.begin(); | |
| 73 #else | |
| 74 return ip.data(); | 71 return ip.data(); |
| 75 #endif | |
| 76 } | 72 } |
| 77 | 73 |
| 78 // Gets the connection type for interface |ifname| by checking for wireless | 74 // Gets the connection type for interface |ifname| by checking for wireless |
| 79 // or ethtool extensions. | 75 // or ethtool extensions. |
| 80 NetworkChangeNotifier::ConnectionType GetInterfaceConnectionType( | 76 NetworkChangeNotifier::ConnectionType GetInterfaceConnectionType( |
| 81 const std::string& ifname) { | 77 const std::string& ifname) { |
| 82 base::ScopedFD s(socket(AF_INET, SOCK_STREAM, 0)); | 78 base::ScopedFD s(socket(AF_INET, SOCK_STREAM, 0)); |
| 83 if (!s.is_valid()) | 79 if (!s.is_valid()) |
| 84 return NetworkChangeNotifier::CONNECTION_UNKNOWN; | 80 return NetworkChangeNotifier::CONNECTION_UNKNOWN; |
| 85 | 81 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 std::string GetWifiSSID() { | 217 std::string GetWifiSSID() { |
| 222 NetworkInterfaceList networks; | 218 NetworkInterfaceList networks; |
| 223 if (GetNetworkList(&networks, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES)) { | 219 if (GetNetworkList(&networks, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES)) { |
| 224 return internal::GetWifiSSIDFromInterfaceListInternal( | 220 return internal::GetWifiSSIDFromInterfaceListInternal( |
| 225 networks, internal::GetInterfaceSSID); | 221 networks, internal::GetInterfaceSSID); |
| 226 } | 222 } |
| 227 return ""; | 223 return ""; |
| 228 } | 224 } |
| 229 | 225 |
| 230 } // namespace net | 226 } // namespace net |
| OLD | NEW |