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

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

Issue 948943003: Better support for Cellular roaming state in ONC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits Created 5 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') | components/onc/docs/onc_spec.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3de5f77ac946fca45e9509f3892bf8001f494986..ac06b4e4c2de346abee56c44ee3c0202043ed463 100644
--- a/chromeos/network/onc/onc_translator_shill_to_onc.cc
+++ b/chromeos/network/onc/onc_translator_shill_to_onc.cc
@@ -343,9 +343,6 @@ void ShillToONCTranslator::TranslateCellularWithState() {
TranslateWithTableAndSet(shill::kActivationStateProperty,
kActivationStateTable,
::onc::cellular::kActivationState);
- TranslateWithTableAndSet(shill::kRoamingStateProperty,
- kRoamingStateTable,
- ::onc::cellular::kRoamingState);
const base::DictionaryValue* dictionary = NULL;
if (shill_dictionary_->GetDictionaryWithoutPathExpansion(
shill::kServingOperatorProperty, &dictionary)) {
@@ -359,20 +356,31 @@ void ShillToONCTranslator::TranslateCellularWithState() {
shill::kCellularLastGoodApnProperty, &dictionary)) {
TranslateAndAddNestedObject(::onc::cellular::kLastGoodAPN, *dictionary);
}
- // Merge the Device dictionary with this one (Cellular) using the
- // CellularDevice signature.
const base::DictionaryValue* device_dictionary = NULL;
- if (!shill_dictionary_->GetDictionaryWithoutPathExpansion(
- shill::kDeviceProperty, &device_dictionary)) {
- return;
+ bool requires_roaming = false;
+ shill_dictionary_->GetDictionaryWithoutPathExpansion(shill::kDeviceProperty,
+ &device_dictionary);
+ if (device_dictionary) {
+ // Merge the Device dictionary with this one (Cellular) using the
+ // CellularDevice signature.
+ ShillToONCTranslator nested_translator(*device_dictionary, onc_source_,
+ kCellularWithStateSignature,
+ kCellularDeviceTable);
+ scoped_ptr<base::DictionaryValue> nested_object =
+ nested_translator.CreateTranslatedONCObject();
+ onc_object_->MergeDictionary(nested_object.get());
+
+ /// Get the requires_roaming from the Device dictionary.
+ device_dictionary->GetBooleanWithoutPathExpansion(
+ shill::kProviderRequiresRoamingProperty, &requires_roaming);
+ }
+ if (requires_roaming) {
+ onc_object_->SetStringWithoutPathExpansion(
+ ::onc::cellular::kRoamingState, ::onc::cellular::kRoamingRequired);
+ } else {
+ TranslateWithTableAndSet(shill::kRoamingStateProperty, kRoamingStateTable,
+ ::onc::cellular::kRoamingState);
}
- ShillToONCTranslator nested_translator(*device_dictionary,
- onc_source_,
- kCellularWithStateSignature,
- kCellularDeviceTable);
- scoped_ptr<base::DictionaryValue> nested_object =
- nested_translator.CreateTranslatedONCObject();
- onc_object_->MergeDictionary(nested_object.get());
}
void ShillToONCTranslator::TranslateCellularDevice() {
« no previous file with comments | « chromeos/network/onc/onc_translation_tables.cc ('k') | components/onc/docs/onc_spec.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698