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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 } | 112 } |
113 | 113 |
114 if (path.empty()) | 114 if (path.empty()) |
115 return false; | 115 return false; |
116 std::replace(path.begin(), path.end(), '/', '\\'); | 116 std::replace(path.begin(), path.end(), '/', '\\'); |
117 | 117 |
118 // GURL stores strings as percent-encoded UTF-8, this will undo if possible. | 118 // GURL stores strings as percent-encoded UTF-8, this will undo if possible. |
119 path = UnescapeURLComponent(path, | 119 path = UnescapeURLComponent(path, |
120 UnescapeRule::SPACES | UnescapeRule::URL_SPECIAL_CHARS); | 120 UnescapeRule::SPACES | UnescapeRule::URL_SPECIAL_CHARS); |
121 | 121 |
122 if (!IsStringUTF8(path)) { | 122 if (!base::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(base::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 |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 case dot11_phy_type_erp: | 307 case dot11_phy_type_erp: |
308 return WIFI_PHY_LAYER_PROTOCOL_G; | 308 return WIFI_PHY_LAYER_PROTOCOL_G; |
309 case dot11_phy_type_ht: | 309 case dot11_phy_type_ht: |
310 return WIFI_PHY_LAYER_PROTOCOL_N; | 310 return WIFI_PHY_LAYER_PROTOCOL_N; |
311 default: | 311 default: |
312 return WIFI_PHY_LAYER_PROTOCOL_UNKNOWN; | 312 return WIFI_PHY_LAYER_PROTOCOL_UNKNOWN; |
313 } | 313 } |
314 } | 314 } |
315 | 315 |
316 } // namespace net | 316 } // namespace net |
OLD | NEW |