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

Unified Diff: chrome/browser/resources/options/chromeos/network_list.js

Issue 662063005: Fix VPN dropdown menu in Settings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Feedback Created 6 years, 2 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/options/chromeos/network_list.js
diff --git a/chrome/browser/resources/options/chromeos/network_list.js b/chrome/browser/resources/options/chromeos/network_list.js
index 70cc49c6a416f5439040a67c5af824955e30a38c..90b1d1757302c6fd1f0f37b2a9f55f43d206ff9d 100644
--- a/chrome/browser/resources/options/chromeos/network_list.js
+++ b/chrome/browser/resources/options/chromeos/network_list.js
@@ -511,7 +511,14 @@ cr.define('options.network', function() {
};
}
addendum.push(entry);
+ } else if (this.data_.key == 'VPN') {
+ addendum.push({
+ label: loadTimeData.getString('joinOtherNetwork'),
+ command: createAddConnectionCallback_('VPN'),
+ data: {}
+ });
}
+
var list = this.data.rememberedNetworks;
if (list && list.length > 0) {
var callback = function(list) {
@@ -531,24 +538,29 @@ cr.define('options.network', function() {
list = this.data.networkList;
var empty = !list || list.length == 0;
if (list) {
+ var connectedVpnServicePath = '';
for (var i = 0; i < list.length; i++) {
var data = list[i];
this.createNetworkOptionsCallback_(networkGroup, data);
- if (data.ConnectionState == 'Connected') {
- if (data.Type == 'VPN') {
- var disconnectCallback = function() {
- sendChromeMetricsAction('Options_NetworkDisconnectVPN');
- // TODO(stevenjb): chrome.networkingPrivate.startDisconnect
- chrome.send('startDisconnect', [data.servicePath]);
- };
- // Add separator
- addendum.push({});
- addendum.push({label: loadTimeData.getString('disconnectNetwork'),
- command: disconnectCallback,
- data: data});
- }
+ // For VPN only, append a 'Disconnect' item to the dropdown menu.
+ if (!connectedVpnServicePath && data.Type == 'VPN' &&
+ (data.ConnectionState == 'Connected' ||
+ data.ConnectionState == 'Connecting')) {
+ connectedVpnServicePath = data.servicePath;
}
}
+ if (connectedVpnServicePath) {
+ var disconnectCallback = function() {
+ sendChromeMetricsAction('Options_NetworkDisconnectVPN');
+ // TODO(stevenjb): chrome.networkingPrivate.startDisconnect
+ chrome.send('startDisconnect', [connectedVpnServicePath]);
+ };
+ // Add separator
+ addendum.push({});
+ addendum.push({label: loadTimeData.getString('disconnectNetwork'),
+ command: disconnectCallback,
+ data: data});
+ }
}
if (this.data_.key == 'WiFi' || this.data_.key == 'WiMAX' ||
this.data_.key == 'Cellular') {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698