| 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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 // This field is part of the provided ONCSignature, thus it can be | 375 // This field is part of the provided ONCSignature, thus it can be |
| 376 // controlled by policy. | 376 // controlled by policy. |
| 377 std::string which_effective; | 377 std::string which_effective; |
| 378 scoped_ptr<base::Value> effective_value = | 378 scoped_ptr<base::Value> effective_value = |
| 379 MergeToEffective::MergeValues(key, values, &which_effective); | 379 MergeToEffective::MergeValues(key, values, &which_effective); |
| 380 | 380 |
| 381 if (IsIdentifierField(*signature_, key)) { | 381 if (IsIdentifierField(*signature_, key)) { |
| 382 // Don't augment the GUID but write the plain value. | 382 // Don't augment the GUID but write the plain value. |
| 383 if (!effective_value) { | 383 if (!effective_value) { |
| 384 LOG(ERROR) << "GUID field has no effective value"; | 384 LOG(ERROR) << "GUID field has no effective value"; |
| 385 return make_scoped_ptr<base::Value>(NULL); | 385 return nullptr; |
| 386 } | 386 } |
| 387 | 387 |
| 388 // DCHECK that all provided GUIDs are identical. | 388 // DCHECK that all provided GUIDs are identical. |
| 389 DCHECK(AllPresentValuesEqual(values, *effective_value)); | 389 DCHECK(AllPresentValuesEqual(values, *effective_value)); |
| 390 | 390 |
| 391 // Return the un-augmented GUID. | 391 // Return the un-augmented GUID. |
| 392 return effective_value.Pass(); | 392 return effective_value.Pass(); |
| 393 } | 393 } |
| 394 | 394 |
| 395 scoped_ptr<base::DictionaryValue> augmented_value( | 395 scoped_ptr<base::DictionaryValue> augmented_value( |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 if (HasUserPolicy() && values.user_editable) { | 432 if (HasUserPolicy() && values.user_editable) { |
| 433 augmented_value->SetBooleanWithoutPathExpansion( | 433 augmented_value->SetBooleanWithoutPathExpansion( |
| 434 ::onc::kAugmentationUserEditable, true); | 434 ::onc::kAugmentationUserEditable, true); |
| 435 } | 435 } |
| 436 if (HasDevicePolicy() && values.device_editable) { | 436 if (HasDevicePolicy() && values.device_editable) { |
| 437 augmented_value->SetBooleanWithoutPathExpansion( | 437 augmented_value->SetBooleanWithoutPathExpansion( |
| 438 ::onc::kAugmentationDeviceEditable, true); | 438 ::onc::kAugmentationDeviceEditable, true); |
| 439 } | 439 } |
| 440 if (augmented_value->empty()) | 440 if (augmented_value->empty()) |
| 441 augmented_value.reset(); | 441 augmented_value.reset(); |
| 442 return augmented_value.PassAs<base::Value>(); | 442 return augmented_value.Pass(); |
| 443 } | 443 } |
| 444 | 444 |
| 445 // MergeListOfDictionaries override. | 445 // MergeListOfDictionaries override. |
| 446 virtual DictionaryPtr MergeNestedDictionaries( | 446 virtual DictionaryPtr MergeNestedDictionaries( |
| 447 const std::string& key, | 447 const std::string& key, |
| 448 const DictPtrs &dicts) override { | 448 const DictPtrs &dicts) override { |
| 449 DictionaryPtr result; | 449 DictionaryPtr result; |
| 450 if (signature_) { | 450 if (signature_) { |
| 451 const OncValueSignature* enclosing_signature = signature_; | 451 const OncValueSignature* enclosing_signature = signature_; |
| 452 signature_ = NULL; | 452 signature_ = NULL; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 const base::DictionaryValue* shared_settings, | 489 const base::DictionaryValue* shared_settings, |
| 490 const base::DictionaryValue* active_settings) { | 490 const base::DictionaryValue* active_settings) { |
| 491 MergeToAugmented merger; | 491 MergeToAugmented merger; |
| 492 return merger.MergeDictionaries( | 492 return merger.MergeDictionaries( |
| 493 signature, user_policy, device_policy, user_settings, shared_settings, | 493 signature, user_policy, device_policy, user_settings, shared_settings, |
| 494 active_settings); | 494 active_settings); |
| 495 } | 495 } |
| 496 | 496 |
| 497 } // namespace onc | 497 } // namespace onc |
| 498 } // namespace chromeos | 498 } // namespace chromeos |
| OLD | NEW |