| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_H_ | 6 #define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 const Entry* begin; | 33 const Entry* begin; |
| 34 const Entry* end; | 34 const Entry* end; |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 explicit ConfigurationPolicyProvider(const PolicyDefinitionList* policy_list); | 37 explicit ConfigurationPolicyProvider(const PolicyDefinitionList* policy_list); |
| 38 | 38 |
| 39 virtual ~ConfigurationPolicyProvider(); | 39 virtual ~ConfigurationPolicyProvider(); |
| 40 | 40 |
| 41 // Must be implemented by provider subclasses to specify the | 41 // Must be implemented by provider subclasses to specify the provider-specific |
| 42 // provider-specific policy decisions. The preference service | 42 // policy decisions. The preference service invokes this |Provide| method when |
| 43 // invokes this |Provide| method when it needs a policy | 43 // it needs a policy provider to specify its policy choices. In |Provide|, the |
| 44 // provider to specify its policy choices. In |Provide|, | 44 // |ConfigurationPolicyProvider| must make calls to the |Apply| method of |
| 45 // the |ConfigurationPolicyProvider| must make calls to the | 45 // |store| to apply specific policies. Returns true if the policy could be |
| 46 // |Apply| method of |store| to apply specific policies. | 46 // provided, otherwise false. |
| 47 // Returns true if the policy could be provided, otherwise false. | |
| 48 virtual bool Provide(ConfigurationPolicyStoreInterface* store) = 0; | 47 virtual bool Provide(ConfigurationPolicyStoreInterface* store) = 0; |
| 49 | 48 |
| 49 // Check whether this provider has completed initialization. This is used to |
| 50 // detect whether initialization is done in case providers implementations |
| 51 // need to do asynchronous operations for initialization. |
| 52 virtual bool IsInitializationComplete() const { return true; } |
| 53 |
| 50 // Called by the subclass provider at any time to indicate that the currently | 54 // Called by the subclass provider at any time to indicate that the currently |
| 51 // applied policy is not longer current. A policy refresh will be initiated as | 55 // applied policy is not longer current. A policy refresh will be initiated as |
| 52 // soon as possible. | 56 // soon as possible. |
| 53 virtual void NotifyStoreOfPolicyChange(); | 57 virtual void NotifyStoreOfPolicyChange(); |
| 54 | 58 |
| 59 protected: |
| 55 // Decodes the value tree and writes the configuration to the given |store|. | 60 // Decodes the value tree and writes the configuration to the given |store|. |
| 56 void DecodePolicyValueTree(const DictionaryValue* policies, | 61 void DecodePolicyValueTree(const DictionaryValue* policies, |
| 57 ConfigurationPolicyStoreInterface* store); | 62 ConfigurationPolicyStoreInterface* store); |
| 58 protected: | 63 |
| 59 const PolicyDefinitionList* policy_definition_list() const { | 64 const PolicyDefinitionList* policy_definition_list() const { |
| 60 return policy_definition_list_; | 65 return policy_definition_list_; |
| 61 } | 66 } |
| 62 | 67 |
| 63 private: | 68 private: |
| 64 // Contains the default mapping from policy values to the actual names. | 69 // Contains the default mapping from policy values to the actual names. |
| 65 const ConfigurationPolicyProvider::PolicyDefinitionList* | 70 const ConfigurationPolicyProvider::PolicyDefinitionList* |
| 66 policy_definition_list_; | 71 policy_definition_list_; |
| 67 | 72 |
| 68 private: | 73 private: |
| 69 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyProvider); | 74 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyProvider); |
| 70 }; | 75 }; |
| 71 | 76 |
| 72 } // namespace policy | 77 } // namespace policy |
| 73 | 78 |
| 74 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_H_ | 79 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_H_ |
| OLD | NEW |