shill: Add Network.Shill.Cellular.TimeToEnable metrics.

This metric tracks the amount of time it takes the modem manager to
enable the modem.

BUG=chromium-os:38086
TEST=Unit tests, check chrome://histograms for new metrics

Change-Id: Ie12e8cee20586f4ebf0070721c6327c13c175474
Reviewed-on: https://gerrit.chromium.org/gerrit/41878
Reviewed-by: Arman Uguray <armansito@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Thieu Le <thieule@chromium.org>
Tested-by: Thieu Le <thieule@chromium.org>
diff --git a/metrics.h b/metrics.h
index 1cad04a..8ac0bfb 100644
--- a/metrics.h
+++ b/metrics.h
@@ -176,9 +176,13 @@
   static const char kMetricTimeToDropSeconds[];
   static const int kMetricTimeToDropSecondsMax;
   static const int kMetricTimeToDropSecondsMin;
+  static const char kMetricTimeToEnableMilliseconds[];
+  static const int kMetricTimeToEnableMillisecondsMax;
+  static const int kMetricTimeToEnableMillisecondsMin;
+  static const int kMetricTimeToEnableMillisecondsNumBuckets;
   static const char kMetricTimeToInitializeMilliseconds[];
-  static const int kMetricTimeToInitializeMillisecondsMin;
   static const int kMetricTimeToInitializeMillisecondsMax;
+  static const int kMetricTimeToInitializeMillisecondsMin;
   static const int kMetricTimeToInitializeMillisecondsNumBuckets;
   static const char kMetricTimeToJoinMilliseconds[];
   static const char kMetricTimeToOnlineMilliseconds[];
@@ -321,6 +325,12 @@
   // Notifies this object that a device has been initialized.
   void NotifyDeviceInitialized(int interface_index);
 
+  // Notifies this object that a device has started the enable process.
+  void NotifyDeviceEnableStarted(int interface_index);
+
+  // Notifies this object that a device has completed the enable process.
+  void NotifyDeviceEnableFinished(int interface_index);
+
   // Sends linear histogram data to UMA.
   virtual bool SendEnumToUMA(const std::string &name, int sample, int max);
 
@@ -362,6 +372,7 @@
   struct DeviceMetrics {
     DeviceMetrics() {}
     scoped_ptr<chromeos_metrics::TimerReporter> initialization_timer;
+    scoped_ptr<chromeos_metrics::TimerReporter> enable_timer;
   };
   typedef std::map<const int, std::tr1::shared_ptr<DeviceMetrics> >
       DeviceMetricsLookupMap;
@@ -386,6 +397,8 @@
                                            Service::ConnectState new_state);
   void SendServiceFailure(const Service *service);
 
+  DeviceMetrics *GetDeviceMetrics(int interface_index);
+
   // For unit test purposes.
   void set_library(MetricsLibraryInterface *library);
   void set_time_online_timer(chromeos_metrics::Timer *timer) {