Send UMA Stats for update engine error codes.

With the latest addition of new optional security checks for the update
manifest and operations checked in, we now want to track the number of
failures, if any, over time to help us decide when it is safe to make
the new security checks mandatory. This CL adds the UMA metric for
reporting the new (as well as the old) error codes to UMA for the first
time.

There's no change to the existing errors that are being sent to Omaha.
Due to UMA restrictions, some Omaha codes will be aggregated when being
sent to UMA.

BUG=chromium-os:34299
TEST=Unit tests pass, tested on real ZGB, all stats show up in
     chrome://histograms correctly for both dev mode and normal mode.
Change-Id: I3ce4645636311cedbb33f601e775951966c0a545
Reviewed-on: https://gerrit.chromium.org/gerrit/36408
Commit-Ready: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
diff --git a/delta_performer.h b/delta_performer.h
index a484096..0bdf7ca 100644
--- a/delta_performer.h
+++ b/delta_performer.h
@@ -15,6 +15,7 @@
 #include "update_engine/file_writer.h"
 #include "update_engine/install_plan.h"
 #include "update_engine/omaha_hash_calculator.h"
+#include "update_engine/system_state.h"
 #include "update_engine/update_metadata.pb.h"
 
 namespace chromeos_update_engine {
@@ -36,8 +37,11 @@
   static const uint64_t kDeltaManifestSizeSize;
   static const char kUpdatePayloadPublicKeyPath[];
 
-  DeltaPerformer(PrefsInterface* prefs, InstallPlan* install_plan)
+  DeltaPerformer(PrefsInterface* prefs,
+                 SystemState* system_state,
+                 InstallPlan* install_plan)
       : prefs_(prefs),
+        system_state_(system_state),
         install_plan_(install_plan),
         fd_(-1),
         kernel_fd_(-1),
@@ -212,9 +216,15 @@
   // update. Returns false otherwise.
   bool PrimeUpdateState();
 
+  // Sends UMA statistics for the given error code.
+  void SendUMAStat(ActionExitCode code);
+
   // Update Engine preference store.
   PrefsInterface* prefs_;
 
+  // Global context of the system.
+  SystemState* system_state_;
+
   // Install Plan based on Omaha Response.
   InstallPlan* install_plan_;