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

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: proposal for updates to schema internal structure 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 | « no previous file | no next file » | 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..3a543f4ff3627580dfb71d68a89a42788c25ba7b 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
+ // limitations (enumeration of possible values, or range for integer), then
+ // |extra| is an offset into SchemaData::limitation_nodes that indexes the
+ // LimitationNode describing the limitation on the value.
+ //
// Otherwise extra is -1 and is invalid.
int extra;
};
@@ -66,12 +71,42 @@ struct POLICY_EXPORT PropertiesNode {
int additional;
};
+// 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.
+// base::Value.
+struct POLICY_EXPORT LimitationNode {
+ // Set to true if RangedLimitation is used, and set to false otherwise.
+ bool is_ranged;
+
+ union LimitationValues {
+ // 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.
+ struct EnumerationLimitation {
+ int offset_begin;
+ int offset_end;
+ };
+ // 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.
+ // 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.
+ // is bounded, so this can also be used if only one of |min_value| and
+ // |max_value| is stated.
+ struct RangedLimitation {
+ int min_value;
+ int max_value;
+ };
+ };
+};
+
+
// 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 LimitationNode* limitation_nodes;
+
+ const int* int_enums;
+ const char** string_enums;
};
} // namespace internal
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698