| Index: chromeos/dbus/leadership_daemon_manager_client.cc
|
| diff --git a/chromeos/dbus/leadership_daemon_manager_client.cc b/chromeos/dbus/leadership_daemon_manager_client.cc
|
| index 51f7765a4a6689acc7d9eb2a1c16769eb4e05e78..9ad7f42ad890b8649e45f217c31da8ed08b9020c 100644
|
| --- a/chromeos/dbus/leadership_daemon_manager_client.cc
|
| +++ b/chromeos/dbus/leadership_daemon_manager_client.cc
|
| @@ -53,7 +53,7 @@ class LeadershipDaemonManagerClientImpl
|
| void RemoveObserver(Observer* observer) override;
|
| void JoinGroup(const std::string& group,
|
| const base::DictionaryValue& options,
|
| - const StringDBusMethodCallback& callback) override;
|
| + const ObjectPathDBusMethodCallback& callback) override;
|
| void LeaveGroup(const std::string& object_path,
|
| const VoidDBusMethodCallback& callback) override;
|
| void SetScore(const std::string& object_path,
|
| @@ -85,6 +85,8 @@ class LeadershipDaemonManagerClientImpl
|
| void OnGroupPropertyChanged(const dbus::ObjectPath& object_path,
|
| const std::string& property_name);
|
|
|
| + void OnObjectPathDBusMethod(const ObjectPathDBusMethodCallback& callback,
|
| + dbus::Response* response);
|
| void OnStringDBusMethod(const StringDBusMethodCallback& callback,
|
| dbus::Response* response);
|
| void OnVoidDBusMethod(const VoidDBusMethodCallback& callback,
|
| @@ -122,13 +124,13 @@ void LeadershipDaemonManagerClientImpl::RemoveObserver(Observer* observer) {
|
| void LeadershipDaemonManagerClientImpl::JoinGroup(
|
| const std::string& group,
|
| const base::DictionaryValue& options,
|
| - const StringDBusMethodCallback& callback) {
|
| + const ObjectPathDBusMethodCallback& callback) {
|
| dbus::ObjectProxy* object_proxy = object_manager_->GetObjectProxy(
|
| dbus::ObjectPath(leaderd::kLeaderdManagerPath));
|
| if (!object_proxy) {
|
| base::MessageLoop::current()->PostTask(
|
| FROM_HERE,
|
| - base::Bind(&LeadershipDaemonManagerClientImpl::OnStringDBusMethod,
|
| + base::Bind(&LeadershipDaemonManagerClientImpl::OnObjectPathDBusMethod,
|
| weak_ptr_factory_.GetWeakPtr(), callback, nullptr));
|
| return;
|
| }
|
| @@ -140,7 +142,7 @@ void LeadershipDaemonManagerClientImpl::JoinGroup(
|
| dbus::AppendValueData(&writer, options);
|
| object_proxy->CallMethod(
|
| &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
|
| - base::Bind(&LeadershipDaemonManagerClientImpl::OnStringDBusMethod,
|
| + base::Bind(&LeadershipDaemonManagerClientImpl::OnObjectPathDBusMethod,
|
| weak_ptr_factory_.GetWeakPtr(), callback));
|
| }
|
|
|
| @@ -298,6 +300,24 @@ void LeadershipDaemonManagerClientImpl::OnGroupPropertyChanged(
|
| GroupPropertyChanged(object_path, property_name));
|
| }
|
|
|
| +void LeadershipDaemonManagerClientImpl::OnObjectPathDBusMethod(
|
| + const ObjectPathDBusMethodCallback& callback,
|
| + dbus::Response* response) {
|
| + if (!response) {
|
| + callback.Run(DBUS_METHOD_CALL_FAILURE, dbus::ObjectPath());
|
| + return;
|
| + }
|
| +
|
| + dbus::MessageReader reader(response);
|
| + dbus::ObjectPath result;
|
| + if (!reader.PopObjectPath(&result)) {
|
| + callback.Run(DBUS_METHOD_CALL_FAILURE, result);
|
| + return;
|
| + }
|
| +
|
| + callback.Run(DBUS_METHOD_CALL_SUCCESS, result);
|
| +}
|
| +
|
| void LeadershipDaemonManagerClientImpl::OnStringDBusMethod(
|
| const StringDBusMethodCallback& callback,
|
| dbus::Response* response) {
|
|
|