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 COMPONENTS_POLICY_CORE_COMMON_SCHEMA_INTERNAL_H_ | 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_SCHEMA_INTERNAL_H_ |
6 #define COMPONENTS_POLICY_CORE_COMMON_SCHEMA_INTERNAL_H_ | 6 #define COMPONENTS_POLICY_CORE_COMMON_SCHEMA_INTERNAL_H_ |
7 | 7 |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "components/policy/policy_export.h" | 9 #include "components/policy/policy_export.h" |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... | |
21 base::Value::Type type; | 21 base::Value::Type type; |
22 | 22 |
23 // If |type| is TYPE_DICTIONARY then |extra| is an offset into | 23 // If |type| is TYPE_DICTIONARY then |extra| is an offset into |
24 // SchemaData::properties_nodes that indexes the PropertiesNode describing | 24 // SchemaData::properties_nodes that indexes the PropertiesNode describing |
25 // the entries of this dictionary. | 25 // the entries of this dictionary. |
26 // | 26 // |
27 // If |type| is TYPE_LIST then |extra| is an offset into | 27 // If |type| is TYPE_LIST then |extra| is an offset into |
28 // SchemaData::schema_nodes that indexes the SchemaNode describing the items | 28 // SchemaData::schema_nodes that indexes the SchemaNode describing the items |
29 // of this list. | 29 // of this list. |
30 // | 30 // |
31 // If |type| is TYPE_INTEGER or TYPE_STRING, and contains corresponding | |
32 // limitations (enumeration of possible values, or range for integer), then | |
33 // |extra| is an offset into SchemaData::limitation_nodes that indexes the | |
34 // LimitationNode describing the limitation on the value. | |
35 // | |
31 // Otherwise extra is -1 and is invalid. | 36 // Otherwise extra is -1 and is invalid. |
32 int extra; | 37 int extra; |
33 }; | 38 }; |
34 | 39 |
35 // Represents an entry of a map policy. | 40 // Represents an entry of a map policy. |
36 struct POLICY_EXPORT PropertyNode { | 41 struct POLICY_EXPORT PropertyNode { |
37 // The entry key. | 42 // The entry key. |
38 const char* key; | 43 const char* key; |
39 | 44 |
40 // An offset into SchemaData::schema_nodes that indexes the SchemaNode | 45 // An offset into SchemaData::schema_nodes that indexes the SchemaNode |
(...skipping 18 matching lines...) Expand all Loading... | |
59 int end; | 64 int end; |
60 | 65 |
61 // If this map policy supports keys with any value (besides the well-known | 66 // If this map policy supports keys with any value (besides the well-known |
62 // values described in the range [begin, end)) then |additional| is an offset | 67 // values described in the range [begin, end)) then |additional| is an offset |
63 // into SchemaData::schema_nodes that indexes the SchemaNode describing the | 68 // into SchemaData::schema_nodes that indexes the SchemaNode describing the |
64 // structure of the values for those keys. Otherwise |additional| is -1 and | 69 // structure of the values for those keys. Otherwise |additional| is -1 and |
65 // is invalid. | 70 // is invalid. |
66 int additional; | 71 int additional; |
67 }; | 72 }; |
68 | 73 |
74 // Represent the limitation on TYPE_INTEGER or TYPE_STRING instance of | |
Joao da Silva
2014/01/14 10:50:41
*Represents
binjin
2014/01/15 15:02:54
Done.
| |
75 // base::Value. | |
76 struct POLICY_EXPORT LimitationNode { | |
77 // Set to true if RangedLimitation is used, and set to false otherwise. | |
78 bool is_ranged; | |
79 | |
80 union LimitationValues { | |
81 // Offsets into SchemaData::int_enums or SchemaData::string_enums, the | |
82 // entry of which describes the enumeration of all possible values of | |
83 // corresponding integer or string value. | |
84 struct EnumerationLimitation { | |
85 int offset_begin; | |
86 int offset_end; | |
87 }; | |
88 // For integer type only, represents that all values between |min_value| | |
Joao da Silva
2014/01/14 10:50:41
nit: add a newline after };
binjin
2014/01/15 15:02:54
Done.
| |
89 // and |max_value| can be choosed. Note that integer type in base::Value | |
Joao da Silva
2014/01/14 10:50:41
*chosen
binjin
2014/01/15 15:02:54
Done.
| |
90 // is bounded, so this can also be used if only one of |min_value| and | |
91 // |max_value| is stated. | |
92 struct RangedLimitation { | |
93 int min_value; | |
94 int max_value; | |
95 }; | |
96 }; | |
97 }; | |
98 | |
99 | |
69 // Contains arrays of related nodes. All of the offsets in these nodes reference | 100 // Contains arrays of related nodes. All of the offsets in these nodes reference |
70 // other nodes in these arrays. | 101 // other nodes in these arrays. |
71 struct POLICY_EXPORT SchemaData { | 102 struct POLICY_EXPORT SchemaData { |
72 const SchemaNode* schema_nodes; | 103 const SchemaNode* schema_nodes; |
73 const PropertyNode* property_nodes; | 104 const PropertyNode* property_nodes; |
74 const PropertiesNode* properties_nodes; | 105 const PropertiesNode* properties_nodes; |
106 const LimitationNode* limitation_nodes; | |
107 | |
108 const int* int_enums; | |
109 const char** string_enums; | |
75 }; | 110 }; |
76 | 111 |
77 } // namespace internal | 112 } // namespace internal |
78 } // namespace policy | 113 } // namespace policy |
79 | 114 |
80 #endif // COMPONENTS_POLICY_CORE_COMMON_SCHEMA_INTERNAL_H_ | 115 #endif // COMPONENTS_POLICY_CORE_COMMON_SCHEMA_INTERNAL_H_ |
OLD | NEW |