Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Side by Side Diff: chromeos/dbus/shill_device_client.cc

Issue 11367048: This is the first pass at making GetIPConfigs asynchronous. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/shill_device_client.h" 5 #include "chromeos/dbus/shill_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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 // Manager entry. 392 // Manager entry.
393 AddDevice("stub_cellular_device1", flimflam::kTypeCellular, 393 AddDevice("stub_cellular_device1", flimflam::kTypeCellular,
394 "/device/cellular1", "/stub"); 394 "/device/cellular1", "/stub");
395 } 395 }
396 396
397 void PassStubDeviceProperties(const dbus::ObjectPath& device_path, 397 void PassStubDeviceProperties(const dbus::ObjectPath& device_path,
398 const DictionaryValueCallback& callback) const { 398 const DictionaryValueCallback& callback) const {
399 const base::DictionaryValue* device_properties = NULL; 399 const base::DictionaryValue* device_properties = NULL;
400 if (!stub_devices_.GetDictionaryWithoutPathExpansion( 400 if (!stub_devices_.GetDictionaryWithoutPathExpansion(
401 device_path.value(), &device_properties)) { 401 device_path.value(), &device_properties)) {
402 base::DictionaryValue empty_dictionary; 402 scoped_ptr<base::DictionaryValue> empty_dictionary(
403 callback.Run(DBUS_METHOD_CALL_FAILURE, empty_dictionary); 403 new base::DictionaryValue);
404 callback.Run(DBUS_METHOD_CALL_FAILURE, empty_dictionary.Pass());
404 return; 405 return;
405 } 406 }
406 callback.Run(DBUS_METHOD_CALL_SUCCESS, *device_properties); 407 scoped_ptr<base::DictionaryValue> properties_copy(
408 device_properties->DeepCopy());
409 callback.Run(DBUS_METHOD_CALL_SUCCESS, properties_copy.Pass());
407 } 410 }
408 411
409 // Posts a task to run a void callback with status code |status|. 412 // Posts a task to run a void callback with status code |status|.
410 void PostVoidCallback(const VoidDBusMethodCallback& callback, 413 void PostVoidCallback(const VoidDBusMethodCallback& callback,
411 DBusMethodCallStatus status) { 414 DBusMethodCallStatus status) {
412 MessageLoop::current()->PostTask(FROM_HERE, 415 MessageLoop::current()->PostTask(FROM_HERE,
413 base::Bind(callback, status)); 416 base::Bind(callback, status));
414 } 417 }
415 418
416 base::DictionaryValue* GetDeviceProperties(const std::string& device_path) { 419 base::DictionaryValue* GetDeviceProperties(const std::string& device_path) {
(...skipping 26 matching lines...) Expand all
443 ShillDeviceClient* ShillDeviceClient::Create( 446 ShillDeviceClient* ShillDeviceClient::Create(
444 DBusClientImplementationType type, 447 DBusClientImplementationType type,
445 dbus::Bus* bus) { 448 dbus::Bus* bus) {
446 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) 449 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION)
447 return new ShillDeviceClientImpl(bus); 450 return new ShillDeviceClientImpl(bus);
448 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); 451 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type);
449 return new ShillDeviceClientStubImpl(); 452 return new ShillDeviceClientStubImpl();
450 } 453 }
451 454
452 } // namespace chromeos 455 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698