OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "chrome/browser/chromeos/policy/login_profile_policy_provider.h" | 5 #include "chrome/browser/chromeos/policy/login_profile_policy_provider.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 // |device_policy| is unset, does nothing. | 57 // |device_policy| is unset, does nothing. |
58 void ApplyDevicePolicyAsRecommendedPolicy(const std::string& device_policy, | 58 void ApplyDevicePolicyAsRecommendedPolicy(const std::string& device_policy, |
59 const std::string& user_policy, | 59 const std::string& user_policy, |
60 const PolicyMap& device_policy_map, | 60 const PolicyMap& device_policy_map, |
61 PolicyMap* user_policy_map) { | 61 PolicyMap* user_policy_map) { |
62 const base::Value* value = device_policy_map.GetValue(device_policy); | 62 const base::Value* value = device_policy_map.GetValue(device_policy); |
63 if (value) { | 63 if (value) { |
64 user_policy_map->Set(user_policy, | 64 user_policy_map->Set(user_policy, |
65 POLICY_LEVEL_RECOMMENDED, | 65 POLICY_LEVEL_RECOMMENDED, |
66 POLICY_SCOPE_USER, | 66 POLICY_SCOPE_USER, |
67 POLICY_SOURCE_CLOUD, | |
68 value->DeepCopy(), | 67 value->DeepCopy(), |
69 NULL); | 68 NULL); |
70 } | 69 } |
71 } | 70 } |
72 | 71 |
73 // Applies |value| as the mandatory value of |user_policy| in |user_policy_map|. | 72 // Applies |value| as the mandatory value of |user_policy| in |user_policy_map|. |
74 // If |value| is NULL, does nothing. | 73 // If |value| is NULL, does nothing. |
75 void ApplyValueAsMandatoryPolicy(const base::Value* value, | 74 void ApplyValueAsMandatoryPolicy(const base::Value* value, |
76 const std::string& user_policy, | 75 const std::string& user_policy, |
77 PolicyMap* user_policy_map) { | 76 PolicyMap* user_policy_map) { |
78 if (value) { | 77 if (value) { |
79 user_policy_map->Set(user_policy, | 78 user_policy_map->Set(user_policy, |
80 POLICY_LEVEL_MANDATORY, | 79 POLICY_LEVEL_MANDATORY, |
81 POLICY_SCOPE_USER, | 80 POLICY_SCOPE_USER, |
82 POLICY_SOURCE_CLOUD, | |
83 value->DeepCopy(), | 81 value->DeepCopy(), |
84 NULL); | 82 NULL); |
85 } | 83 } |
86 } | 84 } |
87 | 85 |
88 } // namespace | 86 } // namespace |
89 | 87 |
90 LoginProfilePolicyProvider::LoginProfilePolicyProvider( | 88 LoginProfilePolicyProvider::LoginProfilePolicyProvider( |
91 PolicyService* device_policy_service) | 89 PolicyService* device_policy_service) |
92 : device_policy_service_(device_policy_service), | 90 : device_policy_service_(device_policy_service), |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 ApplyValueAsMandatoryPolicy(policy_value.get(), | 197 ApplyValueAsMandatoryPolicy(policy_value.get(), |
200 key::kPowerManagementIdleSettings, | 198 key::kPowerManagementIdleSettings, |
201 &user_policy_map); | 199 &user_policy_map); |
202 } | 200 } |
203 } | 201 } |
204 | 202 |
205 UpdatePolicy(bundle.Pass()); | 203 UpdatePolicy(bundle.Pass()); |
206 } | 204 } |
207 | 205 |
208 } // namespace policy | 206 } // namespace policy |
OLD | NEW |