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/network/cros_network_functions.h" | 5 #include "chromeos/network/cros_network_functions.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 name_servers_string)); | 279 name_servers_string)); |
280 return true; | 280 return true; |
281 } | 281 } |
282 | 282 |
283 void ListIPConfigsCallback(const NetworkGetIPConfigsCallback& callback, | 283 void ListIPConfigsCallback(const NetworkGetIPConfigsCallback& callback, |
284 const std::string& device_path, | 284 const std::string& device_path, |
285 DBusMethodCallStatus call_status, | 285 DBusMethodCallStatus call_status, |
286 const base::DictionaryValue& properties) { | 286 const base::DictionaryValue& properties) { |
287 NetworkIPConfigVector ipconfig_vector; | 287 NetworkIPConfigVector ipconfig_vector; |
288 std::string hardware_address; | 288 std::string hardware_address; |
289 const ListValue* ips = NULL; | 289 const base::ListValue* ips = NULL; |
290 if (call_status != DBUS_METHOD_CALL_SUCCESS || | 290 if (call_status != DBUS_METHOD_CALL_SUCCESS || |
291 !properties.GetListWithoutPathExpansion(flimflam::kIPConfigsProperty, | 291 !properties.GetListWithoutPathExpansion(flimflam::kIPConfigsProperty, |
292 &ips)) { | 292 &ips)) { |
293 callback.Run(ipconfig_vector, hardware_address); | 293 callback.Run(ipconfig_vector, hardware_address); |
294 return; | 294 return; |
295 } | 295 } |
296 | 296 |
297 for (size_t i = 0; i < ips->GetSize(); i++) { | 297 for (size_t i = 0; i < ips->GetSize(); i++) { |
298 std::string ipconfig_path; | 298 std::string ipconfig_path; |
299 if (!ips->GetString(i, &ipconfig_path)) { | 299 if (!ips->GetString(i, &ipconfig_path)) { |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 const dbus::ObjectPath device_object_path(device_path); | 620 const dbus::ObjectPath device_object_path(device_path); |
621 ShillDeviceClient* device_client = | 621 ShillDeviceClient* device_client = |
622 DBusThreadManager::Get()->GetShillDeviceClient(); | 622 DBusThreadManager::Get()->GetShillDeviceClient(); |
623 // TODO(hashimoto): Remove this blocking D-Bus method call. | 623 // TODO(hashimoto): Remove this blocking D-Bus method call. |
624 // crosbug.com/29902 | 624 // crosbug.com/29902 |
625 scoped_ptr<base::DictionaryValue> properties( | 625 scoped_ptr<base::DictionaryValue> properties( |
626 device_client->CallGetPropertiesAndBlock(device_object_path)); | 626 device_client->CallGetPropertiesAndBlock(device_object_path)); |
627 if (!properties.get()) | 627 if (!properties.get()) |
628 return false; | 628 return false; |
629 | 629 |
630 ListValue* ips = NULL; | 630 base::ListValue* ips = NULL; |
631 if (!properties->GetListWithoutPathExpansion( | 631 if (!properties->GetListWithoutPathExpansion( |
632 flimflam::kIPConfigsProperty, &ips)) | 632 flimflam::kIPConfigsProperty, &ips)) |
633 return false; | 633 return false; |
634 | 634 |
635 for (size_t i = 0; i < ips->GetSize(); i++) { | 635 for (size_t i = 0; i < ips->GetSize(); i++) { |
636 std::string ipconfig_path; | 636 std::string ipconfig_path; |
637 if (!ips->GetString(i, &ipconfig_path)) { | 637 if (!ips->GetString(i, &ipconfig_path)) { |
638 LOG(WARNING) << "Found NULL ip for device " << device_path; | 638 LOG(WARNING) << "Found NULL ip for device " << device_path; |
639 continue; | 639 continue; |
640 } | 640 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 | 674 |
675 // Resets the device. | 675 // Resets the device. |
676 void CrosReset(const std::string& device_path) { | 676 void CrosReset(const std::string& device_path) { |
677 DBusThreadManager::Get()->GetShillDeviceClient()->Reset( | 677 DBusThreadManager::Get()->GetShillDeviceClient()->Reset( |
678 dbus::ObjectPath(device_path), | 678 dbus::ObjectPath(device_path), |
679 base::Bind(&DoNothing), | 679 base::Bind(&DoNothing), |
680 base::Bind(&IgnoreErrors)); | 680 base::Bind(&IgnoreErrors)); |
681 } | 681 } |
682 | 682 |
683 } // namespace chromeos | 683 } // namespace chromeos |
OLD | NEW |