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/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/posix/eintr_wrapper.h" | 11 #include "base/posix/eintr_wrapper.h" |
12 #include "base/string_tokenizer.h" | |
13 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "base/strings/string_tokenizer.h" |
14 #include "base/threading/thread_restrictions.h" | 14 #include "base/threading/thread_restrictions.h" |
15 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.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 | 19 |
20 #if !defined(OS_ANDROID) | 20 #if !defined(OS_ANDROID) |
21 #include <ifaddrs.h> | 21 #include <ifaddrs.h> |
22 #endif | 22 #endif |
23 #include <net/if.h> | 23 #include <net/if.h> |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 #if defined(OS_ANDROID) | 67 #if defined(OS_ANDROID) |
68 std::string network_list = android::GetNetworkList(); | 68 std::string network_list = android::GetNetworkList(); |
69 StringTokenizer network_interfaces(network_list, ";"); | 69 base::StringTokenizer network_interfaces(network_list, ";"); |
70 while (network_interfaces.GetNext()) { | 70 while (network_interfaces.GetNext()) { |
71 std::string network_item = network_interfaces.token(); | 71 std::string network_item = network_interfaces.token(); |
72 StringTokenizer network_tokenizer(network_item, ","); | 72 base::StringTokenizer network_tokenizer(network_item, ","); |
73 std::string name; | 73 std::string name; |
74 if (!network_tokenizer.GetNext()) | 74 if (!network_tokenizer.GetNext()) |
75 continue; | 75 continue; |
76 name = network_tokenizer.token(); | 76 name = network_tokenizer.token(); |
77 | 77 |
78 std::string literal_address; | 78 std::string literal_address; |
79 if (!network_tokenizer.GetNext()) | 79 if (!network_tokenizer.GetNext()) |
80 continue; | 80 continue; |
81 literal_address = network_tokenizer.token(); | 81 literal_address = network_tokenizer.token(); |
82 | 82 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 } | 135 } |
136 } | 136 } |
137 | 137 |
138 freeifaddrs(interfaces); | 138 freeifaddrs(interfaces); |
139 | 139 |
140 return true; | 140 return true; |
141 #endif | 141 #endif |
142 } | 142 } |
143 | 143 |
144 } // namespace net | 144 } // namespace net |
OLD | NEW |