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

Unified Diff: omaha_request_action.cc

Issue 6836025: Add support to update_engine to poke Omaha after an update has been applied (Closed) Base URL: http://git.chromium.org/git/update_engine.git@master
Patch Set: Fixed bug where last ping day was not properly updated Created 9 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: omaha_request_action.cc
diff --git a/omaha_request_action.cc b/omaha_request_action.cc
index a02387ebf5af08f1fca2d70dda1e7355a2d1dc83..f75e443f44014aa8eee22d77f623c113696b8542 100644
--- a/omaha_request_action.cc
+++ b/omaha_request_action.cc
@@ -83,7 +83,7 @@ string GetPingBody(int ping_active_days, int ping_roll_call_days) {
string ping_active = GetPingAttribute("a", ping_active_days);
string ping_roll_call = GetPingAttribute("r", ping_roll_call_days);
if (!ping_active.empty() || !ping_roll_call.empty()) {
- return StringPrintf(" <o:ping%s%s></o:ping>\n",
+ return StringPrintf(" <o:ping active=\"1\"%s%s></o:ping>\n",
ping_active.c_str(),
ping_roll_call.c_str());
}
@@ -92,13 +92,15 @@ string GetPingBody(int ping_active_days, int ping_roll_call_days) {
string FormatRequest(const OmahaEvent* event,
const OmahaRequestParams& params,
+ bool ping_only,
int ping_active_days,
int ping_roll_call_days,
PrefsInterface* prefs) {
string body;
if (event == NULL) {
- body = GetPingBody(ping_active_days, ping_roll_call_days) +
- " <o:updatecheck></o:updatecheck>\n";
+ body = GetPingBody(ping_active_days, ping_roll_call_days);
+ if (!ping_only)
+ body += " <o:updatecheck></o:updatecheck>\n";
// If this is the first update check after a reboot following a previous
// update, generate an event containing the previous version number. If the
// previous version preference file doesn't exist the event is still
@@ -173,11 +175,13 @@ string XmlEncode(const string& input) {
OmahaRequestAction::OmahaRequestAction(PrefsInterface* prefs,
const OmahaRequestParams& params,
OmahaEvent* event,
- HttpFetcher* http_fetcher)
+ HttpFetcher* http_fetcher,
+ bool ping_only)
: prefs_(prefs),
params_(params),
event_(event),
http_fetcher_(http_fetcher),
+ ping_only_(ping_only),
ping_active_days_(0),
ping_roll_call_days_(0),
should_skip_(false) {}
@@ -225,6 +229,7 @@ void OmahaRequestAction::PerformAction() {
InitPingDays();
string request_post(FormatRequest(event_.get(),
params_,
+ ping_only_,
ping_active_days_,
ping_roll_call_days_,
prefs_));
@@ -373,12 +378,6 @@ void OmahaRequestAction::TransferComplete(HttpFetcher *fetcher,
kActionCodeOmahaRequestHTTPResponseBase + code));
return;
}
- if (!HasOutputPipe()) {
- // Just set success to whether or not the http transfer succeeded,
- // which must be true at this point in the code.
- completer.set_code(kActionCodeSuccess);
- return;
- }
// parse our response and fill the fields in the output object
scoped_ptr_malloc<xmlDoc, ScopedPtrXmlDocFree> doc(
@@ -401,6 +400,13 @@ void OmahaRequestAction::TransferComplete(HttpFetcher *fetcher,
<< "Failed to update the last ping day preferences!";
}
+ if (!HasOutputPipe()) {
+ // Just set success to whether or not the http transfer succeeded,
+ // which must be true at this point in the code.
+ completer.set_code(kActionCodeSuccess);
+ return;
+ }
+
static const char* kNamespace("x");
static const char* kUpdatecheckNodeXpath("/x:gupdate/x:app/x:updatecheck");
static const char* kNsUrl("http://www.google.com/update2/response");

Powered by Google App Engine
This is Rietveld 408576698