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

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: fix hardware address format in internet options handler 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..8dc5b0cd358981208990c9d37a53772fd50cd001 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,23 @@ 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();
+ cros_->GetIPConfigs(
+ network->device_path(),
+ chromeos::NetworkLibrary::FORMAT_COLON_SEPARATED_HEX,
+ base::Bind(&InternetOptionsHandler::PopulateIPConfigsCallback,
+ weak_factory_.GetWeakPtr(),
+ network,
Dmitry Polukhin 2012/11/12 23:02:28 I haven't write this code initially so I might not
stevenjb 2012/11/12 23:09:43 Yikes. We should never be passing a Network* in a
Greg Spencer (Chromium) 2012/11/13 00:04:59 Fixed.
+ 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 +1261,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 +1317,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);
« 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