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

Unified Diff: chromeos/network/device_state.cc

Issue 267433005: Provide IPConfigs in networkingPrivate.GetProperties (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 7 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') | chromeos/network/managed_network_configuration_handler.h » ('j') | 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 6fd8d7d7d9aa4032186874a485f32c19b94eed3d..0880ef7393d64247b8ed3e0b6660cb7064382dab 100644
--- a/chromeos/network/device_state.cc
+++ b/chromeos/network/device_state.cc
@@ -8,6 +8,7 @@
#include "base/metrics/histogram.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
+#include "chromeos/network/network_event_log.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
namespace chromeos {
@@ -121,6 +122,12 @@ bool DeviceState::PropertyChanged(const std::string& key,
return GetBooleanValue(key, value, &sim_present_);
} else if (key == shill::kEapAuthenticationCompletedProperty) {
return GetBooleanValue(key, value, &eap_authentication_completed_);
+ } else if (key == shill::kIPConfigsProperty) {
+ // If kIPConfigsProperty changes, clear any previous ip_configs_.
+ // ShillPropertyhandler will request the IPConfig objects which will trigger
+ // calls to IPConfigPropertiesChanged.
+ ip_configs_.Clear();
+ return false; // No actual state change.
}
return false;
}
@@ -135,6 +142,22 @@ bool DeviceState::InitialPropertiesReceived(
return false;
}
+void DeviceState::IPConfigPropertiesChanged(
+ const std::string& ip_config_path,
+ const base::DictionaryValue& properties) {
+ base::DictionaryValue* ip_config = NULL;
+ if (ip_configs_.GetDictionaryWithoutPathExpansion(
+ ip_config_path, &ip_config)) {
+ NET_LOG_EVENT("IPConfig Updated: " + ip_config_path, path());
+ ip_config->Clear();
+ } else {
+ NET_LOG_EVENT("IPConfig Added: " + ip_config_path, path());
+ ip_config = new base::DictionaryValue;
+ ip_configs_.SetWithoutPathExpansion(ip_config_path, ip_config);
+ }
+ ip_config->MergeDictionary(&properties);
+}
+
std::string DeviceState::GetFormattedMacAddress() const {
if (mac_address_.size() % 2 != 0)
return mac_address_;
« no previous file with comments | « chromeos/network/device_state.h ('k') | chromeos/network/managed_network_configuration_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698