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 #ifndef CHROME_COMMON_POLICY_POLICY_SCHEMA_H_ | 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_POLICY_SCHEMA_H_ |
6 #define CHROME_COMMON_POLICY_POLICY_SCHEMA_H_ | 6 #define COMPONENTS_POLICY_CORE_COMMON_POLICY_SCHEMA_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "components/policy/policy_export.h" |
14 | 15 |
15 namespace policy { | 16 namespace policy { |
16 | 17 |
17 class PolicySchema; | 18 class PolicySchema; |
18 typedef std::map<std::string, PolicySchema*> PolicySchemaMap; | 19 typedef std::map<std::string, PolicySchema*> PolicySchemaMap; |
19 | 20 |
20 // Maps known policy keys to their expected types, and recursively describes | 21 // Maps known policy keys to their expected types, and recursively describes |
21 // the known keys within dictionary or list types. | 22 // the known keys within dictionary or list types. |
22 class PolicySchema { | 23 class POLICY_EXPORT PolicySchema { |
23 public: | 24 public: |
24 | 25 |
25 // Parses |schema| as a JSON v3 schema, and additionally verifies that: | 26 // Parses |schema| as a JSON v3 schema, and additionally verifies that: |
26 // - the version is JSON schema v3; | 27 // - the version is JSON schema v3; |
27 // - the top-level entry is of type "object"; | 28 // - the top-level entry is of type "object"; |
28 // - the top-level object doesn't contain "additionalProperties" nor | 29 // - the top-level object doesn't contain "additionalProperties" nor |
29 // "patternProperties"; | 30 // "patternProperties"; |
30 // - each "property" maps to a schema with one "type"; | 31 // - each "property" maps to a schema with one "type"; |
31 // - the type "any" is not used. | 32 // - the type "any" is not used. |
32 // If all the checks pass then the parsed PolicySchema is returned; otherwise | 33 // If all the checks pass then the parsed PolicySchema is returned; otherwise |
(...skipping 26 matching lines...) Expand all Loading... |
59 virtual const PolicySchema* GetSchemaForItems() const; | 60 virtual const PolicySchema* GetSchemaForItems() const; |
60 | 61 |
61 private: | 62 private: |
62 const base::Value::Type type_; | 63 const base::Value::Type type_; |
63 | 64 |
64 DISALLOW_COPY_AND_ASSIGN(PolicySchema); | 65 DISALLOW_COPY_AND_ASSIGN(PolicySchema); |
65 }; | 66 }; |
66 | 67 |
67 } // namespace policy | 68 } // namespace policy |
68 | 69 |
69 #endif // CHROME_COMMON_POLICY_POLICY_SCHEMA_H_ | 70 #endif // COMPONENTS_POLICY_CORE_COMMON_POLICY_SCHEMA_H_ |
OLD | NEW |