OLD | NEW |
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS 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 "update_engine/omaha_request_action.h" | 5 #include "update_engine/omaha_request_action.h" |
| 6 |
6 #include <inttypes.h> | 7 #include <inttypes.h> |
| 8 |
7 #include <sstream> | 9 #include <sstream> |
8 | 10 |
| 11 #include <base/string_number_conversions.h> |
| 12 #include <base/string_util.h> |
| 13 #include <base/time.h> |
| 14 #include <base/logging.h> |
9 #include <libxml/parser.h> | 15 #include <libxml/parser.h> |
10 #include <libxml/xpath.h> | 16 #include <libxml/xpath.h> |
11 #include <libxml/xpathInternals.h> | 17 #include <libxml/xpathInternals.h> |
12 | 18 |
13 #include "base/string_number_conversions.h" | |
14 #include "base/string_util.h" | |
15 #include "base/time.h" | |
16 #include "base/logging.h" | |
17 #include "update_engine/action_pipe.h" | 19 #include "update_engine/action_pipe.h" |
18 #include "update_engine/omaha_request_params.h" | 20 #include "update_engine/omaha_request_params.h" |
19 #include "update_engine/prefs_interface.h" | 21 #include "update_engine/prefs_interface.h" |
20 #include "update_engine/utils.h" | 22 #include "update_engine/utils.h" |
21 | 23 |
22 using base::Time; | 24 using base::Time; |
23 using base::TimeDelta; | 25 using base::TimeDelta; |
24 using std::string; | 26 using std::string; |
25 | 27 |
26 namespace chromeos_update_engine { | 28 namespace chromeos_update_engine { |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 CHECK(nodeset) << "XPath missing NodeSet"; | 372 CHECK(nodeset) << "XPath missing NodeSet"; |
371 CHECK_GE(nodeset->nodeNr, 1); | 373 CHECK_GE(nodeset->nodeNr, 1); |
372 | 374 |
373 xmlNode* updatecheck_node = nodeset->nodeTab[0]; | 375 xmlNode* updatecheck_node = nodeset->nodeTab[0]; |
374 // get status | 376 // get status |
375 if (!xmlHasProp(updatecheck_node, ConstXMLStr("status"))) { | 377 if (!xmlHasProp(updatecheck_node, ConstXMLStr("status"))) { |
376 LOG(ERROR) << "Response missing status"; | 378 LOG(ERROR) << "Response missing status"; |
377 return; | 379 return; |
378 } | 380 } |
379 | 381 |
| 382 OmahaResponse output_object; |
| 383 base::StringToInt(XmlGetProperty(updatecheck_node, "PollInterval"), |
| 384 &output_object.poll_interval); |
380 const string status(XmlGetProperty(updatecheck_node, "status")); | 385 const string status(XmlGetProperty(updatecheck_node, "status")); |
381 OmahaResponse output_object; | |
382 if (status == "noupdate") { | 386 if (status == "noupdate") { |
383 LOG(INFO) << "No update."; | 387 LOG(INFO) << "No update."; |
384 output_object.update_exists = false; | 388 output_object.update_exists = false; |
385 SetOutputObject(output_object); | 389 SetOutputObject(output_object); |
386 completer.set_code(kActionCodeSuccess); | 390 completer.set_code(kActionCodeSuccess); |
387 return; | 391 return; |
388 } | 392 } |
389 | 393 |
390 if (status != "ok") { | 394 if (status != "ok") { |
391 LOG(ERROR) << "Unknown status: " << status; | 395 LOG(ERROR) << "Unknown status: " << status; |
(...skipping 10 matching lines...) Expand all Loading... |
402 output_object.codebase = XmlGetProperty(updatecheck_node, "codebase"); | 406 output_object.codebase = XmlGetProperty(updatecheck_node, "codebase"); |
403 output_object.more_info_url = XmlGetProperty(updatecheck_node, "MoreInfo"); | 407 output_object.more_info_url = XmlGetProperty(updatecheck_node, "MoreInfo"); |
404 output_object.hash = XmlGetProperty(updatecheck_node, "hash"); | 408 output_object.hash = XmlGetProperty(updatecheck_node, "hash"); |
405 output_object.size = ParseInt(XmlGetProperty(updatecheck_node, "size")); | 409 output_object.size = ParseInt(XmlGetProperty(updatecheck_node, "size")); |
406 output_object.needs_admin = | 410 output_object.needs_admin = |
407 XmlGetProperty(updatecheck_node, "needsadmin") == "true"; | 411 XmlGetProperty(updatecheck_node, "needsadmin") == "true"; |
408 output_object.prompt = XmlGetProperty(updatecheck_node, "Prompt") == "true"; | 412 output_object.prompt = XmlGetProperty(updatecheck_node, "Prompt") == "true"; |
409 output_object.is_delta = | 413 output_object.is_delta = |
410 XmlGetProperty(updatecheck_node, "IsDelta") == "true"; | 414 XmlGetProperty(updatecheck_node, "IsDelta") == "true"; |
411 SetOutputObject(output_object); | 415 SetOutputObject(output_object); |
412 return; | |
413 } | 416 } |
414 | 417 |
415 }; // namespace chromeos_update_engine | 418 }; // namespace chromeos_update_engine |
OLD | NEW |