diff options
author | cernekee <cernekee@chromium.org> | 2016-03-16 15:18:56 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-16 22:22:12 +0000 |
commit | 7288268a683040968054a3dcfedef28d9151bc1d (patch) | |
tree | 4d0622077d1a0ffbc623a06b39fe87c3595fa34c /extensions/browser/api | |
parent | d4793d5841f84175a0d069391fd612f9cc3f1345 (diff) | |
download | chromium_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 'extensions/browser/api')
-rw-r--r-- | extensions/browser/api/vpn_provider/vpn_provider_api.cc | 5 | ||||
-rw-r--r-- | extensions/browser/api/vpn_provider/vpn_service.cc | 9 |
2 files changed, 12 insertions, 2 deletions
diff --git a/extensions/browser/api/vpn_provider/vpn_provider_api.cc b/extensions/browser/api/vpn_provider/vpn_provider_api.cc index 3529f63..601835d 100644 --- a/extensions/browser/api/vpn_provider/vpn_provider_api.cc +++ b/extensions/browser/api/vpn_provider/vpn_provider_api.cc @@ -143,6 +143,11 @@ void ConvertParameters(const api_vpn::Parameters& parameters, shill::kDnsServersParameterThirdPartyVpn, base::JoinString(parameters.dns_servers, ip_delimiter)); + if (parameters.reconnect) { + parameter_value->SetStringWithoutPathExpansion( + shill::kReconnectParameterThirdPartyVpn, *parameters.reconnect); + } + return; } diff --git a/extensions/browser/api/vpn_provider/vpn_service.cc b/extensions/browser/api/vpn_provider/vpn_service.cc index 7293f70..09452d5 100644 --- a/extensions/browser/api/vpn_provider/vpn_service.cc +++ b/extensions/browser/api/vpn_provider/vpn_service.cc @@ -114,8 +114,13 @@ void VpnService::VpnConfiguration::OnPlatformMessage(uint32_t message) { api_vpn::PlatformMessage platform_message = static_cast<api_vpn::PlatformMessage>(message); - vpn_service_->SetActiveConfiguration( - platform_message == api_vpn::PLATFORM_MESSAGE_CONNECTED ? this : nullptr); + + if (platform_message == api_vpn::PLATFORM_MESSAGE_CONNECTED) { + vpn_service_->SetActiveConfiguration(this); + } else if (platform_message == api_vpn::PLATFORM_MESSAGE_DISCONNECTED || + platform_message == api_vpn::PLATFORM_MESSAGE_ERROR) { + vpn_service_->SetActiveConfiguration(nullptr); + } // TODO(kaliamoorthi): Update the lower layers to get the error message and // pass in the error instead of std::string(). |