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/utils.h b/utils.h
index 1b3095b..e7bf288 100644
--- a/utils.h
+++ b/utils.h
@@ -16,12 +16,15 @@
 #include <base/time.h>
 #include <ext2fs/ext2fs.h>
 #include <glib.h>
+#include "metrics/metrics_library.h"
 
 #include "update_engine/action.h"
 #include "update_engine/action_processor.h"
 
 namespace chromeos_update_engine {
 
+class InstallPlan;
+
 namespace utils {
 
 // Returns true if this is an official Chrome OS build, false otherwise.
@@ -275,6 +278,11 @@
 // when applicable.
 std::string FormatTimeDelta(base::TimeDelta delta);
 
+// Sends the error code to the appropriate bucket in UMA using the metrics_lib
+// interface. This method also massages the error code to be suitable for UMA
+// purposes.
+void SendErrorCodeToUMA(MetricsLibraryInterface* metrics_lib,
+                        ActionExitCode code);
 }  // namespace utils