Enforce handling of expected payload versions only.

We have always shipped version 1 payloads, but have never checked the
version number. This change enforces that, so we refuse to process
any other version number.

The new error code kErrorCodeUnsupportedPayloadVersion is added to
report bad payload versions if they are received.

BUG=chromium:312526
TEST=Unittests.

Change-Id: I25c9f7e73c37274527bc7cc9ba9e3d9f4734326c
Reviewed-on: https://chromium-review.googlesource.com/174940
Commit-Queue: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
diff --git a/error_code.h b/error_code.h
index 65a5533..5853c1b 100644
--- a/error_code.h
+++ b/error_code.h
@@ -53,11 +53,15 @@
   kErrorCodePostinstallPowerwashError = 41,
   kErrorCodeUpdateCanceledByChannelChange = 42,
   kErrorCodePostinstallFirmwareRONotUpdatable = 43,
+  kErrorCodeUnsupportedMajorPayloadVersion = 44,
+  kErrorCodeUnsupportedMinorPayloadVersion = 45,
 
-  // Note: When adding new error codes, please remember to add the
-  // error into one of the buckets in PayloadState::UpdateFailed method so
-  // that the retries across URLs and the payload backoff mechanism work
-  // correctly for those new error codes.
+  // VERY IMPORTANT! When adding new error codes:
+  //
+  // 1) Update tools/metrics/histograms/histograms.xml in Chrome.
+  //
+  // 2) Update the assorted switch statements in update_engine which won't
+  //    build until this case is added.
 
   // Any code above this is sent to both Omaha and UMA as-is, except
   // kErrorCodeOmahaErrorInHTTPResponse (see error code 2000 for more details).