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

Unified Diff: chromeos/network/network_state.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: Fixed browser tests. 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
« no previous file with comments | « chromeos/network/network_state.h ('k') | chromeos/network/network_state_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/network/network_state.cc
diff --git a/chromeos/network/network_state.cc b/chromeos/network/network_state.cc
index 609c9f0f1c7b589ab30ffc2b52ccf1a37ce353da..f4ad9599cfa98a0dbaf20eaffe4ca1304873c6e4 100644
--- a/chromeos/network/network_state.cc
+++ b/chromeos/network/network_state.cc
@@ -4,6 +4,7 @@
#include "chromeos/network/network_state.h"
+#include "base/memory/scoped_ptr.h"
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
@@ -166,25 +167,29 @@ bool NetworkState::PropertyChanged(const std::string& key,
}
return true;
} else if (key == shill::kProviderProperty) {
+ std::string vpn_provider_type;
const base::DictionaryValue* dict;
- std::string provider_type;
if (!value.GetAsDictionary(&dict) ||
!dict->GetStringWithoutPathExpansion(shill::kTypeProperty,
- &provider_type)) {
+ &vpn_provider_type)) {
+ NET_LOG(ERROR) << "Failed to parse " << path() << "." << key;
return false;
}
- if (provider_type != shill::kProviderThirdPartyVpn) {
- // If the network uses the built-in OpenVPN and L2TP support, set the
- // provider extension ID to an empty string.
- vpn_provider_extension_id_.clear();
- return true;
+ if (vpn_provider_type == shill::kProviderThirdPartyVpn) {
+ // If the network uses a third-party VPN provider, copy over the
+ // provider's extension ID, which is held in |shill::kHostProperty|.
+ if (!dict->GetStringWithoutPathExpansion(
+ shill::kHostProperty, &third_party_vpn_provider_extension_id_)) {
+ NET_LOG(ERROR) << "Failed to parse " << path() << "." << key;
+ return false;
+ }
+ } else {
+ third_party_vpn_provider_extension_id_.clear();
}
- // If the network uses a third-party VPN provider, copy over the provider's
- // extension ID, which is held in |shill::kHostProperty|.
- return dict->GetStringWithoutPathExpansion(shill::kHostProperty,
- &vpn_provider_extension_id_);
+ vpn_provider_type_ = vpn_provider_type;
+ return true;
}
return false;
}
@@ -232,6 +237,22 @@ void NetworkState::GetStateProperties(base::DictionaryValue* dictionary) const {
connection_state());
}
+ // VPN properties.
+ if (NetworkTypePattern::VPN().MatchesType(type())) {
+ // Shill sends VPN provider properties in a nested dictionary. |dictionary|
+ // must replicate that nested structure.
+ scoped_ptr<base::DictionaryValue> provider_property(
+ new base::DictionaryValue);
+ provider_property->SetStringWithoutPathExpansion(shill::kTypeProperty,
+ vpn_provider_type_);
+ if (vpn_provider_type_ == shill::kProviderThirdPartyVpn) {
+ provider_property->SetStringWithoutPathExpansion(
+ shill::kHostProperty, third_party_vpn_provider_extension_id_);
+ }
+ dictionary->SetWithoutPathExpansion(shill::kProviderProperty,
+ provider_property.release());
+ }
+
// Wireless properties
if (!NetworkTypePattern::Wireless().MatchesType(type()))
return;
« no previous file with comments | « chromeos/network/network_state.h ('k') | chromeos/network/network_state_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698