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> |
11 #include <linux/sockios.h> | 11 #include <linux/sockios.h> |
12 #include <linux/wireless.h> | 12 #include <linux/wireless.h> |
13 #include <set> | 13 #include <set> |
14 #include <sys/ioctl.h> | 14 #include <sys/ioctl.h> |
15 #include <sys/types.h> | 15 #include <sys/types.h> |
16 | 16 |
17 #include "base/files/file_path.h" | 17 #include "base/files/file_path.h" |
18 #include "base/files/scoped_file.h" | 18 #include "base/files/scoped_file.h" |
19 #include "base/logging.h" | 19 #include "base/logging.h" |
20 #include "base/memory/scoped_ptr.h" | 20 #include "base/memory/scoped_ptr.h" |
| 21 #include "base/stl_util.h" |
21 #include "base/strings/string_number_conversions.h" | 22 #include "base/strings/string_number_conversions.h" |
22 #include "base/strings/string_tokenizer.h" | 23 #include "base/strings/string_tokenizer.h" |
23 #include "base/strings/string_util.h" | 24 #include "base/strings/string_util.h" |
24 #include "base/threading/thread_restrictions.h" | 25 #include "base/threading/thread_restrictions.h" |
25 #include "net/base/address_tracker_linux.h" | 26 #include "net/base/address_tracker_linux.h" |
26 #include "net/base/escape.h" | 27 #include "net/base/escape.h" |
27 #include "net/base/ip_endpoint.h" | 28 #include "net/base/ip_endpoint.h" |
28 #include "net/base/net_errors.h" | 29 #include "net/base/net_errors.h" |
29 #include "net/base/net_util_posix.h" | 30 #include "net/base/net_util_posix.h" |
30 #include "url/gurl.h" | 31 #include "url/gurl.h" |
(...skipping 30 matching lines...) Expand all Loading... |
61 } | 62 } |
62 | 63 |
63 return true; | 64 return true; |
64 } | 65 } |
65 | 66 |
66 } // namespace | 67 } // namespace |
67 | 68 |
68 namespace internal { | 69 namespace internal { |
69 | 70 |
70 inline const unsigned char* GetIPAddressData(const IPAddressNumber& ip) { | 71 inline const unsigned char* GetIPAddressData(const IPAddressNumber& ip) { |
71 #if defined(OS_ANDROID) | 72 return vector_as_array(&ip); |
72 return ip.begin(); | |
73 #else | |
74 return ip.data(); | |
75 #endif | |
76 } | 73 } |
77 | 74 |
78 // Gets the connection type for interface |ifname| by checking for wireless | 75 // Gets the connection type for interface |ifname| by checking for wireless |
79 // or ethtool extensions. | 76 // or ethtool extensions. |
80 NetworkChangeNotifier::ConnectionType GetInterfaceConnectionType( | 77 NetworkChangeNotifier::ConnectionType GetInterfaceConnectionType( |
81 const std::string& ifname) { | 78 const std::string& ifname) { |
82 base::ScopedFD s(socket(AF_INET, SOCK_STREAM, 0)); | 79 base::ScopedFD s(socket(AF_INET, SOCK_STREAM, 0)); |
83 if (!s.is_valid()) | 80 if (!s.is_valid()) |
84 return NetworkChangeNotifier::CONNECTION_UNKNOWN; | 81 return NetworkChangeNotifier::CONNECTION_UNKNOWN; |
85 | 82 |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 std::string GetWifiSSID() { | 218 std::string GetWifiSSID() { |
222 NetworkInterfaceList networks; | 219 NetworkInterfaceList networks; |
223 if (GetNetworkList(&networks, net::INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES)) { | 220 if (GetNetworkList(&networks, net::INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES)) { |
224 return internal::GetWifiSSIDFromInterfaceListInternal( | 221 return internal::GetWifiSSIDFromInterfaceListInternal( |
225 networks, internal::GetInterfaceSSID); | 222 networks, internal::GetInterfaceSSID); |
226 } | 223 } |
227 return ""; | 224 return ""; |
228 } | 225 } |
229 | 226 |
230 } // namespace net | 227 } // namespace net |
OLD | NEW |