Chromium Code Reviews| Index: chrome/browser/resources/options/chromeos/internet_detail.js |
| diff --git a/chrome/browser/resources/options/chromeos/internet_detail.js b/chrome/browser/resources/options/chromeos/internet_detail.js |
| index 6358c4261d773ce432c043130bf72d16da8b8469..99fef27467c5a28e39be51de7d7c6d9b2e836a5c 100644 |
| --- a/chrome/browser/resources/options/chromeos/internet_detail.js |
| +++ b/chrome/browser/resources/options/chromeos/internet_detail.js |
| @@ -215,6 +215,7 @@ cr.define('options.internet', function() { |
| var guid = parseQueryParams(window.location).guid; |
| if (!guid || !guid.length) |
| return; |
| + chrome.send('updateVPNProviders'); |
| chrome.networkingPrivate.getManagedProperties( |
| guid, DetailsInternetPage.initializeDetailsPage); |
| }, |
| @@ -756,7 +757,9 @@ cr.define('options.internet', function() { |
| populateHeader_: function() { |
| var onc = this.onc_; |
| - $('network-details-title').textContent = onc.getTranslatedValue('Name'); |
| + $('network-details-title').textContent = |
| + this.networkTitle_ || onc.getTranslatedValue('Name'); |
| + |
| var connectionState = onc.getActiveValue('ConnectionState'); |
| var connectionStateString = onc.getTranslatedValue('ConnectionState'); |
| $('network-details-subtitle-status').textContent = connectionStateString; |
| @@ -1185,7 +1188,11 @@ cr.define('options.internet', function() { |
| } else if (type == 'Cellular') { |
| autoConnectCheckboxId = 'auto-connect-network-cellular'; |
| } else if (type == 'VPN') { |
| - oncData.setProperty('VPN.Host', $('inet-server-hostname').value); |
| + var providerType = detailsPage.onc_.getActiveValue('VPN.Type'); |
| + if (providerType != 'ThirdPartyVPN') { |
| + oncData.setProperty('VPN.Type', providerType); |
| + oncData.setProperty('VPN.Host', $('inet-server-hostname').value); |
| + } |
| autoConnectCheckboxId = 'auto-connect-network-vpn'; |
| } |
| if (autoConnectCheckboxId != '') { |
| @@ -1305,6 +1312,16 @@ cr.define('options.internet', function() { |
| sendShowDetailsMetrics(type, onc.getActiveValue('ConnectionState')); |
| + if (type == 'VPN') { |
| + // Cache the dialog title, which will contain the provider name in the |
| + // case of a third-party VPN provider. This caching is important as the |
| + // provider may go away while the details dialog is being shown, causing |
| + // subsequent updates to be unable to determine the correct title. |
| + detailsPage.networkTitle_ = options.VPNProviders.formatNetworkName(onc); |
| + } else { |
| + detailsPage.networkTitle_ = undefined; |
|
pneubeck (no reviews)
2015/03/18 20:41:30
I think it's more idiomatic to do
delete detailsP
bartfab (slow)
2015/03/18 21:10:48
Done.
|
| + } |
| + |
| detailsPage.populateHeader_(); |
| detailsPage.updateConnectionButtonVisibilty_(); |
| detailsPage.updateDetails_(); |
| @@ -1636,33 +1653,49 @@ cr.define('options.internet', function() { |
| $('auto-connect-network-cellular').disabled = false; |
| } else if (type == 'VPN') { |
| OptionsPage.showTab($('vpn-nav-tab')); |
| + var providerType = onc.getActiveValue('VPN.Type'); |
| + var thirdPartyVPN = providerType == 'ThirdPartyVPN'; |
|
pneubeck (no reviews)
2015/03/18 20:41:30
nit: rename to isThirdPartyVPN
bartfab (slow)
2015/03/18 21:10:48
Done.
|
| + $('vpn-tab').classList.toggle('third-party-vpn-provider', thirdPartyVPN); |
| + |
| $('inet-service-name').textContent = networkName; |
| $('inet-provider-type').textContent = |
| onc.getTranslatedValue('VPN.Type'); |
| - var providerType = onc.getActiveValue('VPN.Type'); |
| - var usernameKey; |
| - if (providerType == 'OpenVPN') |
| - usernameKey = 'VPN.OpenVPN.Username'; |
| - else if (providerType == 'L2TP-IPsec') |
| - usernameKey = 'VPN.L2TP.Username'; |
| - |
| - if (usernameKey) { |
| - $('inet-username').parentElement.hidden = false; |
| - $('inet-username').textContent = onc.getActiveValue(usernameKey); |
| + |
| + if (thirdPartyVPN) { |
| + $('inet-provider-name').textContent = ''; |
| + var extensionID = onc.getActiveValue('VPN.ThirdPartyVPN.ExtensionID'); |
| + var providers = options.VPNProviders.getProviders(); |
| + for (var i = 0; i < providers.length; ++i) { |
|
pneubeck (no reviews)
2015/03/18 20:41:30
if this is the only use of getProviders(), then yo
bartfab (slow)
2015/03/18 21:10:48
CL 1017443002 will add another use which needs to
|
| + if (extensionID == providers[i].extensionID) { |
| + $('inet-provider-name').textContent = providers[i].name; |
| + break; |
| + } |
| + } |
| } else { |
| - $('inet-username').parentElement.hidden = true; |
| + var usernameKey; |
| + if (providerType == 'OpenVPN') |
| + usernameKey = 'VPN.OpenVPN.Username'; |
| + else if (providerType == 'L2TP-IPsec') |
| + usernameKey = 'VPN.L2TP.Username'; |
| + |
| + if (usernameKey) { |
| + $('inet-username').parentElement.hidden = false; |
| + $('inet-username').textContent = onc.getActiveValue(usernameKey); |
| + } else { |
| + $('inet-username').parentElement.hidden = true; |
| + } |
| + var inetServerHostname = $('inet-server-hostname'); |
| + inetServerHostname.value = onc.getActiveValue('VPN.Host'); |
| + inetServerHostname.resetHandler = function() { |
| + PageManager.hideBubble(); |
| + var recommended = onc.getRecommendedValue('VPN.Host'); |
| + if (recommended != undefined) |
| + inetServerHostname.value = recommended; |
| + }; |
| + $('auto-connect-network-vpn').checked = |
| + onc.getActiveValue('VPN.AutoConnect'); |
| + $('auto-connect-network-vpn').disabled = false; |
| } |
| - var inetServerHostname = $('inet-server-hostname'); |
| - inetServerHostname.value = onc.getActiveValue('VPN.Host'); |
| - inetServerHostname.resetHandler = function() { |
| - PageManager.hideBubble(); |
| - var recommended = onc.getRecommendedValue('VPN.Host'); |
| - if (recommended != undefined) |
| - inetServerHostname.value = recommended; |
| - }; |
| - $('auto-connect-network-vpn').checked = |
| - onc.getActiveValue('VPN.AutoConnect'); |
| - $('auto-connect-network-vpn').disabled = false; |
| } else { |
| OptionsPage.showTab($('internet-nav-tab')); |
| } |