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

Unified Diff: chromeos/network/onc/onc_validator.cc

Issue 750313003: ONC: Add IPConfigType. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ipconfig_object
Patch Set: Change clearing of StaticIPConfig. Created 6 years 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/onc/onc_validator.cc
diff --git a/chromeos/network/onc/onc_validator.cc b/chromeos/network/onc/onc_validator.cc
index d84d2556cb174bbc54e22ddff9c47c69a0027a11..41605f8a5018aa3ff782692dad451fc33076e964 100644
--- a/chromeos/network/onc/onc_validator.cc
+++ b/chromeos/network/onc/onc_validator.cc
@@ -471,7 +471,13 @@ bool Validator::ValidateNetworkConfiguration(base::DictionaryValue* result) {
::onc::network_type::kEthernet, ::onc::network_type::kVPN,
::onc::network_type::kWiFi, ::onc::network_type::kCellular};
const std::vector<const char*> valid_types(toVector(kValidTypes));
+ const char* const kValidIPConfigTypes[] = {kIPConfigTypeDHCP,
+ kIPConfigTypeStatic};
+ const std::vector<const char*> valid_ipconfig_types(
+ toVector(kValidIPConfigTypes));
if (FieldExistsAndHasNoValidValue(*result, kType, valid_types) ||
+ FieldExistsAndHasNoValidValue(*result, kIPConfigType,
+ valid_ipconfig_types) ||
FieldExistsAndIsEmpty(*result, kGUID)) {
return false;
}
@@ -487,6 +493,11 @@ bool Validator::ValidateNetworkConfiguration(base::DictionaryValue* result) {
all_required_exist &=
RequireField(*result, kName) && RequireField(*result, kType);
+ std::string ipconfig_type;
+ result->GetStringWithoutPathExpansion(kIPConfigType, &ipconfig_type);
+ if (ipconfig_type == kIPConfigTypeStatic)
+ all_required_exist &= RequireField(*result, kStaticIPConfig);
+
std::string type;
result->GetStringWithoutPathExpansion(kType, &type);
« no previous file with comments | « chromeos/network/onc/onc_translator_onc_to_shill.cc ('k') | chromeos/test/data/network/augmented_merge.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698