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

Side by Side Diff: chrome/browser/resources/options/chromeos/internet_detail.js

Issue 1006553002: Add third-party VPN support to network details dialog (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@f_2_460428_add_ash_ui
Patch Set: Prepare for removal of GetManagedPropertiesResult() by tracking VPN providers and networks separate… 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // require: onc_data.js 5 // require: onc_data.js
6 6
7 // NOTE(stevenjb): This code is in the process of being converted to be 7 // NOTE(stevenjb): This code is in the process of being converted to be
8 // compatible with the networkingPrivate extension API: 8 // compatible with the networkingPrivate extension API:
9 // * The network property dictionaries are being converted to use ONC values. 9 // * The network property dictionaries are being converted to use ONC values.
10 // * chrome.send calls will be replaced with chrome.networkingPrivate calls. 10 // * chrome.send calls will be replaced with chrome.networkingPrivate calls.
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 }, 750 },
751 751
752 /** 752 /**
753 * Helper method called from initializeDetailsPage and updateConnectionData. 753 * Helper method called from initializeDetailsPage and updateConnectionData.
754 * Updates the fields in the header section of the details frame. 754 * Updates the fields in the header section of the details frame.
755 * @private 755 * @private
756 */ 756 */
757 populateHeader_: function() { 757 populateHeader_: function() {
758 var onc = this.onc_; 758 var onc = this.onc_;
759 759
760 $('network-details-title').textContent = onc.getTranslatedValue('Name'); 760 $('network-details-title').textContent =
761 this.networkTitle_ || onc.getTranslatedValue('Name');
762
761 var connectionState = onc.getActiveValue('ConnectionState'); 763 var connectionState = onc.getActiveValue('ConnectionState');
762 var connectionStateString = onc.getTranslatedValue('ConnectionState'); 764 var connectionStateString = onc.getTranslatedValue('ConnectionState');
763 $('network-details-subtitle-status').textContent = connectionStateString; 765 $('network-details-subtitle-status').textContent = connectionStateString;
764 766
765 var typeKey; 767 var typeKey;
766 var type = this.type_; 768 var type = this.type_;
767 if (type == 'Ethernet') 769 if (type == 'Ethernet')
768 typeKey = 'ethernetTitle'; 770 typeKey = 'ethernetTitle';
769 else if (type == 'WiFi') 771 else if (type == 'WiFi')
770 typeKey = 'wifiTitle'; 772 typeKey = 'wifiTitle';
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
1304 var onc = new OncData(oncData); 1306 var onc = new OncData(oncData);
1305 1307
1306 var detailsPage = DetailsInternetPage.getInstance(); 1308 var detailsPage = DetailsInternetPage.getInstance();
1307 detailsPage.servicePath_ = oncData.servicePath; 1309 detailsPage.servicePath_ = oncData.servicePath;
1308 detailsPage.onc_ = onc; 1310 detailsPage.onc_ = onc;
1309 var type = onc.getActiveValue('Type'); 1311 var type = onc.getActiveValue('Type');
1310 detailsPage.type_ = type; 1312 detailsPage.type_ = type;
1311 1313
1312 sendShowDetailsMetrics(type, onc.getActiveValue('ConnectionState')); 1314 sendShowDetailsMetrics(type, onc.getActiveValue('ConnectionState'));
1313 1315
1316 if (type == 'VPN') {
1317 // Cache the dialog title, which will contain the provider name in the
1318 // case of a third-party VPN provider. This caching is important as the
1319 // provider may go away while the details dialog is being shown, causing
1320 // subsequent updates to be unable to determine the correct title.
1321 detailsPage.networkTitle_ = options.VPNProviders.formatNetworkName(
1322 oncData.VPNProviderID,
stevenjb 2015/03/15 17:00:08 Don't use oncData directly, use onc.getActiveValue
bartfab (slow) 2015/03/16 10:04:51 I had based this on existing code. It seemed to me
1323 onc.getTranslatedValue('Name'));
1324 }
stevenjb 2015/03/15 17:00:08 else detailsPage.networkTitle = undefined;
bartfab (slow) 2015/03/16 10:04:51 Done.
1325
1314 detailsPage.populateHeader_(); 1326 detailsPage.populateHeader_();
1315 detailsPage.updateConnectionButtonVisibilty_(); 1327 detailsPage.updateConnectionButtonVisibilty_();
1316 detailsPage.updateDetails_(); 1328 detailsPage.updateDetails_();
1317 1329
1318 // TODO(stevenjb): Some of the setup below should be moved to 1330 // TODO(stevenjb): Some of the setup below should be moved to
1319 // updateDetails_() so that updates are reflected in the UI. 1331 // updateDetails_() so that updates are reflected in the UI.
1320 1332
1321 // Only show proxy for remembered networks. 1333 // Only show proxy for remembered networks.
1322 var remembered = onc.getSource() != 'None'; 1334 var remembered = onc.getSource() != 'None';
1323 if (remembered) { 1335 if (remembered) {
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
1632 if (isGsm) { 1644 if (isGsm) {
1633 $('iccid').textContent = onc.getActiveValue('Cellular.ICCID'); 1645 $('iccid').textContent = onc.getActiveValue('Cellular.ICCID');
1634 $('imsi').textContent = onc.getActiveValue('Cellular.IMSI'); 1646 $('imsi').textContent = onc.getActiveValue('Cellular.IMSI');
1635 detailsPage.initializeApnList_(); 1647 detailsPage.initializeApnList_();
1636 } 1648 }
1637 $('auto-connect-network-cellular').checked = 1649 $('auto-connect-network-cellular').checked =
1638 onc.getActiveValue('Cellular.AutoConnect'); 1650 onc.getActiveValue('Cellular.AutoConnect');
1639 $('auto-connect-network-cellular').disabled = false; 1651 $('auto-connect-network-cellular').disabled = false;
1640 } else if (type == 'VPN') { 1652 } else if (type == 'VPN') {
1641 OptionsPage.showTab($('vpn-nav-tab')); 1653 OptionsPage.showTab($('vpn-nav-tab'));
1654 var providers = options.VPNProviders;
1655 var providerID = oncData.VPNProviderID;
stevenjb 2015/03/15 17:00:08 Use onc.getActiveValue
bartfab (slow) 2015/03/16 10:04:51 Done.
1656 $('vpn-tab').classList.toggle('third-party-vpn-provider',
1657 providers.isThirdPartyProvider(providerID));
1658
1642 $('inet-service-name').textContent = networkName; 1659 $('inet-service-name').textContent = networkName;
1643 $('inet-provider-type').textContent = 1660 $('inet-provider-type').textContent =
1644 onc.getTranslatedValue('VPN.Type'); 1661 onc.getTranslatedValue('VPN.Type');
1645 var providerType = onc.getActiveValue('VPN.Type'); 1662 var providerType = onc.getActiveValue('VPN.Type');
1646 var usernameKey; 1663 var usernameKey;
1647 if (providerType == 'OpenVPN') 1664 if (providerType == 'OpenVPN')
1648 usernameKey = 'VPN.OpenVPN.Username'; 1665 usernameKey = 'VPN.OpenVPN.Username';
1649 else if (providerType == 'L2TP-IPsec') 1666 else if (providerType == 'L2TP-IPsec')
1650 usernameKey = 'VPN.L2TP.Username'; 1667 usernameKey = 'VPN.L2TP.Username';
1651 1668
1652 if (usernameKey) { 1669 if (usernameKey) {
1653 $('inet-username').parentElement.hidden = false; 1670 $('inet-username').parentElement.hidden = false;
1654 $('inet-username').textContent = onc.getActiveValue(usernameKey); 1671 $('inet-username').textContent = onc.getActiveValue(usernameKey);
1655 } else { 1672 } else {
1656 $('inet-username').parentElement.hidden = true; 1673 $('inet-username').parentElement.hidden = true;
1657 } 1674 }
1658 var inetServerHostname = $('inet-server-hostname'); 1675 var inetServerHostname = $('inet-server-hostname');
1659 inetServerHostname.value = onc.getActiveValue('VPN.Host'); 1676 inetServerHostname.value = onc.getActiveValue('VPN.Host');
1660 inetServerHostname.resetHandler = function() { 1677 inetServerHostname.resetHandler = function() {
1661 PageManager.hideBubble(); 1678 PageManager.hideBubble();
1662 var recommended = onc.getRecommendedValue('VPN.Host'); 1679 var recommended = onc.getRecommendedValue('VPN.Host');
1663 if (recommended != undefined) 1680 if (recommended != undefined)
1664 inetServerHostname.value = recommended; 1681 inetServerHostname.value = recommended;
1665 }; 1682 };
1666 $('auto-connect-network-vpn').checked = 1683 $('auto-connect-network-vpn').checked =
1667 onc.getActiveValue('VPN.AutoConnect'); 1684 onc.getActiveValue('VPN.AutoConnect');
1668 $('auto-connect-network-vpn').disabled = false; 1685 $('auto-connect-network-vpn').disabled = false;
1686 $('inet-provider-name').textContent =
1687 providers.getProviders()[providerID];
1669 } else { 1688 } else {
1670 OptionsPage.showTab($('internet-nav-tab')); 1689 OptionsPage.showTab($('internet-nav-tab'));
1671 } 1690 }
1672 1691
1673 // Update controlled option indicators. 1692 // Update controlled option indicators.
1674 var indicators = cr.doc.querySelectorAll( 1693 var indicators = cr.doc.querySelectorAll(
1675 '#details-internet-page .controlled-setting-indicator'); 1694 '#details-internet-page .controlled-setting-indicator');
1676 for (var i = 0; i < indicators.length; i++) { 1695 for (var i = 0; i < indicators.length; i++) {
1677 var managed = indicators[i].hasAttribute('managed'); 1696 var managed = indicators[i].hasAttribute('managed');
1678 // TODO(stevenjb): Eliminate support for 'data' once 39 is stable. 1697 // TODO(stevenjb): Eliminate support for 'data' once 39 is stable.
(...skipping 28 matching lines...) Expand all
1707 1726
1708 // Don't show page name in address bar and in history to prevent people 1727 // Don't show page name in address bar and in history to prevent people
1709 // navigate here by hand and solve issue with page session restore. 1728 // navigate here by hand and solve issue with page session restore.
1710 PageManager.showPageByName('detailsInternetPage', false); 1729 PageManager.showPageByName('detailsInternetPage', false);
1711 }; 1730 };
1712 1731
1713 return { 1732 return {
1714 DetailsInternetPage: DetailsInternetPage 1733 DetailsInternetPage: DetailsInternetPage
1715 }; 1734 };
1716 }); 1735 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698