| OLD | NEW |
| 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 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 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 | 23 class PolicyDomainDescriptor |
| 24 : public base::RefCountedThreadSafe<PolicyDomainDescriptor> { | 24 : public base::RefCountedThreadSafe<PolicyDomainDescriptor> { |
| 25 public: | 25 public: |
| 26 typedef std::map<std::string, const PolicySchema*> SchemaMap; | 26 typedef std::map<std::string, const PolicySchema*> SchemaMap; |
| 27 | 27 |
| 28 explicit PolicyDomainDescriptor(PolicyDomain domain); | 28 explicit PolicyDomainDescriptor(PolicyDomain domain); |
| 29 | 29 |
| 30 PolicyDomain domain() const { return domain_; } | 30 PolicyDomain domain() const { return domain_; } |
| 31 const SchemaMap& components() const { return schema_map_; } | 31 const SchemaMap& components() const { return schema_map_; } |
| 32 const PolicySchema* get_schema(const std::string& component) const; |
| 32 | 33 |
| 33 // Registers the given |component_id| for this domain, and sets its current | 34 // Registers the given |component_id| for this domain, and sets its current |
| 34 // |schema|. This registration overrides any previously set schema for this | 35 // |schema|. This registration overrides any previously set schema for this |
| 35 // component. | 36 // component. |
| 36 void RegisterComponent(const std::string& component_id, | 37 void RegisterComponent(const std::string& component_id, |
| 37 scoped_ptr<PolicySchema> schema); | 38 scoped_ptr<PolicySchema> schema); |
| 38 | 39 |
| 39 // Removes all the policies in |bundle| that don't match this descriptor. | 40 // Removes all the policies in |bundle| that don't match this descriptor. |
| 40 // Policies of domains other than |domain_| are ignored. | 41 // Policies of domains other than |domain_| are ignored. |
| 41 void FilterBundle(PolicyBundle* bundle) const; | 42 void FilterBundle(PolicyBundle* bundle) const; |
| 42 | 43 |
| 43 private: | 44 private: |
| 44 friend class base::RefCountedThreadSafe<PolicyDomainDescriptor>; | 45 friend class base::RefCountedThreadSafe<PolicyDomainDescriptor>; |
| 45 ~PolicyDomainDescriptor(); | 46 ~PolicyDomainDescriptor(); |
| 46 | 47 |
| 47 PolicyDomain domain_; | 48 PolicyDomain domain_; |
| 48 SchemaMap schema_map_; | 49 SchemaMap schema_map_; |
| 49 | 50 |
| 50 DISALLOW_COPY_AND_ASSIGN(PolicyDomainDescriptor); | 51 DISALLOW_COPY_AND_ASSIGN(PolicyDomainDescriptor); |
| 51 }; | 52 }; |
| 52 | 53 |
| 53 } // namespace policy | 54 } // namespace policy |
| 54 | 55 |
| 55 #endif // CHROME_BROWSER_POLICY_POLICY_DOMAIN_DESCRIPTOR_H_ | 56 #endif // CHROME_BROWSER_POLICY_POLICY_DOMAIN_DESCRIPTOR_H_ |
| OLD | NEW |