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

Unified Diff: components/policy/core/common/schema_internal.h

Issue 138003003: Add additional restriction to policy schema internal (part1) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more fixes Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/policy/core/common/schema.cc ('k') | components/policy/core/common/schema_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/policy/core/common/schema_internal.h
diff --git a/components/policy/core/common/schema_internal.h b/components/policy/core/common/schema_internal.h
index 40d557a408d72ff868b0bfd3bf58ce537e75f9e9..86e6a2b75b20f16e6d2e98c3840a5df9ad353c26 100644
--- a/components/policy/core/common/schema_internal.h
+++ b/components/policy/core/common/schema_internal.h
@@ -28,6 +28,11 @@ struct POLICY_EXPORT SchemaNode {
// SchemaData::schema_nodes that indexes the SchemaNode describing the items
// of this list.
//
+ // If |type| is TYPE_INTEGER or TYPE_STRING, and contains corresponding
+ // restriction (enumeration of possible values, or range for integer), then
+ // |extra| is an offset into SchemaData::restriction_nodes that indexes the
+ // RestrictionNode describing the restriction on the value.
+ //
// Otherwise extra is -1 and is invalid.
int extra;
};
@@ -66,12 +71,40 @@ struct POLICY_EXPORT PropertiesNode {
int additional;
};
+// Represents the restriction on TYPE_INTEGER or TYPE_STRING instance of
+// base::Value.
+union POLICY_EXPORT RestrictionNode {
+ // Offsets into SchemaData::int_enums or SchemaData::string_enums, the
+ // entry of which describes the enumeration of all possible values of
+ // corresponding integer or string value. |offset_begin| being strictly less
+ // than |offset_end| is assumed.
+ struct EnumerationRestriction {
+ int offset_begin;
+ int offset_end;
+ } enumeration_restriction;
+
+ // For integer type only, represents that all values between |min_value|
+ // and |max_value| can be choosen. Note that integer type in base::Value
+ // is bounded, so this can also be used if only one of |min_value| and
+ // |max_value| is stated. |max_value| being greater or equal to |min_value|
+ // is assumed.
+ struct RangedRestriction {
+ int max_value;
+ int min_value;
+ } ranged_restriction;
+};
+
+
// Contains arrays of related nodes. All of the offsets in these nodes reference
// other nodes in these arrays.
struct POLICY_EXPORT SchemaData {
const SchemaNode* schema_nodes;
const PropertyNode* property_nodes;
const PropertiesNode* properties_nodes;
+ const RestrictionNode* restriction_nodes;
+
+ const int* int_enums;
+ const char** string_enums;
};
} // namespace internal
« no previous file with comments | « components/policy/core/common/schema.cc ('k') | components/policy/core/common/schema_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698