| Index: chromeos/dbus/shill_device_client.cc
|
| diff --git a/chromeos/dbus/shill_device_client.cc b/chromeos/dbus/shill_device_client.cc
|
| index a1c84db43bfb3aec858dd9ad43e928984e5714db..219520daca4dbd9059021f5d0193b1b22482a4a7 100644
|
| --- a/chromeos/dbus/shill_device_client.cc
|
| +++ b/chromeos/dbus/shill_device_client.cc
|
| @@ -29,15 +29,16 @@ class ShillDeviceClientImpl : public ShillDeviceClient {
|
|
|
| ///////////////////////////////////////
|
| // ShillDeviceClient overrides.
|
| - virtual void SetPropertyChangedHandler(
|
| + virtual void AddPropertyChangedObserver(
|
| const dbus::ObjectPath& device_path,
|
| - const PropertyChangedHandler& handler) OVERRIDE {
|
| - GetHelper(device_path)->SetPropertyChangedHandler(handler);
|
| + PropertyChangedObserver* observer) OVERRIDE {
|
| + GetHelper(device_path)->AddPropertyChangedObserver(observer);
|
| }
|
|
|
| - virtual void ResetPropertyChangedHandler(
|
| - const dbus::ObjectPath& device_path) OVERRIDE {
|
| - GetHelper(device_path)->ResetPropertyChangedHandler();
|
| + virtual void RemovePropertyChangedObserver(
|
| + const dbus::ObjectPath& device_path,
|
| + PropertyChangedObserver* observer) OVERRIDE {
|
| + GetHelper(device_path)->RemovePropertyChangedObserver(observer);
|
| }
|
|
|
| virtual void GetProperties(const dbus::ObjectPath& device_path,
|
| @@ -65,13 +66,16 @@ class ShillDeviceClientImpl : public ShillDeviceClient {
|
| virtual void SetProperty(const dbus::ObjectPath& device_path,
|
| const std::string& name,
|
| const base::Value& value,
|
| - const VoidDBusMethodCallback& callback) OVERRIDE {
|
| + const base::Closure& callback,
|
| + const ErrorCallback& error_callback) OVERRIDE {
|
| dbus::MethodCall method_call(flimflam::kFlimflamDeviceInterface,
|
| flimflam::kSetPropertyFunction);
|
| dbus::MessageWriter writer(&method_call);
|
| writer.AppendString(name);
|
| ShillClientHelper::AppendValueDataAsVariant(&writer, value);
|
| - GetHelper(device_path)->CallVoidMethod(&method_call, callback);
|
| + GetHelper(device_path)->CallVoidMethodWithErrorCallback(&method_call,
|
| + callback,
|
| + error_callback);
|
| }
|
|
|
| virtual void ClearProperty(const dbus::ObjectPath& device_path,
|
| @@ -235,52 +239,54 @@ class ShillDeviceClientStubImpl : public ShillDeviceClient {
|
|
|
| virtual ~ShillDeviceClientStubImpl() {}
|
|
|
| - // ShillDeviceClient override.
|
| - virtual void SetPropertyChangedHandler(
|
| + ///////////////////////////////////
|
| + // ShillDeviceClient overrides.
|
| + virtual void AddPropertyChangedObserver(
|
| const dbus::ObjectPath& device_path,
|
| - const PropertyChangedHandler& handler) OVERRIDE {}
|
| + PropertyChangedObserver* observer) OVERRIDE {}
|
|
|
| - // ShillDeviceClient override.
|
| - virtual void ResetPropertyChangedHandler(
|
| - const dbus::ObjectPath& device_path) OVERRIDE {}
|
| + virtual void RemovePropertyChangedObserver(
|
| + const dbus::ObjectPath& device_path,
|
| + PropertyChangedObserver* observer) OVERRIDE {}
|
|
|
| - // ShillDeviceClient override.
|
| virtual void GetProperties(const dbus::ObjectPath& device_path,
|
| const DictionaryValueCallback& callback) OVERRIDE {
|
| MessageLoop::current()->PostTask(
|
| FROM_HERE,
|
| - base::Bind(&ShillDeviceClientStubImpl::PassStubDevicePrperties,
|
| + base::Bind(&ShillDeviceClientStubImpl::PassStubDeviceProperties,
|
| weak_ptr_factory_.GetWeakPtr(),
|
| device_path, callback));
|
| }
|
|
|
| - // ShillDeviceClient override.
|
| virtual base::DictionaryValue* CallGetPropertiesAndBlock(
|
| const dbus::ObjectPath& device_path) OVERRIDE {
|
| return new base::DictionaryValue;
|
| }
|
|
|
| - // ShillProfileClient override.
|
| virtual void ProposeScan(const dbus::ObjectPath& device_path,
|
| const VoidDBusMethodCallback& callback) OVERRIDE {
|
| PostVoidCallback(callback, DBUS_METHOD_CALL_SUCCESS);
|
| }
|
|
|
| - // ShillDeviceClient override.
|
| virtual void SetProperty(const dbus::ObjectPath& device_path,
|
| const std::string& name,
|
| const base::Value& value,
|
| - const VoidDBusMethodCallback& callback) OVERRIDE {
|
| + const base::Closure& callback,
|
| + const ErrorCallback& error_callback) OVERRIDE {
|
| base::DictionaryValue* device_properties = NULL;
|
| if (!stub_devices_.GetDictionary(device_path.value(), &device_properties)) {
|
| - PostVoidCallback(callback, DBUS_METHOD_CALL_FAILURE);
|
| + std::string error_name("org.chromium.flimflam.Error.Failure");
|
| + std::string error_message("Failed");
|
| + MessageLoop::current()->PostTask(FROM_HERE,
|
| + base::Bind(error_callback,
|
| + error_name,
|
| + error_message));
|
| return;
|
| }
|
| device_properties->Set(name, value.DeepCopy());
|
| - PostVoidCallback(callback, DBUS_METHOD_CALL_SUCCESS);
|
| + MessageLoop::current()->PostTask(FROM_HERE, callback);
|
| }
|
|
|
| - // ShillDeviceClient override.
|
| virtual void ClearProperty(const dbus::ObjectPath& device_path,
|
| const std::string& name,
|
| const VoidDBusMethodCallback& callback) OVERRIDE {
|
| @@ -293,7 +299,6 @@ class ShillDeviceClientStubImpl : public ShillDeviceClient {
|
| PostVoidCallback(callback, DBUS_METHOD_CALL_SUCCESS);
|
| }
|
|
|
| - // ShillDeviceClient override.
|
| virtual void AddIPConfig(
|
| const dbus::ObjectPath& device_path,
|
| const std::string& method,
|
| @@ -304,14 +309,12 @@ class ShillDeviceClientStubImpl : public ShillDeviceClient {
|
| dbus::ObjectPath()));
|
| }
|
|
|
| - // ShillDeviceClient override.
|
| virtual dbus::ObjectPath CallAddIPConfigAndBlock(
|
| const dbus::ObjectPath& device_path,
|
| const std::string& method) OVERRIDE {
|
| return dbus::ObjectPath();
|
| }
|
|
|
| - // ShillDeviceClient override.
|
| virtual void RequirePin(const dbus::ObjectPath& device_path,
|
| const std::string& pin,
|
| bool require,
|
| @@ -320,7 +323,6 @@ class ShillDeviceClientStubImpl : public ShillDeviceClient {
|
| MessageLoop::current()->PostTask(FROM_HERE, callback);
|
| }
|
|
|
| - // ShillDeviceClient override.
|
| virtual void EnterPin(const dbus::ObjectPath& device_path,
|
| const std::string& pin,
|
| const base::Closure& callback,
|
| @@ -328,7 +330,6 @@ class ShillDeviceClientStubImpl : public ShillDeviceClient {
|
| MessageLoop::current()->PostTask(FROM_HERE, callback);
|
| }
|
|
|
| - // ShillDeviceClient override.
|
| virtual void UnblockPin(const dbus::ObjectPath& device_path,
|
| const std::string& puk,
|
| const std::string& pin,
|
| @@ -337,7 +338,6 @@ class ShillDeviceClientStubImpl : public ShillDeviceClient {
|
| MessageLoop::current()->PostTask(FROM_HERE, callback);
|
| }
|
|
|
| - // ShillDeviceClient override.
|
| virtual void ChangePin(const dbus::ObjectPath& device_path,
|
| const std::string& old_pin,
|
| const std::string& new_pin,
|
| @@ -346,7 +346,6 @@ class ShillDeviceClientStubImpl : public ShillDeviceClient {
|
| MessageLoop::current()->PostTask(FROM_HERE, callback);
|
| }
|
|
|
| - // ShillDeviceClient override.
|
| virtual void Register(const dbus::ObjectPath& device_path,
|
| const std::string& network_id,
|
| const base::Closure& callback,
|
| @@ -355,7 +354,7 @@ class ShillDeviceClientStubImpl : public ShillDeviceClient {
|
| }
|
|
|
| private:
|
| - void PassStubDevicePrperties(const dbus::ObjectPath& device_path,
|
| + void PassStubDeviceProperties(const dbus::ObjectPath& device_path,
|
| const DictionaryValueCallback& callback) const {
|
| const base::DictionaryValue* device_properties = NULL;
|
| if (!stub_devices_.GetDictionary(device_path.value(), &device_properties)) {
|
|
|