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

Side by Side Diff: chrome/browser/policy/policy_schema.h

Issue 15133005: Added a PolicySchema class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_POLICY_POLICY_SCHEMA_H_
6 #define CHROME_BROWSER_POLICY_POLICY_SCHEMA_H_
7
8 #include <map>
9 #include <string>
10
11 #include "base/basictypes.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/values.h"
14
15 namespace policy {
16
17 // Maps known policy keys to their expected types. Currently, only the top-level
18 // type is declared; the types of list and dictionary entries are not declared.
Mattias Nissler (ping if slow) 2013/05/15 10:04:12 Is there a plan for further type checks? In partic
Joao da Silva 2013/05/19 13:17:08 That comment made me think more about this, and I
19 class PolicySchema {
20 public:
21 typedef std::map<std::string, base::Value::Type> TypeMap;
22
23 // Parses |schema| as a JSON v3 schema, and additionally verifies that:
24 // - the version is JSON schema v3;
25 // - the top-level entry is of type "object";
26 // - the top-level object doesn't contain "additionalProperties" nor
27 // "patternProperties";
28 // - each "property" maps to a schema with one "type";
29 // If all the checks pass then the parsed PolicySchema is returned; otherwise
30 // returns NULL.
31 static scoped_ptr<PolicySchema> Parse(const std::string& schema,
32 std::string* error);
33 ~PolicySchema();
34
35 const TypeMap& type_map() const { return type_map_; }
36
37 private:
38 PolicySchema();
39
40 TypeMap type_map_;
41
42 DISALLOW_COPY_AND_ASSIGN(PolicySchema);
43 };
44
45 } // namespace policy
46
47 #endif // CHROME_BROWSER_POLICY_POLICY_SCHEMA_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/policy/policy_schema.cc » ('j') | chrome/browser/policy/policy_schema.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698