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

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

Issue 776603002: Revert of Change to Shill's IPConfig objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 8e30af55446f6889b6c35922c488bf602039aae8..5300a9d424b5e003ceb66a2c5c9b62c3922b06d1 100644
--- a/chromeos/network/onc/onc_translator_onc_to_shill.cc
+++ b/chromeos/network/onc/onc_translator_onc_to_shill.cc
@@ -27,6 +27,17 @@
namespace onc {
namespace {
+
+bool ConvertListValueToStringVector(const base::ListValue& string_list,
+ std::vector<std::string>* result) {
+ for (size_t i = 0; i < string_list.GetSize(); ++i) {
+ std::string str;
+ if (!string_list.GetString(i, &str))
+ return false;
+ result->push_back(str);
+ }
+ return true;
+}
scoped_ptr<base::StringValue> ConvertValueToString(const base::Value& value) {
std::string str;
@@ -60,6 +71,7 @@
void TranslateVPN();
void TranslateWiFi();
void TranslateEAP();
+ void TranslateStaticIPConfig();
void TranslateNetworkConfiguration();
// Copies all entries from |onc_object_| to |shill_dictionary_| for which a
@@ -96,6 +108,8 @@
void LocalTranslator::TranslateFields() {
if (onc_signature_ == &kNetworkConfigurationSignature)
TranslateNetworkConfiguration();
+ else if (onc_signature_ == &kStaticIPConfigSignature)
+ TranslateStaticIPConfig();
else if (onc_signature_ == &kEthernetSignature)
TranslateEthernet();
else if (onc_signature_ == &kVPNSignature)
@@ -126,6 +140,20 @@
CopyFieldsAccordingToSignature();
}
+
+void LocalTranslator::TranslateStaticIPConfig() {
+ const base::ListValue* onc_nameservers = NULL;
+ if (onc_object_->GetListWithoutPathExpansion(::onc::ipconfig::kNameServers,
+ &onc_nameservers)) {
+ std::vector<std::string> onc_nameservers_vector;
+ ConvertListValueToStringVector(*onc_nameservers, &onc_nameservers_vector);
+ std::string shill_nameservers = JoinString(onc_nameservers_vector, ',');
+ shill_dictionary_->SetStringWithoutPathExpansion(
+ shill::kStaticIPNameServersProperty, shill_nameservers);
+ }
+
+ CopyFieldsAccordingToSignature();
+}
void LocalTranslator::TranslateOpenVPN() {
// SaveCredentials needs special handling when translating from Shill -> ONC
« 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