OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chromeos/network/shill_property_util.h" | 5 #include "chromeos/network/shill_property_util.h" |
6 | 6 |
7 #include "base/i18n/icu_encoding_detection.h" | 7 #include "base/i18n/icu_encoding_detection.h" |
8 #include "base/i18n/icu_string_conversions.h" | 8 #include "base/i18n/icu_string_conversions.h" |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 ssid = std::string(raw_ssid_bytes.begin(), raw_ssid_bytes.end()); | 81 ssid = std::string(raw_ssid_bytes.begin(), raw_ssid_bytes.end()); |
82 NET_LOG_DEBUG( | 82 NET_LOG_DEBUG( |
83 "GetSSIDFromProperties", | 83 "GetSSIDFromProperties", |
84 base::StringPrintf("%s, SSID: %s", hex_ssid.c_str(), ssid.c_str())); | 84 base::StringPrintf("%s, SSID: %s", hex_ssid.c_str(), ssid.c_str())); |
85 } else { | 85 } else { |
86 NET_LOG_ERROR("GetSSIDFromProperties", | 86 NET_LOG_ERROR("GetSSIDFromProperties", |
87 base::StringPrintf("Error processing: %s", hex_ssid.c_str())); | 87 base::StringPrintf("Error processing: %s", hex_ssid.c_str())); |
88 return std::string(); | 88 return std::string(); |
89 } | 89 } |
90 | 90 |
91 if (IsStringUTF8(ssid)) | 91 if (base::IsStringUTF8(ssid)) |
92 return ssid; | 92 return ssid; |
93 | 93 |
94 // Detect encoding and convert to UTF-8. | 94 // Detect encoding and convert to UTF-8. |
95 std::string encoding; | 95 std::string encoding; |
96 if (!base::DetectEncoding(ssid, &encoding)) { | 96 if (!base::DetectEncoding(ssid, &encoding)) { |
97 // TODO(stevenjb): This is currently experimental. If we find a case where | 97 // TODO(stevenjb): This is currently experimental. If we find a case where |
98 // base::DetectEncoding() fails, we need to figure out whether we can use | 98 // base::DetectEncoding() fails, we need to figure out whether we can use |
99 // country_code with ConvertToUtf8(). crbug.com/233267. | 99 // country_code with ConvertToUtf8(). crbug.com/233267. |
100 properties.GetStringWithoutPathExpansion(shill::kCountryProperty, | 100 properties.GetStringWithoutPathExpansion(shill::kCountryProperty, |
101 &encoding); | 101 &encoding); |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 if (!str.empty()) | 396 if (!str.empty()) |
397 str += "|"; | 397 str += "|"; |
398 str += shill_type_to_flag[i].shill_network_type; | 398 str += shill_type_to_flag[i].shill_network_type; |
399 } | 399 } |
400 return str; | 400 return str; |
401 } | 401 } |
402 | 402 |
403 NetworkTypePattern::NetworkTypePattern(int pattern) : pattern_(pattern) {} | 403 NetworkTypePattern::NetworkTypePattern(int pattern) : pattern_(pattern) {} |
404 | 404 |
405 } // namespace chromeos | 405 } // namespace chromeos |
OLD | NEW |