metrics: fork metrics sources from Chromium source base

In preparation to libchrome uprev, fork off non-protobuf code
from Chromium's metrics component into platform2/metrics.

The current version of Chromium's metrics component has been
significantly refactored and pieces of functionality that
Chromium OS was dependant on (e.g. MetricsLogBase class) has
been removed completely.

So, taking the r293518 version we have been using for a while
and putting it as part of platform2/metrics now.

BUG=None
TEST=FEATURES=test emerge-link metrics

Change-Id: Ib46ac1dff2e2b9cc881e4787b3c6b6250f0bf9c4
Reviewed-on: https://chromium-review.googlesource.com/234635
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Bertrand Simonnet <bsimonnet@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
Trybot-Ready: Alex Vakulenko <avakulenko@chromium.org>
diff --git a/metrics/metrics_library.cc b/metrics/metrics_library.cc
index c352bcf..5088cae 100644
--- a/metrics/metrics_library.cc
+++ b/metrics/metrics_library.cc
@@ -13,13 +13,11 @@
 #include <cstdio>
 #include <cstring>
 
-#include "components/metrics/chromeos/metric_sample.h"
-#include "components/metrics/chromeos/serialization_utils.h"
+#include "metrics/serialization/metric_sample.h"
+#include "metrics/serialization/serialization_utils.h"
 
 #include "policy/device_policy.h"
 
-#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
-
 static const char kAutotestPath[] = "/var/log/metrics/autotest-events";
 static const char kUMAEventsPath[] = "/var/run/metrics/uma-events";
 static const char kConsentFile[] = "/home/chronos/Consent To Send Stats";
@@ -206,7 +204,7 @@
 }
 
 bool MetricsLibrary::SendCrosEventToUMA(const std::string& event) {
-  for (size_t i = 0; i < ARRAY_SIZE(kCrosEventNames); i++) {
+  for (size_t i = 0; i < arraysize(kCrosEventNames); i++) {
     if (strcmp(event.c_str(), kCrosEventNames[i]) == 0) {
       return SendEnumToUMA(kCrosEventHistogramName, i, kCrosEventHistogramMax);
     }