| 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 #include "chromeos/network/onc/onc_signature.h" |
| 16 | 16 |
| 17 namespace chromeos { | 17 namespace chromeos { |
| 18 namespace onc { | 18 namespace onc { |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 typedef scoped_ptr<base::DictionaryValue> DictionaryPtr; | 21 typedef scoped_ptr<base::DictionaryValue> DictionaryPtr; |
| 22 | 22 |
| 23 // 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 |
| 24 // |policy|. | 24 // |policy|. |
| 25 void MarkRecommendedFieldnames(const base::DictionaryValue& policy, | 25 void MarkRecommendedFieldnames(const base::DictionaryValue& policy, |
| 26 base::DictionaryValue* result) { | 26 base::DictionaryValue* result) { |
| 27 const ListValue* recommended_value = NULL; | 27 const base::ListValue* recommended_value = NULL; |
| 28 if (!policy.GetListWithoutPathExpansion(kRecommended, &recommended_value)) | 28 if (!policy.GetListWithoutPathExpansion(kRecommended, &recommended_value)) |
| 29 return; | 29 return; |
| 30 for (ListValue::const_iterator it = recommended_value->begin(); | 30 for (base::ListValue::const_iterator it = recommended_value->begin(); |
| 31 it != recommended_value->end(); ++it) { | 31 it != recommended_value->end(); ++it) { |
| 32 std::string entry; | 32 std::string entry; |
| 33 if ((*it)->GetAsString(&entry)) | 33 if ((*it)->GetAsString(&entry)) |
| 34 result->SetBooleanWithoutPathExpansion(entry, true); | 34 result->SetBooleanWithoutPathExpansion(entry, true); |
| 35 } | 35 } |
| 36 } | 36 } |
| 37 | 37 |
| 38 // Returns a dictionary which contains |true| at each path that is editable by | 38 // Returns a dictionary which contains |true| at each path that is editable by |
| 39 // the user. No other fields are set. | 39 // the user. No other fields are set. |
| 40 DictionaryPtr GetEditableFlags(const base::DictionaryValue& policy) { | 40 DictionaryPtr GetEditableFlags(const base::DictionaryValue& policy) { |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 const base::DictionaryValue* shared_settings, | 435 const base::DictionaryValue* shared_settings, |
| 436 const base::DictionaryValue* active_settings) { | 436 const base::DictionaryValue* active_settings) { |
| 437 MergeToAugmented merger; | 437 MergeToAugmented merger; |
| 438 return merger.MergeDictionaries( | 438 return merger.MergeDictionaries( |
| 439 signature, user_policy, device_policy, user_settings, shared_settings, | 439 signature, user_policy, device_policy, user_settings, shared_settings, |
| 440 active_settings); | 440 active_settings); |
| 441 } | 441 } |
| 442 | 442 |
| 443 } // namespace onc | 443 } // namespace onc |
| 444 } // namespace chromeos | 444 } // namespace chromeos |
| OLD | NEW |