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

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

Issue 11962048: This adds Cellular to the Shill to ONC translation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix some semantics Created 7 years, 11 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
« chromeos/network/onc/onc_utils.cc ('K') | « chromeos/network/onc/onc_utils.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/network/onc/onc_validator.cc
diff --git a/chromeos/network/onc/onc_validator.cc b/chromeos/network/onc/onc_validator.cc
index a57aeca2d6e77608b5532f9f853e2a33c7f4f2fa..949920a1e730a1b06982b90ac59484829485b045 100644
--- a/chromeos/network/onc/onc_validator.cc
+++ b/chromeos/network/onc/onc_validator.cc
@@ -387,7 +387,9 @@ bool Validator::ValidateToplevelConfiguration(
static const char* kValidTypes[] =
{ kUnencryptedConfiguration, kEncryptedConfiguration, NULL };
- if (FieldExistsAndHasNoValidValue(*result, kType, kValidTypes))
+ if (FieldExistsAndHasNoValidValue(*result,
+ network_config::kType,
+ kValidTypes))
pneubeck (no reviews) 2013/01/18 10:27:41 toplevel_config::kType
Greg Spencer (Chromium) 2013/01/22 19:10:54 Done.
return false;
bool allRequiredExist = true;
@@ -395,7 +397,7 @@ bool Validator::ValidateToplevelConfiguration(
// Not part of the ONC spec yet:
// We don't require the type field and default to UnencryptedConfiguration.
std::string type = kUnencryptedConfiguration;
- result->GetStringWithoutPathExpansion(kType, &type);
+ result->GetStringWithoutPathExpansion(network_config::kType, &type);
pneubeck (no reviews) 2013/01/18 10:27:41 here too
Greg Spencer (Chromium) 2013/01/22 19:10:54 Done.
if (type == kUnencryptedConfiguration &&
!result->HasKey(kNetworkConfigurations) &&
!result->HasKey(kCertificates)) {
@@ -421,26 +423,31 @@ bool Validator::ValidateNetworkConfiguration(
return false;
}
- static const char* kValidTypes[] = { kEthernet, kVPN, kWiFi, NULL };
- if (FieldExistsAndHasNoValidValue(*result, kType, kValidTypes))
+ static const char* kValidTypes[] = { network_type::kEthernet,
+ network_type::kVPN,
+ network_type::kWiFi,
+ NULL };
+ if (FieldExistsAndHasNoValidValue(*result,
+ network_config::kType,
+ kValidTypes))
return false;
- bool allRequiredExist = RequireField(*result, kGUID);
+ bool allRequiredExist = RequireField(*result, network_config::kGUID);
bool remove = false;
result->GetBooleanWithoutPathExpansion(kRemove, &remove);
if (!remove) {
- allRequiredExist &= RequireField(*result, kName);
- allRequiredExist &= RequireField(*result, kType);
+ allRequiredExist &= RequireField(*result, network_config::kName);
+ allRequiredExist &= RequireField(*result, network_config::kType);
std::string type;
- result->GetStringWithoutPathExpansion(kType, &type);
+ result->GetStringWithoutPathExpansion(network_config::kType, &type);
// Prohibit anything but WiFi and Ethernet for device-level policy (which
// corresponds to shared networks). See also http://crosbug.com/28741.
if (onc_source_ == ONC_SOURCE_DEVICE_POLICY &&
- type != kWiFi &&
- type != kEthernet) {
+ type != network_type::kWiFi &&
+ type != network_type::kEthernet) {
error_or_warning_found_ = true;
LOG(ERROR) << ErrorHeader() << "Networks of type '"
<< type << "' are prohibited in ONC device policies.";
@@ -739,7 +746,7 @@ bool Validator::ValidateCertificate(
if (FieldExistsAndHasNoValidValue(*result, certificate::kType, kValidTypes))
return false;
- bool allRequiredExist = RequireField(*result, kGUID);
+ bool allRequiredExist = RequireField(*result, network_config::kGUID);
pneubeck (no reviews) 2013/01/18 10:27:41 kGUID without namespace (with the 'using namespace
bool remove = false;
result->GetBooleanWithoutPathExpansion(kRemove, &remove);
« chromeos/network/onc/onc_utils.cc ('K') | « chromeos/network/onc/onc_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698