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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 virtual void Register(const dbus::ObjectPath& device_path, | 360 virtual void Register(const dbus::ObjectPath& device_path, |
361 const std::string& network_id, | 361 const std::string& network_id, |
362 const base::Closure& callback, | 362 const base::Closure& callback, |
363 const ErrorCallback& error_callback) OVERRIDE { | 363 const ErrorCallback& error_callback) OVERRIDE { |
364 MessageLoop::current()->PostTask(FROM_HERE, callback); | 364 MessageLoop::current()->PostTask(FROM_HERE, callback); |
365 } | 365 } |
366 | 366 |
367 private: | 367 private: |
368 void PassStubDevicePrperties(const dbus::ObjectPath& device_path, | 368 void PassStubDevicePrperties(const dbus::ObjectPath& device_path, |
369 const DictionaryValueCallback& callback) const { | 369 const DictionaryValueCallback& callback) const { |
370 base::DictionaryValue* device_properties = NULL; | 370 const base::DictionaryValue* device_properties = NULL; |
371 if (!stub_devices_.GetDictionary(device_path.value(), &device_properties)) { | 371 if (!stub_devices_.GetDictionary(device_path.value(), &device_properties)) { |
372 base::DictionaryValue empty_dictionary; | 372 base::DictionaryValue empty_dictionary; |
373 callback.Run(DBUS_METHOD_CALL_FAILURE, empty_dictionary); | 373 callback.Run(DBUS_METHOD_CALL_FAILURE, empty_dictionary); |
374 return; | 374 return; |
375 } | 375 } |
376 callback.Run(DBUS_METHOD_CALL_SUCCESS, *device_properties); | 376 callback.Run(DBUS_METHOD_CALL_SUCCESS, *device_properties); |
377 } | 377 } |
378 | 378 |
379 // Posts a task to run a void callback with status code |status|. | 379 // Posts a task to run a void callback with status code |status|. |
380 void PostVoidCallback(const VoidCallback& callback, | 380 void PostVoidCallback(const VoidCallback& callback, |
(...skipping 19 matching lines...) Expand all Loading... |
400 FlimflamDeviceClient* FlimflamDeviceClient::Create( | 400 FlimflamDeviceClient* FlimflamDeviceClient::Create( |
401 DBusClientImplementationType type, | 401 DBusClientImplementationType type, |
402 dbus::Bus* bus) { | 402 dbus::Bus* bus) { |
403 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) | 403 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) |
404 return new FlimflamDeviceClientImpl(bus); | 404 return new FlimflamDeviceClientImpl(bus); |
405 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); | 405 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); |
406 return new FlimflamDeviceClientStubImpl(); | 406 return new FlimflamDeviceClientStubImpl(); |
407 } | 407 } |
408 | 408 |
409 } // namespace chromeos | 409 } // namespace chromeos |
OLD | NEW |