Chromium Code Reviews| Index: chromeos/dbus/shill_ipconfig_client_stub.cc |
| diff --git a/chromeos/dbus/shill_ipconfig_client_stub.cc b/chromeos/dbus/shill_ipconfig_client_stub.cc |
| index c78605de25de92e9b11802a15b5beb33885ba578..b6acfc91423e1c74173095a6914e4488089035f9 100644 |
| --- a/chromeos/dbus/shill_ipconfig_client_stub.cc |
| +++ b/chromeos/dbus/shill_ipconfig_client_stub.cc |
| @@ -43,10 +43,15 @@ void ShillIPConfigClientStub::GetProperties( |
| const DictionaryValueCallback& callback) { |
| if (callback.is_null()) |
| return; |
| + const base::DictionaryValue* dict = NULL; |
| + if (!ipconfigs_.GetDictionaryWithoutPathExpansion(ipconfig_path.value(), |
| + &dict)) |
|
stevenjb
2013/03/28 20:30:58
nit: align
gauravsh
2013/03/29 00:02:11
Done.
|
| + return; |
| MessageLoop::current()->PostTask( |
| - FROM_HERE, base::Bind(&ShillIPConfigClientStub::PassProperties, |
| - weak_ptr_factory_.GetWeakPtr(), |
| - callback)); |
| + FROM_HERE, base::Bind(&ShillIPConfigClientStub::PassProperties, |
| + weak_ptr_factory_.GetWeakPtr(), |
| + dict, |
| + callback)); |
| } |
| base::DictionaryValue* ShillIPConfigClientStub::CallGetPropertiesAndBlock( |
| @@ -61,6 +66,18 @@ void ShillIPConfigClientStub::SetProperty( |
| const VoidDBusMethodCallback& callback) { |
| if (callback.is_null()) |
| return; |
| + base::DictionaryValue* dict = NULL; |
| + if (ipconfigs_.GetDictionaryWithoutPathExpansion(ipconfig_path.value(), |
| + &dict)) { |
| + // Update existing ip config stub object's properties. |
| + dict->SetWithoutPathExpansion(name, value.DeepCopy()); |
| + } else { |
| + // Create a new stub ipconfig object, and update its properties. |
| + DictionaryValue* dvalue = new DictionaryValue; |
| + dvalue->SetWithoutPathExpansion(name, value.DeepCopy()); |
| + ipconfigs_.SetWithoutPathExpansion(ipconfig_path.value(), |
| + dvalue); |
| + } |
| MessageLoop::current()->PostTask( |
| FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS)); |
| } |
| @@ -84,8 +101,9 @@ void ShillIPConfigClientStub::Remove(const dbus::ObjectPath& ipconfig_path, |
| } |
| void ShillIPConfigClientStub::PassProperties( |
| + const base::DictionaryValue* values, |
| const DictionaryValueCallback& callback) const { |
| - callback.Run(DBUS_METHOD_CALL_SUCCESS, properties_); |
| + callback.Run(DBUS_METHOD_CALL_SUCCESS, *values); |
| } |
| } // namespace chromeos |