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

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
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..ad19116aa6448b65050994748791ff2a9b5615ff 100644
--- a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
+++ b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
@@ -1226,10 +1226,23 @@ void InternetOptionsHandler::PopulateDictionaryDetails(
void InternetOptionsHandler::PopulateDictionaryDetailsCallback(
const chromeos::Network* network,
const std::string& service_path,
- const base::DictionaryValue* shill_properties) {
+ scoped_ptr<base::DictionaryValue> shill_properties) {
+ chromeos::CrosListIPConfigs(
+ network->device_path(),
+ base::Bind(&InternetOptionsHandler::PopulateIPConfigsCallback,
+ weak_factory_.GetWeakPtr(),
+ network,
+ base::Passed(&shill_properties)));
Greg Spencer (Chromium) 2012/11/05 21:05:31 This is why the dictionary callback needs to use a
+}
+
+void InternetOptionsHandler::PopulateIPConfigsCallback(
+ const chromeos::Network* network,
+ scoped_ptr<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,
+ base::JSONWriter::WriteWithOptions(shill_properties.get(),
base::JSONWriter::OPTIONS_PRETTY_PRINT,
&properties_json);
VLOG(2) << "Shill Properties: " << std::endl << properties_json;
@@ -1244,10 +1257,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);
@@ -1275,7 +1284,7 @@ void InternetOptionsHandler::PopulateDictionaryDetailsCallback(
property_ui_data);
std::string name_server_type = kNameServerTypeAutomatic;
- if (shill_properties) {
+ if (shill_properties.get()) {
int automatic_ip_config = 0;
scoped_ptr<DictionaryValue> static_ip_dict(
BuildIPInfoDictionary(*shill_properties, true, &automatic_ip_config));
@@ -1304,7 +1313,7 @@ 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";
// 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