OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 COMPONENTS_POLICY_CORE_COMMON_SCHEMA_REGISTRY_H_ | 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_SCHEMA_REGISTRY_H_ |
6 #define COMPONENTS_POLICY_CORE_COMMON_SCHEMA_REGISTRY_H_ | 6 #define COMPONENTS_POLICY_CORE_COMMON_SCHEMA_REGISTRY_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 DISALLOW_COPY_AND_ASSIGN(SchemaRegistry); | 95 DISALLOW_COPY_AND_ASSIGN(SchemaRegistry); |
96 }; | 96 }; |
97 | 97 |
98 // A registry that combines the maps of other registries. | 98 // A registry that combines the maps of other registries. |
99 class POLICY_EXPORT CombinedSchemaRegistry | 99 class POLICY_EXPORT CombinedSchemaRegistry |
100 : public SchemaRegistry, | 100 : public SchemaRegistry, |
101 public SchemaRegistry::Observer, | 101 public SchemaRegistry::Observer, |
102 public SchemaRegistry::InternalObserver { | 102 public SchemaRegistry::InternalObserver { |
103 public: | 103 public: |
104 CombinedSchemaRegistry(); | 104 CombinedSchemaRegistry(); |
105 virtual ~CombinedSchemaRegistry(); | 105 ~CombinedSchemaRegistry() override; |
106 | 106 |
107 void Track(SchemaRegistry* registry); | 107 void Track(SchemaRegistry* registry); |
108 | 108 |
109 // SchemaRegistry: | 109 // SchemaRegistry: |
110 virtual void RegisterComponents(PolicyDomain domain, | 110 void RegisterComponents(PolicyDomain domain, |
111 const ComponentMap& components) override; | 111 const ComponentMap& components) override; |
112 virtual void UnregisterComponent(const PolicyNamespace& ns) override; | 112 void UnregisterComponent(const PolicyNamespace& ns) override; |
113 | 113 |
114 // SchemaRegistry::Observer: | 114 // SchemaRegistry::Observer: |
115 virtual void OnSchemaRegistryUpdated(bool has_new_schemas) override; | 115 void OnSchemaRegistryUpdated(bool has_new_schemas) override; |
116 virtual void OnSchemaRegistryReady() override; | 116 void OnSchemaRegistryReady() override; |
117 | 117 |
118 // SchemaRegistry::InternalObserver: | 118 // SchemaRegistry::InternalObserver: |
119 virtual void OnSchemaRegistryShuttingDown(SchemaRegistry* registry) override; | 119 void OnSchemaRegistryShuttingDown(SchemaRegistry* registry) override; |
120 | 120 |
121 private: | 121 private: |
122 void Combine(bool has_new_schemas); | 122 void Combine(bool has_new_schemas); |
123 | 123 |
124 std::set<SchemaRegistry*> registries_; | 124 std::set<SchemaRegistry*> registries_; |
125 scoped_refptr<SchemaMap> own_schema_map_; | 125 scoped_refptr<SchemaMap> own_schema_map_; |
126 | 126 |
127 DISALLOW_COPY_AND_ASSIGN(CombinedSchemaRegistry); | 127 DISALLOW_COPY_AND_ASSIGN(CombinedSchemaRegistry); |
128 }; | 128 }; |
129 | 129 |
130 // A registry that wraps another schema registry. | 130 // A registry that wraps another schema registry. |
131 class POLICY_EXPORT ForwardingSchemaRegistry | 131 class POLICY_EXPORT ForwardingSchemaRegistry |
132 : public SchemaRegistry, | 132 : public SchemaRegistry, |
133 public SchemaRegistry::Observer, | 133 public SchemaRegistry::Observer, |
134 public SchemaRegistry::InternalObserver { | 134 public SchemaRegistry::InternalObserver { |
135 public: | 135 public: |
136 // This registry will stop updating its SchemaMap when |wrapped| is | 136 // This registry will stop updating its SchemaMap when |wrapped| is |
137 // destroyed. | 137 // destroyed. |
138 explicit ForwardingSchemaRegistry(SchemaRegistry* wrapped); | 138 explicit ForwardingSchemaRegistry(SchemaRegistry* wrapped); |
139 virtual ~ForwardingSchemaRegistry(); | 139 ~ForwardingSchemaRegistry() override; |
140 | 140 |
141 // SchemaRegistry: | 141 // SchemaRegistry: |
142 virtual void RegisterComponents(PolicyDomain domain, | 142 void RegisterComponents(PolicyDomain domain, |
143 const ComponentMap& components) override; | 143 const ComponentMap& components) override; |
144 virtual void UnregisterComponent(const PolicyNamespace& ns) override; | 144 void UnregisterComponent(const PolicyNamespace& ns) override; |
145 | 145 |
146 // SchemaRegistry::Observer: | 146 // SchemaRegistry::Observer: |
147 virtual void OnSchemaRegistryUpdated(bool has_new_schemas) override; | 147 void OnSchemaRegistryUpdated(bool has_new_schemas) override; |
148 virtual void OnSchemaRegistryReady() override; | 148 void OnSchemaRegistryReady() override; |
149 | 149 |
150 // SchemaRegistry::InternalObserver: | 150 // SchemaRegistry::InternalObserver: |
151 virtual void OnSchemaRegistryShuttingDown(SchemaRegistry* registry) override; | 151 void OnSchemaRegistryShuttingDown(SchemaRegistry* registry) override; |
152 | 152 |
153 private: | 153 private: |
154 SchemaRegistry* wrapped_; | 154 SchemaRegistry* wrapped_; |
155 | 155 |
156 DISALLOW_COPY_AND_ASSIGN(ForwardingSchemaRegistry); | 156 DISALLOW_COPY_AND_ASSIGN(ForwardingSchemaRegistry); |
157 }; | 157 }; |
158 | 158 |
159 } // namespace policy | 159 } // namespace policy |
160 | 160 |
161 #endif // COMPONENTS_POLICY_CORE_COMMON_SCHEMA_REGISTRY_H_ | 161 #endif // COMPONENTS_POLICY_CORE_COMMON_SCHEMA_REGISTRY_H_ |
OLD | NEW |