| 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 <sys/types.h> | 7 #include <sys/types.h> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 12 #include "base/strings/string_tokenizer.h" | 12 #include "base/strings/string_tokenizer.h" |
| 13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 14 #include "base/threading/thread_restrictions.h" | 14 #include "base/threading/thread_restrictions.h" |
| 15 #include "net/base/escape.h" | 15 #include "net/base/escape.h" |
| 16 #include "net/base/ip_endpoint.h" | 16 #include "net/base/ip_endpoint.h" |
| 17 #include "net/base/net_errors.h" | 17 #include "net/base/net_errors.h" |
| 18 #include "url/gurl.h" | 18 #include "url/gurl.h" |
| 19 | 19 |
| 20 #if !defined(OS_ANDROID) | 20 #if !defined(OS_ANDROID) && !defined(OS_NACL) |
| 21 #include <ifaddrs.h> | 21 #include <ifaddrs.h> |
| 22 #endif | |
| 23 #include <net/if.h> | 22 #include <net/if.h> |
| 24 #include <netinet/in.h> | 23 #include <netinet/in.h> |
| 24 #endif |
| 25 | 25 |
| 26 #if defined(OS_ANDROID) | 26 #if defined(OS_ANDROID) |
| 27 #include "net/android/network_library.h" | 27 #include "net/android/network_library.h" |
| 28 #endif | 28 #endif |
| 29 | 29 |
| 30 namespace net { | 30 namespace net { |
| 31 | 31 |
| 32 bool FileURLToFilePath(const GURL& url, base::FilePath* path) { | 32 bool FileURLToFilePath(const GURL& url, base::FilePath* path) { |
| 33 *path = base::FilePath(); | 33 *path = base::FilePath(); |
| 34 std::string& file_path_str = const_cast<std::string&>(path->value()); | 34 std::string& file_path_str = const_cast<std::string&>(path->value()); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 58 old_path.swap(new_path); | 58 old_path.swap(new_path); |
| 59 } while (new_path != old_path); | 59 } while (new_path != old_path); |
| 60 | 60 |
| 61 file_path_str.assign(old_path); | 61 file_path_str.assign(old_path); |
| 62 | 62 |
| 63 return !file_path_str.empty(); | 63 return !file_path_str.empty(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 bool GetNetworkList(NetworkInterfaceList* networks, | 66 bool GetNetworkList(NetworkInterfaceList* networks, |
| 67 HostScopeVirtualInterfacePolicy policy) { | 67 HostScopeVirtualInterfacePolicy policy) { |
| 68 #if defined(OS_ANDROID) | 68 #if defined(OS_NACL) |
| 69 return false; |
| 70 #elif defined(OS_ANDROID) |
| 69 std::string network_list = android::GetNetworkList(); | 71 std::string network_list = android::GetNetworkList(); |
| 70 base::StringTokenizer network_interfaces(network_list, "\n"); | 72 base::StringTokenizer network_interfaces(network_list, "\n"); |
| 71 while (network_interfaces.GetNext()) { | 73 while (network_interfaces.GetNext()) { |
| 72 std::string network_item = network_interfaces.token(); | 74 std::string network_item = network_interfaces.token(); |
| 73 base::StringTokenizer network_tokenizer(network_item, "\t"); | 75 base::StringTokenizer network_tokenizer(network_item, "\t"); |
| 74 CHECK(network_tokenizer.GetNext()); | 76 CHECK(network_tokenizer.GetNext()); |
| 75 std::string name = network_tokenizer.token(); | 77 std::string name = network_tokenizer.token(); |
| 76 | 78 |
| 77 CHECK(network_tokenizer.GetNext()); | 79 CHECK(network_tokenizer.GetNext()); |
| 78 std::string interface_address = network_tokenizer.token(); | 80 std::string interface_address = network_tokenizer.token(); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 172 |
| 171 return true; | 173 return true; |
| 172 #endif | 174 #endif |
| 173 } | 175 } |
| 174 | 176 |
| 175 WifiPHYLayerProtocol GetWifiPHYLayerProtocol() { | 177 WifiPHYLayerProtocol GetWifiPHYLayerProtocol() { |
| 176 return WIFI_PHY_LAYER_PROTOCOL_UNKNOWN; | 178 return WIFI_PHY_LAYER_PROTOCOL_UNKNOWN; |
| 177 } | 179 } |
| 178 | 180 |
| 179 } // namespace net | 181 } // namespace net |
| OLD | NEW |