Chromium Code Reviews| 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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 391 void ShillToONCTranslator::TranslateAndAddNestedObject( | 391 void ShillToONCTranslator::TranslateAndAddNestedObject( |
| 392 const std::string& onc_field_name) { | 392 const std::string& onc_field_name) { |
| 393 TranslateAndAddNestedObject(onc_field_name, *shill_dictionary_); | 393 TranslateAndAddNestedObject(onc_field_name, *shill_dictionary_); |
| 394 } | 394 } |
| 395 | 395 |
| 396 void ShillToONCTranslator::TranslateAndAddNestedObject( | 396 void ShillToONCTranslator::TranslateAndAddNestedObject( |
| 397 const std::string& onc_field_name, | 397 const std::string& onc_field_name, |
| 398 const base::DictionaryValue& dictionary) { | 398 const base::DictionaryValue& dictionary) { |
| 399 const OncFieldSignature* field_signature = | 399 const OncFieldSignature* field_signature = |
| 400 GetFieldSignature(*onc_signature_, onc_field_name); | 400 GetFieldSignature(*onc_signature_, onc_field_name); |
| 401 DCHECK(field_signature) << "Unable to find signature for field " | 401 if (!field_signature) { |
| 402 << onc_field_name << "."; | 402 NOTREACHED() << "Unable to find signature for field: " << onc_field_name; |
|
pneubeck (no reviews)
2014/08/20 08:49:28
This case indicates without doubt that we have an
| |
| 403 return; | |
| 404 } | |
| 403 ShillToONCTranslator nested_translator(dictionary, | 405 ShillToONCTranslator nested_translator(dictionary, |
| 404 *field_signature->value_signature); | 406 *field_signature->value_signature); |
| 405 scoped_ptr<base::DictionaryValue> nested_object = | 407 scoped_ptr<base::DictionaryValue> nested_object = |
| 406 nested_translator.CreateTranslatedONCObject(); | 408 nested_translator.CreateTranslatedONCObject(); |
| 407 if (nested_object->empty()) | 409 if (nested_object->empty()) |
| 408 return; | 410 return; |
| 409 onc_object_->SetWithoutPathExpansion(onc_field_name, nested_object.release()); | 411 onc_object_->SetWithoutPathExpansion(onc_field_name, nested_object.release()); |
| 410 } | 412 } |
| 411 | 413 |
| 412 void ShillToONCTranslator::TranslateAndAddListOfObjects( | 414 void ShillToONCTranslator::TranslateAndAddListOfObjects( |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 508 const base::DictionaryValue& shill_dictionary, | 510 const base::DictionaryValue& shill_dictionary, |
| 509 const OncValueSignature* onc_signature) { | 511 const OncValueSignature* onc_signature) { |
| 510 CHECK(onc_signature != NULL); | 512 CHECK(onc_signature != NULL); |
| 511 | 513 |
| 512 ShillToONCTranslator translator(shill_dictionary, *onc_signature); | 514 ShillToONCTranslator translator(shill_dictionary, *onc_signature); |
| 513 return translator.CreateTranslatedONCObject(); | 515 return translator.CreateTranslatedONCObject(); |
| 514 } | 516 } |
| 515 | 517 |
| 516 } // namespace onc | 518 } // namespace onc |
| 517 } // namespace chromeos | 519 } // namespace chromeos |
| OLD | NEW |