Index: components/policy/core/common/schema.h |
diff --git a/components/policy/core/common/schema.h b/components/policy/core/common/schema.h |
index 82ee38fca63ee7d3a8f74512a2e0cd30b5332815..d325a5b4703a1b2ecaa784c626adbfd73d4246fe 100644 |
--- a/components/policy/core/common/schema.h |
+++ b/components/policy/core/common/schema.h |
@@ -6,6 +6,7 @@ |
#define COMPONENTS_POLICY_CORE_COMMON_SCHEMA_H_ |
#include <string> |
+#include <vector> |
#include "base/basictypes.h" |
#include "base/memory/ref_counted.h" |
@@ -48,6 +49,10 @@ enum SchemaOnErrorStrategy { |
SCHEMA_ALLOW_INVALID, |
}; |
+class Schema; |
+ |
+typedef std::vector<Schema> SchemaList; |
+ |
// Describes the expected type of one policy. Also recursively describes the |
// types of inner elements, for structured types. |
// Objects of this class refer to external, immutable data and are cheap to |
@@ -148,14 +153,25 @@ class POLICY_EXPORT Schema { |
// property name then the returned Schema is not valid. |
Schema GetKnownProperty(const std::string& key) const; |
+ // Returns all Schemas from pattern properties that match |key|. May be empty. |
+ SchemaList GetPatternProperties(const std::string& key) const; |
+ |
// Returns the Schema for additional properties. If additional properties are |
// not allowed for this Schema then the Schema returned is not valid. |
Schema GetAdditionalProperties() const; |
// Returns the Schema for |key| if it is a known property, otherwise returns |
// the Schema for additional properties. |
+ // DEPRECATED: This function didn't consider patternProperties, use |
+ // GetMatchingProperties() instead. |
+ // TODO(binjin): Replace calls to this function with GetKnownProperty() or |
+ // GetMatchingProperties() and remove this later. |
Schema GetProperty(const std::string& key) const; |
+ // Returns all Schemas that are supposed to be validated against for |key|. |
+ // May be empty. |
+ SchemaList GetMatchingProperties(const std::string& key) const; |
+ |
// Returns the Schema for items of an array. |
// This method should be called only if type() == TYPE_LIST, |
// otherwise invalid memory will be read. A CHECK is currently enforcing this. |