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

Side by Side Diff: chromeos/network/onc/onc_validator.cc

Issue 366273002: Update onc_spec.html to match implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comment. Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | components/onc/docs/onc_spec.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chromeos/network/onc/onc_validator.h" 5 #include "chromeos/network/onc/onc_validator.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 424
425 bool Validator::ValidateToplevelConfiguration(base::DictionaryValue* result) { 425 bool Validator::ValidateToplevelConfiguration(base::DictionaryValue* result) {
426 using namespace ::onc::toplevel_config; 426 using namespace ::onc::toplevel_config;
427 427
428 const char* const kValidTypes[] = {kUnencryptedConfiguration, 428 const char* const kValidTypes[] = {kUnencryptedConfiguration,
429 kEncryptedConfiguration}; 429 kEncryptedConfiguration};
430 const std::vector<const char*> valid_types(toVector(kValidTypes)); 430 const std::vector<const char*> valid_types(toVector(kValidTypes));
431 if (FieldExistsAndHasNoValidValue(*result, kType, valid_types)) 431 if (FieldExistsAndHasNoValidValue(*result, kType, valid_types))
432 return false; 432 return false;
433 433
434 // Not part of the ONC spec:
435 // - We don't require the type field (we assume that it's an
436 // UnencryptedConfiguration then).
437 // - We don't require specific toplevel objects to be present (e.g. at least
438 // one of NetworkConfiguration or Certificates).
439
440 if (IsGlobalNetworkConfigInUserImport(*result)) 434 if (IsGlobalNetworkConfigInUserImport(*result))
441 return false; 435 return false;
442 436
443 return true; 437 return true;
444 } 438 }
445 439
446 bool Validator::ValidateNetworkConfiguration(base::DictionaryValue* result) { 440 bool Validator::ValidateNetworkConfiguration(base::DictionaryValue* result) {
447 using namespace ::onc::network_config; 441 using namespace ::onc::network_config;
448 442
449 const char* const kValidTypes[] = { 443 const char* const kValidTypes[] = {
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 } 844 }
851 845
852 std::string Validator::MessageHeader() { 846 std::string Validator::MessageHeader() {
853 std::string path = path_.empty() ? "toplevel" : JoinString(path_, "."); 847 std::string path = path_.empty() ? "toplevel" : JoinString(path_, ".");
854 std::string message = "At " + path + ": "; 848 std::string message = "At " + path + ": ";
855 return message; 849 return message;
856 } 850 }
857 851
858 } // namespace onc 852 } // namespace onc
859 } // namespace chromeos 853 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | components/onc/docs/onc_spec.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698