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

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: Rebase 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
« no previous file with comments | « chromeos/network/shill_property_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/network/shill_property_util.cc
diff --git a/chromeos/network/shill_property_util.cc b/chromeos/network/shill_property_util.cc
index 613478e214381ffa97887fc9a831d2e13cc791dc..35e4bb19a9154c532b57d8419f6690e94ffc7789 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.GetStringWithoutPathExpansion(shill::kGuidProperty, &result))
+ return result;
+ if (properties.GetStringWithoutPathExpansion(shill::kSSIDProperty, &result))
+ return result;
+ if (properties.GetStringWithoutPathExpansion(shill::kNameProperty, &result))
+ return result;
+ std::string type = "UnknownType";
+ properties.GetStringWithoutPathExpansion(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;
}
« no previous file with comments | « chromeos/network/shill_property_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698