OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/policy_util.h" | 5 #include "chromeos/network/policy_util.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chromeos/network/network_profile.h" | 8 #include "chromeos/network/network_profile.h" |
9 #include "chromeos/network/network_ui_data.h" | 9 #include "chromeos/network/network_ui_data.h" |
10 #include "chromeos/network/onc/onc_constants.h" | 10 #include "chromeos/network/onc/onc_constants.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 // has no non-const iterator. | 40 // has no non-const iterator. |
41 onc_object->GetWithoutPathExpansion(field_name, &value); | 41 onc_object->GetWithoutPathExpansion(field_name, &value); |
42 // Advance before delete. | 42 // Advance before delete. |
43 it.Advance(); | 43 it.Advance(); |
44 | 44 |
45 // If |value| is a dictionary, recurse. | 45 // If |value| is a dictionary, recurse. |
46 base::DictionaryValue* nested_object = NULL; | 46 base::DictionaryValue* nested_object = NULL; |
47 if (value->GetAsDictionary(&nested_object)) { | 47 if (value->GetAsDictionary(&nested_object)) { |
48 const onc::OncFieldSignature* field_signature = | 48 const onc::OncFieldSignature* field_signature = |
49 onc::GetFieldSignature(signature, field_name); | 49 onc::GetFieldSignature(signature, field_name); |
50 | 50 if (field_signature) |
51 RemoveFakeCredentials(*field_signature->value_signature, | 51 RemoveFakeCredentials(*field_signature->value_signature, nested_object); |
52 nested_object); | 52 else |
| 53 LOG(ERROR) << "ONC has unrecoginzed field: " << field_name; |
53 continue; | 54 continue; |
54 } | 55 } |
55 | 56 |
56 // If |value| is a string, check if it is a fake credential. | 57 // If |value| is a string, check if it is a fake credential. |
57 std::string string_value; | 58 std::string string_value; |
58 if (value->GetAsString(&string_value) && | 59 if (value->GetAsString(&string_value) && |
59 onc::FieldIsCredential(signature, field_name)) { | 60 onc::FieldIsCredential(signature, field_name)) { |
60 if (string_value == kFakeCredential) { | 61 if (string_value == kFakeCredential) { |
61 // The value wasn't modified by the UI, thus we remove the field to keep | 62 // The value wasn't modified by the UI, thus we remove the field to keep |
62 // the existing value that is stored in Shill. | 63 // the existing value that is stored in Shill. |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 it != policies.end(); ++it) { | 192 it != policies.end(); ++it) { |
192 if (IsPolicyMatching(*it->second, actual_network)) | 193 if (IsPolicyMatching(*it->second, actual_network)) |
193 return it->second; | 194 return it->second; |
194 } | 195 } |
195 return NULL; | 196 return NULL; |
196 } | 197 } |
197 | 198 |
198 } // namespace policy_util | 199 } // namespace policy_util |
199 | 200 |
200 } // namespace chromeos | 201 } // namespace chromeos |
OLD | NEW |