| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/flimflam_device_client.h" | 5 #include "chromeos/dbus/flimflam_device_client.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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 // FlimflamProfileClient override. | 43 // FlimflamProfileClient override. |
| 44 virtual void GetProperties(const dbus::ObjectPath& device_path, | 44 virtual void GetProperties(const dbus::ObjectPath& device_path, |
| 45 const DictionaryValueCallback& callback) OVERRIDE { | 45 const DictionaryValueCallback& callback) OVERRIDE { |
| 46 dbus::MethodCall method_call(flimflam::kFlimflamDeviceInterface, | 46 dbus::MethodCall method_call(flimflam::kFlimflamDeviceInterface, |
| 47 flimflam::kGetPropertiesFunction); | 47 flimflam::kGetPropertiesFunction); |
| 48 GetHelper(device_path)->CallDictionaryValueMethod(&method_call, callback); | 48 GetHelper(device_path)->CallDictionaryValueMethod(&method_call, callback); |
| 49 } | 49 } |
| 50 | 50 |
| 51 // FlimflamProfileClient override. | 51 // FlimflamProfileClient override. |
| 52 virtual base::DictionaryValue* CallGetPropertiesAndBlock( |
| 53 const dbus::ObjectPath& device_path) OVERRIDE { |
| 54 dbus::MethodCall method_call(flimflam::kFlimflamDeviceInterface, |
| 55 flimflam::kGetPropertiesFunction); |
| 56 return GetHelper(device_path)->CallDictionaryValueMethodAndBlock( |
| 57 &method_call); |
| 58 } |
| 59 |
| 60 // FlimflamProfileClient override. |
| 52 virtual void ProposeScan(const dbus::ObjectPath& device_path, | 61 virtual void ProposeScan(const dbus::ObjectPath& device_path, |
| 53 const VoidCallback& callback) OVERRIDE { | 62 const VoidCallback& callback) OVERRIDE { |
| 54 dbus::MethodCall method_call(flimflam::kFlimflamDeviceInterface, | 63 dbus::MethodCall method_call(flimflam::kFlimflamDeviceInterface, |
| 55 flimflam::kProposeScanFunction); | 64 flimflam::kProposeScanFunction); |
| 56 GetHelper(device_path)->CallVoidMethod(&method_call, callback); | 65 GetHelper(device_path)->CallVoidMethod(&method_call, callback); |
| 57 } | 66 } |
| 58 | 67 |
| 59 // FlimflamProfileClient override. | 68 // FlimflamProfileClient override. |
| 60 virtual void SetProperty(const dbus::ObjectPath& device_path, | 69 virtual void SetProperty(const dbus::ObjectPath& device_path, |
| 61 const std::string& name, | 70 const std::string& name, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 85 const std::string& method, | 94 const std::string& method, |
| 86 const ObjectPathCallback& callback) OVERRIDE { | 95 const ObjectPathCallback& callback) OVERRIDE { |
| 87 dbus::MethodCall method_call(flimflam::kFlimflamDeviceInterface, | 96 dbus::MethodCall method_call(flimflam::kFlimflamDeviceInterface, |
| 88 flimflam::kAddIPConfigFunction); | 97 flimflam::kAddIPConfigFunction); |
| 89 dbus::MessageWriter writer(&method_call); | 98 dbus::MessageWriter writer(&method_call); |
| 90 writer.AppendString(method); | 99 writer.AppendString(method); |
| 91 GetHelper(device_path)->CallObjectPathMethod(&method_call, callback); | 100 GetHelper(device_path)->CallObjectPathMethod(&method_call, callback); |
| 92 } | 101 } |
| 93 | 102 |
| 94 // FlimflamProfileClient override. | 103 // FlimflamProfileClient override. |
| 104 virtual dbus::ObjectPath CallAddIPConfigAndBlock( |
| 105 const dbus::ObjectPath& device_path, |
| 106 const std::string& method) OVERRIDE { |
| 107 dbus::MethodCall method_call(flimflam::kFlimflamDeviceInterface, |
| 108 flimflam::kAddIPConfigFunction); |
| 109 dbus::MessageWriter writer(&method_call); |
| 110 writer.AppendString(method); |
| 111 return GetHelper(device_path)->CallObjectPathMethodAndBlock(&method_call); |
| 112 } |
| 113 |
| 114 // FlimflamProfileClient override. |
| 95 virtual void RequirePin(const dbus::ObjectPath& device_path, | 115 virtual void RequirePin(const dbus::ObjectPath& device_path, |
| 96 const std::string& pin, | 116 const std::string& pin, |
| 97 bool require, | 117 bool require, |
| 98 const VoidCallback& callback) OVERRIDE { | 118 const VoidCallback& callback) OVERRIDE { |
| 99 dbus::MethodCall method_call(flimflam::kFlimflamDeviceInterface, | 119 dbus::MethodCall method_call(flimflam::kFlimflamDeviceInterface, |
| 100 flimflam::kRequirePinFunction); | 120 flimflam::kRequirePinFunction); |
| 101 dbus::MessageWriter writer(&method_call); | 121 dbus::MessageWriter writer(&method_call); |
| 102 writer.AppendString(pin); | 122 writer.AppendString(pin); |
| 103 writer.AppendBool(require); | 123 writer.AppendBool(require); |
| 104 GetHelper(device_path)->CallVoidMethod(&method_call, callback); | 124 GetHelper(device_path)->CallVoidMethod(&method_call, callback); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 // FlimflamDeviceClient override. | 216 // FlimflamDeviceClient override. |
| 197 virtual void GetProperties(const dbus::ObjectPath& device_path, | 217 virtual void GetProperties(const dbus::ObjectPath& device_path, |
| 198 const DictionaryValueCallback& callback) OVERRIDE { | 218 const DictionaryValueCallback& callback) OVERRIDE { |
| 199 MessageLoop::current()->PostTask( | 219 MessageLoop::current()->PostTask( |
| 200 FROM_HERE, | 220 FROM_HERE, |
| 201 base::Bind(&FlimflamDeviceClientStubImpl::PassEmptyDictionaryValue, | 221 base::Bind(&FlimflamDeviceClientStubImpl::PassEmptyDictionaryValue, |
| 202 weak_ptr_factory_.GetWeakPtr(), | 222 weak_ptr_factory_.GetWeakPtr(), |
| 203 callback)); | 223 callback)); |
| 204 } | 224 } |
| 205 | 225 |
| 226 // FlimflamDeviceClient override. |
| 227 virtual base::DictionaryValue* CallGetPropertiesAndBlock( |
| 228 const dbus::ObjectPath& device_path) OVERRIDE { |
| 229 return new base::DictionaryValue; |
| 230 } |
| 231 |
| 206 // FlimflamProfileClient override. | 232 // FlimflamProfileClient override. |
| 207 virtual void ProposeScan(const dbus::ObjectPath& device_path, | 233 virtual void ProposeScan(const dbus::ObjectPath& device_path, |
| 208 const VoidCallback& callback) OVERRIDE { | 234 const VoidCallback& callback) OVERRIDE { |
| 209 PostSuccessVoidCallback(callback); | 235 PostSuccessVoidCallback(callback); |
| 210 } | 236 } |
| 211 | 237 |
| 212 // FlimflamDeviceClient override. | 238 // FlimflamDeviceClient override. |
| 213 virtual void SetProperty(const dbus::ObjectPath& device_path, | 239 virtual void SetProperty(const dbus::ObjectPath& device_path, |
| 214 const std::string& name, | 240 const std::string& name, |
| 215 const base::Value& value, | 241 const base::Value& value, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 228 virtual void AddIPConfig(const dbus::ObjectPath& device_path, | 254 virtual void AddIPConfig(const dbus::ObjectPath& device_path, |
| 229 const std::string& method, | 255 const std::string& method, |
| 230 const ObjectPathCallback& callback) OVERRIDE { | 256 const ObjectPathCallback& callback) OVERRIDE { |
| 231 MessageLoop::current()->PostTask(FROM_HERE, | 257 MessageLoop::current()->PostTask(FROM_HERE, |
| 232 base::Bind(callback, | 258 base::Bind(callback, |
| 233 DBUS_METHOD_CALL_SUCCESS, | 259 DBUS_METHOD_CALL_SUCCESS, |
| 234 dbus::ObjectPath())); | 260 dbus::ObjectPath())); |
| 235 } | 261 } |
| 236 | 262 |
| 237 // FlimflamDeviceClient override. | 263 // FlimflamDeviceClient override. |
| 264 virtual dbus::ObjectPath CallAddIPConfigAndBlock( |
| 265 const dbus::ObjectPath& device_path, |
| 266 const std::string& method) OVERRIDE { |
| 267 return dbus::ObjectPath(); |
| 268 } |
| 269 |
| 270 // FlimflamDeviceClient override. |
| 238 virtual void RequirePin(const dbus::ObjectPath& device_path, | 271 virtual void RequirePin(const dbus::ObjectPath& device_path, |
| 239 const std::string& pin, | 272 const std::string& pin, |
| 240 bool require, | 273 bool require, |
| 241 const VoidCallback& callback) OVERRIDE { | 274 const VoidCallback& callback) OVERRIDE { |
| 242 PostSuccessVoidCallback(callback); | 275 PostSuccessVoidCallback(callback); |
| 243 } | 276 } |
| 244 | 277 |
| 245 // FlimflamDeviceClient override. | 278 // FlimflamDeviceClient override. |
| 246 virtual void EnterPin(const dbus::ObjectPath& device_path, | 279 virtual void EnterPin(const dbus::ObjectPath& device_path, |
| 247 const std::string& pin, | 280 const std::string& pin, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 FlimflamDeviceClient* FlimflamDeviceClient::Create( | 333 FlimflamDeviceClient* FlimflamDeviceClient::Create( |
| 301 DBusClientImplementationType type, | 334 DBusClientImplementationType type, |
| 302 dbus::Bus* bus) { | 335 dbus::Bus* bus) { |
| 303 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) | 336 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) |
| 304 return new FlimflamDeviceClientImpl(bus); | 337 return new FlimflamDeviceClientImpl(bus); |
| 305 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); | 338 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); |
| 306 return new FlimflamDeviceClientStubImpl(); | 339 return new FlimflamDeviceClientStubImpl(); |
| 307 } | 340 } |
| 308 | 341 |
| 309 } // namespace chromeos | 342 } // namespace chromeos |
| OLD | NEW |