| 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 | 284 |
| 285 // Parses a single <app> tag. | 285 // Parses a single <app> tag. |
| 286 bool ParseAppTag(xmlNode* app, | 286 bool ParseAppTag(xmlNode* app, |
| 287 UpdateResponse::Result* result, | 287 UpdateResponse::Result* result, |
| 288 std::string* error) { | 288 std::string* error) { |
| 289 // Read cohort information. | 289 // Read cohort information. |
| 290 auto cohort = GetAttributePtr(app, "cohort"); | 290 auto cohort = GetAttributePtr(app, "cohort"); |
| 291 static const char* attrs[] = {UpdateResponse::Result::kCohort, | 291 static const char* attrs[] = {UpdateResponse::Result::kCohort, |
| 292 UpdateResponse::Result::kCohortHint, | 292 UpdateResponse::Result::kCohortHint, |
| 293 UpdateResponse::Result::kCohortName}; | 293 UpdateResponse::Result::kCohortName}; |
| 294 for (const auto& attr : attrs) { | 294 for (auto* attr : attrs) { |
| 295 auto value = GetAttributePtr(app, attr); | 295 auto value = GetAttributePtr(app, attr); |
| 296 if (value) | 296 if (value) |
| 297 result->cohort_attrs.insert({attr, *value}); | 297 result->cohort_attrs.insert({attr, *value}); |
| 298 } | 298 } |
| 299 | 299 |
| 300 // Read the crx id. | 300 // Read the crx id. |
| 301 result->extension_id = GetAttribute(app, "appid"); | 301 result->extension_id = GetAttribute(app, "appid"); |
| 302 if (result->extension_id.empty()) { | 302 if (result->extension_id.empty()) { |
| 303 *error = "Missing appid on app node"; | 303 *error = "Missing appid on app node"; |
| 304 return false; | 304 return false; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 results_.list.push_back(result); | 381 results_.list.push_back(result); |
| 382 } else { | 382 } else { |
| 383 ParseError("%s", error.c_str()); | 383 ParseError("%s", error.c_str()); |
| 384 } | 384 } |
| 385 } | 385 } |
| 386 | 386 |
| 387 return true; | 387 return true; |
| 388 } | 388 } |
| 389 | 389 |
| 390 } // namespace update_client | 390 } // namespace update_client |
| OLD | NEW |