Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Unified Diff: chromeos/network/onc/onc_translator_onc_to_shill.cc

Issue 12390017: Separating ONC<->Shill translation from the ONC signature. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed browser tests. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/network/onc/onc_translation_tables.cc ('k') | chromeos/network/onc/onc_translator_shill_to_onc.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(
« no previous file with comments | « chromeos/network/onc/onc_translation_tables.cc ('k') | chromeos/network/onc/onc_translator_shill_to_onc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698