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 #include <inttypes.h> | 6 #include <inttypes.h> |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include <libxml/parser.h> | 9 #include <libxml/parser.h> |
10 #include <libxml/xpath.h> | 10 #include <libxml/xpath.h> |
11 #include <libxml/xpathInternals.h> | 11 #include <libxml/xpathInternals.h> |
12 | 12 |
| 13 #include "base/string_number_conversions.h" |
13 #include "base/string_util.h" | 14 #include "base/string_util.h" |
14 #include "base/time.h" | 15 #include "base/time.h" |
15 #include "chromeos/obsolete_logging.h" | 16 #include "base/logging.h" |
16 #include "update_engine/action_pipe.h" | 17 #include "update_engine/action_pipe.h" |
17 #include "update_engine/omaha_request_params.h" | 18 #include "update_engine/omaha_request_params.h" |
18 #include "update_engine/prefs_interface.h" | 19 #include "update_engine/prefs_interface.h" |
19 #include "update_engine/utils.h" | 20 #include "update_engine/utils.h" |
20 | 21 |
21 using base::Time; | 22 using base::Time; |
22 using base::TimeDelta; | 23 using base::TimeDelta; |
23 using std::string; | 24 using std::string; |
24 | 25 |
25 namespace chromeos_update_engine { | 26 namespace chromeos_update_engine { |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 ConstXMLStr(kNamespace), | 288 ConstXMLStr(kNamespace), |
288 ConstXMLStr(kNsUrl))); | 289 ConstXMLStr(kNsUrl))); |
289 TEST_AND_RETURN_FALSE(xpath_nodeset.get()); | 290 TEST_AND_RETURN_FALSE(xpath_nodeset.get()); |
290 xmlNodeSet* nodeset = xpath_nodeset->nodesetval; | 291 xmlNodeSet* nodeset = xpath_nodeset->nodesetval; |
291 TEST_AND_RETURN_FALSE(nodeset && nodeset->nodeNr >= 1); | 292 TEST_AND_RETURN_FALSE(nodeset && nodeset->nodeNr >= 1); |
292 xmlNode* daystart_node = nodeset->nodeTab[0]; | 293 xmlNode* daystart_node = nodeset->nodeTab[0]; |
293 TEST_AND_RETURN_FALSE(xmlHasProp(daystart_node, | 294 TEST_AND_RETURN_FALSE(xmlHasProp(daystart_node, |
294 ConstXMLStr("elapsed_seconds"))); | 295 ConstXMLStr("elapsed_seconds"))); |
295 | 296 |
296 int64_t elapsed_seconds = 0; | 297 int64_t elapsed_seconds = 0; |
297 TEST_AND_RETURN_FALSE(StringToInt64(XmlGetProperty(daystart_node, | 298 TEST_AND_RETURN_FALSE(base::StringToInt64(XmlGetProperty(daystart_node, |
298 "elapsed_seconds"), | 299 "elapsed_seconds"), |
299 &elapsed_seconds)); | 300 &elapsed_seconds)); |
300 TEST_AND_RETURN_FALSE(elapsed_seconds >= 0); | 301 TEST_AND_RETURN_FALSE(elapsed_seconds >= 0); |
301 | 302 |
302 // Remember the local time that matches the server's last midnight | 303 // Remember the local time that matches the server's last midnight |
303 // time. | 304 // time. |
304 Time daystart = Time::Now() - TimeDelta::FromSeconds(elapsed_seconds); | 305 Time daystart = Time::Now() - TimeDelta::FromSeconds(elapsed_seconds); |
305 prefs->SetInt64(kPrefsLastActivePingDay, daystart.ToInternalValue()); | 306 prefs->SetInt64(kPrefsLastActivePingDay, daystart.ToInternalValue()); |
306 prefs->SetInt64(kPrefsLastRollCallPingDay, daystart.ToInternalValue()); | 307 prefs->SetInt64(kPrefsLastRollCallPingDay, daystart.ToInternalValue()); |
307 return true; | 308 return true; |
308 } | 309 } |
309 } // namespace {} | 310 } // namespace {} |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 output_object.needs_admin = | 406 output_object.needs_admin = |
406 XmlGetProperty(updatecheck_node, "needsadmin") == "true"; | 407 XmlGetProperty(updatecheck_node, "needsadmin") == "true"; |
407 output_object.prompt = XmlGetProperty(updatecheck_node, "Prompt") == "true"; | 408 output_object.prompt = XmlGetProperty(updatecheck_node, "Prompt") == "true"; |
408 output_object.is_delta = | 409 output_object.is_delta = |
409 XmlGetProperty(updatecheck_node, "IsDelta") == "true"; | 410 XmlGetProperty(updatecheck_node, "IsDelta") == "true"; |
410 SetOutputObject(output_object); | 411 SetOutputObject(output_object); |
411 return; | 412 return; |
412 } | 413 } |
413 | 414 |
414 }; // namespace chromeos_update_engine | 415 }; // namespace chromeos_update_engine |
OLD | NEW |