| 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> |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 "protocol=\"2.0\" " | 81 "protocol=\"2.0\" " |
| 82 "machineid=\"") + XmlEncode(params.machine_id) + | 82 "machineid=\"") + XmlEncode(params.machine_id) + |
| 83 "\" ismachine=\"1\" userid=\"" + XmlEncode(params.user_id) + "\">\n" | 83 "\" ismachine=\"1\" userid=\"" + XmlEncode(params.user_id) + "\">\n" |
| 84 " <o:os version=\"" + XmlEncode(params.os_version) + "\" platform=\"" + | 84 " <o:os version=\"" + XmlEncode(params.os_version) + "\" platform=\"" + |
| 85 XmlEncode(params.os_platform) + "\" sp=\"" + | 85 XmlEncode(params.os_platform) + "\" sp=\"" + |
| 86 XmlEncode(params.os_sp) + "\"></o:os>\n" | 86 XmlEncode(params.os_sp) + "\"></o:os>\n" |
| 87 " <o:app appid=\"" + XmlEncode(params.app_id) + "\" version=\"" + | 87 " <o:app appid=\"" + XmlEncode(params.app_id) + "\" version=\"" + |
| 88 XmlEncode(params.app_version) + "\" " | 88 XmlEncode(params.app_version) + "\" " |
| 89 "lang=\"" + XmlEncode(params.app_lang) + "\" track=\"" + | 89 "lang=\"" + XmlEncode(params.app_lang) + "\" track=\"" + |
| 90 XmlEncode(params.app_track) + "\" board=\"" + | 90 XmlEncode(params.app_track) + "\" board=\"" + |
| 91 XmlEncode(params.os_board) + "\">\n" + body + | 91 XmlEncode(params.os_board) + "\" delta_okay=\"" + |
| 92 (params.delta_okay ? "true" : "false") + "\">\n" + body + |
| 92 " </o:app>\n" | 93 " </o:app>\n" |
| 93 "</o:gupdate>\n"; | 94 "</o:gupdate>\n"; |
| 94 } | 95 } |
| 95 } // namespace {} | 96 } // namespace {} |
| 96 | 97 |
| 97 // Encodes XML entities in a given string with libxml2. input must be | 98 // Encodes XML entities in a given string with libxml2. input must be |
| 98 // UTF-8 formatted. Output will be UTF-8 formatted. | 99 // UTF-8 formatted. Output will be UTF-8 formatted. |
| 99 string XmlEncode(const string& input) { | 100 string XmlEncode(const string& input) { |
| 100 // // TODO(adlr): if allocating a new xmlDoc each time is taking up too much | 101 // // TODO(adlr): if allocating a new xmlDoc each time is taking up too much |
| 101 // // cpu, considering creating one and caching it. | 102 // // cpu, considering creating one and caching it. |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 output_object.needs_admin = | 290 output_object.needs_admin = |
| 290 XmlGetProperty(updatecheck_node, "needsadmin") == "true"; | 291 XmlGetProperty(updatecheck_node, "needsadmin") == "true"; |
| 291 output_object.prompt = XmlGetProperty(updatecheck_node, "Prompt") == "true"; | 292 output_object.prompt = XmlGetProperty(updatecheck_node, "Prompt") == "true"; |
| 292 output_object.is_delta = | 293 output_object.is_delta = |
| 293 XmlGetProperty(updatecheck_node, "IsDelta") == "true"; | 294 XmlGetProperty(updatecheck_node, "IsDelta") == "true"; |
| 294 SetOutputObject(output_object); | 295 SetOutputObject(output_object); |
| 295 return; | 296 return; |
| 296 } | 297 } |
| 297 | 298 |
| 298 }; // namespace chromeos_update_engine | 299 }; // namespace chromeos_update_engine |
| OLD | NEW |