OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "net/base/net_util.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <sys/types.h> | 8 #include <sys/types.h> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
13 #include "base/strings/string_tokenizer.h" | 13 #include "base/strings/string_tokenizer.h" |
14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
15 #include "base/threading/thread_restrictions.h" | 15 #include "base/threading/thread_restrictions.h" |
16 #include "net/base/escape.h" | 16 #include "net/base/escape.h" |
17 #include "net/base/ip_endpoint.h" | 17 #include "net/base/ip_endpoint.h" |
18 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
19 #include "url/gurl.h" | 19 #include "url/gurl.h" |
20 | 20 |
21 #if !defined(OS_ANDROID) | 21 #if !defined(OS_ANDROID) && !defined(OS_NACL) |
22 #include <ifaddrs.h> | 22 #include <ifaddrs.h> |
23 #endif | |
24 #include <net/if.h> | 23 #include <net/if.h> |
25 #include <netinet/in.h> | 24 #include <netinet/in.h> |
| 25 #endif |
26 | 26 |
27 #if defined(OS_MACOSX) && !defined(OS_IOS) | 27 #if defined(OS_MACOSX) && !defined(OS_IOS) |
28 #include <netinet/in_var.h> | 28 #include <netinet/in_var.h> |
29 #include <sys/ioctl.h> | 29 #include <sys/ioctl.h> |
30 #endif | 30 #endif |
31 | 31 |
32 #if defined(OS_ANDROID) | 32 #if defined(OS_ANDROID) |
33 #include "net/android/network_library.h" | 33 #include "net/android/network_library.h" |
34 #endif | 34 #endif |
35 | 35 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 ++i; | 79 ++i; |
80 } | 80 } |
81 } | 81 } |
82 } | 82 } |
83 | 83 |
84 #endif | 84 #endif |
85 | 85 |
86 } // namespace | 86 } // namespace |
87 | 87 |
88 bool GetNetworkList(NetworkInterfaceList* networks, int policy) { | 88 bool GetNetworkList(NetworkInterfaceList* networks, int policy) { |
89 #if defined(OS_ANDROID) | 89 #if defined(OS_NACL) |
| 90 NOTIMPLEMENTED(); |
| 91 return false; |
| 92 #elif defined(OS_ANDROID) |
90 std::string network_list = android::GetNetworkList(); | 93 std::string network_list = android::GetNetworkList(); |
91 base::StringTokenizer network_interfaces(network_list, "\n"); | 94 base::StringTokenizer network_interfaces(network_list, "\n"); |
92 while (network_interfaces.GetNext()) { | 95 while (network_interfaces.GetNext()) { |
93 std::string network_item = network_interfaces.token(); | 96 std::string network_item = network_interfaces.token(); |
94 base::StringTokenizer network_tokenizer(network_item, "\t"); | 97 base::StringTokenizer network_tokenizer(network_item, "\t"); |
95 CHECK(network_tokenizer.GetNext()); | 98 CHECK(network_tokenizer.GetNext()); |
96 std::string name = network_tokenizer.token(); | 99 std::string name = network_tokenizer.token(); |
97 | 100 |
98 CHECK(network_tokenizer.GetNext()); | 101 CHECK(network_tokenizer.GetNext()); |
99 std::string interface_address = network_tokenizer.token(); | 102 std::string interface_address = network_tokenizer.token(); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 } | 231 } |
229 return true; | 232 return true; |
230 #endif | 233 #endif |
231 } | 234 } |
232 | 235 |
233 WifiPHYLayerProtocol GetWifiPHYLayerProtocol() { | 236 WifiPHYLayerProtocol GetWifiPHYLayerProtocol() { |
234 return WIFI_PHY_LAYER_PROTOCOL_UNKNOWN; | 237 return WIFI_PHY_LAYER_PROTOCOL_UNKNOWN; |
235 } | 238 } |
236 | 239 |
237 } // namespace net | 240 } // namespace net |
OLD | NEW |