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 #ifndef CHROMEOS_NETWORK_ONC_ONC_VALIDATOR_H_ | 5 #ifndef CHROMEOS_NETWORK_ONC_ONC_VALIDATOR_H_ |
6 #define CHROMEOS_NETWORK_ONC_ONC_VALIDATOR_H_ | 6 #define CHROMEOS_NETWORK_ONC_ONC_VALIDATOR_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 20 matching lines...) Expand all Loading... |
31 // - a field name is found that is not part of the signature | 31 // - a field name is found that is not part of the signature |
32 // (controlled by flag |error_on_unknown_field|) | 32 // (controlled by flag |error_on_unknown_field|) |
33 // | 33 // |
34 // - a kRecommended array contains a field name that is not part of the | 34 // - a kRecommended array contains a field name that is not part of the |
35 // enclosing object's signature or if that field is dictionary typed | 35 // enclosing object's signature or if that field is dictionary typed |
36 // (controlled by flag |error_on_wrong_recommended|) | 36 // (controlled by flag |error_on_wrong_recommended|) |
37 // | 37 // |
38 // - |managed_onc| is false and a field with name kRecommended is found | 38 // - |managed_onc| is false and a field with name kRecommended is found |
39 // (always ignored) | 39 // (always ignored) |
40 // | 40 // |
41 // - a required field is missing (controlled by flag |error_on_missing_field|) | 41 // - a required field is missing. controlled by flag |error_on_missing_field|. |
| 42 // If true this is an error, if false a message is logged but no error or |
| 43 // warning is flagged. |
42 // | 44 // |
43 // If one of these invalid cases occurs and, in case of a controlling flag, that | 45 // If one of these invalid cases occurs and, in case of a controlling flag, that |
44 // flag is true, then it is an error. The function ValidateAndRepairObject sets | 46 // flag is true, then it is an error. The function ValidateAndRepairObject sets |
45 // |result| to INVALID and returns NULL. | 47 // |result| to INVALID and returns NULL. |
46 // | 48 // |
47 // Otherwise, a DeepCopy of the validated object is created, which contains | 49 // Otherwise, a DeepCopy of the validated object is created, which contains |
48 // all but the invalid fields and values. | 50 // all but the invalid fields and values. |
49 // | 51 // |
50 // If one of the invalid cases occurs and the controlling flag is false, then | 52 // If one of the invalid cases occurs and the controlling flag is false, then |
51 // it is a warning. The function ValidateAndRepairObject sets |result| to | 53 // it is a warning. The function ValidateAndRepairObject sets |result| to |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 // function ValidateAndRepairObject. | 224 // function ValidateAndRepairObject. |
223 bool error_or_warning_found_; | 225 bool error_or_warning_found_; |
224 | 226 |
225 DISALLOW_COPY_AND_ASSIGN(Validator); | 227 DISALLOW_COPY_AND_ASSIGN(Validator); |
226 }; | 228 }; |
227 | 229 |
228 } // namespace onc | 230 } // namespace onc |
229 } // namespace chromeos | 231 } // namespace chromeos |
230 | 232 |
231 #endif // CHROMEOS_NETWORK_ONC_ONC_VALIDATOR_H_ | 233 #endif // CHROMEOS_NETWORK_ONC_ONC_VALIDATOR_H_ |
OLD | NEW |