Convert chromecast/metrics to base::Bind and base::Callback to
Once/Repeating

Convert to pass by value for RepeatingCallback when ownership is
being received

Convert chromecast/metrics to base::Bind and base::Callback to Once/Repeating

Changed bind to bind repeating when calling metric state manager
Format cast_metrics_service_client.cc

Bug: 1007650
Change-Id: Iabf6b88180d2d79eb89c6ebd9dd9504ab5147b9a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2274857
Reviewed-by: danakj <danakj@chromium.org>
Reviewed-by: Steven Holte <holte@chromium.org>
Commit-Queue: Shengfa Lin <shengfa@google.com>
Cr-Original-Commit-Position: refs/heads/master@{#784604}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 823cdfc7d4ba906a7f4006886f7a337a464930f3
diff --git a/metrics_state_manager.cc b/metrics_state_manager.cc
index cbd07a1..240e142 100644
--- a/metrics_state_manager.cc
+++ b/metrics_state_manager.cc
@@ -142,12 +142,12 @@
     PrefService* local_state,
     EnabledStateProvider* enabled_state_provider,
     const base::string16& backup_registry_key,
-    const StoreClientInfoCallback& store_client_info,
-    const LoadClientInfoCallback& retrieve_client_info)
+    StoreClientInfoCallback store_client_info,
+    LoadClientInfoCallback retrieve_client_info)
     : local_state_(local_state),
       enabled_state_provider_(enabled_state_provider),
-      store_client_info_(store_client_info),
-      load_client_info_(retrieve_client_info),
+      store_client_info_(std::move(store_client_info)),
+      load_client_info_(std::move(retrieve_client_info)),
       clean_exit_beacon_(backup_registry_key, local_state),
       entropy_state_(local_state),
       entropy_source_returned_(ENTROPY_SOURCE_NONE),
@@ -325,14 +325,14 @@
     PrefService* local_state,
     EnabledStateProvider* enabled_state_provider,
     const base::string16& backup_registry_key,
-    const StoreClientInfoCallback& store_client_info,
-    const LoadClientInfoCallback& retrieve_client_info) {
+    StoreClientInfoCallback store_client_info,
+    LoadClientInfoCallback retrieve_client_info) {
   std::unique_ptr<MetricsStateManager> result;
   // Note: |instance_exists_| is updated in the constructor and destructor.
   if (!instance_exists_) {
-    result.reset(new MetricsStateManager(local_state, enabled_state_provider,
-                                         backup_registry_key, store_client_info,
-                                         retrieve_client_info));
+    result.reset(new MetricsStateManager(
+        local_state, enabled_state_provider, backup_registry_key,
+        std::move(store_client_info), std::move(retrieve_client_info)));
   }
   return result;
 }
diff --git a/metrics_state_manager.h b/metrics_state_manager.h
index 378c2d9..d3f1f8f 100644
--- a/metrics_state_manager.h
+++ b/metrics_state_manager.h
@@ -102,8 +102,8 @@
       PrefService* local_state,
       EnabledStateProvider* enabled_state_provider,
       const base::string16& backup_registry_key,
-      const StoreClientInfoCallback& store_client_info,
-      const LoadClientInfoCallback& load_client_info);
+      StoreClientInfoCallback store_client_info,
+      LoadClientInfoCallback load_client_info);
 
   // Registers local state prefs used by this class.
   static void RegisterPrefs(PrefRegistrySimple* registry);
@@ -138,8 +138,8 @@
   MetricsStateManager(PrefService* local_state,
                       EnabledStateProvider* enabled_state_provider,
                       const base::string16& backup_registry_key,
-                      const StoreClientInfoCallback& store_client_info,
-                      const LoadClientInfoCallback& load_client_info);
+                      StoreClientInfoCallback store_client_info,
+                      LoadClientInfoCallback load_client_info);
 
   // Backs up the current client info via |store_client_info_|.
   void BackUpCurrentClientInfo();