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

Unified Diff: chrome/browser/ui/webui/options/chromeos/internet_options_handler.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: Removed scoped_ptr changes 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
diff --git a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
index bc63f1f019261044a4c79bb9238af431a181274e..1dd4ae47d9a34820c87e4f35bcd9dbf3df10222c 100644
--- a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
+++ b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
@@ -1227,6 +1227,22 @@ void InternetOptionsHandler::PopulateDictionaryDetailsCallback(
const chromeos::Network* network,
const std::string& service_path,
const base::DictionaryValue* shill_properties) {
+ // Have to copy the properties because the object will be out of scope when
+ // this function call completes (it's owned by the calling function).
+ base::DictionaryValue* shill_props_copy = shill_properties->DeepCopy();
+ chromeos::CrosListIPConfigs(
+ network->device_path(),
+ base::Bind(&InternetOptionsHandler::PopulateIPConfigsCallback,
+ weak_factory_.GetWeakPtr(),
+ network,
+ base::Owned(shill_props_copy)));
+}
+
+void InternetOptionsHandler::PopulateIPConfigsCallback(
+ const chromeos::Network* network,
+ base::DictionaryValue* shill_properties,
+ const chromeos::NetworkIPConfigVector& ipconfigs,
+ const std::string& hardware_address) {
if (VLOG_IS_ON(2)) {
std::string properties_json;
base::JSONWriter::WriteWithOptions(shill_properties,
@@ -1244,10 +1260,6 @@ void InternetOptionsHandler::PopulateDictionaryDetailsCallback(
cros_->FindOncForNetwork(network->unique_id());
base::DictionaryValue dictionary;
- std::string hardware_address;
- chromeos::NetworkIPConfigVector ipconfigs = cros_->GetIPConfigs(
- network->device_path(), &hardware_address,
- chromeos::NetworkLibrary::FORMAT_COLON_SEPARATED_HEX);
if (!hardware_address.empty())
dictionary.SetString(kTagHardwareAddress, hardware_address);
@@ -1304,7 +1316,8 @@ void InternetOptionsHandler::PopulateDictionaryDetailsCallback(
static_ip_dict.release(),
property_ui_data);
} else {
- LOG(ERROR) << "Unable to fetch IP configuration for " << service_path;
+ LOG(ERROR) << "Unable to fetch IP configuration for "
+ << network->service_path();
// If we were unable to fetch shill_properties for some reason,
// then just go with some defaults.
dictionary.SetBoolean(kIpConfigAutoConfig, false);

Powered by Google App Engine
This is Rietveld 408576698