OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <iphlpapi.h> | 7 #include <iphlpapi.h> |
8 #include <wlanapi.h> | 8 #include <wlanapi.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 131 |
132 // We used to try too hard and see if |path| made up entirely of | 132 // We used to try too hard and see if |path| made up entirely of |
133 // the 1st 256 characters in the Unicode was a zero-extended UTF-16. | 133 // the 1st 256 characters in the Unicode was a zero-extended UTF-16. |
134 // If so, we converted it to 'Latin-1' and checked if the result was UTF-8. | 134 // If so, we converted it to 'Latin-1' and checked if the result was UTF-8. |
135 // If the check passed, we converted the result to UTF-8. | 135 // If the check passed, we converted the result to UTF-8. |
136 // Otherwise, we treated the result as the native OS encoding. | 136 // Otherwise, we treated the result as the native OS encoding. |
137 // However, that led to http://crbug.com/4619 and http://crbug.com/14153 | 137 // However, that led to http://crbug.com/4619 and http://crbug.com/14153 |
138 return true; | 138 return true; |
139 } | 139 } |
140 | 140 |
141 bool GetNetworkList(NetworkInterfaceList* networks, | 141 bool GetNetworkList(NetworkInterfaceList* networks, int policy) { |
142 HostScopeVirtualInterfacePolicy policy) { | |
143 // GetAdaptersAddresses() may require IO operations. | 142 // GetAdaptersAddresses() may require IO operations. |
144 base::ThreadRestrictions::AssertIOAllowed(); | 143 base::ThreadRestrictions::AssertIOAllowed(); |
145 bool is_xp = base::win::GetVersion() < base::win::VERSION_VISTA; | 144 bool is_xp = base::win::GetVersion() < base::win::VERSION_VISTA; |
146 ULONG len = 0; | 145 ULONG len = 0; |
147 ULONG flags = is_xp ? GAA_FLAG_INCLUDE_PREFIX : 0; | 146 ULONG flags = is_xp ? GAA_FLAG_INCLUDE_PREFIX : 0; |
148 // First get number of networks. | 147 // First get number of networks. |
149 ULONG result = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, NULL, &len); | 148 ULONG result = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, NULL, &len); |
150 if (result != ERROR_BUFFER_OVERFLOW) { | 149 if (result != ERROR_BUFFER_OVERFLOW) { |
151 // There are 0 networks. | 150 // There are 0 networks. |
152 return true; | 151 return true; |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 case dot11_phy_type_erp: | 306 case dot11_phy_type_erp: |
308 return WIFI_PHY_LAYER_PROTOCOL_G; | 307 return WIFI_PHY_LAYER_PROTOCOL_G; |
309 case dot11_phy_type_ht: | 308 case dot11_phy_type_ht: |
310 return WIFI_PHY_LAYER_PROTOCOL_N; | 309 return WIFI_PHY_LAYER_PROTOCOL_N; |
311 default: | 310 default: |
312 return WIFI_PHY_LAYER_PROTOCOL_UNKNOWN; | 311 return WIFI_PHY_LAYER_PROTOCOL_UNKNOWN; |
313 } | 312 } |
314 } | 313 } |
315 | 314 |
316 } // namespace net | 315 } // namespace net |
OLD | NEW |