| 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_CONFIGURATION_POLICY_PROVIDER_H_ | 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_CONFIGURATION_POLICY_PROVIDER_H_ |
| 6 #define COMPONENTS_POLICY_CORE_COMMON_CONFIGURATION_POLICY_PROVIDER_H_ | 6 #define COMPONENTS_POLICY_CORE_COMMON_CONFIGURATION_POLICY_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 9 |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
| 12 #include "components/policy/core/common/policy_bundle.h" | 13 #include "components/policy/core/common/policy_bundle.h" |
| 13 #include "components/policy/core/common/policy_namespace.h" | 14 #include "components/policy/core/common/policy_namespace.h" |
| 14 #include "components/policy/core/common/schema_registry.h" | 15 #include "components/policy/core/common/schema_registry.h" |
| 15 #include "components/policy/policy_export.h" | 16 #include "components/policy/policy_export.h" |
| 16 | 17 |
| 17 namespace policy { | 18 namespace policy { |
| 18 | 19 |
| 19 // A mostly-abstract super class for platform-specific policy providers. | 20 // A mostly-abstract super class for platform-specific policy providers. |
| 20 // Platform-specific policy providers (Windows Group Policy, gconf, | 21 // Platform-specific policy providers (Windows Group Policy, gconf, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 virtual void RemoveObserver(Observer* observer); | 72 virtual void RemoveObserver(Observer* observer); |
| 72 | 73 |
| 73 // SchemaRegistry::Observer: | 74 // SchemaRegistry::Observer: |
| 74 void OnSchemaRegistryUpdated(bool has_new_schemas) override; | 75 void OnSchemaRegistryUpdated(bool has_new_schemas) override; |
| 75 void OnSchemaRegistryReady() override; | 76 void OnSchemaRegistryReady() override; |
| 76 | 77 |
| 77 protected: | 78 protected: |
| 78 // Subclasses must invoke this to update the policies currently served by | 79 // Subclasses must invoke this to update the policies currently served by |
| 79 // this provider. UpdatePolicy() takes ownership of |policies|. | 80 // this provider. UpdatePolicy() takes ownership of |policies|. |
| 80 // The observers are notified after the policies are updated. | 81 // The observers are notified after the policies are updated. |
| 81 void UpdatePolicy(scoped_ptr<PolicyBundle> bundle); | 82 void UpdatePolicy(std::unique_ptr<PolicyBundle> bundle); |
| 82 | 83 |
| 83 SchemaRegistry* schema_registry() const; | 84 SchemaRegistry* schema_registry() const; |
| 84 | 85 |
| 85 const scoped_refptr<SchemaMap>& schema_map() const; | 86 const scoped_refptr<SchemaMap>& schema_map() const; |
| 86 | 87 |
| 87 private: | 88 private: |
| 88 // The policies currently configured at this provider. | 89 // The policies currently configured at this provider. |
| 89 PolicyBundle policy_bundle_; | 90 PolicyBundle policy_bundle_; |
| 90 | 91 |
| 91 // Used to validate proper Init() and Shutdown() nesting. This flag is set by | 92 // Used to validate proper Init() and Shutdown() nesting. This flag is set by |
| 92 // Init() and cleared by Shutdown() and needs to be false in the destructor. | 93 // Init() and cleared by Shutdown() and needs to be false in the destructor. |
| 93 bool initialized_; | 94 bool initialized_; |
| 94 | 95 |
| 95 SchemaRegistry* schema_registry_; | 96 SchemaRegistry* schema_registry_; |
| 96 | 97 |
| 97 base::ObserverList<Observer, true> observer_list_; | 98 base::ObserverList<Observer, true> observer_list_; |
| 98 | 99 |
| 99 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyProvider); | 100 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyProvider); |
| 100 }; | 101 }; |
| 101 | 102 |
| 102 } // namespace policy | 103 } // namespace policy |
| 103 | 104 |
| 104 #endif // COMPONENTS_POLICY_CORE_COMMON_CONFIGURATION_POLICY_PROVIDER_H_ | 105 #endif // COMPONENTS_POLICY_CORE_COMMON_CONFIGURATION_POLICY_PROVIDER_H_ |
| OLD | NEW |