| Index: chrome/browser/chromeos/cros/cros_network_functions.cc
|
| diff --git a/chrome/browser/chromeos/cros/cros_network_functions.cc b/chrome/browser/chromeos/cros/cros_network_functions.cc
|
| index aff8e27dca2cfb7d19569a67e4210930b4f5388a..1080692d3f4d1d1d85182b373915e66eec0756b1 100644
|
| --- a/chrome/browser/chromeos/cros/cros_network_functions.cc
|
| +++ b/chrome/browser/chromeos/cros/cros_network_functions.cc
|
| @@ -222,16 +222,21 @@ void IgnoreErrors(const std::string& error_name,
|
| void RunCallbackWithDictionaryValue(const NetworkPropertiesCallback& callback,
|
| const std::string& path,
|
| DBusMethodCallStatus call_status,
|
| - const base::DictionaryValue& value) {
|
| - callback.Run(path, call_status == DBUS_METHOD_CALL_SUCCESS ? &value : NULL);
|
| + scoped_ptr<base::DictionaryValue> value) {
|
| + if (call_status == DBUS_METHOD_CALL_SUCCESS) {
|
| + callback.Run(path, value.Pass());
|
| + } else {
|
| + scoped_ptr<base::DictionaryValue> empty(NULL);
|
| + callback.Run(path, empty.Pass());
|
| + }
|
| }
|
|
|
| // A callback used to implement CrosRequest*Properties functions.
|
| void RunCallbackWithDictionaryValueNoStatus(
|
| const NetworkPropertiesCallback& callback,
|
| const std::string& path,
|
| - const base::DictionaryValue& value) {
|
| - callback.Run(path, &value);
|
| + scoped_ptr<base::DictionaryValue> value) {
|
| + callback.Run(path, value.Pass());
|
| }
|
|
|
| // A callback used to implement the error callback for CrosRequest*Properties
|
| @@ -241,7 +246,8 @@ void RunCallbackWithDictionaryValueError(
|
| const std::string& path,
|
| const std::string& error_name,
|
| const std::string& error_message) {
|
| - callback.Run(path, NULL);
|
| + scoped_ptr<base::DictionaryValue> null_dict(NULL);
|
| + callback.Run(path, null_dict.Pass());
|
| }
|
|
|
| // Used as a callback for ShillManagerClient::GetService
|
| @@ -346,6 +352,36 @@ bool ParseIPConfig(const std::string& device_path,
|
| return true;
|
| }
|
|
|
| +void ListIPConfigsCallback(const NetworkGetIPConfigsCallback& callback,
|
| + const std::string& device_path,
|
| + DBusMethodCallStatus call_status,
|
| + scoped_ptr<base::DictionaryValue> properties) {
|
| + DCHECK(properties.get());
|
| + NetworkIPConfigVector ipconfig_vector;
|
| + std::string hardware_address;
|
| + const ListValue* ips = NULL;
|
| + if (call_status != DBUS_METHOD_CALL_SUCCESS ||
|
| + !properties->GetListWithoutPathExpansion(flimflam::kIPConfigsProperty,
|
| + &ips)) {
|
| + callback.Run(ipconfig_vector, hardware_address);
|
| + return;
|
| + }
|
| +
|
| + for (size_t i = 0; i < ips->GetSize(); i++) {
|
| + std::string ipconfig_path;
|
| + if (!ips->GetString(i, &ipconfig_path)) {
|
| + LOG(WARNING) << "Found NULL ip for device " << device_path;
|
| + continue;
|
| + }
|
| + ParseIPConfig(device_path, ipconfig_path, &ipconfig_vector);
|
| + }
|
| + // Get the hardware address as well.
|
| + properties->GetStringWithoutPathExpansion(flimflam::kAddressProperty,
|
| + &hardware_address);
|
| +
|
| + callback.Run(ipconfig_vector, hardware_address);
|
| +}
|
| +
|
| } // namespace
|
|
|
| SMS::SMS()
|
| @@ -654,10 +690,18 @@ bool CrosSetOfflineMode(bool offline) {
|
| return true;
|
| }
|
|
|
| -bool CrosListIPConfigs(const std::string& device_path,
|
| - NetworkIPConfigVector* ipconfig_vector,
|
| - std::vector<std::string>* ipconfig_paths,
|
| - std::string* hardware_address) {
|
| +void CrosListIPConfigs(const std::string& device_path,
|
| + const NetworkGetIPConfigsCallback& callback) {
|
| + const dbus::ObjectPath device_object_path(device_path);
|
| + DBusThreadManager::Get()->GetShillDeviceClient()->GetProperties(
|
| + device_object_path,
|
| + base::Bind(&ListIPConfigsCallback, callback, device_path));
|
| +}
|
| +
|
| +bool CrosListIPConfigsAndBlock(const std::string& device_path,
|
| + NetworkIPConfigVector* ipconfig_vector,
|
| + std::vector<std::string>* ipconfig_paths,
|
| + std::string* hardware_address) {
|
| if (hardware_address)
|
| hardware_address->clear();
|
| const dbus::ObjectPath device_object_path(device_path);
|
|
|