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_translator.h" | 5 #include "chromeos/network/onc/onc_translator.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 if (nested_object->empty()) | 309 if (nested_object->empty()) |
310 return; | 310 return; |
311 onc_object_->SetWithoutPathExpansion(onc_field_name, nested_object.release()); | 311 onc_object_->SetWithoutPathExpansion(onc_field_name, nested_object.release()); |
312 } | 312 } |
313 | 313 |
314 void ShillToONCTranslator::TranslateAndAddListOfObjects( | 314 void ShillToONCTranslator::TranslateAndAddListOfObjects( |
315 const std::string& onc_field_name, | 315 const std::string& onc_field_name, |
316 const base::ListValue& list) { | 316 const base::ListValue& list) { |
317 const OncFieldSignature* field_signature = | 317 const OncFieldSignature* field_signature = |
318 GetFieldSignature(*onc_signature_, onc_field_name); | 318 GetFieldSignature(*onc_signature_, onc_field_name); |
319 if (field_signature->value_signature->onc_type != Value::TYPE_LIST) { | 319 if (field_signature->value_signature->onc_type != base::Value::TYPE_LIST) { |
320 LOG(ERROR) << "ONC Field name: '" << onc_field_name << "' has type '" | 320 LOG(ERROR) << "ONC Field name: '" << onc_field_name << "' has type '" |
321 << field_signature->value_signature->onc_type | 321 << field_signature->value_signature->onc_type |
322 << "', expected: base::Value::TYPE_LIST."; | 322 << "', expected: base::Value::TYPE_LIST."; |
323 return; | 323 return; |
324 } | 324 } |
325 DCHECK(field_signature->value_signature->onc_array_entry_signature); | 325 DCHECK(field_signature->value_signature->onc_array_entry_signature); |
326 scoped_ptr<base::ListValue> result(new base::ListValue()); | 326 scoped_ptr<base::ListValue> result(new base::ListValue()); |
327 for (base::ListValue::const_iterator it = list.begin(); | 327 for (base::ListValue::const_iterator it = list.begin(); |
328 it != list.end(); ++it) { | 328 it != list.end(); ++it) { |
329 const base::DictionaryValue* shill_value = NULL; | 329 const base::DictionaryValue* shill_value = NULL; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 const base::DictionaryValue& shill_dictionary, | 411 const base::DictionaryValue& shill_dictionary, |
412 const OncValueSignature* onc_signature) { | 412 const OncValueSignature* onc_signature) { |
413 CHECK(onc_signature != NULL); | 413 CHECK(onc_signature != NULL); |
414 | 414 |
415 ShillToONCTranslator translator(shill_dictionary, *onc_signature); | 415 ShillToONCTranslator translator(shill_dictionary, *onc_signature); |
416 return translator.CreateTranslatedONCObject(); | 416 return translator.CreateTranslatedONCObject(); |
417 } | 417 } |
418 | 418 |
419 } // namespace onc | 419 } // namespace onc |
420 } // namespace chromeos | 420 } // namespace chromeos |
OLD | NEW |