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

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

Issue 78453005: Move PolicySchema and PolicySchemaRegistry to components/policy/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: export nested class on win Created 7 years 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 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_SCHEMA_MAP_H_
6 #define CHROME_BROWSER_POLICY_SCHEMA_MAP_H_
7
8 #include <map>
9 #include <string>
10
11 #include "base/basictypes.h"
12 #include "base/memory/ref_counted.h"
13 #include "components/policy/core/common/policy_namespace.h"
14 #include "components/policy/core/common/schema.h"
15
16 namespace policy {
17
18 class PolicyBundle;
19
20 typedef std::map<std::string, Schema> ComponentMap;
21 typedef std::map<PolicyDomain, ComponentMap> DomainMap;
22
23 // Contains a mapping of policy namespaces (domain + component ID) to its
24 // corresponding Schema.
25 class SchemaMap : public base::RefCountedThreadSafe<SchemaMap> {
26 public:
27 SchemaMap();
28 // Takes ownership of |map| (its contents will be swapped).
29 explicit SchemaMap(DomainMap& map);
30
31 const DomainMap& GetDomains() const;
32
33 const ComponentMap* GetComponents(PolicyDomain domain) const;
34
35 const Schema* GetSchema(const PolicyNamespace& ns) const;
36
37 // Removes all the policies in |bundle| that don't match the known schemas.
38 // Unknown components are also dropped.
39 void FilterBundle(PolicyBundle* bundle) const;
40
41 // Returns true if this map contains at least one component of a domain other
42 // than POLICY_DOMAIN_CHROME.
43 bool HasComponents() const;
44
45 void GetChanges(const scoped_refptr<SchemaMap>& older,
46 PolicyNamespaceList* removed,
47 PolicyNamespaceList* added) const;
48
49 private:
50 friend class base::RefCountedThreadSafe<SchemaMap>;
51
52 void GetNamespacesNotInOther(const SchemaMap* other,
53 PolicyNamespaceList* list) const;
54
55 ~SchemaMap();
56
57 DomainMap map_;
58
59 DISALLOW_COPY_AND_ASSIGN(SchemaMap);
60 };
61
62 } // namespace policy
63
64 #endif // CHROME_BROWSER_POLICY_SCHEMA_MAP_H_
OLDNEW
« no previous file with comments | « chrome/browser/policy/policy_loader_win_unittest.cc ('k') | chrome/browser/policy/schema_map.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698