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

Side by Side Diff: components/policy/core/common/policy_schema.cc

Issue 22645011: policy: use JSON schema to deserialize entries from Windows registry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix chrome schema unit tests Created 7 years, 3 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
OLDNEW
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698