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

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

Issue 2816513002: Revert of Change base::Value::ListStorage to std::vector<base::Value> (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « chromeos/network/onc/onc_utils_unittest.cc ('k') | chromeos/network/policy_applicator.cc » ('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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 error_or_warning_found_ = true; 238 error_or_warning_found_ = true;
239 LOG(WARNING) << MessageHeader() << "Found the field '" 239 LOG(WARNING) << MessageHeader() << "Found the field '"
240 << ::onc::kRecommended 240 << ::onc::kRecommended
241 << "' in an unmanaged ONC. Removing it."; 241 << "' in an unmanaged ONC. Removing it.";
242 return true; 242 return true;
243 } 243 }
244 244
245 std::unique_ptr<base::ListValue> repaired_recommended(new base::ListValue); 245 std::unique_ptr<base::ListValue> repaired_recommended(new base::ListValue);
246 for (const auto& entry : *recommended_list) { 246 for (const auto& entry : *recommended_list) {
247 std::string field_name; 247 std::string field_name;
248 if (!entry.GetAsString(&field_name)) { 248 if (!entry->GetAsString(&field_name)) {
249 NOTREACHED(); // The types of field values are already verified. 249 NOTREACHED(); // The types of field values are already verified.
250 continue; 250 continue;
251 } 251 }
252 252
253 const OncFieldSignature* field_signature = 253 const OncFieldSignature* field_signature =
254 GetFieldSignature(object_signature, field_name); 254 GetFieldSignature(object_signature, field_name);
255 255
256 bool found_error = false; 256 bool found_error = false;
257 std::string error_cause; 257 std::string error_cause;
258 if (!field_signature) { 258 if (!field_signature) {
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 397
398 bool Validator::ListFieldContainsValidValues( 398 bool Validator::ListFieldContainsValidValues(
399 const base::DictionaryValue& object, 399 const base::DictionaryValue& object,
400 const std::string& field_name, 400 const std::string& field_name,
401 const std::vector<const char*>& valid_values) { 401 const std::vector<const char*>& valid_values) {
402 const base::ListValue* list = NULL; 402 const base::ListValue* list = NULL;
403 if (object.GetListWithoutPathExpansion(field_name, &list)) { 403 if (object.GetListWithoutPathExpansion(field_name, &list)) {
404 path_.push_back(field_name); 404 path_.push_back(field_name);
405 for (const auto& entry : *list) { 405 for (const auto& entry : *list) {
406 std::string value; 406 std::string value;
407 if (!entry.GetAsString(&value)) { 407 if (!entry->GetAsString(&value)) {
408 NOTREACHED(); // The types of field values are already verified. 408 NOTREACHED(); // The types of field values are already verified.
409 continue; 409 continue;
410 } 410 }
411 if (!IsValidValue(value, valid_values)) { 411 if (!IsValidValue(value, valid_values)) {
412 path_.pop_back(); 412 path_.pop_back();
413 return false; 413 return false;
414 } 414 }
415 } 415 }
416 path_.pop_back(); 416 path_.pop_back();
417 } 417 }
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 } 1016 }
1017 1017
1018 std::string Validator::MessageHeader() { 1018 std::string Validator::MessageHeader() {
1019 std::string path = path_.empty() ? "toplevel" : base::JoinString(path_, "."); 1019 std::string path = path_.empty() ? "toplevel" : base::JoinString(path_, ".");
1020 std::string message = "At " + path + ": "; 1020 std::string message = "At " + path + ": ";
1021 return message; 1021 return message;
1022 } 1022 }
1023 1023
1024 } // namespace onc 1024 } // namespace onc
1025 } // namespace chromeos 1025 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/onc/onc_utils_unittest.cc ('k') | chromeos/network/policy_applicator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698