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 #include "chromeos/network/onc/onc_merger.h" | 5 #include "chromeos/network/onc/onc_merger.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/values.h" | 13 #include "base/values.h" |
14 #include "chromeos/network/onc/onc_constants.h" | 14 #include "chromeos/network/onc/onc_constants.h" |
| 15 #include "chromeos/network/onc/onc_signature.h" |
15 | 16 |
16 namespace chromeos { | 17 namespace chromeos { |
17 namespace onc { | 18 namespace onc { |
18 namespace { | 19 namespace { |
19 | 20 |
20 typedef scoped_ptr<base::DictionaryValue> DictionaryPtr; | 21 typedef scoped_ptr<base::DictionaryValue> DictionaryPtr; |
21 | 22 |
22 // Inserts |true| at every field name in |result| that is recommended in | 23 // Inserts |true| at every field name in |result| that is recommended in |
23 // |policy|. | 24 // |policy|. |
24 void MarkRecommendedFieldnames(const base::DictionaryValue& policy, | 25 void MarkRecommendedFieldnames(const base::DictionaryValue& policy, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 scoped_ptr<base::Value> merged_value; | 90 scoped_ptr<base::Value> merged_value; |
90 if (field.value().IsType(base::Value::TYPE_DICTIONARY)) { | 91 if (field.value().IsType(base::Value::TYPE_DICTIONARY)) { |
91 DictPtrs nested_dicts; | 92 DictPtrs nested_dicts; |
92 for (DictPtrs::const_iterator it_inner = dicts.begin(); | 93 for (DictPtrs::const_iterator it_inner = dicts.begin(); |
93 it_inner != dicts.end(); ++it_inner) { | 94 it_inner != dicts.end(); ++it_inner) { |
94 const base::DictionaryValue* nested_dict = NULL; | 95 const base::DictionaryValue* nested_dict = NULL; |
95 if (*it_inner) | 96 if (*it_inner) |
96 (*it_inner)->GetDictionaryWithoutPathExpansion(key, &nested_dict); | 97 (*it_inner)->GetDictionaryWithoutPathExpansion(key, &nested_dict); |
97 nested_dicts.push_back(nested_dict); | 98 nested_dicts.push_back(nested_dict); |
98 } | 99 } |
99 DictionaryPtr merged_dict(MergeDictionaries(nested_dicts)); | 100 DictionaryPtr merged_dict(MergeNestedDictionaries(key, nested_dicts)); |
100 if (!merged_dict->empty()) | 101 if (!merged_dict->empty()) |
101 merged_value = merged_dict.Pass(); | 102 merged_value = merged_dict.Pass(); |
102 } else { | 103 } else { |
103 std::vector<const base::Value*> values; | 104 std::vector<const base::Value*> values; |
104 for (DictPtrs::const_iterator it_inner = dicts.begin(); | 105 for (DictPtrs::const_iterator it_inner = dicts.begin(); |
105 it_inner != dicts.end(); ++it_inner) { | 106 it_inner != dicts.end(); ++it_inner) { |
106 const base::Value* value = NULL; | 107 const base::Value* value = NULL; |
107 if (*it_inner) | 108 if (*it_inner) |
108 (*it_inner)->GetWithoutPathExpansion(key, &value); | 109 (*it_inner)->GetWithoutPathExpansion(key, &value); |
109 values.push_back(value); | 110 values.push_back(value); |
110 } | 111 } |
111 merged_value = MergeListOfValues(values); | 112 merged_value = MergeListOfValues(key, values); |
112 } | 113 } |
113 | 114 |
114 if (merged_value) | 115 if (merged_value) |
115 result->SetWithoutPathExpansion(key, merged_value.release()); | 116 result->SetWithoutPathExpansion(key, merged_value.release()); |
116 } | 117 } |
117 } | 118 } |
118 return result.Pass(); | 119 return result.Pass(); |
119 } | 120 } |
120 | 121 |
121 protected: | 122 protected: |
122 // This function is called by MergeDictionaries for each list of values that | 123 // This function is called by MergeDictionaries for each list of values that |
123 // are located at the same path in each of the dictionaries. The order of the | 124 // are located at the same path in each of the dictionaries. The order of the |
124 // values is the same as of the given dictionaries |dicts|. If a dictionary | 125 // values is the same as of the given dictionaries |dicts|. If a dictionary |
125 // doesn't contain a path then it's value is NULL. | 126 // doesn't contain a path then it's value is NULL. |
126 virtual scoped_ptr<base::Value> MergeListOfValues( | 127 virtual scoped_ptr<base::Value> MergeListOfValues( |
| 128 const std::string& key, |
127 const std::vector<const base::Value*>& values) = 0; | 129 const std::vector<const base::Value*>& values) = 0; |
128 | 130 |
| 131 virtual DictionaryPtr MergeNestedDictionaries(const std::string& key, |
| 132 const DictPtrs &dicts) { |
| 133 return MergeDictionaries(dicts); |
| 134 } |
| 135 |
129 private: | 136 private: |
130 DISALLOW_COPY_AND_ASSIGN(MergeListOfDictionaries); | 137 DISALLOW_COPY_AND_ASSIGN(MergeListOfDictionaries); |
131 }; | 138 }; |
132 | 139 |
133 // This is the base class for merging policies and user settings. | 140 // This is the base class for merging policies and user settings. |
134 class MergeSettingsAndPolicies : public MergeListOfDictionaries { | 141 class MergeSettingsAndPolicies : public MergeListOfDictionaries { |
135 public: | 142 public: |
136 struct ValueParams { | 143 struct ValueParams { |
137 const base::Value* user_policy; | 144 const base::Value* user_policy; |
138 const base::Value* device_policy; | 145 const base::Value* device_policy; |
139 const base::Value* user_settings; | 146 const base::Value* user_setting; |
140 const base::Value* shared_settings; | 147 const base::Value* shared_setting; |
| 148 const base::Value* active_setting; |
141 bool user_editable; | 149 bool user_editable; |
142 bool device_editable; | 150 bool device_editable; |
143 }; | 151 }; |
144 | 152 |
| 153 MergeSettingsAndPolicies() {} |
| 154 |
145 // Merge the provided dictionaries. For each path in any of the dictionaries, | 155 // Merge the provided dictionaries. For each path in any of the dictionaries, |
146 // MergeValues is called. Its results are collected in a new dictionary which | 156 // MergeValues is called. Its results are collected in a new dictionary which |
147 // is then returned. The resulting dictionary never contains empty | 157 // is then returned. The resulting dictionary never contains empty |
148 // dictionaries. | 158 // dictionaries. |
149 DictionaryPtr MergeDictionaries( | 159 DictionaryPtr MergeDictionaries( |
150 const base::DictionaryValue* user_policy, | 160 const base::DictionaryValue* user_policy, |
151 const base::DictionaryValue* device_policy, | 161 const base::DictionaryValue* device_policy, |
152 const base::DictionaryValue* user_settings, | 162 const base::DictionaryValue* user_settings, |
153 const base::DictionaryValue* shared_settings) { | 163 const base::DictionaryValue* shared_settings, |
| 164 const base::DictionaryValue* active_settings) { |
154 hasUserPolicy_ = (user_policy != NULL); | 165 hasUserPolicy_ = (user_policy != NULL); |
155 hasDevicePolicy_ = (device_policy != NULL); | 166 hasDevicePolicy_ = (device_policy != NULL); |
156 | 167 |
157 DictionaryPtr user_editable; | 168 DictionaryPtr user_editable; |
158 if (user_policy != NULL) | 169 if (user_policy != NULL) |
159 user_editable = GetEditableFlags(*user_policy); | 170 user_editable = GetEditableFlags(*user_policy); |
160 | 171 |
161 DictionaryPtr device_editable; | 172 DictionaryPtr device_editable; |
162 if (device_policy != NULL) | 173 if (device_policy != NULL) |
163 device_editable = GetEditableFlags(*device_policy); | 174 device_editable = GetEditableFlags(*device_policy); |
164 | 175 |
165 std::vector<const base::DictionaryValue*> dicts(kLastIndex, NULL); | 176 std::vector<const base::DictionaryValue*> dicts(kLastIndex, NULL); |
166 dicts[kUserPolicyIndex] = user_policy; | 177 dicts[kUserPolicyIndex] = user_policy; |
167 dicts[kDevicePolicyIndex] = device_policy; | 178 dicts[kDevicePolicyIndex] = device_policy; |
168 dicts[kUserSettingsIndex] = user_settings; | 179 dicts[kUserSettingsIndex] = user_settings; |
169 dicts[kSharedSettingsIndex] = shared_settings; | 180 dicts[kSharedSettingsIndex] = shared_settings; |
| 181 dicts[kActiveSettingsIndex] = active_settings; |
170 dicts[kUserEditableIndex] = user_editable.get(); | 182 dicts[kUserEditableIndex] = user_editable.get(); |
171 dicts[kDeviceEditableIndex] = device_editable.get(); | 183 dicts[kDeviceEditableIndex] = device_editable.get(); |
172 return MergeListOfDictionaries::MergeDictionaries(dicts); | 184 return MergeListOfDictionaries::MergeDictionaries(dicts); |
173 } | 185 } |
174 | 186 |
175 protected: | 187 protected: |
176 // This function is called by MergeDictionaries for each list of values that | 188 // This function is called by MergeDictionaries for each list of values that |
177 // are located at the same path in each of the dictionaries. Implementations | 189 // are located at the same path in each of the dictionaries. Implementations |
178 // can use the Has*Policy functions. | 190 // can use the Has*Policy functions. |
179 virtual scoped_ptr<base::Value> MergeValues(ValueParams values) = 0; | 191 virtual scoped_ptr<base::Value> MergeValues(const std::string& key, |
| 192 const ValueParams& values) = 0; |
180 | 193 |
181 // Whether a user policy was provided. | 194 // Whether a user policy was provided. |
182 bool HasUserPolicy() { | 195 bool HasUserPolicy() { |
183 return hasUserPolicy_; | 196 return hasUserPolicy_; |
184 } | 197 } |
185 | 198 |
186 // Whether a device policy was provided. | 199 // Whether a device policy was provided. |
187 bool HasDevicePolicy() { | 200 bool HasDevicePolicy() { |
188 return hasDevicePolicy_; | 201 return hasDevicePolicy_; |
189 } | 202 } |
190 | 203 |
191 // MergeListOfDictionaries override. | 204 // MergeListOfDictionaries override. |
192 virtual scoped_ptr<base::Value> MergeListOfValues( | 205 virtual scoped_ptr<base::Value> MergeListOfValues( |
| 206 const std::string& key, |
193 const std::vector<const base::Value*>& values) OVERRIDE { | 207 const std::vector<const base::Value*>& values) OVERRIDE { |
194 bool user_editable = !HasUserPolicy(); | 208 bool user_editable = !HasUserPolicy(); |
195 if (values[kUserEditableIndex]) | 209 if (values[kUserEditableIndex]) |
196 values[kUserEditableIndex]->GetAsBoolean(&user_editable); | 210 values[kUserEditableIndex]->GetAsBoolean(&user_editable); |
197 | 211 |
198 bool device_editable = !HasDevicePolicy(); | 212 bool device_editable = !HasDevicePolicy(); |
199 if (values[kDeviceEditableIndex]) | 213 if (values[kDeviceEditableIndex]) |
200 values[kDeviceEditableIndex]->GetAsBoolean(&device_editable); | 214 values[kDeviceEditableIndex]->GetAsBoolean(&device_editable); |
201 | 215 |
202 ValueParams params; | 216 ValueParams params; |
203 params.user_policy = values[kUserPolicyIndex]; | 217 params.user_policy = values[kUserPolicyIndex]; |
204 params.device_policy = values[kDevicePolicyIndex]; | 218 params.device_policy = values[kDevicePolicyIndex]; |
205 params.user_settings = values[kUserSettingsIndex]; | 219 params.user_setting = values[kUserSettingsIndex]; |
206 params.shared_settings = values[kSharedSettingsIndex]; | 220 params.shared_setting = values[kSharedSettingsIndex]; |
| 221 params.active_setting = values[kActiveSettingsIndex]; |
207 params.user_editable = user_editable; | 222 params.user_editable = user_editable; |
208 params.device_editable = device_editable; | 223 params.device_editable = device_editable; |
209 return MergeValues(params); | 224 return MergeValues(key, params); |
210 } | 225 } |
211 | 226 |
212 private: | 227 private: |
213 enum { | 228 enum { |
214 kUserPolicyIndex, | 229 kUserPolicyIndex, |
215 kDevicePolicyIndex, | 230 kDevicePolicyIndex, |
216 kUserSettingsIndex, | 231 kUserSettingsIndex, |
217 kSharedSettingsIndex, | 232 kSharedSettingsIndex, |
| 233 kActiveSettingsIndex, |
218 kUserEditableIndex, | 234 kUserEditableIndex, |
219 kDeviceEditableIndex, | 235 kDeviceEditableIndex, |
220 kLastIndex | 236 kLastIndex |
221 }; | 237 }; |
222 | 238 |
223 bool hasUserPolicy_, hasDevicePolicy_; | 239 bool hasUserPolicy_, hasDevicePolicy_; |
| 240 |
| 241 DISALLOW_COPY_AND_ASSIGN(MergeSettingsAndPolicies); |
224 }; | 242 }; |
225 | 243 |
226 // Call MergeDictionaries to merge policies and settings to the effective | 244 // Call MergeDictionaries to merge policies and settings to the effective |
227 // values. See the description of MergeSettingsAndPoliciesToEffective. | 245 // values. This ignores the active settings of Shill. See the description of |
| 246 // MergeSettingsAndPoliciesToEffective. |
228 class MergeToEffective : public MergeSettingsAndPolicies { | 247 class MergeToEffective : public MergeSettingsAndPolicies { |
| 248 public: |
| 249 MergeToEffective() {} |
| 250 |
229 protected: | 251 protected: |
230 // Merges |values| to the effective value (Mandatory policy overwrites user | 252 // Merges |values| to the effective value (Mandatory policy overwrites user |
231 // settings overwrites shared settings overwrites recommended policy). |which| | 253 // settings overwrites shared settings overwrites recommended policy). |which| |
232 // is set to the respective onc::kAugmentation* constant that indicates which | 254 // is set to the respective onc::kAugmentation* constant that indicates which |
233 // source of settings is effective. Note that this function may return a NULL | 255 // source of settings is effective. Note that this function may return a NULL |
234 // pointer and set |which| to kAugmentationUserPolicy, which means that the | 256 // pointer and set |which| to kAugmentationUserPolicy, which means that the |
235 // user policy didn't set a value but also didn't recommend it, thus enforcing | 257 // user policy didn't set a value but also didn't recommend it, thus enforcing |
236 // the empty value. | 258 // the empty value. |
237 scoped_ptr<base::Value> MergeValues(ValueParams values, std::string* which) { | 259 scoped_ptr<base::Value> MergeValues(const std::string& key, |
| 260 const ValueParams& values, |
| 261 std::string* which) { |
238 const base::Value* result = NULL; | 262 const base::Value* result = NULL; |
239 which->clear(); | 263 which->clear(); |
240 if (!values.user_editable) { | 264 if (!values.user_editable) { |
241 result = values.user_policy; | 265 result = values.user_policy; |
242 *which = kAugmentationUserPolicy; | 266 *which = kAugmentationUserPolicy; |
243 } else if (!values.device_editable) { | 267 } else if (!values.device_editable) { |
244 result = values.device_policy; | 268 result = values.device_policy; |
245 *which = kAugmentationDevicePolicy; | 269 *which = kAugmentationDevicePolicy; |
246 } else if (values.user_settings) { | 270 } else if (values.user_setting) { |
247 result = values.user_settings; | 271 result = values.user_setting; |
248 *which = kAugmentationUserSetting; | 272 *which = kAugmentationUserSetting; |
249 } else if (values.shared_settings) { | 273 } else if (values.shared_setting) { |
250 result = values.shared_settings; | 274 result = values.shared_setting; |
251 *which = kAugmentationSharedSetting; | 275 *which = kAugmentationSharedSetting; |
252 } else if (values.user_policy) { | 276 } else if (values.user_policy) { |
253 result = values.user_policy; | 277 result = values.user_policy; |
254 *which = kAugmentationUserPolicy; | 278 *which = kAugmentationUserPolicy; |
255 } else if (values.device_policy) { | 279 } else if (values.device_policy) { |
256 result = values.device_policy; | 280 result = values.device_policy; |
257 *which = kAugmentationDevicePolicy; | 281 *which = kAugmentationDevicePolicy; |
258 } else { | 282 } else { |
259 // Can be reached if the current field is recommended, but none of the | 283 // Can be reached if the current field is recommended, but none of the |
260 // dictionaries contained a value for it. | 284 // dictionaries contained a value for it. |
261 } | 285 } |
262 if (result) | 286 if (result) |
263 return make_scoped_ptr(result->DeepCopy()); | 287 return make_scoped_ptr(result->DeepCopy()); |
264 return scoped_ptr<base::Value>(); | 288 return scoped_ptr<base::Value>(); |
265 } | 289 } |
266 | 290 |
267 // MergeSettingsAndPolicies override. | 291 // MergeSettingsAndPolicies override. |
268 virtual scoped_ptr<base::Value> MergeValues( | 292 virtual scoped_ptr<base::Value> MergeValues( |
269 ValueParams values) OVERRIDE { | 293 const std::string& key, |
| 294 const ValueParams& values) OVERRIDE { |
270 std::string which; | 295 std::string which; |
271 return MergeValues(values, &which); | 296 return MergeValues(key, values, &which); |
272 } | 297 } |
| 298 |
| 299 private: |
| 300 DISALLOW_COPY_AND_ASSIGN(MergeToEffective); |
273 }; | 301 }; |
274 | 302 |
275 // Call MergeDictionaries to merge policies and settings to an augmented | 303 // Call MergeDictionaries to merge policies and settings to an augmented |
276 // dictionary which contains a dictionary for each value in the original | 304 // dictionary which contains a dictionary for each value in the original |
277 // dictionaries. See the description of MergeSettingsAndPoliciesToAugmented. | 305 // dictionaries. See the description of MergeSettingsAndPoliciesToAugmented. |
278 class MergeToAugmented : public MergeToEffective { | 306 class MergeToAugmented : public MergeToEffective { |
| 307 public: |
| 308 MergeToAugmented() {} |
| 309 |
| 310 DictionaryPtr MergeDictionaries( |
| 311 const OncValueSignature& signature, |
| 312 const base::DictionaryValue* user_policy, |
| 313 const base::DictionaryValue* device_policy, |
| 314 const base::DictionaryValue* user_settings, |
| 315 const base::DictionaryValue* shared_settings, |
| 316 const base::DictionaryValue* active_settings) { |
| 317 signature_ = &signature; |
| 318 return MergeToEffective::MergeDictionaries(user_policy, |
| 319 device_policy, |
| 320 user_settings, |
| 321 shared_settings, |
| 322 active_settings); |
| 323 } |
| 324 |
279 protected: | 325 protected: |
280 // MergeSettingsAndPolicies override. | 326 // MergeSettingsAndPolicies override. |
281 virtual scoped_ptr<base::Value> MergeValues( | 327 virtual scoped_ptr<base::Value> MergeValues( |
282 ValueParams values) OVERRIDE { | 328 const std::string& key, |
| 329 const ValueParams& values) OVERRIDE { |
283 scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue); | 330 scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue); |
284 std::string which_effective; | 331 if (values.active_setting) { |
285 MergeToEffective::MergeValues(values, &which_effective).reset(); | 332 result->SetWithoutPathExpansion(kAugmentationActiveSetting, |
286 if (!which_effective.empty()) { | 333 values.active_setting->DeepCopy()); |
| 334 } |
| 335 |
| 336 const OncFieldSignature* field = NULL; |
| 337 if (signature_) |
| 338 field = GetFieldSignature(*signature_, key); |
| 339 |
| 340 if (field) { |
| 341 // This field is part of the provided ONCSignature, thus it can be |
| 342 // controlled by policy. |
| 343 std::string which_effective; |
| 344 MergeToEffective::MergeValues(key, values, &which_effective).reset(); |
| 345 if (!which_effective.empty()) { |
| 346 result->SetStringWithoutPathExpansion(kAugmentationEffectiveSetting, |
| 347 which_effective); |
| 348 } |
| 349 bool is_credential = onc::FieldIsCredential(*signature_, key); |
| 350 |
| 351 // Prevent credentials from being forwarded in cleartext to |
| 352 // UI. User/shared credentials are not stored separately, so they cannot |
| 353 // leak here. |
| 354 if (!is_credential) { |
| 355 if (values.user_policy) { |
| 356 result->SetWithoutPathExpansion(kAugmentationUserPolicy, |
| 357 values.user_policy->DeepCopy()); |
| 358 } |
| 359 if (values.device_policy) { |
| 360 result->SetWithoutPathExpansion(kAugmentationDevicePolicy, |
| 361 values.device_policy->DeepCopy()); |
| 362 } |
| 363 } |
| 364 if (values.user_setting) { |
| 365 result->SetWithoutPathExpansion(kAugmentationUserSetting, |
| 366 values.user_setting->DeepCopy()); |
| 367 } |
| 368 if (values.shared_setting) { |
| 369 result->SetWithoutPathExpansion(kAugmentationSharedSetting, |
| 370 values.shared_setting->DeepCopy()); |
| 371 } |
| 372 if (HasUserPolicy() && values.user_editable) { |
| 373 result->SetBooleanWithoutPathExpansion(kAugmentationUserEditable, |
| 374 true); |
| 375 } |
| 376 if (HasDevicePolicy() && values.device_editable) { |
| 377 result->SetBooleanWithoutPathExpansion(kAugmentationDeviceEditable, |
| 378 true); |
| 379 } |
| 380 } else { |
| 381 // This field is not part of the provided ONCSignature, thus it cannot be |
| 382 // controlled by policy. |
287 result->SetStringWithoutPathExpansion(kAugmentationEffectiveSetting, | 383 result->SetStringWithoutPathExpansion(kAugmentationEffectiveSetting, |
288 which_effective); | 384 kAugmentationUnmanaged); |
289 } | 385 } |
290 if (values.user_policy) { | 386 if (result->empty()) |
291 result->SetWithoutPathExpansion(kAugmentationUserPolicy, | 387 result.reset(); |
292 values.user_policy->DeepCopy()); | |
293 } | |
294 if (values.device_policy) { | |
295 result->SetWithoutPathExpansion(kAugmentationDevicePolicy, | |
296 values.device_policy->DeepCopy()); | |
297 } | |
298 if (values.user_settings) { | |
299 result->SetWithoutPathExpansion(kAugmentationUserSetting, | |
300 values.user_settings->DeepCopy()); | |
301 } | |
302 if (values.shared_settings) { | |
303 result->SetWithoutPathExpansion(kAugmentationSharedSetting, | |
304 values.shared_settings->DeepCopy()); | |
305 } | |
306 if (HasUserPolicy() && values.user_editable) { | |
307 result->SetBooleanWithoutPathExpansion(kAugmentationUserEditable, | |
308 values.user_editable); | |
309 } | |
310 if (HasDevicePolicy() && values.device_editable) { | |
311 result->SetBooleanWithoutPathExpansion(kAugmentationDeviceEditable, | |
312 values.device_editable); | |
313 } | |
314 return result.PassAs<base::Value>(); | 388 return result.PassAs<base::Value>(); |
315 } | 389 } |
| 390 |
| 391 // MergeListOfDictionaries override. |
| 392 virtual DictionaryPtr MergeNestedDictionaries( |
| 393 const std::string& key, |
| 394 const DictPtrs &dicts) OVERRIDE { |
| 395 DictionaryPtr result; |
| 396 if (signature_) { |
| 397 const OncValueSignature* enclosing_signature = signature_; |
| 398 signature_ = NULL; |
| 399 |
| 400 const OncFieldSignature* field = |
| 401 GetFieldSignature(*enclosing_signature, key); |
| 402 if (field) |
| 403 signature_ = field->value_signature; |
| 404 result = MergeToEffective::MergeNestedDictionaries(key, dicts); |
| 405 |
| 406 signature_ = enclosing_signature; |
| 407 } else { |
| 408 result = MergeToEffective::MergeNestedDictionaries(key, dicts); |
| 409 } |
| 410 return result.Pass(); |
| 411 } |
| 412 |
| 413 private: |
| 414 const OncValueSignature* signature_; |
| 415 DISALLOW_COPY_AND_ASSIGN(MergeToAugmented); |
316 }; | 416 }; |
317 | 417 |
318 } // namespace | 418 } // namespace |
319 | 419 |
320 DictionaryPtr MergeSettingsAndPoliciesToEffective( | 420 DictionaryPtr MergeSettingsAndPoliciesToEffective( |
321 const base::DictionaryValue* user_policy, | 421 const base::DictionaryValue* user_policy, |
322 const base::DictionaryValue* device_policy, | 422 const base::DictionaryValue* device_policy, |
323 const base::DictionaryValue* user_settings, | 423 const base::DictionaryValue* user_settings, |
324 const base::DictionaryValue* shared_settings) { | 424 const base::DictionaryValue* shared_settings) { |
325 MergeToEffective merger; | 425 MergeToEffective merger; |
326 return merger.MergeDictionaries( | 426 return merger.MergeDictionaries( |
327 user_policy, device_policy, user_settings, shared_settings); | 427 user_policy, device_policy, user_settings, shared_settings, NULL); |
328 } | 428 } |
329 | 429 |
330 DictionaryPtr MergeSettingsAndPoliciesToAugmented( | 430 DictionaryPtr MergeSettingsAndPoliciesToAugmented( |
| 431 const OncValueSignature& signature, |
331 const base::DictionaryValue* user_policy, | 432 const base::DictionaryValue* user_policy, |
332 const base::DictionaryValue* device_policy, | 433 const base::DictionaryValue* device_policy, |
333 const base::DictionaryValue* user_settings, | 434 const base::DictionaryValue* user_settings, |
334 const base::DictionaryValue* shared_settings) { | 435 const base::DictionaryValue* shared_settings, |
| 436 const base::DictionaryValue* active_settings) { |
335 MergeToAugmented merger; | 437 MergeToAugmented merger; |
336 return merger.MergeDictionaries( | 438 return merger.MergeDictionaries( |
337 user_policy, device_policy, user_settings, shared_settings); | 439 signature, user_policy, device_policy, user_settings, shared_settings, |
| 440 active_settings); |
338 } | 441 } |
339 | 442 |
340 } // namespace onc | 443 } // namespace onc |
341 } // namespace chromeos | 444 } // namespace chromeos |
OLD | NEW |