1d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved.
2d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
3d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)// found in the LICENSE file.
4d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
5d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)#ifndef COMPONENTS_POLICY_CORE_COMMON_SCHEMA_H_
6d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)#define COMPONENTS_POLICY_CORE_COMMON_SCHEMA_H_
7d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
8d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)#include <string>
9c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch#include <vector>
10d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
11d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)#include "base/basictypes.h"
12f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#include "base/memory/ref_counted.h"
13d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)#include "base/values.h"
14d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)#include "components/policy/policy_export.h"
15d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
16d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)namespace policy {
17d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)namespace internal {
18d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
19f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)struct POLICY_EXPORT SchemaData;
20d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)struct POLICY_EXPORT SchemaNode;
21d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)struct POLICY_EXPORT PropertyNode;
22d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)struct POLICY_EXPORT PropertiesNode;
23d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
24d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)}  // namespace internal
25d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
265d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// Option flags passed to Schema::Validate() and Schema::Normalize(), describing
275d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// the strategy to handle unknown properties or invalid values for dict type.
285d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// Note that in Schema::Normalize() allowed errors will be dropped and thus
295d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// ignored.
30a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Unknown error indicates that some value in a dictionary (may or may not be
31a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// the one in root) have unknown property name according to schema.
32a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Invalid error indicates a validation failure against the schema. As
33a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// validation is done recursively, a validation failure of dict properties or
34a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// list items might be ignored (or dropped in Normalize()) or trigger whole
35a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// dictionary/list validation failure.
365d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)enum SchemaOnErrorStrategy {
375d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // No errors will be allowed.
385d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  SCHEMA_STRICT = 0,
395d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Unknown properties in the top-level dictionary will be ignored.
405d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  SCHEMA_ALLOW_UNKNOWN_TOPLEVEL,
415d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Unknown properties in any dictionary will be ignored.
425d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  SCHEMA_ALLOW_UNKNOWN,
435d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Mismatched values will be ignored at the toplevel.
445d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  SCHEMA_ALLOW_INVALID_TOPLEVEL,
455d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Mismatched values will be ignored at the top-level value.
465d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Unknown properties in any dictionary will be ignored.
475d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  SCHEMA_ALLOW_INVALID_TOPLEVEL_AND_ALLOW_UNKNOWN,
485d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Mismatched values will be ignored.
495d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  SCHEMA_ALLOW_INVALID,
505d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)};
515d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
52c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdochclass Schema;
53c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch
54c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdochtypedef std::vector<Schema> SchemaList;
55c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch
56d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)// Describes the expected type of one policy. Also recursively describes the
57d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)// types of inner elements, for structured types.
58d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)// Objects of this class refer to external, immutable data and are cheap to
59d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)// copy.
60d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)class POLICY_EXPORT Schema {
61d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) public:
62f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // Used internally to store shared data.
63f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  class InternalStorage;
64f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
6568043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  // Builds an empty, invalid schema.
6668043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  Schema();
6768043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)
68f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // Makes a copy of |schema| that shares the same internal storage.
69d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  Schema(const Schema& schema);
70d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
71f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  ~Schema();
72f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
73d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  Schema& operator=(const Schema& schema);
74d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
75f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // Returns a Schema that references static data. This can be used by
76f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // the embedder to pass structures generated at compile time, which can then
77f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // be quickly loaded at runtime.
78f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  static Schema Wrap(const internal::SchemaData* data);
79f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
80f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // Parses the JSON schema in |schema| and returns a Schema that owns
81f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // the internal representation. If |schema| is invalid then an invalid Schema
82f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // is returned and |error| contains a reason for the failure.
83f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  static Schema Parse(const std::string& schema, std::string* error);
84f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
85d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  // Returns true if this Schema is valid. Schemas returned by the methods below
86d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  // may be invalid, and in those cases the other methods must not be used.
87f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  bool valid() const { return node_ != NULL; }
88d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
89d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  base::Value::Type type() const;
90d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
915d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Validate |value| against current schema, |strategy| is the strategy to
925d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // handle unknown properties or invalid values. Allowed errors will be
935d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // ignored. |error_path| and |error| will contain the last error location and
945d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // detailed message if |value| doesn't strictly conform to the schema. If
955d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // |value| doesn't conform to the schema even within the allowance of
965d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // |strategy|, false will be returned and |error_path| and |error| will
975d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // contain the corresponding error that caused the failure. |error_path| can
985d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // be NULL and in that case no error path will be returned.
995d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  bool Validate(const base::Value& value,
1005d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                SchemaOnErrorStrategy strategy,
1015d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                std::string* error_path,
1025d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                std::string* error) const;
1035d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
104a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // Similar to Validate() but drop values with errors instead of ignoring them.
105a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // |changed| is a pointer to a boolean value, and indicate whether |value|
106a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // is changed or not (probably dropped properties or items). Be sure to set
107a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // the bool that |changed| pointed to to false before calling Normalize().
108a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // |changed| can be NULL and in that case no boolean will be set.
109a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // This function will also take the ownership of dropped base::Value and
110a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // destroy them.
1115d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  bool Normalize(base::Value* value,
1125d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                 SchemaOnErrorStrategy strategy,
1135d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                 std::string* error_path,
114a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                 std::string* error,
115a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                 bool* changed) const;
116f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
117d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  // Used to iterate over the known properties of TYPE_DICTIONARY schemas.
118d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  class POLICY_EXPORT Iterator {
119d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)   public:
120f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)    Iterator(const scoped_refptr<const InternalStorage>& storage,
121f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)             const internal::PropertiesNode* node);
122d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)    Iterator(const Iterator& iterator);
123d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)    ~Iterator();
124d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
125d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)    Iterator& operator=(const Iterator& iterator);
126d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
127d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)    // The other methods must not be called if the iterator is at the end.
128d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)    bool IsAtEnd() const;
129d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
130d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)    // Advances the iterator to the next property.
131d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)    void Advance();
132d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
133d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)    // Returns the name of the current property.
134d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)    const char* key() const;
135d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
136d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)    // Returns the Schema for the current property. This Schema is always valid.
137d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)    Schema schema() const;
138d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
139d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)   private:
140f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)    scoped_refptr<const InternalStorage> storage_;
141d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)    const internal::PropertyNode* it_;
142d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)    const internal::PropertyNode* end_;
143d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  };
144d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
145d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  // These methods should be called only if type() == TYPE_DICTIONARY,
146d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  // otherwise invalid memory will be read. A CHECK is currently enforcing this.
147d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
148d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  // Returns an iterator that goes over the named properties of this schema.
149d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  // The returned iterator is at the beginning.
150d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  Iterator GetPropertiesIterator() const;
151d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
152d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  // Returns the Schema for the property named |key|. If |key| is not a known
153d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  // property name then the returned Schema is not valid.
154d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  Schema GetKnownProperty(const std::string& key) const;
155d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
156c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  // Returns all Schemas from pattern properties that match |key|. May be empty.
157c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  SchemaList GetPatternProperties(const std::string& key) const;
158c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch
159d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  // Returns the Schema for additional properties. If additional properties are
160d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  // not allowed for this Schema then the Schema returned is not valid.
161d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  Schema GetAdditionalProperties() const;
162d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
163d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  // Returns the Schema for |key| if it is a known property, otherwise returns
164d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  // the Schema for additional properties.
165c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  // DEPRECATED: This function didn't consider patternProperties, use
166c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  // GetMatchingProperties() instead.
167c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  // TODO(binjin): Replace calls to this function with GetKnownProperty() or
168c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  // GetMatchingProperties() and remove this later.
169d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  Schema GetProperty(const std::string& key) const;
170d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
171c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  // Returns all Schemas that are supposed to be validated against for |key|.
172c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  // May be empty.
173c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  SchemaList GetMatchingProperties(const std::string& key) const;
174c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch
175d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  // Returns the Schema for items of an array.
176d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  // This method should be called only if type() == TYPE_LIST,
177d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  // otherwise invalid memory will be read. A CHECK is currently enforcing this.
178d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  Schema GetItems() const;
179d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
180d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) private:
181f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // Builds a schema pointing to the inner structure of |storage|,
182f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // rooted at |node|.
183f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  Schema(const scoped_refptr<const InternalStorage>& storage,
184f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)         const internal::SchemaNode* node);
185d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
1865d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  bool ValidateIntegerRestriction(int index, int value) const;
1875d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  bool ValidateStringRestriction(int index, const char* str) const;
1885d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
189f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  scoped_refptr<const InternalStorage> storage_;
190f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  const internal::SchemaNode* node_;
191d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)};
192d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
193d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)}  // namespace policy
194d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
195d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)#endif  // COMPONENTS_POLICY_CORE_COMMON_SCHEMA_H_
196