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

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

Issue 15061007: Added a PolicyDomainDescriptor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed comments, rebase on new PolicySchema 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_DOMAIN_DESCRIPTOR_H_
6 #define CHROME_BROWSER_POLICY_POLICY_DOMAIN_DESCRIPTOR_H_
7
8 #include <map>
9 #include <string>
10
11 #include "base/basictypes.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "chrome/browser/policy/policy_service.h"
15
16 namespace policy {
17
18 class PolicyBundle;
19 class PolicySchema;
20
21 // For each policy domain, this class keeps the complete list of valid
22 // components for that domain, and the PolicySchema for each component.
23 class PolicyDomainDescriptor : public base::RefCounted<PolicyDomainDescriptor> {
24 public:
25 typedef std::map<std::string, const PolicySchema*> SchemaMap;
26
27 explicit PolicyDomainDescriptor(PolicyDomain domain);
28
29 PolicyDomain domain() const { return domain_; }
30 const SchemaMap& components() const { return schema_map_; }
31
32 // Sets the |schema| for |component_id|, overridding any previously set
33 // schema for that component.
34 void SetComponent(const std::string& component_id,
bartfab (slow) 2013/05/21 12:10:56 Nit: Maybe better |SetComponentSchema| or |AddComp
Joao da Silva 2013/05/21 17:50:14 Went for RegisterComponent(), I think that conveys
35 scoped_ptr<PolicySchema> schema);
36
37 // Removes all the policies in |bundle| that don't match this descriptor.
38 // Policies of domains other than |domain_| are ignored.
39 void FilterBundle(PolicyBundle* bundle) const;
40
41 private:
42 friend class base::RefCounted<PolicyDomainDescriptor>;
43 ~PolicyDomainDescriptor();
44
45 PolicyDomain domain_;
46 SchemaMap schema_map_;
47
48 DISALLOW_COPY_AND_ASSIGN(PolicyDomainDescriptor);
49 };
50
51 } // namespace policy
52
53 #endif // CHROME_BROWSER_POLICY_POLICY_DOMAIN_DESCRIPTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698