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

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 + Elim DHCP ONC types Created 6 years, 8 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
Index: chromeos/network/device_state.cc
diff --git a/chromeos/network/device_state.cc b/chromeos/network/device_state.cc
index 6fd8d7d7d9aa4032186874a485f32c19b94eed3d..a0eade0502ee7add25fd95f1551b0af1a59f62b9 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 {
@@ -132,9 +133,27 @@ bool DeviceState::InitialPropertiesReceived(
bool locked = !sim_lock_type_.empty();
UMA_HISTOGRAM_BOOLEAN("Cellular.SIMLocked", locked);
}
+ // IP Configs will be added when they are received.
pneubeck (no reviews) 2014/05/05 21:09:28 the comment doesn't explain why you have to clear
stevenjb 2014/05/06 01:15:11 Moved this logic and added a better comment.
+ ip_configs_.Clear();
return false;
}
+void DeviceState::IPConfigPropertiesChanged(
+ const std::string& ip_config_path,
+ const base::DictionaryValue& properties) {
+ base::DictionaryValue* ip_config;
pneubeck (no reviews) 2014/05/05 21:09:28 nit: initialize with NULL
stevenjb 2014/05/06 01:15:11 Done.
+ 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_;

Powered by Google App Engine
This is Rietveld 408576698