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_utils.h" | 5 #include "chromeos/network/onc/onc_utils.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 | 175 |
176 void ExpandField(const std::string& fieldname, | 176 void ExpandField(const std::string& fieldname, |
177 const StringSubstitution& substitution, | 177 const StringSubstitution& substitution, |
178 base::DictionaryValue* onc_object) { | 178 base::DictionaryValue* onc_object) { |
179 std::string user_string; | 179 std::string user_string; |
180 if (!onc_object->GetStringWithoutPathExpansion(fieldname, &user_string)) | 180 if (!onc_object->GetStringWithoutPathExpansion(fieldname, &user_string)) |
181 return; | 181 return; |
182 | 182 |
183 std::string login_id; | 183 std::string login_id; |
184 if (substitution.GetSubstitute(substitutes::kLoginIDField, &login_id)) { | 184 if (substitution.GetSubstitute(substitutes::kLoginIDField, &login_id)) { |
185 ReplaceSubstringsAfterOffset(&user_string, 0, | 185 base::ReplaceSubstringsAfterOffset(&user_string, 0, |
186 substitutes::kLoginIDField, | 186 substitutes::kLoginIDField, |
187 login_id); | 187 login_id); |
188 } | 188 } |
189 | 189 |
190 std::string email; | 190 std::string email; |
191 if (substitution.GetSubstitute(substitutes::kEmailField, &email)) { | 191 if (substitution.GetSubstitute(substitutes::kEmailField, &email)) { |
192 ReplaceSubstringsAfterOffset(&user_string, 0, | 192 base::ReplaceSubstringsAfterOffset(&user_string, 0, |
193 substitutes::kEmailField, | 193 substitutes::kEmailField, |
194 email); | 194 email); |
195 } | 195 } |
196 | 196 |
197 onc_object->SetStringWithoutPathExpansion(fieldname, user_string); | 197 onc_object->SetStringWithoutPathExpansion(fieldname, user_string); |
198 } | 198 } |
199 | 199 |
200 void ExpandStringsInOncObject( | 200 void ExpandStringsInOncObject( |
201 const OncValueSignature& signature, | 201 const OncValueSignature& signature, |
202 const StringSubstitution& substitution, | 202 const StringSubstitution& substitution, |
203 base::DictionaryValue* onc_object) { | 203 base::DictionaryValue* onc_object) { |
204 if (&signature == &kEAPSignature) { | 204 if (&signature == &kEAPSignature) { |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 } | 733 } |
734 | 734 |
735 const base::ListValue* recommended_keys = nullptr; | 735 const base::ListValue* recommended_keys = nullptr; |
736 return (onc->GetList(recommended_property_key, &recommended_keys) && | 736 return (onc->GetList(recommended_property_key, &recommended_keys) && |
737 recommended_keys->Find(base::StringValue(property_basename)) != | 737 recommended_keys->Find(base::StringValue(property_basename)) != |
738 recommended_keys->end()); | 738 recommended_keys->end()); |
739 } | 739 } |
740 | 740 |
741 } // namespace onc | 741 } // namespace onc |
742 } // namespace chromeos | 742 } // namespace chromeos |
OLD | NEW |