Set X-GoogleUpdate headers on Omaha requests.

When sending requests to Omaha, set the custom X-GoogleUpdate-* headers
to help identify the request type without parsing the actual request.

Bug: 28823234
TEST=Added unittests.

Change-Id: I4f0d64b4fc0f69e8a5d4b86337331a3a7a481b35
diff --git a/omaha_request_action.cc b/omaha_request_action.cc
index 7f18cc4..a9143a8 100644
--- a/omaha_request_action.cc
+++ b/omaha_request_action.cc
@@ -77,6 +77,11 @@
 
 static const char* kOmahaUpdaterVersion = "0.1.0.0";
 
+// X-GoogleUpdate headers.
+static const char* kXGoogleUpdateInteractivity = "X-GoogleUpdate-Interactivity";
+static const char* kXGoogleUpdateAppId = "X-GoogleUpdate-AppId";
+static const char* kXGoogleUpdateUpdater = "X-GoogleUpdate-Updater";
+
 // updatecheck attributes (without the underscore prefix).
 static const char* kEolAttr = "eol";
 
@@ -649,6 +654,15 @@
                                     GetInstallDate(system_state_),
                                     system_state_));
 
+  // Set X-GoogleUpdate headers.
+  http_fetcher_->SetHeader(kXGoogleUpdateInteractivity,
+                           params_->interactive() ? "fg" : "bg");
+  http_fetcher_->SetHeader(kXGoogleUpdateAppId, params_->GetAppId());
+  http_fetcher_->SetHeader(
+      kXGoogleUpdateUpdater,
+      base::StringPrintf(
+          "%s-%s", constants::kOmahaUpdaterID, kOmahaUpdaterVersion));
+
   http_fetcher_->SetPostData(request_post.data(), request_post.size(),
                              kHttpContentTypeTextXml);
   LOG(INFO) << "Posting an Omaha request to " << params_->update_url();