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

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

Issue 1019033002: Add an ONC property for the third-party VPN provider extension ID (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
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 1ec647aadd06bd85a256ea88cbd27e150fc744ea..997de4449f9985bd3609706bd3a79f7f3b885f85 100644
--- a/chromeos/network/onc/onc_translator_shill_to_onc.cc
+++ b/chromeos/network/onc/onc_translator_shill_to_onc.cc
@@ -77,6 +77,7 @@ class ShillToONCTranslator {
void TranslateEthernet();
void TranslateOpenVPN();
void TranslateIPsec();
+ void TranslateThirdPartyVPN();
void TranslateVPN();
void TranslateWiFiWithState();
void TranslateWiMAXWithState();
@@ -159,6 +160,8 @@ ShillToONCTranslator::CreateTranslatedONCObject() {
TranslateOpenVPN();
} else if (onc_signature_ == &kIPsecSignature) {
TranslateIPsec();
+ } else if (onc_signature_ == &kThirdPartyVPNSignature) {
+ TranslateThirdPartyVPN();
} else if (onc_signature_ == &kWiFiWithStateSignature) {
TranslateWiFiWithState();
} else if (onc_signature_ == &kWiMAXWithStateSignature) {
@@ -266,6 +269,16 @@ void ShillToONCTranslator::TranslateIPsec() {
authentication_type);
}
+void ShillToONCTranslator::TranslateThirdPartyVPN() {
+ CopyPropertiesAccordingToSignature();
+
+ std::string shill_extension_id;
pneubeck (no reviews) 2015/03/18 19:35:29 nit: same comment as in the other direction: // F
bartfab (slow) 2015/03/18 20:02:14 Done.
+ shill_dictionary_->GetStringWithoutPathExpansion(shill::kHostProperty,
+ &shill_extension_id);
+ onc_object_->SetStringWithoutPathExpansion(
+ ::onc::third_party_vpn::kExtensionID, shill_extension_id);
+}
+
void ShillToONCTranslator::TranslateVPN() {
CopyPropertiesAccordingToSignature();
@@ -285,11 +298,12 @@ void ShillToONCTranslator::TranslateVPN() {
}
onc_object_->SetStringWithoutPathExpansion(::onc::vpn::kType,
onc_provider_type);
- std::string provider_host;
- if (provider->GetStringWithoutPathExpansion(shill::kHostProperty,
- &provider_host)) {
+ std::string shill_provider_host;
+ if (onc_provider_type != ::onc::vpn::kThirdPartyVpn &&
+ provider->GetStringWithoutPathExpansion(shill::kHostProperty,
+ &shill_provider_host)) {
onc_object_->SetStringWithoutPathExpansion(::onc::vpn::kHost,
- provider_host);
+ shill_provider_host);
}
// Translate the nested dictionary.
@@ -298,13 +312,14 @@ void ShillToONCTranslator::TranslateVPN() {
TranslateAndAddNestedObject(::onc::vpn::kIPsec, *provider);
TranslateAndAddNestedObject(::onc::vpn::kL2TP, *provider);
provider_type_dictionary = ::onc::vpn::kIPsec;
- } else if (onc_provider_type != ::onc::vpn::kThirdPartyVpn) {
+ } else {
TranslateAndAddNestedObject(onc_provider_type, *provider);
provider_type_dictionary = onc_provider_type;
}
bool save_credentials;
- if (shill_dictionary_->GetBooleanWithoutPathExpansion(
+ if (onc_provider_type != ::onc::vpn::kThirdPartyVpn &&
+ shill_dictionary_->GetBooleanWithoutPathExpansion(
shill::kSaveCredentialsProperty, &save_credentials)) {
SetNestedOncValue(provider_type_dictionary,
::onc::vpn::kSaveCredentials,

Powered by Google App Engine
This is Rietveld 408576698