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 |
7 #include <inttypes.h> | 7 #include <inttypes.h> |
8 | 8 |
9 #include <sstream> | 9 #include <sstream> |
10 | 10 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 string prev_version; | 107 string prev_version; |
108 if (!prefs->GetString(kPrefsPreviousVersion, &prev_version)) { | 108 if (!prefs->GetString(kPrefsPreviousVersion, &prev_version)) { |
109 prev_version = "0.0.0.0"; | 109 prev_version = "0.0.0.0"; |
110 } | 110 } |
111 if (!prev_version.empty()) { | 111 if (!prev_version.empty()) { |
112 body += StringPrintf( | 112 body += StringPrintf( |
113 " <o:event eventtype=\"%d\" eventresult=\"%d\" " | 113 " <o:event eventtype=\"%d\" eventresult=\"%d\" " |
114 "previousversion=\"%s\"></o:event>\n", | 114 "previousversion=\"%s\"></o:event>\n", |
115 OmahaEvent::kTypeUpdateComplete, | 115 OmahaEvent::kTypeUpdateComplete, |
116 OmahaEvent::kResultSuccessReboot, | 116 OmahaEvent::kResultSuccessReboot, |
117 prev_version.c_str()); | 117 XmlEncode(prev_version).c_str()); |
118 LOG_IF(WARNING, !prefs->SetString(kPrefsPreviousVersion, "")) | 118 LOG_IF(WARNING, !prefs->SetString(kPrefsPreviousVersion, "")) |
119 << "Unable to reset the previous version."; | 119 << "Unable to reset the previous version."; |
120 } | 120 } |
121 } else { | 121 } else { |
122 // The error code is an optional attribute so append it only if the result | 122 // The error code is an optional attribute so append it only if the result |
123 // is not success. | 123 // is not success. |
124 string error_code; | 124 string error_code; |
125 if (event->result != OmahaEvent::kResultSuccess) { | 125 if (event->result != OmahaEvent::kResultSuccess) { |
126 int code = event->error_code; | 126 int code = event->error_code; |
127 if (!utils::IsNormalBootMode()) { | 127 if (!utils::IsNormalBootMode()) { |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 output_object.needs_admin = | 453 output_object.needs_admin = |
454 XmlGetProperty(updatecheck_node, "needsadmin") == "true"; | 454 XmlGetProperty(updatecheck_node, "needsadmin") == "true"; |
455 output_object.prompt = XmlGetProperty(updatecheck_node, "Prompt") == "true"; | 455 output_object.prompt = XmlGetProperty(updatecheck_node, "Prompt") == "true"; |
456 output_object.is_delta = | 456 output_object.is_delta = |
457 XmlGetProperty(updatecheck_node, "IsDelta") == "true"; | 457 XmlGetProperty(updatecheck_node, "IsDelta") == "true"; |
458 output_object.deadline = XmlGetProperty(updatecheck_node, "deadline"); | 458 output_object.deadline = XmlGetProperty(updatecheck_node, "deadline"); |
459 SetOutputObject(output_object); | 459 SetOutputObject(output_object); |
460 } | 460 } |
461 | 461 |
462 }; // namespace chromeos_update_engine | 462 }; // namespace chromeos_update_engine |
OLD | NEW |