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/update_client/update_response.h" | 5 #include "components/update_client/update_response.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 | 295 |
296 // Parses a single <app> tag. | 296 // Parses a single <app> tag. |
297 bool ParseAppTag(xmlNode* app, | 297 bool ParseAppTag(xmlNode* app, |
298 UpdateResponse::Result* result, | 298 UpdateResponse::Result* result, |
299 std::string* error) { | 299 std::string* error) { |
300 // Read cohort information. | 300 // Read cohort information. |
301 auto cohort = GetAttributePtr(app, "cohort"); | 301 auto cohort = GetAttributePtr(app, "cohort"); |
302 static const char* attrs[] = {UpdateResponse::Result::kCohort, | 302 static const char* attrs[] = {UpdateResponse::Result::kCohort, |
303 UpdateResponse::Result::kCohortHint, | 303 UpdateResponse::Result::kCohortHint, |
304 UpdateResponse::Result::kCohortName}; | 304 UpdateResponse::Result::kCohortName}; |
305 for (const auto& attr : attrs) { | 305 for (auto* attr : attrs) { |
306 auto value = GetAttributePtr(app, attr); | 306 auto value = GetAttributePtr(app, attr); |
307 if (value) | 307 if (value) |
308 result->cohort_attrs.insert({attr, *value}); | 308 result->cohort_attrs.insert({attr, *value}); |
309 } | 309 } |
310 | 310 |
311 // Read the crx id. | 311 // Read the crx id. |
312 result->extension_id = GetAttribute(app, "appid"); | 312 result->extension_id = GetAttribute(app, "appid"); |
313 if (result->extension_id.empty()) { | 313 if (result->extension_id.empty()) { |
314 *error = "Missing appid on app node"; | 314 *error = "Missing appid on app node"; |
315 return false; | 315 return false; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 results_.list.push_back(result); | 392 results_.list.push_back(result); |
393 } else { | 393 } else { |
394 ParseError("%s", error.c_str()); | 394 ParseError("%s", error.c_str()); |
395 } | 395 } |
396 } | 396 } |
397 | 397 |
398 return true; | 398 return true; |
399 } | 399 } |
400 | 400 |
401 } // namespace update_client | 401 } // namespace update_client |
OLD | NEW |