Change dbus Get/Set Property callback to OnceCallback.

These callbacks are only called once, so change them to the correct
spelling. This will allow bluetooth code to be converted to OnceCallback
as well, which will then allow content code to be converted.

TBR=hashimoto,rkc

Bug: 953861
Change-Id: I49b0fcf6e00721e5e6bbb4439bad7c5cbb0d6463
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1572204
Commit-Queue: danakj <danakj@chromium.org>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Auto-Submit: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#652169}
diff --git a/dbus/property.cc b/dbus/property.cc
index 7ec7eb7..489ef99 100644
--- a/dbus/property.cc
+++ b/dbus/property.cc
@@ -105,12 +105,9 @@
   writer.AppendString(property->name());
 
   DCHECK(object_proxy_);
-  object_proxy_->CallMethod(&method_call,
-                            ObjectProxy::TIMEOUT_USE_DEFAULT,
-                            base::Bind(&PropertySet::OnGet,
-                                       GetWeakPtr(),
-                                       property,
-                                       callback));
+  object_proxy_->CallMethod(&method_call, ObjectProxy::TIMEOUT_USE_DEFAULT,
+                            base::BindOnce(&PropertySet::OnGet, GetWeakPtr(),
+                                           property, std::move(callback)));
 }
 
 void PropertySet::OnGet(PropertyBase* property, GetCallback callback,
@@ -132,7 +129,7 @@
   }
 
   if (!callback.is_null())
-    callback.Run(response);
+    std::move(callback).Run(response);
 }
 
 bool PropertySet::GetAndBlock(PropertyBase* property) {
@@ -196,12 +193,9 @@
   property->AppendSetValueToWriter(&writer);
 
   DCHECK(object_proxy_);
-  object_proxy_->CallMethod(&method_call,
-                            ObjectProxy::TIMEOUT_USE_DEFAULT,
-                            base::Bind(&PropertySet::OnSet,
-                                       GetWeakPtr(),
-                                       property,
-                                       callback));
+  object_proxy_->CallMethod(&method_call, ObjectProxy::TIMEOUT_USE_DEFAULT,
+                            base::BindOnce(&PropertySet::OnSet, GetWeakPtr(),
+                                           property, std::move(callback)));
 }
 
 bool PropertySet::SetAndBlock(PropertyBase* property) {
@@ -224,7 +218,7 @@
                         Response* response) {
   LOG_IF(WARNING, !response) << property->name() << ": Set: failed.";
   if (!callback.is_null())
-    callback.Run(response);
+    std::move(callback).Run(response);
 }
 
 bool PropertySet::UpdatePropertiesFromReader(MessageReader* reader) {
diff --git a/dbus/property.h b/dbus/property.h
index 6dc49474..68cf38b3 100644
--- a/dbus/property.h
+++ b/dbus/property.h
@@ -250,7 +250,7 @@
   // Callback for Get() method, |success| indicates whether or not the
   // value could be retrived, if true the new value can be obtained by
   // calling value() on the property.
-  typedef base::Callback<void(bool success)> GetCallback;
+  using GetCallback = base::OnceCallback<void(bool success)>;
 
   // Requests an updated value from the remote object for |property|
   // incurring a round-trip. |callback| will be called when the new
@@ -274,7 +274,7 @@
 
   // Callback for Set() method, |success| indicates whether or not the
   // new property value was accepted by the remote object.
-  typedef base::Callback<void(bool success)> SetCallback;
+  using SetCallback = base::OnceCallback<void(bool success)>;
 
   // Requests that the remote object for |property| change the property to
   // its new value. |callback| will be called to indicate the success or
@@ -387,7 +387,7 @@
   // round-trip. |callback| will be called when the new value is available.
   // This may not be implemented by some interfaces.
   virtual void Get(dbus::PropertySet::GetCallback callback) {
-    property_set()->Get(this, callback);
+    property_set()->Get(this, std::move(callback));
   }
 
   // The synchronous version of Get().
@@ -402,7 +402,7 @@
   // remote object.
   virtual void Set(const T& value, dbus::PropertySet::SetCallback callback) {
     set_value_ = value;
-    property_set()->Set(this, callback);
+    property_set()->Set(this, std::move(callback));
   }
 
   // The synchronous version of Set().
diff --git a/device/bluetooth/dbus/fake_bluetooth_adapter_client.cc b/device/bluetooth/dbus/fake_bluetooth_adapter_client.cc
index 853d52e..e9dd80f 100644
--- a/device/bluetooth/dbus/fake_bluetooth_adapter_client.cc
+++ b/device/bluetooth/dbus/fake_bluetooth_adapter_client.cc
@@ -52,7 +52,7 @@
     dbus::PropertyBase* property,
     dbus::PropertySet::GetCallback callback) {
   VLOG(1) << "Get " << property->name();
-  callback.Run(false);
+  std::move(callback).Run(false);
 }
 
 void FakeBluetoothAdapterClient::Properties::GetAll() {
@@ -66,10 +66,10 @@
   if (property->name() == powered.name() || property->name() == alias.name() ||
       property->name() == discoverable.name() ||
       property->name() == discoverable_timeout.name()) {
-    callback.Run(true);
+    std::move(callback).Run(true);
     property->ReplaceValueWithSetValue();
   } else {
-    callback.Run(false);
+    std::move(callback).Run(false);
   }
 }
 
diff --git a/device/bluetooth/dbus/fake_bluetooth_device_client.cc b/device/bluetooth/dbus/fake_bluetooth_device_client.cc
index 1446da1..cc4b1a60 100644
--- a/device/bluetooth/dbus/fake_bluetooth_device_client.cc
+++ b/device/bluetooth/dbus/fake_bluetooth_device_client.cc
@@ -279,7 +279,7 @@
     dbus::PropertyBase* property,
     dbus::PropertySet::GetCallback callback) {
   VLOG(1) << "Get " << property->name();
-  callback.Run(false);
+  std::move(callback).Run(false);
 }
 
 void FakeBluetoothDeviceClient::Properties::GetAll() {
@@ -291,10 +291,10 @@
     dbus::PropertySet::SetCallback callback) {
   VLOG(1) << "Set " << property->name();
   if (property->name() == trusted.name()) {
-    callback.Run(true);
+    std::move(callback).Run(true);
     property->ReplaceValueWithSetValue();
   } else {
-    callback.Run(false);
+    std::move(callback).Run(false);
   }
 }
 
diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.cc b/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.cc
index a0369e5..a9180eb 100644
--- a/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.cc
+++ b/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.cc
@@ -62,7 +62,7 @@
     dbus::PropertyBase* property,
     dbus::PropertySet::GetCallback callback) {
   VLOG(1) << "Get " << property->name();
-  callback.Run(true);
+  std::move(callback).Run(true);
 }
 
 void FakeBluetoothGattCharacteristicClient::Properties::GetAll() {
@@ -73,7 +73,7 @@
     dbus::PropertyBase* property,
     dbus::PropertySet::SetCallback callback) {
   VLOG(1) << "Set " << property->name();
-  callback.Run(false);
+  std::move(callback).Run(false);
 }
 
 FakeBluetoothGattCharacteristicClient::FakeBluetoothGattCharacteristicClient()
diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.cc b/device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.cc
index a3b2acb..cce7db8 100644
--- a/device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.cc
+++ b/device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.cc
@@ -37,7 +37,7 @@
     dbus::PropertyBase* property,
     dbus::PropertySet::GetCallback callback) {
   VLOG(1) << "Get " << property->name();
-  callback.Run(true);
+  std::move(callback).Run(true);
 }
 
 void FakeBluetoothGattDescriptorClient::Properties::GetAll() {
@@ -48,7 +48,7 @@
     dbus::PropertyBase* property,
     dbus::PropertySet::SetCallback callback) {
   VLOG(1) << "Set " << property->name();
-  callback.Run(false);
+  std::move(callback).Run(false);
 }
 
 FakeBluetoothGattDescriptorClient::DescriptorData::DescriptorData() = default;
diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_service_client.cc b/device/bluetooth/dbus/fake_bluetooth_gatt_service_client.cc
index 37a84ac..b3781d6 100644
--- a/device/bluetooth/dbus/fake_bluetooth_gatt_service_client.cc
+++ b/device/bluetooth/dbus/fake_bluetooth_gatt_service_client.cc
@@ -41,7 +41,7 @@
     dbus::PropertyBase* property,
     dbus::PropertySet::GetCallback callback) {
   VLOG(1) << "Get " << property->name();
-  callback.Run(false);
+  std::move(callback).Run(false);
 }
 
 void FakeBluetoothGattServiceClient::Properties::GetAll() {
@@ -50,9 +50,9 @@
 
 void FakeBluetoothGattServiceClient::Properties::Set(
     dbus::PropertyBase* property,
-    dbus::PropertySet::GetCallback callback) {
+    dbus::PropertySet::SetCallback callback) {
   VLOG(1) << "Set " << property->name();
-  callback.Run(false);
+  std::move(callback).Run(false);
 }
 
 FakeBluetoothGattServiceClient::FakeBluetoothGattServiceClient()
diff --git a/device/bluetooth/dbus/fake_bluetooth_input_client.cc b/device/bluetooth/dbus/fake_bluetooth_input_client.cc
index 5ce6953d..9d72a0de2 100644
--- a/device/bluetooth/dbus/fake_bluetooth_input_client.cc
+++ b/device/bluetooth/dbus/fake_bluetooth_input_client.cc
@@ -31,7 +31,7 @@
     dbus::PropertyBase* property,
     dbus::PropertySet::GetCallback callback) {
   VLOG(1) << "Get " << property->name();
-  callback.Run(false);
+  std::move(callback).Run(false);
 }
 
 void FakeBluetoothInputClient::Properties::GetAll() {
@@ -42,7 +42,7 @@
     dbus::PropertyBase* property,
     dbus::PropertySet::SetCallback callback) {
   VLOG(1) << "Set " << property->name();
-  callback.Run(false);
+  std::move(callback).Run(false);
 }
 
 FakeBluetoothInputClient::FakeBluetoothInputClient() = default;
diff --git a/device/bluetooth/dbus/fake_bluetooth_media_transport_client.cc b/device/bluetooth/dbus/fake_bluetooth_media_transport_client.cc
index e5f7156..990f9fe 100644
--- a/device/bluetooth/dbus/fake_bluetooth_media_transport_client.cc
+++ b/device/bluetooth/dbus/fake_bluetooth_media_transport_client.cc
@@ -74,7 +74,7 @@
     dbus::PropertyBase* property,
     dbus::PropertySet::GetCallback callback) {
   VLOG(1) << "Get " << property->name();
-  callback.Run(false);
+  std::move(callback).Run(false);
 }
 
 void FakeBluetoothMediaTransportClient::Properties::GetAll() {
@@ -85,7 +85,7 @@
     dbus::PropertyBase* property,
     dbus::PropertySet::SetCallback callback) {
   VLOG(1) << "Set " << property->name();
-  callback.Run(false);
+  std::move(callback).Run(false);
 }
 
 FakeBluetoothMediaTransportClient::Transport::Transport(
diff --git a/services/device/bluetooth/bluetooth_system_unittest.cc b/services/device/bluetooth/bluetooth_system_unittest.cc
index d6e96e2..a9a01f1a 100644
--- a/services/device/bluetooth/bluetooth_system_unittest.cc
+++ b/services/device/bluetooth/bluetooth_system_unittest.cc
@@ -117,10 +117,11 @@
         ++set_powered_call_count_;
         last_set_powered_value_ = powered.GetSetValueForTesting();
         if (next_set_powered_response_) {
-          callback.Run(GetValueAndReset(&next_set_powered_response_));
+          std::move(callback).Run(
+              GetValueAndReset(&next_set_powered_response_));
           return;
         }
-        set_powered_callbacks_.push_back(callback);
+        set_powered_callbacks_.push_back(std::move(callback));
       } else {
         NOTIMPLEMENTED();
       }