UMA metric reporting for user-initiated wifi scan.

Created a historgram for reporting user-initiated network events,
and add an entry for user-initiated wifi scan.

Also changed the histograms for DHCPOptionFailure. Instead of having
one histogram per technology type, changed to one histogram with one
entry per technology type.

BUG=chromium:369545
TEST=unit tests, manual
Manual Test:
1. On a chrome device, open the network menu in chrome to
   initate wifi scan.
2. Browse to "chrome://histograms" to verify there is a histogram
   for "Network.Shill.UserInitiatedEvents", and a hit for value
   0 (WifiScan).

Change-Id: I6a34ed3906cdfd1d74f104e2670d78dec1768e3f
Reviewed-on: https://chromium-review.googlesource.com/197988
Reviewed-by: Peter Qiu <zqiu@chromium.org>
Commit-Queue: Peter Qiu <zqiu@chromium.org>
Tested-by: Peter Qiu <zqiu@chromium.org>
diff --git a/metrics.h b/metrics.h
index 18d929d..67ba3ce 100644
--- a/metrics.h
+++ b/metrics.h
@@ -262,9 +262,20 @@
     kVpnUserAuthenticationTypeMax
   };
 
-  enum DHCPOptionFailure {
-    kDHCPOptionFailure = 1,
-    kDHCPOptionFailureMax
+  enum DHCPOptionFailureTechnology {
+    kDHCPOptionFailureTechnologyCellular = 0,
+    kDHCPOptionFailureTechnologyEthernet,
+    kDHCPOptionFailureTechnologyEthernetEap,
+    kDHCPOptionFailureTechnologyWifi,
+    kDHCPOptionFailureTechnologyWiMax,
+    kDHCPOptionFailureTechnologyVPN,
+    kDHCPOptionFailureTechnologyUnknown,
+    kDHCPOptionFailureTechnologyMax
+  };
+
+  enum UserInitiatedEvent {
+    kUserInitiatedEventWifiScan = 0,
+    kUserInitiatedEventMax
   };
 
   static const char kMetricDisconnectSuffix[];
@@ -427,7 +438,7 @@
   // We have detected that a DHCP server can only deliver leases if
   // we reduce the number of options that we request of it.  This
   // implies an infrastructure issue.
-  static const char kMetricDHCPOptionFailureDetectedSuffix[];
+  static const char kMetricDHCPOptionFailureDetected[];
 
   // The length in seconds of a lease that has expired while the DHCP
   // client was attempting to renew the lease..
@@ -455,6 +466,9 @@
   static const int kMetricServicesOnSameNetworkMin;
   static const int kMetricServicesOnSameNetworkNumBuckets;
 
+  // Metric for user-initiated events.
+  static const char kMetricUserInitiatedEvents[];
+
   explicit Metrics(EventDispatcher *dispatcher);
   virtual ~Metrics();
 
@@ -630,6 +644,9 @@
   // Notifies this object about a service with DHCP infrastructure problems.
   virtual void NotifyDHCPOptionFailure(const Service &service);
 
+  // Notifies this object about user-initiated event.
+  virtual void NotifyUserInitiatedEvent(int event);
+
   // Sends linear histogram data to UMA.
   virtual bool SendEnumToUMA(const std::string &name, int sample, int max);