| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/policy/core/common/policy_schema.h" | 5 #include "components/policy/core/common/policy_schema.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "components/json_schema/json_schema_constants.h" | 10 #include "components/json_schema/json_schema_constants.h" |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 } | 223 } |
| 224 | 224 |
| 225 // Validate the main type. | 225 // Validate the main type. |
| 226 if (!dict->GetString(json_schema_constants::kType, &string_value) || | 226 if (!dict->GetString(json_schema_constants::kType, &string_value) || |
| 227 string_value != json_schema_constants::kObject) { | 227 string_value != json_schema_constants::kObject) { |
| 228 *error = | 228 *error = |
| 229 "The main schema must have a type attribute with \"object\" value."; | 229 "The main schema must have a type attribute with \"object\" value."; |
| 230 return scoped_ptr<PolicySchema>(); | 230 return scoped_ptr<PolicySchema>(); |
| 231 } | 231 } |
| 232 | 232 |
| 233 // Checks for invalid attributes at the top-level. | |
| 234 if (dict->HasKey(json_schema_constants::kAdditionalProperties) || | |
| 235 dict->HasKey(json_schema_constants::kPatternProperties)) { | |
| 236 *error = "\"additionalProperties\" and \"patternProperties\" are not " | |
| 237 "supported at the main schema."; | |
| 238 return scoped_ptr<PolicySchema>(); | |
| 239 } | |
| 240 | |
| 241 return ParseSchema(*dict, error); | 233 return ParseSchema(*dict, error); |
| 242 } | 234 } |
| 243 | 235 |
| 244 } // namespace policy | 236 } // namespace policy |
| OLD | NEW |