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

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: Validate() against multiple properties 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
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..9fd60b0beb401103814f4cae64de0278679e729e 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"
@@ -57,6 +58,8 @@ class POLICY_EXPORT Schema {
// Used internally to store shared data.
class InternalStorage;
+ typedef std::vector<Schema> SchemaList;
Joao da Silva 2014/04/02 09:51:11 Put this outside the class. It will require a forw
binjin 2014/04/03 10:13:37 Done.
+
// Builds an empty, invalid schema.
Schema();
@@ -148,14 +151,24 @@ 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 matchs |key|, might be
Joao da Silva 2014/04/02 09:51:11 [...] that match |key|. May be empty.
binjin 2014/04/03 10:13:37 Done.
+ // 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.
Schema GetProperty(const std::string& key) const;
Joao da Silva 2014/04/02 09:51:11 Leave a TODO to remove this.
binjin 2014/04/03 10:13:37 Done.
+ // Returns all Schemas that are supposed to be validate against for |key|,
+ // might be empty.
Joao da Silva 2014/04/02 09:51:11 Returns all Schemas that are supposed to be valida
binjin 2014/04/03 10:13:37 Done.
+ 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.

Powered by Google App Engine
This is Rietveld 408576698