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

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

Issue 482243002: Use Managed properties for Preferred and Provider. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 4 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 2fd411fa5113c304315d94fd8d28a70ef950d19b..e7e77829d18f7f733c8b7735cb798e84830724c7 100644
--- a/chromeos/network/onc/onc_translator_onc_to_shill.cc
+++ b/chromeos/network/onc/onc_translator_onc_to_shill.cc
@@ -55,6 +55,7 @@ class LocalTranslator {
private:
void TranslateEthernet();
void TranslateOpenVPN();
+ void TranslateIPsec();
void TranslateVPN();
void TranslateWiFi();
void TranslateEAP();
@@ -94,6 +95,8 @@ void LocalTranslator::TranslateFields() {
TranslateVPN();
else if (onc_signature_ == &kOpenVPNSignature)
TranslateOpenVPN();
+ else if (onc_signature_ == &kIPsecSignature)
+ TranslateIPsec();
else if (onc_signature_ == &kWiFiSignature)
TranslateWiFi();
else if (onc_signature_ == &kEAPSignature)
@@ -117,6 +120,14 @@ void LocalTranslator::TranslateEthernet() {
}
void LocalTranslator::TranslateOpenVPN() {
+ // SaveCredentials needs special handling when translating from Shill -> ONC
+ // so handle it explicitly here.
+ bool save_credentials;
+ if (onc_object_->GetBooleanWithoutPathExpansion(
+ ::onc::vpn::kSaveCredentials, &save_credentials)) {
+ shill_dictionary_->SetBooleanWithoutPathExpansion(
+ shill::kSaveCredentialsProperty, save_credentials);
+ }
// Shill supports only one RemoteCertKU but ONC a list.
// Copy only the first entry if existing.
const base::ListValue* certKUs = NULL;
@@ -131,8 +142,7 @@ void LocalTranslator::TranslateOpenVPN() {
for (base::DictionaryValue::Iterator it(*onc_object_); !it.IsAtEnd();
it.Advance()) {
scoped_ptr<base::Value> translated;
- if (it.key() == ::onc::vpn::kSaveCredentials ||
- it.key() == ::onc::openvpn::kRemoteCertKU ||
+ if (it.key() == ::onc::openvpn::kRemoteCertKU ||
it.key() == ::onc::openvpn::kServerCAPEMs) {
translated.reset(it.value().DeepCopy());
} else {
@@ -143,7 +153,25 @@ void LocalTranslator::TranslateOpenVPN() {
}
}
+void LocalTranslator::TranslateIPsec() {
+ CopyFieldsAccordingToSignature();
+
+ // SaveCredentials needs special handling when translating from Shill -> ONC
+ // so handle it explicitly here.
+ bool save_credentials;
+ if (onc_object_->GetBooleanWithoutPathExpansion(
+ ::onc::vpn::kSaveCredentials, &save_credentials)) {
+ shill_dictionary_->SetBooleanWithoutPathExpansion(
+ shill::kSaveCredentialsProperty, save_credentials);
+ }
+}
+
void LocalTranslator::TranslateVPN() {
+ std::string host;
+ if (onc_object_->GetStringWithoutPathExpansion(::onc::vpn::kHost, &host)) {
+ shill_dictionary_->SetStringWithoutPathExpansion(
+ shill::kProviderHostProperty, host);
+ }
std::string type;
onc_object_->GetStringWithoutPathExpansion(::onc::vpn::kType, &type);
TranslateWithTableAndSet(type, kVPNTypeTable, shill::kProviderTypeProperty);
« 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