Index: chromeos/network/onc/onc_translator_shill_to_onc.cc |
diff --git a/chromeos/network/onc/onc_translator_shill_to_onc.cc b/chromeos/network/onc/onc_translator_shill_to_onc.cc |
index 3c00e40ec1082881975849179530b5ecd8d9e761..0d4fb8f4066a44c0a055a90e5e2f0ca0acba0bf8 100644 |
--- a/chromeos/network/onc/onc_translator_shill_to_onc.cc |
+++ b/chromeos/network/onc/onc_translator_shill_to_onc.cc |
@@ -66,6 +66,7 @@ class ShillToONCTranslator { |
void TranslateVPN(); |
void TranslateWiFiWithState(); |
void TranslateCellularWithState(); |
+ void TranslateCellularDevice(); |
void TranslateNetworkWithState(); |
void TranslateIPConfig(); |
@@ -133,6 +134,8 @@ ShillToONCTranslator::CreateTranslatedONCObject() { |
TranslateWiFiWithState(); |
} else if (onc_signature_ == &kCellularWithStateSignature) { |
TranslateCellularWithState(); |
+ } else if (onc_signature_ == &kCellularDeviceSignature) { |
+ TranslateCellularDevice(); |
} else if (onc_signature_ == &kIPConfigSignature) { |
TranslateIPConfig(); |
} else { |
@@ -258,36 +261,37 @@ void ShillToONCTranslator::TranslateCellularWithState() { |
shill::kCellularApnProperty, &dictionary)) { |
TranslateAndAddNestedObject(::onc::cellular::kAPN, *dictionary); |
} |
- const base::ListValue* shill_apns = NULL; |
- if (shill_dictionary_->GetListWithoutPathExpansion( |
- shill::kCellularApnListProperty, &shill_apns)) { |
- TranslateAndAddListOfObjects(::onc::cellular::kAPNList, *shill_apns); |
- } |
- |
+ // Merge the Device dictionary with this one (Cellular) using the |
+ // CellularDevice signiture. |
pneubeck (no reviews)
2014/07/21 08:21:53
typo: signiture -> signature
stevenjb
2014/07/22 18:29:33
Done.
|
const base::DictionaryValue* device_dictionary = NULL; |
if (!shill_dictionary_->GetDictionaryWithoutPathExpansion( |
shill::kDeviceProperty, &device_dictionary)) { |
return; |
} |
+ ShillToONCTranslator nested_translator(*device_dictionary, |
+ kCellularDeviceSignature); |
pneubeck (no reviews)
2014/07/21 08:31:04
how about using kCellularWithStateSignature here a
stevenjb
2014/07/22 18:29:33
I'm not sure I follow.
|
+ scoped_ptr<base::DictionaryValue> nested_object = |
+ nested_translator.CreateTranslatedONCObject(); |
+ onc_object_->MergeDictionary(nested_object.get()); |
+} |
- // Iterate through all fields of the CellularWithState signature and copy |
- // values from the device properties according to the separate |
- // CellularDeviceTable. |
- for (const OncFieldSignature* field_signature = onc_signature_->fields; |
- field_signature->onc_field_name != NULL; ++field_signature) { |
- const std::string& onc_field_name = field_signature->onc_field_name; |
- |
- std::string shill_property_name; |
- const base::Value* shill_value = NULL; |
- if (!GetShillPropertyName(field_signature->onc_field_name, |
- kCellularDeviceTable, |
- &shill_property_name) || |
- !device_dictionary->GetWithoutPathExpansion(shill_property_name, |
- &shill_value)) { |
- continue; |
- } |
- onc_object_->SetWithoutPathExpansion(onc_field_name, |
- shill_value->DeepCopy()); |
+void ShillToONCTranslator::TranslateCellularDevice() { |
+ CopyPropertiesAccordingToSignature(); |
+ const base::DictionaryValue* dictionary = NULL; |
pneubeck (no reviews)
2014/07/21 08:21:53
nit: dictionary -> shill_sim_lock
stevenjb
2014/07/22 18:29:33
Done.
|
+ if (shill_dictionary_->GetDictionaryWithoutPathExpansion( |
+ shill::kSIMLockStatusProperty, &dictionary)) { |
+ TranslateAndAddNestedObject(::onc::cellular::kSIMLockStatus, *dictionary); |
+ } |
+ const base::ListValue* shill_apns = NULL; |
+ if (shill_dictionary_->GetListWithoutPathExpansion( |
+ shill::kCellularApnListProperty, &shill_apns)) { |
+ TranslateAndAddListOfObjects(::onc::cellular::kAPNList, *shill_apns); |
+ } |
+ const base::ListValue* shill_found_networks = NULL; |
+ if (shill_dictionary_->GetListWithoutPathExpansion( |
+ shill::kFoundNetworksProperty, &shill_found_networks)) { |
+ TranslateAndAddListOfObjects(::onc::cellular::kFoundNetworks, |
+ *shill_found_networks); |
} |
} |