| 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" | |
| 11 #include "policy/configuration_policy_type.h" | 10 #include "policy/configuration_policy_type.h" |
| 12 | 11 |
| 13 class Value; | 12 class Value; |
| 14 | 13 |
| 15 namespace policy { | 14 namespace policy { |
| 16 | 15 |
| 17 // Constants for the "Proxy Server Mode" defined in the policies. | 16 // Constants for the "Proxy Server Mode" defined in the policies. |
| 18 // Note that these diverge from internal presentation defined in | 17 // Note that these diverge from internal presentation defined in |
| 19 // ProxyPrefs::ProxyMode for legacy reasons. The following four | 18 // ProxyPrefs::ProxyMode for legacy reasons. The following four |
| 20 // PolicyProxyModeType types were not very precise and had overlapping use | 19 // PolicyProxyModeType types were not very precise and had overlapping use |
| (...skipping 22 matching lines...) Expand all Loading... |
| 43 // store takes over the ownership of |value|. | 42 // store takes over the ownership of |value|. |
| 44 virtual void Apply(ConfigurationPolicyType policy, Value* value) = 0; | 43 virtual void Apply(ConfigurationPolicyType policy, Value* value) = 0; |
| 45 | 44 |
| 46 protected: | 45 protected: |
| 47 ConfigurationPolicyStoreInterface() {} | 46 ConfigurationPolicyStoreInterface() {} |
| 48 | 47 |
| 49 private: | 48 private: |
| 50 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyStoreInterface); | 49 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyStoreInterface); |
| 51 }; | 50 }; |
| 52 | 51 |
| 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 | 52 } // namespace policy |
| 96 | 53 |
| 97 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_STORE_INTERFACE_H_ | 54 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_STORE_INTERFACE_H_ |
| OLD | NEW |