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

Unified Diff: chromeos/network/shill_property_util.cc

Issue 207183003: Cleanup network event logging, add to ManagedNetworkConfigurationHandler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 9 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/shill_property_util.cc
diff --git a/chromeos/network/shill_property_util.cc b/chromeos/network/shill_property_util.cc
index d0d33d3a6742f4e62509375f7b0ba980b35e6584..7ffa457f5da8a224178325a8d471841002a4430b 100644
--- a/chromeos/network/shill_property_util.cc
+++ b/chromeos/network/shill_property_util.cc
@@ -120,6 +120,22 @@ std::string GetSSIDFromProperties(const base::DictionaryValue& properties,
return ssid;
}
+std::string GetNetworkIdFromProperties(
+ const base::DictionaryValue& properties) {
+ if (properties.empty())
+ return "EmptyProperties";
+ std::string result;
+ if (properties.GetString(shill::kGuidProperty, &result))
pneubeck (no reviews) 2014/03/21 09:33:42 ...WithoutPathExpansion... (I hate that verbosity)
stevenjb 2014/03/21 17:08:51 Yeah, so do I. Strictly speaking it's not necessar
pneubeck (no reviews) 2014/03/21 19:52:19 Yes, and the method names are simply wrong: withou
+ return result;
+ if (properties.GetString(shill::kSSIDProperty, &result))
+ return result;
+ if (properties.GetString(shill::kNameProperty, &result))
+ return result;
+ std::string type = "UnknownType";
+ properties.GetString(shill::kTypeProperty, &type);
+ return "Unidentified " + type;
+}
+
std::string GetNameFromProperties(const std::string& service_path,
const base::DictionaryValue& properties) {
std::string name;
@@ -135,6 +151,10 @@ std::string GetNameFromProperties(const std::string& service_path,
std::string type;
properties.GetStringWithoutPathExpansion(shill::kTypeProperty, &type);
+ if (type.empty()) {
+ NET_LOG_ERROR("GetNameFromProperties: No type", service_path);
+ return validated_name;
+ }
if (!NetworkTypePattern::WiFi().MatchesType(type))
return validated_name;
@@ -222,8 +242,9 @@ bool CopyIdentifyingProperties(const base::DictionaryValue& service_properties,
// with the keys "Provider.Type" and "Provider.Host".
const base::DictionaryValue* provider_properties = NULL;
if (!service_properties.GetDictionaryWithoutPathExpansion(
- shill::kProviderProperty, &provider_properties)) {
- NET_LOG_ERROR("CopyIdentifyingProperties", "Missing VPN provider dict");
+ shill::kProviderProperty, &provider_properties)) {
+ NET_LOG_ERROR("Missing VPN provider dict",
+ GetNetworkIdFromProperties(service_properties));
return false;
}
std::string vpn_provider_type;
@@ -246,8 +267,10 @@ bool CopyIdentifyingProperties(const base::DictionaryValue& service_properties,
NOTREACHED() << "Unsupported network type " << type;
success = false;
}
- if (!success)
- NET_LOG_ERROR("CopyIdentifyingProperties", "Missing required properties");
+ if (!success) {
+ NET_LOG_ERROR("Missing required properties",
+ GetNetworkIdFromProperties(service_properties));
+ }
return success;
}
« chromeos/network/network_state.cc ('K') | « chromeos/network/shill_property_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698