| 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/network_interfaces_linux.h" | 5 #include "net/base/network_interfaces_linux.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #if !defined(OS_ANDROID) | 9 #if !defined(OS_ANDROID) |
| 10 #include <linux/ethtool.h> | 10 #include <linux/ethtool.h> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "base/strings/string_tokenizer.h" | 23 #include "base/strings/string_tokenizer.h" |
| 24 #include "base/strings/string_util.h" | 24 #include "base/strings/string_util.h" |
| 25 #include "base/threading/thread_restrictions.h" | 25 #include "base/threading/thread_restrictions.h" |
| 26 #include "net/base/address_tracker_linux.h" | 26 #include "net/base/address_tracker_linux.h" |
| 27 #include "net/base/escape.h" | 27 #include "net/base/escape.h" |
| 28 #include "net/base/ip_endpoint.h" | 28 #include "net/base/ip_endpoint.h" |
| 29 #include "net/base/net_errors.h" | 29 #include "net/base/net_errors.h" |
| 30 #include "net/base/network_interfaces_posix.h" | 30 #include "net/base/network_interfaces_posix.h" |
| 31 #include "url/gurl.h" | 31 #include "url/gurl.h" |
| 32 | 32 |
| 33 #if defined(OS_ANDROID) |
| 34 #include "net/android/network_library.h" |
| 35 #endif |
| 36 |
| 33 namespace net { | 37 namespace net { |
| 34 | 38 |
| 35 namespace { | 39 namespace { |
| 36 | 40 |
| 37 // When returning true, the platform native IPv6 address attributes were | 41 // When returning true, the platform native IPv6 address attributes were |
| 38 // successfully converted to net IP address attributes. Otherwise, returning | 42 // successfully converted to net IP address attributes. Otherwise, returning |
| 39 // false and the caller should drop the IP address which can't be used by the | 43 // false and the caller should drop the IP address which can't be used by the |
| 40 // application layer. | 44 // application layer. |
| 41 bool TryConvertNativeToNetIPAttributes(int native_attributes, | 45 bool TryConvertNativeToNetIPAttributes(int native_attributes, |
| 42 int* net_attributes) { | 46 int* net_attributes) { |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 | 209 |
| 206 internal::AddressTrackerLinux tracker; | 210 internal::AddressTrackerLinux tracker; |
| 207 tracker.Init(); | 211 tracker.Init(); |
| 208 | 212 |
| 209 return internal::GetNetworkListImpl( | 213 return internal::GetNetworkListImpl( |
| 210 networks, policy, tracker.GetOnlineLinks(), tracker.GetAddressMap(), | 214 networks, policy, tracker.GetOnlineLinks(), tracker.GetAddressMap(), |
| 211 &internal::AddressTrackerLinux::GetInterfaceName); | 215 &internal::AddressTrackerLinux::GetInterfaceName); |
| 212 } | 216 } |
| 213 | 217 |
| 214 std::string GetWifiSSID() { | 218 std::string GetWifiSSID() { |
| 219 // On Android, obtain the SSID using the Android-specific APIs. |
| 220 #if defined(OS_ANDROID) |
| 221 return android::GetWifiSSID(); |
| 222 #endif |
| 215 NetworkInterfaceList networks; | 223 NetworkInterfaceList networks; |
| 216 if (GetNetworkList(&networks, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES)) { | 224 if (GetNetworkList(&networks, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES)) { |
| 217 return internal::GetWifiSSIDFromInterfaceListInternal( | 225 return internal::GetWifiSSIDFromInterfaceListInternal( |
| 218 networks, internal::GetInterfaceSSID); | 226 networks, internal::GetInterfaceSSID); |
| 219 } | 227 } |
| 220 return ""; | 228 return ""; |
| 221 } | 229 } |
| 222 | 230 |
| 223 } // namespace net | 231 } // namespace net |
| OLD | NEW |