| Index: chromeos/dbus/shill_client_helper.cc
|
| diff --git a/chromeos/dbus/shill_client_helper.cc b/chromeos/dbus/shill_client_helper.cc
|
| index bd421bcfa453f26f02bd5b809d0dc0f2038d275a..d629fd5f81d87ed60471c09d55a0257b498ccf01 100644
|
| --- a/chromeos/dbus/shill_client_helper.cc
|
| +++ b/chromeos/dbus/shill_client_helper.cc
|
| @@ -13,6 +13,13 @@
|
|
|
| namespace chromeos {
|
|
|
| +namespace {
|
| +
|
| +const char kInvalidResponseErrorName[] = ""; // No error name.
|
| +const char kInvalidResponseErrorMessage[] = "Invalid response.";
|
| +
|
| +} // namespace
|
| +
|
| ShillClientHelper::ShillClientHelper(dbus::Bus* bus,
|
| dbus::ObjectProxy* proxy)
|
| : blocking_method_caller_(bus, proxy),
|
| @@ -55,13 +62,29 @@ void ShillClientHelper::CallVoidMethod(
|
|
|
| void ShillClientHelper::CallObjectPathMethod(
|
| dbus::MethodCall* method_call,
|
| - const ObjectPathDBusMethodCallback& callback) {
|
| + const ObjectPathCallback& callback) {
|
| proxy_->CallMethod(method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
|
| base::Bind(&ShillClientHelper::OnObjectPathMethod,
|
| weak_ptr_factory_.GetWeakPtr(),
|
| callback));
|
| }
|
|
|
| +void ShillClientHelper::CallObjectPathMethodWithErrorCallback(
|
| + dbus::MethodCall* method_call,
|
| + const ObjectPathCallbackWithoutStatus& callback,
|
| + const ErrorCallback& error_callback) {
|
| + proxy_->CallMethodWithErrorCallback(
|
| + method_call,
|
| + dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
|
| + base::Bind(&ShillClientHelper::OnObjectPathMethodWithoutStatus,
|
| + weak_ptr_factory_.GetWeakPtr(),
|
| + callback,
|
| + error_callback),
|
| + base::Bind(&ShillClientHelper::OnError,
|
| + weak_ptr_factory_.GetWeakPtr(),
|
| + error_callback));
|
| +}
|
| +
|
| void ShillClientHelper::CallDictionaryValueMethod(
|
| dbus::MethodCall* method_call,
|
| const DictionaryValueCallback& callback) {
|
| @@ -215,7 +238,7 @@ void ShillClientHelper::OnVoidMethod(const VoidDBusMethodCallback& callback,
|
| }
|
|
|
| void ShillClientHelper::OnObjectPathMethod(
|
| - const ObjectPathDBusMethodCallback& callback,
|
| + const ObjectPathCallback& callback,
|
| dbus::Response* response) {
|
| if (!response) {
|
| callback.Run(DBUS_METHOD_CALL_FAILURE, dbus::ObjectPath());
|
| @@ -230,6 +253,23 @@ void ShillClientHelper::OnObjectPathMethod(
|
| callback.Run(DBUS_METHOD_CALL_SUCCESS, result);
|
| }
|
|
|
| +void ShillClientHelper::OnObjectPathMethodWithoutStatus(
|
| + const ObjectPathCallbackWithoutStatus& callback,
|
| + const ErrorCallback& error_callback,
|
| + dbus::Response* response) {
|
| + if (!response) {
|
| + error_callback.Run(kInvalidResponseErrorName, kInvalidResponseErrorMessage);
|
| + return;
|
| + }
|
| + dbus::MessageReader reader(response);
|
| + dbus::ObjectPath result;
|
| + if (!reader.PopObjectPath(&result)) {
|
| + error_callback.Run(kInvalidResponseErrorName, kInvalidResponseErrorMessage);
|
| + return;
|
| + }
|
| + callback.Run(result);
|
| +}
|
| +
|
| void ShillClientHelper::OnDictionaryValueMethod(
|
| const DictionaryValueCallback& callback,
|
| dbus::Response* response) {
|
| @@ -263,9 +303,7 @@ void ShillClientHelper::OnDictionaryValueMethodWithErrorCallback(
|
| scoped_ptr<base::Value> value(dbus::PopDataAsValue(&reader));
|
| base::DictionaryValue* result = NULL;
|
| if (!value.get() || !value->GetAsDictionary(&result)) {
|
| - const std::string error_name; // No error name.
|
| - const std::string error_message = "Invalid response.";
|
| - error_callback.Run(error_name, error_message);
|
| + error_callback.Run(kInvalidResponseErrorName, kInvalidResponseErrorMessage);
|
| return;
|
| }
|
| callback.Run(*result);
|
|
|