| 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> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "chrome/browser/policy/configuration_policy_store.h" | 15 #include "chrome/browser/policy/configuration_policy_store_interface.h" |
| 16 | 16 |
| 17 namespace policy { | 17 namespace policy { |
| 18 | 18 |
| 19 // A mostly-abstract super class for platform-specific policy providers. | 19 // A mostly-abstract super class for platform-specific policy providers. |
| 20 // Platform-specific policy providers (Windows Group Policy, gconf, | 20 // Platform-specific policy providers (Windows Group Policy, gconf, |
| 21 // etc.) should implement a subclass of this class. | 21 // etc.) should implement a subclass of this class. |
| 22 class ConfigurationPolicyProvider { | 22 class ConfigurationPolicyProvider { |
| 23 public: | 23 public: |
| 24 // Used for static arrays of policy values that is used to initialize an | 24 // Used for static arrays of policy values that is used to initialize an |
| 25 // instance of the ConfigurationPolicyProvider. | 25 // instance of the ConfigurationPolicyProvider. |
| 26 struct PolicyDefinitionList { | 26 struct PolicyDefinitionList { |
| 27 struct Entry { | 27 struct Entry { |
| 28 ConfigurationPolicyStore::PolicyType policy_type; | 28 ConfigurationPolicyType policy_type; |
| 29 Value::ValueType value_type; | 29 Value::ValueType value_type; |
| 30 const char* name; | 30 const char* name; |
| 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 |
| 42 // provider-specific policy decisions. The preference service | 42 // provider-specific policy decisions. The preference service |
| 43 // invokes this |Provide| method when it needs a policy | 43 // invokes this |Provide| method when it needs a policy |
| 44 // provider to specify its policy choices. In |Provide|, | 44 // provider to specify its policy choices. In |Provide|, |
| 45 // the |ConfigurationPolicyProvider| must make calls to the | 45 // the |ConfigurationPolicyProvider| must make calls to the |
| 46 // |Apply| method of |store| to apply specific policies. | 46 // |Apply| method of |store| to apply specific policies. |
| 47 // Returns true if the policy could be provided, otherwise false. | 47 // Returns true if the policy could be provided, otherwise false. |
| 48 virtual bool Provide(ConfigurationPolicyStore* store) = 0; | 48 virtual bool Provide(ConfigurationPolicyStoreInterface* store) = 0; |
| 49 | 49 |
| 50 // Called by the subclass provider at any time to indicate that the currently | 50 // 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 | 51 // applied policy is not longer current. A policy refresh will be initiated as |
| 52 // soon as possible. | 52 // soon as possible. |
| 53 virtual void NotifyStoreOfPolicyChange(); | 53 virtual void NotifyStoreOfPolicyChange(); |
| 54 | 54 |
| 55 protected: | 55 protected: |
| 56 const PolicyDefinitionList* policy_definition_list() const { | 56 const PolicyDefinitionList* policy_definition_list() const { |
| 57 return policy_definition_list_; | 57 return policy_definition_list_; |
| 58 } | 58 } |
| 59 | 59 |
| 60 private: | 60 private: |
| 61 // Contains the default mapping from policy values to the actual names. | 61 // Contains the default mapping from policy values to the actual names. |
| 62 const ConfigurationPolicyProvider::PolicyDefinitionList* | 62 const ConfigurationPolicyProvider::PolicyDefinitionList* |
| 63 policy_definition_list_; | 63 policy_definition_list_; |
| 64 | 64 |
| 65 private: | 65 private: |
| 66 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyProvider); | 66 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyProvider); |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 } // namespace policy | 69 } // namespace policy |
| 70 | 70 |
| 71 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_H_ | 71 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_H_ |
| OLD | NEW |