| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 // An offset into SchemaData::property_nodes that indexes the PropertyNode | 56 // An offset into SchemaData::property_nodes that indexes the PropertyNode |
| 57 // right beyond the last known property of this map policy. | 57 // right beyond the last known property of this map policy. |
| 58 // | 58 // |
| 59 // If |begin == end| then the map policy that this PropertiesNode corresponds | 59 // If |begin == end| then the map policy that this PropertiesNode corresponds |
| 60 // to does not have known properties. | 60 // to does not have known properties. |
| 61 // | 61 // |
| 62 // Note that the range [begin, end) is sorted by PropertyNode::key, so that | 62 // Note that the range [begin, end) is sorted by PropertyNode::key, so that |
| 63 // properties can be looked up by binary searching in the range. | 63 // properties can be looked up by binary searching in the range. |
| 64 int end; | 64 int end; |
| 65 | 65 |
| 66 // An offset into SchemaData::property_nodes that indexes the PropertyNode |
| 67 // right beyond the last known pattern property. |
| 68 // |
| 69 // [end, pattern_end) is the range that covers all pattern properties |
| 70 // defined. It's not required to be sorted. |
| 71 int pattern_end; |
| 72 |
| 66 // If this map policy supports keys with any value (besides the well-known | 73 // If this map policy supports keys with any value (besides the well-known |
| 67 // values described in the range [begin, end)) then |additional| is an offset | 74 // values described in the range [begin, end)) then |additional| is an offset |
| 68 // into SchemaData::schema_nodes that indexes the SchemaNode describing the | 75 // into SchemaData::schema_nodes that indexes the SchemaNode describing the |
| 69 // structure of the values for those keys. Otherwise |additional| is -1 and | 76 // structure of the values for those keys. Otherwise |additional| is -1 and |
| 70 // is invalid. | 77 // is invalid. |
| 71 int additional; | 78 int additional; |
| 72 }; | 79 }; |
| 73 | 80 |
| 74 // Represents the restriction on TYPE_INTEGER or TYPE_STRING instance of | 81 // Represents the restriction on TYPE_INTEGER or TYPE_STRING instance of |
| 75 // base::Value. | 82 // base::Value. |
| 76 union POLICY_EXPORT RestrictionNode { | 83 union POLICY_EXPORT RestrictionNode { |
| 77 // Offsets into SchemaData::int_enums or SchemaData::string_enums, the | 84 // Offsets into SchemaData::int_enums or SchemaData::string_enums, the |
| 78 // entry of which describes the enumeration of all possible values of | 85 // entry of which describes the enumeration of all possible values of |
| 79 // corresponding integer or string value. |offset_begin| being strictly less | 86 // corresponding integer or string value. |offset_begin| being strictly less |
| 80 // than |offset_end| is assumed. | 87 // than |offset_end| is assumed. |
| 81 struct EnumerationRestriction { | 88 struct EnumerationRestriction { |
| 82 int offset_begin; | 89 int offset_begin; |
| 83 int offset_end; | 90 int offset_end; |
| 84 } enumeration_restriction; | 91 } enumeration_restriction; |
| 85 | 92 |
| 86 // For integer type only, represents that all values between |min_value| | 93 // For integer type only, represents that all values between |min_value| |
| 87 // and |max_value| can be choosen. Note that integer type in base::Value | 94 // and |max_value| can be choosen. Note that integer type in base::Value |
| 88 // is bounded, so this can also be used if only one of |min_value| and | 95 // is bounded, so this can also be used if only one of |min_value| and |
| 89 // |max_value| is stated. |max_value| being greater or equal to |min_value| | 96 // |max_value| is stated. |max_value| being greater or equal to |min_value| |
| 90 // is assumed. | 97 // is assumed. |
| 91 struct RangedRestriction { | 98 struct RangedRestriction { |
| 92 int max_value; | 99 int max_value; |
| 93 int min_value; | 100 int min_value; |
| 94 } ranged_restriction; | 101 } ranged_restriction; |
| 102 |
| 103 // For string type only, requires |pattern_index| and |pattern_index_backup| |
| 104 // to be exactly the same. And it's an offset into SchemaData::string_enums |
| 105 // which contains the regular expression that the target string must follow. |
| 106 struct StringPatternRestriction { |
| 107 int pattern_index; |
| 108 int pattern_index_backup; |
| 109 } string_pattern_restriction; |
| 95 }; | 110 }; |
| 96 | 111 |
| 97 | 112 |
| 98 // Contains arrays of related nodes. All of the offsets in these nodes reference | 113 // Contains arrays of related nodes. All of the offsets in these nodes reference |
| 99 // other nodes in these arrays. | 114 // other nodes in these arrays. |
| 100 struct POLICY_EXPORT SchemaData { | 115 struct POLICY_EXPORT SchemaData { |
| 101 const SchemaNode* schema_nodes; | 116 const SchemaNode* schema_nodes; |
| 102 const PropertyNode* property_nodes; | 117 const PropertyNode* property_nodes; |
| 103 const PropertiesNode* properties_nodes; | 118 const PropertiesNode* properties_nodes; |
| 104 const RestrictionNode* restriction_nodes; | 119 const RestrictionNode* restriction_nodes; |
| 105 | 120 |
| 106 const int* int_enums; | 121 const int* int_enums; |
| 107 const char** string_enums; | 122 const char** string_enums; |
| 108 }; | 123 }; |
| 109 | 124 |
| 110 } // namespace internal | 125 } // namespace internal |
| 111 } // namespace policy | 126 } // namespace policy |
| 112 | 127 |
| 113 #endif // COMPONENTS_POLICY_CORE_COMMON_SCHEMA_INTERNAL_H_ | 128 #endif // COMPONENTS_POLICY_CORE_COMMON_SCHEMA_INTERNAL_H_ |
| OLD | NEW |