Support for processing multiple URLs in update_engine.

Main changes:
1. Added a new PayloadState class which encapsulates all the persisted
state we use for multiple URLs, back-off (TBD), etc.
2. Added support for handling multiple URLs stored in the OmahaResponse in
OmahaRequestAction and OmahaResponseHandlerAction code.
3. Added support for picking the right URL in OmahaResponseHandlerAction
and putting it in the install_plan. This way, the rest of the code that
uses the install_plan is oblivious to the presence of multiple URLs :-)
4. Added support for advancing to next URL when an update fails. The full
error classification is a new work item (chromium-os:37206). Right now,
it's a basic round-robin on every error.
5. Updated the conditions for determining when hash checks are mandatory.
Previously since there was only one URL, if it was HTTPS, the checks were
waived. Now, even if there's one HTTP URL, we make hash checks mandatory
even if other HTTPS URLs are present.

6. Added new unit tests for PayloadState and the new logic added to other
places.

Noisy changes:
1. Instead of passing PrefsInterface to OmahaRequestAction and
OmahaResponseHandlerAction, we're now passing SystemState which will now
contain PrefsInterface and the newly added PayloadState object that these
actions need to do their work.
2. Renamed a bunch of setters/getters to set_x() and x() instead of SetX()
and GetX() methods - this was pending from Gilad's old CR. As I'm
adding new methods in the correct style, I went ahead and fixed it to
avoid the confusing styles.
3. Updated all existing unit tests to reflect these changes.

BUG=chromium-os:36807
TEST=All Single/Multiple URL scenarios work fine on my ZGB as expected.
TEST=Old and new unit tests run fine.

Change-Id: Id31f9ccb220471f3ec3a475f624dc03c16119144
Reviewed-on: https://gerrit.chromium.org/gerrit/39638
Commit-Ready: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
diff --git a/omaha_request_action.h b/omaha_request_action.h
index 8a5a5d5..bc9b4fe 100644
--- a/omaha_request_action.h
+++ b/omaha_request_action.h
@@ -10,6 +10,7 @@
 #include <fcntl.h>
 
 #include <string>
+#include <vector>
 
 #include <base/memory/scoped_ptr.h>
 #include <curl/curl.h>
@@ -46,7 +47,11 @@
 
   // These are only valid if update_exists is true:
   std::string display_version;
-  std::string codebase;
+
+  // The ordered list of URLs in the Omaha response. Each item is a complete
+  // URL (i.e. in terms of Omaha XML, each value is a urlBase + packageName)
+  std::vector<std::string> payload_urls;
+
   std::string more_info_url;
   std::string hash;
   std::string metadata_signature;
@@ -142,7 +147,7 @@
   // OmahaRequestAction(..., new OmahaEvent(...), new WhateverHttpFetcher);
   // or
   // OmahaRequestAction(..., NULL, new WhateverHttpFetcher);
-  OmahaRequestAction(PrefsInterface* prefs,
+  OmahaRequestAction(SystemState* system_state,
                      OmahaRequestParams* params,
                      OmahaEvent* event,
                      HttpFetcher* http_fetcher,
@@ -228,8 +233,8 @@
                    OmahaResponse* output_object,
                    ScopedActionCompleter* completer);
 
-  // Access to the preferences store.
-  PrefsInterface* prefs_;
+  // Global system context.
+  SystemState* system_state_;
 
   // Contains state that is relevant in the processing of the Omaha request.
   OmahaRequestParams* params_;