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

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

Issue 205923004: Add regex support in policy schema (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@json-schema-regex
Patch Set: Created 6 years, 9 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/DEPS ('k') | components/policy/core/common/schema.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « components/policy/core/DEPS ('k') | components/policy/core/common/schema.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698