| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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_CONFIGURATION_POLICY_STORE_INTERFACE_H_ | 5 #ifndef CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_STORE_INTERFACE_H_ |
| 6 #define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_STORE_INTERFACE_H_ | 6 #define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_STORE_INTERFACE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 // store takes over the ownership of |value|. | 43 // store takes over the ownership of |value|. |
| 44 virtual void Apply(ConfigurationPolicyType policy, Value* value) = 0; | 44 virtual void Apply(ConfigurationPolicyType policy, Value* value) = 0; |
| 45 | 45 |
| 46 protected: | 46 protected: |
| 47 ConfigurationPolicyStoreInterface() {} | 47 ConfigurationPolicyStoreInterface() {} |
| 48 | 48 |
| 49 private: | 49 private: |
| 50 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyStoreInterface); | 50 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyStoreInterface); |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 // Helper class. A pass-through ConfigurationPolicyStoreInterface, that observes | |
| 54 // the application of well-known policies. | |
| 55 class ObservingPolicyStoreInterface: public ConfigurationPolicyStoreInterface { | |
| 56 public: | |
| 57 explicit ObservingPolicyStoreInterface( | |
| 58 ConfigurationPolicyStoreInterface* next) | |
| 59 : next_(next), | |
| 60 proxy_policy_applied_(false) {} | |
| 61 | |
| 62 // ConfigurationPolicyStoreInterface methods: | |
| 63 virtual void Apply(ConfigurationPolicyType policy, Value* value) OVERRIDE; | |
| 64 | |
| 65 bool IsProxyPolicyApplied() const { | |
| 66 return proxy_policy_applied_; | |
| 67 } | |
| 68 | |
| 69 private: | |
| 70 ConfigurationPolicyStoreInterface* next_; | |
| 71 bool proxy_policy_applied_; | |
| 72 | |
| 73 DISALLOW_COPY_AND_ASSIGN(ObservingPolicyStoreInterface); | |
| 74 }; | |
| 75 | |
| 76 // Helper class. A ConfigurationPolicyStoreInterface that filters out most | |
| 77 // policies, and only applies well-known policies. | |
| 78 class FilteringPolicyStoreInterface: public ConfigurationPolicyStoreInterface { | |
| 79 public: | |
| 80 FilteringPolicyStoreInterface(ConfigurationPolicyStoreInterface* next, | |
| 81 bool apply_proxy_policies) | |
| 82 : next_(next), | |
| 83 apply_proxy_policies_(apply_proxy_policies) {} | |
| 84 | |
| 85 // ConfigurationPolicyStoreInterface methods: | |
| 86 virtual void Apply(ConfigurationPolicyType policy, Value* value) OVERRIDE; | |
| 87 | |
| 88 private: | |
| 89 ConfigurationPolicyStoreInterface* next_; | |
| 90 bool apply_proxy_policies_; | |
| 91 | |
| 92 DISALLOW_COPY_AND_ASSIGN(FilteringPolicyStoreInterface); | |
| 93 }; | |
| 94 | |
| 95 } // namespace policy | 53 } // namespace policy |
| 96 | 54 |
| 97 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_STORE_INTERFACE_H_ | 55 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_STORE_INTERFACE_H_ |
| OLD | NEW |