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

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

Issue 16058005: PolicyDomainDescriptor must be RefCountedThreadSafe. (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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_POLICY_POLICY_DOMAIN_DESCRIPTOR_H_ 5 #ifndef CHROME_BROWSER_POLICY_POLICY_DOMAIN_DESCRIPTOR_H_
6 #define CHROME_BROWSER_POLICY_POLICY_DOMAIN_DESCRIPTOR_H_ 6 #define CHROME_BROWSER_POLICY_POLICY_DOMAIN_DESCRIPTOR_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "chrome/browser/policy/policy_service.h" 14 #include "chrome/browser/policy/policy_service.h"
15 15
16 namespace policy { 16 namespace policy {
17 17
18 class PolicyBundle; 18 class PolicyBundle;
19 class PolicySchema; 19 class PolicySchema;
20 20
21 // For each policy domain, this class keeps the complete list of valid 21 // For each policy domain, this class keeps the complete list of valid
22 // components for that domain, and the PolicySchema for each component. 22 // components for that domain, and the PolicySchema for each component.
23 class PolicyDomainDescriptor : public base::RefCounted<PolicyDomainDescriptor> { 23 class PolicyDomainDescriptor
24 : public base::RefCountedThreadSafe<PolicyDomainDescriptor> {
24 public: 25 public:
25 typedef std::map<std::string, const PolicySchema*> SchemaMap; 26 typedef std::map<std::string, const PolicySchema*> SchemaMap;
26 27
27 explicit PolicyDomainDescriptor(PolicyDomain domain); 28 explicit PolicyDomainDescriptor(PolicyDomain domain);
28 29
29 PolicyDomain domain() const { return domain_; } 30 PolicyDomain domain() const { return domain_; }
30 const SchemaMap& components() const { return schema_map_; } 31 const SchemaMap& components() const { return schema_map_; }
31 32
32 // Registers the given |component_id| for this domain, and sets its current 33 // Registers the given |component_id| for this domain, and sets its current
33 // |schema|. This registration overrides any previously set schema for this 34 // |schema|. This registration overrides any previously set schema for this
34 // component. 35 // component.
35 void RegisterComponent(const std::string& component_id, 36 void RegisterComponent(const std::string& component_id,
36 scoped_ptr<PolicySchema> schema); 37 scoped_ptr<PolicySchema> schema);
37 38
38 // Removes all the policies in |bundle| that don't match this descriptor. 39 // Removes all the policies in |bundle| that don't match this descriptor.
39 // Policies of domains other than |domain_| are ignored. 40 // Policies of domains other than |domain_| are ignored.
40 void FilterBundle(PolicyBundle* bundle) const; 41 void FilterBundle(PolicyBundle* bundle) const;
41 42
42 private: 43 private:
43 friend class base::RefCounted<PolicyDomainDescriptor>; 44 friend class base::RefCountedThreadSafe<PolicyDomainDescriptor>;
44 ~PolicyDomainDescriptor(); 45 ~PolicyDomainDescriptor();
45 46
46 PolicyDomain domain_; 47 PolicyDomain domain_;
47 SchemaMap schema_map_; 48 SchemaMap schema_map_;
48 49
49 DISALLOW_COPY_AND_ASSIGN(PolicyDomainDescriptor); 50 DISALLOW_COPY_AND_ASSIGN(PolicyDomainDescriptor);
50 }; 51 };
51 52
52 } // namespace policy 53 } // namespace policy
53 54
54 #endif // CHROME_BROWSER_POLICY_POLICY_DOMAIN_DESCRIPTOR_H_ 55 #endif // CHROME_BROWSER_POLICY_POLICY_DOMAIN_DESCRIPTOR_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698