| 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 } | 375 } |
| 376 | 376 |
| 377 // This field is part of the provided ONCSignature, thus it can be | 377 // This field is part of the provided ONCSignature, thus it can be |
| 378 // controlled by policy. | 378 // controlled by policy. |
| 379 std::string which_effective; | 379 std::string which_effective; |
| 380 scoped_ptr<base::Value> effective_value = | 380 scoped_ptr<base::Value> effective_value = |
| 381 MergeToEffective::MergeValues(key, values, &which_effective); | 381 MergeToEffective::MergeValues(key, values, &which_effective); |
| 382 | 382 |
| 383 if (IsIdentifierField(*signature_, key)) { | 383 if (IsIdentifierField(*signature_, key)) { |
| 384 // Don't augment the GUID but write the plain value. | 384 // Don't augment the GUID but write the plain value. |
| 385 if (!effective_value) { | 385 if (effective_value) { |
| 386 LOG(ERROR) << "GUID field has no effective value"; | 386 // DCHECK that all provided GUIDs are identical. |
| 387 return nullptr; | 387 DCHECK(AllPresentValuesEqual(values, *effective_value)); |
| 388 // Return the un-augmented GUID. |
| 389 return effective_value.Pass(); |
| 388 } | 390 } |
| 389 | 391 if (values.active_setting) { |
| 390 // DCHECK that all provided GUIDs are identical. | 392 // Unmanaged networks have assigned (active) GUID values. |
| 391 DCHECK(AllPresentValuesEqual(values, *effective_value)); | 393 return make_scoped_ptr(values.active_setting->DeepCopy()); |
| 392 | 394 } |
| 393 // Return the un-augmented GUID. | 395 LOG(ERROR) << "GUID field has no effective value"; |
| 394 return effective_value.Pass(); | 396 return nullptr; |
| 395 } | 397 } |
| 396 | 398 |
| 397 scoped_ptr<base::DictionaryValue> augmented_value( | 399 scoped_ptr<base::DictionaryValue> augmented_value( |
| 398 new base::DictionaryValue); | 400 new base::DictionaryValue); |
| 399 | 401 |
| 400 if (values.active_setting) { | 402 if (values.active_setting) { |
| 401 augmented_value->SetWithoutPathExpansion( | 403 augmented_value->SetWithoutPathExpansion( |
| 402 ::onc::kAugmentationActiveSetting, values.active_setting->DeepCopy()); | 404 ::onc::kAugmentationActiveSetting, values.active_setting->DeepCopy()); |
| 403 } | 405 } |
| 404 | 406 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 const base::DictionaryValue* shared_settings, | 493 const base::DictionaryValue* shared_settings, |
| 492 const base::DictionaryValue* active_settings) { | 494 const base::DictionaryValue* active_settings) { |
| 493 MergeToAugmented merger; | 495 MergeToAugmented merger; |
| 494 return merger.MergeDictionaries( | 496 return merger.MergeDictionaries( |
| 495 signature, user_policy, device_policy, user_settings, shared_settings, | 497 signature, user_policy, device_policy, user_settings, shared_settings, |
| 496 active_settings); | 498 active_settings); |
| 497 } | 499 } |
| 498 | 500 |
| 499 } // namespace onc | 501 } // namespace onc |
| 500 } // namespace chromeos | 502 } // namespace chromeos |
| OLD | NEW |