OLD | NEW |
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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 scoped_ptr<base::ListValue> repaired_recommended(new base::ListValue); | 258 scoped_ptr<base::ListValue> repaired_recommended(new base::ListValue); |
259 for (base::ListValue::iterator it = recommended->begin(); | 259 for (base::ListValue::iterator it = recommended->begin(); |
260 it != recommended->end(); ++it) { | 260 it != recommended->end(); ++it) { |
261 std::string field_name; | 261 std::string field_name; |
262 if (!(*it)->GetAsString(&field_name)) { | 262 if (!(*it)->GetAsString(&field_name)) { |
263 NOTREACHED(); | 263 NOTREACHED(); |
264 continue; | 264 continue; |
265 } | 265 } |
266 | 266 |
267 const OncFieldSignature* field_signature = | 267 const OncFieldSignature* field_signature = |
268 GetFieldSignature(object_signature, field_name); | 268 GetOncFieldSignature(object_signature, field_name); |
269 | 269 |
270 bool found_error = false; | 270 bool found_error = false; |
271 std::string error_cause; | 271 std::string error_cause; |
272 if (field_signature == NULL) { | 272 if (field_signature == NULL) { |
273 found_error = true; | 273 found_error = true; |
274 error_cause = "unknown"; | 274 error_cause = "unknown"; |
275 } else if (field_signature->value_signature->onc_type == | 275 } else if (field_signature->value_signature->onc_type == |
276 base::Value::TYPE_DICTIONARY) { | 276 base::Value::TYPE_DICTIONARY) { |
277 found_error = true; | 277 found_error = true; |
278 error_cause = "dictionary-typed"; | 278 error_cause = "dictionary-typed"; |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 } | 813 } |
814 | 814 |
815 std::string Validator::MessageHeader(bool is_error) { | 815 std::string Validator::MessageHeader(bool is_error) { |
816 std::string path = path_.empty() ? "toplevel" : JoinString(path_, "."); | 816 std::string path = path_.empty() ? "toplevel" : JoinString(path_, "."); |
817 std::string message = "At " + path + ": "; | 817 std::string message = "At " + path + ": "; |
818 return message; | 818 return message; |
819 } | 819 } |
820 | 820 |
821 } // namespace onc | 821 } // namespace onc |
822 } // namespace chromeos | 822 } // namespace chromeos |
OLD | NEW |