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

Unified Diff: chromeos/network/device_state.cc

Issue 1417853002: Add IPv6 Address to status tray (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months 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 | « chromeos/network/device_state.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/network/device_state.cc
diff --git a/chromeos/network/device_state.cc b/chromeos/network/device_state.cc
index d736e16671e175d37bd2dc61c15ed0b8f3e28f31..264698cbbd0b9a4502d5932f804d643a35f13853 100644
--- a/chromeos/network/device_state.cc
+++ b/chromeos/network/device_state.cc
@@ -128,6 +128,27 @@ void DeviceState::IPConfigPropertiesChanged(
ip_config->MergeDictionary(&properties);
}
+std::string DeviceState::GetIpAddressByType(const std::string& type) const {
+ for (base::DictionaryValue::Iterator iter(ip_configs_); !iter.IsAtEnd();
+ iter.Advance()) {
+ const base::DictionaryValue* ip_config;
+ if (!iter.value().GetAsDictionary(&ip_config))
+ continue;
+ std::string ip_config_method;
+ if (!ip_config->GetString(shill::kMethodProperty, &ip_config_method))
+ continue;
+ if (type == ip_config_method ||
+ (type == shill::kTypeIPv4 && ip_config_method == shill::kTypeDHCP) ||
+ (type == shill::kTypeIPv6 && ip_config_method == shill::kTypeDHCP6)) {
+ std::string address;
+ if (!ip_config->GetString(shill::kAddressProperty, &address))
+ continue;
+ return address;
+ }
+ }
+ return std::string();
+}
+
bool DeviceState::IsSimAbsent() const {
return technology_family_ == shill::kTechnologyFamilyGsm && !sim_present_;
}
« no previous file with comments | « chromeos/network/device_state.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698