| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 COMPONENTS_POLICY_CORE_BROWSER_CONFIGURATION_POLICY_HANDLER_LIST_H_ | 5 #ifndef COMPONENTS_POLICY_CORE_BROWSER_CONFIGURATION_POLICY_HANDLER_LIST_H_ |
| 6 #define COMPONENTS_POLICY_CORE_BROWSER_CONFIGURATION_POLICY_HANDLER_LIST_H_ | 6 #define COMPONENTS_POLICY_CORE_BROWSER_CONFIGURATION_POLICY_HANDLER_LIST_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "components/policy/core/common/policy_details.h" | 13 #include "components/policy/core/common/policy_details.h" |
| 14 #include "components/policy/policy_export.h" | 14 #include "components/policy/policy_export.h" |
| 15 | 15 |
| 16 class PrefValueMap; | 16 class PrefValueMap; |
| 17 | 17 |
| 18 namespace policy { | 18 namespace policy { |
| 19 | 19 |
| 20 class ConfigurationPolicyHandler; | 20 class ConfigurationPolicyHandler; |
| 21 class PolicyErrorMap; | 21 class PolicyErrorMap; |
| 22 struct PolicyHandlerParameters; |
| 22 class PolicyMap; | 23 class PolicyMap; |
| 23 struct PolicyToPreferenceMapEntry; | 24 struct PolicyToPreferenceMapEntry; |
| 24 class Schema; | 25 class Schema; |
| 25 | 26 |
| 26 // Converts policies to their corresponding preferences by applying a list of | 27 // Converts policies to their corresponding preferences by applying a list of |
| 27 // ConfigurationPolicyHandler objects. This includes error checking and | 28 // ConfigurationPolicyHandler objects. This includes error checking and |
| 28 // cleaning up policy values for displaying. | 29 // cleaning up policy values for displaying. |
| 29 class POLICY_EXPORT ConfigurationPolicyHandlerList { | 30 class POLICY_EXPORT ConfigurationPolicyHandlerList { |
| 30 public: | 31 public: |
| 32 typedef base::Callback<void(PolicyHandlerParameters*)> |
| 33 PopulatePolicyHandlerParametersCallback; |
| 34 |
| 31 explicit ConfigurationPolicyHandlerList( | 35 explicit ConfigurationPolicyHandlerList( |
| 36 const PopulatePolicyHandlerParametersCallback& parameters_callback, |
| 32 const GetChromePolicyDetailsCallback& details_callback); | 37 const GetChromePolicyDetailsCallback& details_callback); |
| 33 ~ConfigurationPolicyHandlerList(); | 38 ~ConfigurationPolicyHandlerList(); |
| 34 | 39 |
| 35 // Adds a policy handler to the list. | 40 // Adds a policy handler to the list. |
| 36 void AddHandler(scoped_ptr<ConfigurationPolicyHandler> handler); | 41 void AddHandler(scoped_ptr<ConfigurationPolicyHandler> handler); |
| 37 | 42 |
| 38 // Translates |policies| to their corresponding preferences in |prefs|. | 43 // Translates |policies| to their corresponding preferences in |prefs|. |
| 39 // Any errors found while processing the policies are stored in |errors|. | 44 // Any errors found while processing the policies are stored in |errors|. |
| 40 // |prefs| or |errors| can be NULL, and won't be filled in that case. | 45 // |prefs| or |errors| can be NULL, and won't be filled in that case. |
| 41 void ApplyPolicySettings(const PolicyMap& policies, | 46 void ApplyPolicySettings(const PolicyMap& policies, |
| 42 PrefValueMap* prefs, | 47 PrefValueMap* prefs, |
| 43 PolicyErrorMap* errors) const; | 48 PolicyErrorMap* errors) const; |
| 44 | 49 |
| 45 // Converts sensitive policy values to others more appropriate for displaying. | 50 // Converts sensitive policy values to others more appropriate for displaying. |
| 46 void PrepareForDisplaying(PolicyMap* policies) const; | 51 void PrepareForDisplaying(PolicyMap* policies) const; |
| 47 | 52 |
| 48 private: | 53 private: |
| 49 std::vector<ConfigurationPolicyHandler*> handlers_; | 54 std::vector<ConfigurationPolicyHandler*> handlers_; |
| 50 GetChromePolicyDetailsCallback details_callback_; | 55 const PopulatePolicyHandlerParametersCallback parameters_callback_; |
| 56 const GetChromePolicyDetailsCallback details_callback_; |
| 51 | 57 |
| 52 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyHandlerList); | 58 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyHandlerList); |
| 53 }; | 59 }; |
| 54 | 60 |
| 55 // Callback with signature of BuildHandlerList(), to be used in constructor of | 61 // Callback with signature of BuildHandlerList(), to be used in constructor of |
| 56 // BrowserPolicyConnector. | 62 // BrowserPolicyConnector. |
| 57 typedef base::Callback<scoped_ptr<ConfigurationPolicyHandlerList>( | 63 typedef base::Callback<scoped_ptr<ConfigurationPolicyHandlerList>( |
| 58 const Schema&)> HandlerListFactory; | 64 const Schema&)> HandlerListFactory; |
| 59 | 65 |
| 60 } // namespace policy | 66 } // namespace policy |
| 61 | 67 |
| 62 #endif // COMPONENTS_POLICY_CORE_BROWSER_CONFIGURATION_POLICY_HANDLER_LIST_H_ | 68 #endif // COMPONENTS_POLICY_CORE_BROWSER_CONFIGURATION_POLICY_HANDLER_LIST_H_ |
| OLD | NEW |