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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 UnescapeRule::SPACES | UnescapeRule::URL_SPECIAL_CHARS); | 120 UnescapeRule::SPACES | UnescapeRule::URL_SPECIAL_CHARS); |
121 | 121 |
122 if (!IsStringUTF8(path)) { | 122 if (!IsStringUTF8(path)) { |
123 // Not UTF-8, assume encoding is native codepage and we're done. We know we | 123 // Not UTF-8, assume encoding is native codepage and we're done. We know we |
124 // are giving the conversion function a nonempty string, and it may fail if | 124 // are giving the conversion function a nonempty string, and it may fail if |
125 // the given string is not in the current encoding and give us an empty | 125 // the given string is not in the current encoding and give us an empty |
126 // string back. We detect this and report failure. | 126 // string back. We detect this and report failure. |
127 file_path_str = base::SysNativeMBToWide(path); | 127 file_path_str = base::SysNativeMBToWide(path); |
128 return !file_path_str.empty(); | 128 return !file_path_str.empty(); |
129 } | 129 } |
130 file_path_str.assign(UTF8ToWide(path)); | 130 file_path_str.assign(base::UTF8ToWide(path)); |
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 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 case dot11_phy_type_erp: | 306 case dot11_phy_type_erp: |
307 return WIFI_PHY_LAYER_PROTOCOL_G; | 307 return WIFI_PHY_LAYER_PROTOCOL_G; |
308 case dot11_phy_type_ht: | 308 case dot11_phy_type_ht: |
309 return WIFI_PHY_LAYER_PROTOCOL_N; | 309 return WIFI_PHY_LAYER_PROTOCOL_N; |
310 default: | 310 default: |
311 return WIFI_PHY_LAYER_PROTOCOL_UNKNOWN; | 311 return WIFI_PHY_LAYER_PROTOCOL_UNKNOWN; |
312 } | 312 } |
313 } | 313 } |
314 | 314 |
315 } // namespace net | 315 } // namespace net |
OLD | NEW |