summaryrefslogtreecommitdiffstats
path: root/chromeos
diff options
context:
space:
mode:
authorcernekee <cernekee@chromium.org>2016-03-16 15:18:56 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-16 22:22:12 +0000
commit7288268a683040968054a3dcfedef28d9151bc1d (patch)
tree4d0622077d1a0ffbc623a06b39fe87c3595fa34c /chromeos
parentd4793d5841f84175a0d069391fd612f9cc3f1345 (diff)
downloadchromium_src-7288268a683040968054a3dcfedef28d9151bc1d.zip
chromium_src-7288268a683040968054a3dcfedef28d9151bc1d.tar.gz
chromium_src-7288268a683040968054a3dcfedef28d9151bc1d.tar.bz2
Extend vpnProvider to allow reconnections
Upcoming changes in the Chrome OS networking daemon (shill) will allow third party VPNs to transition "backwards" from Online->Configuring if the default physical connection changes. Add a "reconnect" flag so that VPN apps can signal their compatibility with this new scheme, and add the necessary UI changes so that Chrome can identify reconnections and present them to the user in a sensible way. Also, change the UI so that users can cancel VPN reconnections (and connections) using the "Disconnect" button. BUG=514343 Review URL: https://codereview.chromium.org/1722453002 Cr-Commit-Position: refs/heads/master@{#381566}
Diffstat (limited to 'chromeos')
-rw-r--r--chromeos/dbus/shill_third_party_vpn_driver_client.cc3
-rw-r--r--chromeos/network/network_state.cc14
-rw-r--r--chromeos/network/network_state.h5
3 files changed, 20 insertions, 2 deletions
diff --git a/chromeos/dbus/shill_third_party_vpn_driver_client.cc b/chromeos/dbus/shill_third_party_vpn_driver_client.cc
index a3f3f7b..63b1851 100644
--- a/chromeos/dbus/shill_third_party_vpn_driver_client.cc
+++ b/chromeos/dbus/shill_third_party_vpn_driver_client.cc
@@ -27,7 +27,8 @@ const char* kSetParametersKeyList[] = {
shill::kSubnetPrefixParameterThirdPartyVpn,
shill::kMtuParameterThirdPartyVpn,
shill::kDomainSearchParameterThirdPartyVpn,
- shill::kDnsServersParameterThirdPartyVpn};
+ shill::kDnsServersParameterThirdPartyVpn,
+ shill::kReconnectParameterThirdPartyVpn};
// The ShillThirdPartyVpnDriverClient implementation.
class ShillThirdPartyVpnDriverClientImpl
diff --git a/chromeos/network/network_state.cc b/chromeos/network/network_state.cc
index 6c022bf..df5f825 100644
--- a/chromeos/network/network_state.cc
+++ b/chromeos/network/network_state.cc
@@ -90,7 +90,14 @@ bool NetworkState::PropertyChanged(const std::string& key,
if (key == shill::kSignalStrengthProperty) {
return GetIntegerValue(key, value, &signal_strength_);
} else if (key == shill::kStateProperty) {
- return GetStringValue(key, value, &connection_state_);
+ std::string saved_state = connection_state_;
+ if (GetStringValue(key, value, &connection_state_)) {
+ if (connection_state_ != saved_state)
+ last_connection_state_ = saved_state;
+ return true;
+ } else {
+ return false;
+ }
} else if (key == shill::kVisibleProperty) {
return GetBooleanValue(key, value, &visible_);
} else if (key == shill::kConnectableProperty) {
@@ -350,6 +357,11 @@ bool NetworkState::IsConnectingState() const {
return visible() && StateIsConnecting(connection_state_);
}
+bool NetworkState::IsReconnecting() const {
+ return visible() && StateIsConnecting(connection_state_) &&
+ StateIsConnected(last_connection_state_);
+}
+
bool NetworkState::IsInProfile() const {
// kTypeEthernetEap is always saved. We need this check because it does
// not show up in the visible list, but its properties may not be available
diff --git a/chromeos/network/network_state.h b/chromeos/network/network_state.h
index 6128a62..24bb8c0 100644
--- a/chromeos/network/network_state.h
+++ b/chromeos/network/network_state.h
@@ -107,6 +107,10 @@ class CHROMEOS_EXPORT NetworkState : public ManagedState {
bool IsConnectedState() const;
bool IsConnectingState() const;
+ // Returns true if |last_connection_state_| is connected, and
+ // |connection_state_| is connecting.
+ bool IsReconnecting() const;
+
// Returns true if this is a network stored in a profile.
bool IsInProfile() const;
@@ -161,6 +165,7 @@ class CHROMEOS_EXPORT NetworkState : public ManagedState {
std::string device_path_;
std::string guid_;
std::string connection_state_;
+ std::string last_connection_state_;
std::string profile_path_;
std::vector<uint8_t> raw_ssid_; // Unknown encoding. Not necessarily UTF-8.
int priority_ = 0;