OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 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_CLOUD_POLICY_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_POLICY_CLOUD_POLICY_PROVIDER_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "base/basictypes.h" |
| 10 #include "chrome/browser/policy/cloud_policy_cache_base.h" |
| 11 #include "chrome/browser/policy/configuration_policy_provider.h" |
| 12 |
| 13 namespace policy { |
| 14 |
| 15 // A policy provider having multiple backend caches, combining their relevant |
| 16 // PolicyMaps and keeping the result cached. The underlying caches are kept as |
| 17 // weak references and can be added dynamically. Also the |
| 18 // |CloudPolicyProvider| instance listens to cache-notifications and removes |
| 19 // the caches automatically when they go away. The order in which the caches are |
| 20 // stored matters! The first cache is applied as is and the following caches |
| 21 // only contribute the not-yet applied policies. There are two functions to add |
| 22 // a new cache: |
| 23 // PrependCache(cache): adds |cache| to the front (i.e. most important cache). |
| 24 // AppendCache(cache): adds |cache| to the back (i.e. least important cache). |
| 25 class CloudPolicyProvider : public ConfigurationPolicyProvider { |
| 26 public: |
| 27 explicit CloudPolicyProvider( |
| 28 const ConfigurationPolicyProvider::PolicyDefinitionList* policy_list); |
| 29 virtual ~CloudPolicyProvider(); |
| 30 |
| 31 // Adds a new instance of CloudPolicyCacheBase to the end of |caches_|. |
| 32 // Does not take ownership of |cache| and listens to OnCacheGoingAway to |
| 33 // automatically remove it from |caches_|. |
| 34 virtual void AppendCache(CloudPolicyCacheBase* cache) = 0; |
| 35 |
| 36 // Adds a new instance of CloudPolicyCacheBase to the beginning of |caches_|. |
| 37 // Does not take ownership of |cache| and listens to OnCacheGoingAway to |
| 38 // automatically remove it from |caches_|. |
| 39 virtual void PrependCache(CloudPolicyCacheBase* cache) = 0; |
| 40 |
| 41 private: |
| 42 DISALLOW_COPY_AND_ASSIGN(CloudPolicyProvider); |
| 43 }; |
| 44 |
| 45 } // namespace policy |
| 46 |
| 47 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_PROVIDER_H_ |
OLD | NEW |