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

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: 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
« no previous file with comments | « chrome/browser/ui/webui/options/chromeos/internet_options_handler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..ba7922213bc9c79fbe8322f699e600909df8cbff 100644
--- a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
+++ b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
@@ -1220,13 +1220,32 @@ void InternetOptionsHandler::PopulateDictionaryDetails(
chromeos::CrosRequestNetworkServiceProperties(
network->service_path(),
base::Bind(&InternetOptionsHandler::PopulateDictionaryDetailsCallback,
- weak_factory_.GetWeakPtr(), network));
+ weak_factory_.GetWeakPtr()));
}
void InternetOptionsHandler::PopulateDictionaryDetailsCallback(
- const chromeos::Network* network,
const std::string& service_path,
const base::DictionaryValue* shill_properties) {
+ chromeos::Network* network = cros_->FindNetworkByPath(service_path);
+ if (!network)
+ return;
+ // Have to copy the properties because the object will go out of scope when
+ // this function call completes (it's owned by the calling function).
+ base::DictionaryValue* shill_props_copy = shill_properties->DeepCopy();
+ cros_->GetIPConfigs(
+ network->device_path(),
+ chromeos::NetworkLibrary::FORMAT_COLON_SEPARATED_HEX,
+ base::Bind(&InternetOptionsHandler::PopulateIPConfigsCallback,
+ weak_factory_.GetWeakPtr(),
+ service_path,
+ base::Owned(shill_props_copy)));
+}
+
+void InternetOptionsHandler::PopulateIPConfigsCallback(
+ const std::string& service_path,
+ 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,
@@ -1234,9 +1253,12 @@ void InternetOptionsHandler::PopulateDictionaryDetailsCallback(
&properties_json);
VLOG(2) << "Shill Properties: " << std::endl << properties_json;
}
+ chromeos::Network* network = cros_->FindNetworkByPath(service_path);
+ if (!network)
+ return;
Profile::FromWebUI(web_ui())->GetProxyConfigTracker()->UISetCurrentNetwork(
- network->service_path());
+ service_path);
const chromeos::NetworkUIData& ui_data = network->ui_data();
const chromeos::NetworkPropertyUIData property_ui_data(ui_data);
@@ -1244,10 +1266,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);
« no previous file with comments | « chrome/browser/ui/webui/options/chromeos/internet_options_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698