Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: omaha_request_action.cc

Issue 3035007: Switch OmahaEvent's error_code to ActionExitCode. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: explicit single argument ctor Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « omaha_request_action.h ('k') | omaha_request_action_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 }; 62 };
63 63
64 string FormatRequest(const OmahaEvent* event, 64 string FormatRequest(const OmahaEvent* event,
65 const OmahaRequestParams& params) { 65 const OmahaRequestParams& params) {
66 string body; 66 string body;
67 if (event == NULL) { 67 if (event == NULL) {
68 body = string( 68 body = string(
69 " <o:ping active=\"0\"></o:ping>\n" 69 " <o:ping active=\"0\"></o:ping>\n"
70 " <o:updatecheck></o:updatecheck>\n"); 70 " <o:updatecheck></o:updatecheck>\n");
71 } else { 71 } else {
72 // The error code is an optional attribute so append it only if
73 // the result is not success.
74 string error_code;
75 if (event->result != OmahaEvent::kResultSuccess) {
76 error_code = StringPrintf(" errorcode=\"%d\"", event->error_code);
77 }
72 body = StringPrintf( 78 body = StringPrintf(
73 " <o:event eventtype=\"%d\" eventresult=\"%d\" " 79 " <o:event eventtype=\"%d\" eventresult=\"%d\"%s></o:event>\n",
74 "errorcode=\"%d\"></o:event>\n", 80 event->type, event->result, error_code.c_str());
75 event->type, event->result, event->error_code);
76 } 81 }
77 return string("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" 82 return string("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
78 "<o:gupdate xmlns:o=\"http://www.google.com/update2/request\" " 83 "<o:gupdate xmlns:o=\"http://www.google.com/update2/request\" "
79 "version=\"" + XmlEncode(kGupdateVersion) + "\" " 84 "version=\"" + XmlEncode(kGupdateVersion) + "\" "
80 "updaterversion=\"" + XmlEncode(kGupdateVersion) + "\" " 85 "updaterversion=\"" + XmlEncode(kGupdateVersion) + "\" "
81 "protocol=\"2.0\" " 86 "protocol=\"2.0\" "
82 "machineid=\"") + XmlEncode(params.machine_id) + 87 "machineid=\"") + XmlEncode(params.machine_id) +
83 "\" ismachine=\"1\" userid=\"" + XmlEncode(params.user_id) + "\">\n" 88 "\" ismachine=\"1\" userid=\"" + XmlEncode(params.user_id) + "\">\n"
84 " <o:os version=\"" + XmlEncode(params.os_version) + "\" platform=\"" + 89 " <o:os version=\"" + XmlEncode(params.os_version) + "\" platform=\"" +
85 XmlEncode(params.os_platform) + "\" sp=\"" + 90 XmlEncode(params.os_platform) + "\" sp=\"" +
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 output_object.needs_admin = 295 output_object.needs_admin =
291 XmlGetProperty(updatecheck_node, "needsadmin") == "true"; 296 XmlGetProperty(updatecheck_node, "needsadmin") == "true";
292 output_object.prompt = XmlGetProperty(updatecheck_node, "Prompt") == "true"; 297 output_object.prompt = XmlGetProperty(updatecheck_node, "Prompt") == "true";
293 output_object.is_delta = 298 output_object.is_delta =
294 XmlGetProperty(updatecheck_node, "IsDelta") == "true"; 299 XmlGetProperty(updatecheck_node, "IsDelta") == "true";
295 SetOutputObject(output_object); 300 SetOutputObject(output_object);
296 return; 301 return;
297 } 302 }
298 303
299 }; // namespace chromeos_update_engine 304 }; // namespace chromeos_update_engine
OLDNEW
« no previous file with comments | « omaha_request_action.h ('k') | omaha_request_action_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698