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