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 |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 } else { | 257 } else { |
258 // Can be reached if the current field is recommended, but none of the | 258 // Can be reached if the current field is recommended, but none of the |
259 // dictionaries contained a value for it. | 259 // dictionaries contained a value for it. |
260 } | 260 } |
261 if (result) | 261 if (result) |
262 return make_scoped_ptr(result->DeepCopy()); | 262 return make_scoped_ptr(result->DeepCopy()); |
263 return scoped_ptr<base::Value>(); | 263 return scoped_ptr<base::Value>(); |
264 } | 264 } |
265 | 265 |
266 // MergeSettingsAndPolicies override. | 266 // MergeSettingsAndPolicies override. |
267 virtual scoped_ptr<base::Value> MergeValues(ValueParams values) { | 267 virtual scoped_ptr<base::Value> MergeValues( |
| 268 ValueParams values) OVERRIDE { |
268 std::string which; | 269 std::string which; |
269 return MergeValues(values, &which); | 270 return MergeValues(values, &which); |
270 } | 271 } |
271 }; | 272 }; |
272 | 273 |
273 // Call MergeDictionaries to merge policies and settings to an augmented | 274 // Call MergeDictionaries to merge policies and settings to an augmented |
274 // dictionary which contains a dictionary for each value in the original | 275 // dictionary which contains a dictionary for each value in the original |
275 // dictionaries. See the description of MergeSettingsAndPoliciesToAugmented. | 276 // dictionaries. See the description of MergeSettingsAndPoliciesToAugmented. |
276 class MergeToAugmented : public MergeToEffective { | 277 class MergeToAugmented : public MergeToEffective { |
277 protected: | 278 protected: |
278 // MergeSettingsAndPolicies override. | 279 // MergeSettingsAndPolicies override. |
279 virtual scoped_ptr<base::Value> MergeValues(ValueParams values) { | 280 virtual scoped_ptr<base::Value> MergeValues( |
| 281 ValueParams values) OVERRIDE { |
280 scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue); | 282 scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue); |
281 std::string which_effective; | 283 std::string which_effective; |
282 MergeToEffective::MergeValues(values, &which_effective).reset(); | 284 MergeToEffective::MergeValues(values, &which_effective).reset(); |
283 if (!which_effective.empty()) { | 285 if (!which_effective.empty()) { |
284 result->SetStringWithoutPathExpansion(kAugmentationEffectiveSetting, | 286 result->SetStringWithoutPathExpansion(kAugmentationEffectiveSetting, |
285 which_effective); | 287 which_effective); |
286 } | 288 } |
287 if (values.user_policy) { | 289 if (values.user_policy) { |
288 result->SetWithoutPathExpansion(kAugmentationUserPolicy, | 290 result->SetWithoutPathExpansion(kAugmentationUserPolicy, |
289 values.user_policy->DeepCopy()); | 291 values.user_policy->DeepCopy()); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 const base::DictionaryValue* device_policy, | 331 const base::DictionaryValue* device_policy, |
330 const base::DictionaryValue* user_settings, | 332 const base::DictionaryValue* user_settings, |
331 const base::DictionaryValue* shared_settings) { | 333 const base::DictionaryValue* shared_settings) { |
332 MergeToAugmented merger; | 334 MergeToAugmented merger; |
333 return merger.MergeDictionaries( | 335 return merger.MergeDictionaries( |
334 user_policy, device_policy, user_settings, shared_settings); | 336 user_policy, device_policy, user_settings, shared_settings); |
335 } | 337 } |
336 | 338 |
337 } // namespace onc | 339 } // namespace onc |
338 } // namespace chromeos | 340 } // namespace chromeos |
OLD | NEW |