OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chromeos/dbus/shill_ipconfig_client_stub.h" | 5 #include "chromeos/dbus/shill_ipconfig_client_stub.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 | 40 |
41 void ShillIPConfigClientStub::GetProperties( | 41 void ShillIPConfigClientStub::GetProperties( |
42 const dbus::ObjectPath& ipconfig_path, | 42 const dbus::ObjectPath& ipconfig_path, |
43 const DictionaryValueCallback& callback) { | 43 const DictionaryValueCallback& callback) { |
44 if (callback.is_null()) | 44 if (callback.is_null()) |
45 return; | 45 return; |
46 const base::DictionaryValue* dict = NULL; | 46 const base::DictionaryValue* dict = NULL; |
47 if (!ipconfigs_.GetDictionaryWithoutPathExpansion(ipconfig_path.value(), | 47 if (!ipconfigs_.GetDictionaryWithoutPathExpansion(ipconfig_path.value(), |
48 &dict)) | 48 &dict)) |
49 return; | 49 return; |
50 MessageLoop::current()->PostTask( | 50 base::MessageLoop::current()->PostTask( |
51 FROM_HERE, base::Bind(&ShillIPConfigClientStub::PassProperties, | 51 FROM_HERE, base::Bind(&ShillIPConfigClientStub::PassProperties, |
52 weak_ptr_factory_.GetWeakPtr(), | 52 weak_ptr_factory_.GetWeakPtr(), |
53 dict, | 53 dict, |
54 callback)); | 54 callback)); |
55 } | 55 } |
56 | 56 |
57 base::DictionaryValue* ShillIPConfigClientStub::CallGetPropertiesAndBlock( | 57 base::DictionaryValue* ShillIPConfigClientStub::CallGetPropertiesAndBlock( |
58 const dbus::ObjectPath& ipconfig_path) { | 58 const dbus::ObjectPath& ipconfig_path) { |
59 return new base::DictionaryValue; | 59 return new base::DictionaryValue; |
60 } | 60 } |
(...skipping 10 matching lines...) Expand all Loading... |
71 &dict)) { | 71 &dict)) { |
72 // Update existing ip config stub object's properties. | 72 // Update existing ip config stub object's properties. |
73 dict->SetWithoutPathExpansion(name, value.DeepCopy()); | 73 dict->SetWithoutPathExpansion(name, value.DeepCopy()); |
74 } else { | 74 } else { |
75 // Create a new stub ipconfig object, and update its properties. | 75 // Create a new stub ipconfig object, and update its properties. |
76 DictionaryValue* dvalue = new DictionaryValue; | 76 DictionaryValue* dvalue = new DictionaryValue; |
77 dvalue->SetWithoutPathExpansion(name, value.DeepCopy()); | 77 dvalue->SetWithoutPathExpansion(name, value.DeepCopy()); |
78 ipconfigs_.SetWithoutPathExpansion(ipconfig_path.value(), | 78 ipconfigs_.SetWithoutPathExpansion(ipconfig_path.value(), |
79 dvalue); | 79 dvalue); |
80 } | 80 } |
81 MessageLoop::current()->PostTask( | 81 base::MessageLoop::current()->PostTask( |
82 FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS)); | 82 FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS)); |
83 } | 83 } |
84 | 84 |
85 void ShillIPConfigClientStub::ClearProperty( | 85 void ShillIPConfigClientStub::ClearProperty( |
86 const dbus::ObjectPath& ipconfig_path, | 86 const dbus::ObjectPath& ipconfig_path, |
87 const std::string& name, | 87 const std::string& name, |
88 const VoidDBusMethodCallback& callback) { | 88 const VoidDBusMethodCallback& callback) { |
89 if (callback.is_null()) | 89 if (callback.is_null()) |
90 return; | 90 return; |
91 MessageLoop::current()->PostTask( | 91 base::MessageLoop::current()->PostTask( |
92 FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS)); | 92 FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS)); |
93 } | 93 } |
94 | 94 |
95 void ShillIPConfigClientStub::Remove(const dbus::ObjectPath& ipconfig_path, | 95 void ShillIPConfigClientStub::Remove(const dbus::ObjectPath& ipconfig_path, |
96 const VoidDBusMethodCallback& callback) { | 96 const VoidDBusMethodCallback& callback) { |
97 if (callback.is_null()) | 97 if (callback.is_null()) |
98 return; | 98 return; |
99 MessageLoop::current()->PostTask( | 99 base::MessageLoop::current()->PostTask( |
100 FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS)); | 100 FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS)); |
101 } | 101 } |
102 | 102 |
103 void ShillIPConfigClientStub::PassProperties( | 103 void ShillIPConfigClientStub::PassProperties( |
104 const base::DictionaryValue* values, | 104 const base::DictionaryValue* values, |
105 const DictionaryValueCallback& callback) const { | 105 const DictionaryValueCallback& callback) const { |
106 callback.Run(DBUS_METHOD_CALL_SUCCESS, *values); | 106 callback.Run(DBUS_METHOD_CALL_SUCCESS, *values); |
107 } | 107 } |
108 | 108 |
109 } // namespace chromeos | 109 } // namespace chromeos |
OLD | NEW |