| Index: chromeos/network/onc/onc_translator_onc_to_shill.cc
|
| diff --git a/chromeos/network/onc/onc_translator_onc_to_shill.cc b/chromeos/network/onc/onc_translator_onc_to_shill.cc
|
| index 84c38fd0f4bc03d2f3c68bb43fe494b1c0c2290e..5dfdbb19d99e706dfef5045eeb28a5b1e5101939 100644
|
| --- a/chromeos/network/onc/onc_translator_onc_to_shill.cc
|
| +++ b/chromeos/network/onc/onc_translator_onc_to_shill.cc
|
| @@ -46,6 +46,7 @@ class LocalTranslator {
|
| : onc_signature_(&onc_signature),
|
| onc_object_(&onc_object),
|
| shill_dictionary_(shill_dictionary) {
|
| + field_translation_table_ = GetFieldTranslationTable(onc_signature);
|
| }
|
|
|
| void TranslateFields();
|
| @@ -75,6 +76,7 @@ class LocalTranslator {
|
| const std::string& shill_property_name);
|
|
|
| const OncValueSignature* onc_signature_;
|
| + const FieldTranslationEntry* field_translation_table_;
|
| const base::DictionaryValue* onc_object_;
|
| base::DictionaryValue* shill_dictionary_;
|
|
|
| @@ -190,16 +192,17 @@ void LocalTranslator::CopyFieldsAccordingToSignature() {
|
| void LocalTranslator::AddValueAccordingToSignature(
|
| const std::string& onc_name,
|
| scoped_ptr<base::Value> value) {
|
| - if (value.get() == NULL)
|
| + if (!value || !field_translation_table_)
|
| return;
|
| - const OncFieldSignature* field_signature =
|
| - GetFieldSignature(*onc_signature_, onc_name);
|
| - DCHECK(field_signature != NULL);
|
| - if (field_signature == NULL || field_signature->shill_property_name == NULL)
|
| +
|
| + std::string shill_property_name;
|
| + if (!GetShillPropertyName(onc_name,
|
| + field_translation_table_,
|
| + &shill_property_name))
|
| return;
|
|
|
| - shill_dictionary_->SetWithoutPathExpansion(
|
| - field_signature->shill_property_name, value.release());
|
| + shill_dictionary_->SetWithoutPathExpansion(shill_property_name,
|
| + value.release());
|
| }
|
|
|
| void LocalTranslator::TranslateWithTableAndSet(
|
|
|