Added X-GoogleUpdate-Updater and X-GoogleUpdate-AppId headers to CUS.

As part of the ddos mitigations, implemented all three ddos headers in
the component updater. The base::Optional implementation of the
feature is removed. Instead, the headers are passed using a map of
string to string.

There is an unrelated error handling change to invoke the callback if
for some reason, the caller is passing in no component id in the Update call.

Bug: 813193
Change-Id: I26e86564c13c0a5991027a6612dcdefbf991bfab
Reviewed-on: https://chromium-review.googlesource.com/938636
Reviewed-by: Joshua Pawlicki <[email protected]>
Commit-Queue: Sorin Jianu <[email protected]>
Cr-Commit-Position: refs/heads/master@{#539853}
diff --git a/components/update_client/request_sender.h b/components/update_client/request_sender.h
index f833fe4..91a83c9 100644
--- a/components/update_client/request_sender.h
+++ b/components/update_client/request_sender.h
@@ -7,6 +7,7 @@
 
 #include <stdint.h>
 
+#include <map>
 #include <memory>
 #include <string>
 #include <vector>
@@ -14,7 +15,6 @@
 #include "base/callback.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/optional.h"
 #include "base/threading/thread_checker.h"
 #include "net/url_request/url_fetcher_delegate.h"
 #include "url/gurl.h"
@@ -61,10 +61,10 @@
   // If this optional parameter is set, the values of "fg" or "bg" are sent
   // for true or false values of this parameter. Otherwise the header is not
   // sent at all.
-  void Send(bool use_signing,
+  void Send(const std::vector<GURL>& urls,
+            const std::map<std::string, std::string>& request_extra_headers,
             const std::string& request_body,
-            base::Optional<bool> is_foreground,
-            const std::vector<GURL>& urls,
+            bool use_signing,
             RequestSenderCallback request_sender_callback);
 
  private:
@@ -103,10 +103,11 @@
   base::ThreadChecker thread_checker_;
 
   const scoped_refptr<Configurator> config_;
-  bool use_signing_;  // True if CUP signing is used.
+
   std::vector<GURL> urls_;
+  std::map<std::string, std::string> request_extra_headers_;
   std::string request_body_;
-  base::Optional<bool> is_foreground_;
+  bool use_signing_;  // True if CUP signing is used.
   RequestSenderCallback request_sender_callback_;
 
   std::string public_key_;