OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/metrics/net/network_metrics_provider.h" | 5 #include "components/metrics/net/network_metrics_provider.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 if (!info.model_name.empty()) | 219 if (!info.model_name.empty()) |
220 vendor->set_model_name(info.model_name); | 220 vendor->set_model_name(info.model_name); |
221 if (!info.device_name.empty()) | 221 if (!info.device_name.empty()) |
222 vendor->set_device_name(info.device_name); | 222 vendor->set_device_name(info.device_name); |
223 | 223 |
224 // Return if OUI list is not provided. | 224 // Return if OUI list is not provided. |
225 if (info.oui_list.empty()) | 225 if (info.oui_list.empty()) |
226 return; | 226 return; |
227 | 227 |
228 // Parse OUI list. | 228 // Parse OUI list. |
229 std::vector<std::string> oui_list; | 229 for (const base::StringPiece& oui_str : base::SplitStringPiece( |
230 base::SplitString(info.oui_list, ' ', &oui_list); | 230 info.oui_list, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) { |
231 for (std::vector<std::string>::const_iterator it = oui_list.begin(); | |
232 it != oui_list.end(); | |
233 ++it) { | |
234 uint32 oui; | 231 uint32 oui; |
235 if (base::HexStringToUInt(*it, &oui)) | 232 if (base::HexStringToUInt(oui_str, &oui)) |
236 vendor->add_element_identifier(oui); | 233 vendor->add_element_identifier(oui); |
237 else | 234 else |
238 NOTREACHED(); | 235 NOTREACHED(); |
239 } | 236 } |
240 } | 237 } |
241 | 238 |
242 } // namespace metrics | 239 } // namespace metrics |
OLD | NEW |