OLD | NEW |
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 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 var onc = this.onc_; | 730 var onc = this.onc_; |
731 if (this.type_ == 'Ethernet') { | 731 if (this.type_ == 'Ethernet') { |
732 // Ethernet can never be connected or disconnected and can always be | 732 // Ethernet can never be connected or disconnected and can always be |
733 // configured (e.g. to set security). | 733 // configured (e.g. to set security). |
734 $('details-internet-login').hidden = true; | 734 $('details-internet-login').hidden = true; |
735 $('details-internet-disconnect').hidden = true; | 735 $('details-internet-disconnect').hidden = true; |
736 $('details-internet-configure').hidden = false; | 736 $('details-internet-configure').hidden = false; |
737 return; | 737 return; |
738 } | 738 } |
739 | 739 |
| 740 var connectable = onc.getActiveValue('Connectable'); |
740 var connectState = onc.getActiveValue('ConnectionState'); | 741 var connectState = onc.getActiveValue('ConnectionState'); |
741 if (connectState == 'NotConnected') { | 742 if (connectState == 'NotConnected') { |
| 743 $('details-internet-disconnect').hidden = true; |
742 $('details-internet-login').hidden = false; | 744 $('details-internet-login').hidden = false; |
743 // Connecting to an unconfigured network might trigger certificate | 745 // Connecting to an unconfigured network might trigger certificate |
744 // installation UI. Until that gets handled here, always enable the | 746 // installation UI. Until that gets handled here, always enable the |
745 // Connect button. | 747 // Connect button for built-in networks. |
746 $('details-internet-login').disabled = false; | 748 var enabled = (this.type_ != 'VPN') || |
747 $('details-internet-disconnect').hidden = true; | 749 (onc.getActiveValue('VPN.Type') != 'ThirdPartyVPN') || |
| 750 connectable; |
| 751 $('details-internet-login').disabled = !enabled; |
748 } else { | 752 } else { |
749 $('details-internet-login').hidden = true; | 753 $('details-internet-login').hidden = true; |
750 $('details-internet-disconnect').hidden = false; | 754 $('details-internet-disconnect').hidden = false; |
751 } | 755 } |
752 | 756 |
753 var showConfigure = false; | 757 var showConfigure = false; |
754 var connectable = onc.getActiveValue('Connectable'); | |
755 if (this.type_ == 'WiMAX' || this.type_ == 'VPN') { | 758 if (this.type_ == 'WiMAX' || this.type_ == 'VPN') { |
756 showConfigure = true; | 759 showConfigure = true; |
757 } else if (this.type_ == 'WiFi') { | 760 } else if (this.type_ == 'WiFi') { |
758 showConfigure = (connectState != 'Connected' && | 761 showConfigure = (connectState != 'Connected' && |
759 (!connectable || onc.getWiFiSecurity() != 'None')); | 762 (!connectable || onc.getWiFiSecurity() != 'None')); |
760 } | 763 } |
761 $('details-internet-configure').hidden = !showConfigure; | 764 $('details-internet-configure').hidden = !showConfigure; |
762 }, | 765 }, |
763 | 766 |
764 /** | 767 /** |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1221 var detailsPage = DetailsInternetPage.getInstance(); | 1224 var detailsPage = DetailsInternetPage.getInstance(); |
1222 if (detailsPage.type_ == 'WiFi') | 1225 if (detailsPage.type_ == 'WiFi') |
1223 sendChromeMetricsAction('Options_NetworkConnectToWifi'); | 1226 sendChromeMetricsAction('Options_NetworkConnectToWifi'); |
1224 else if (detailsPage.type_ == 'VPN') | 1227 else if (detailsPage.type_ == 'VPN') |
1225 sendChromeMetricsAction('Options_NetworkConnectToVPN'); | 1228 sendChromeMetricsAction('Options_NetworkConnectToVPN'); |
1226 | 1229 |
1227 var onc = detailsPage.onc_; | 1230 var onc = detailsPage.onc_; |
1228 var guid = onc.guid(); | 1231 var guid = onc.guid(); |
1229 var type = onc.getActiveValue('Type'); | 1232 var type = onc.getActiveValue('Type'); |
1230 | 1233 |
1231 // VPNs do not correctly set 'Connectable', so we always show the | 1234 // Built-in VPNs do not correctly set 'Connectable', so we always show the |
1232 // configuration UI. | 1235 // configuration UI. |
1233 if (type == 'VPN') { | 1236 if (type == 'VPN') { |
1234 chrome.send('configureNetwork', [guid]); | 1237 if (onc.getActiveValue('VPN.Type') != 'ThirdPartyVPN') { |
1235 return; | 1238 chrome.send('configureNetwork', [guid]); |
| 1239 return; |
| 1240 } |
1236 } | 1241 } |
1237 | 1242 |
1238 // If 'Connectable' is false for WiFi or WiMAX, Shill requires | 1243 // If 'Connectable' is false for WiFi or WiMAX, Shill requires |
1239 // additional configuration to connect, so show the configuration UI. | 1244 // additional configuration to connect, so show the configuration UI. |
1240 if ((type == 'WiFi' || type == 'WiMAX') && | 1245 if ((type == 'WiFi' || type == 'WiMAX') && |
1241 !onc.getActiveValue('Connectable')) { | 1246 !onc.getActiveValue('Connectable')) { |
1242 chrome.send('configureNetwork', [guid]); | 1247 chrome.send('configureNetwork', [guid]); |
1243 return; | 1248 return; |
1244 } | 1249 } |
1245 | 1250 |
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1848 | 1853 |
1849 // Don't show page name in address bar and in history to prevent people | 1854 // Don't show page name in address bar and in history to prevent people |
1850 // navigate here by hand and solve issue with page session restore. | 1855 // navigate here by hand and solve issue with page session restore. |
1851 PageManager.showPageByName('detailsInternetPage', false); | 1856 PageManager.showPageByName('detailsInternetPage', false); |
1852 }; | 1857 }; |
1853 | 1858 |
1854 return { | 1859 return { |
1855 DetailsInternetPage: DetailsInternetPage | 1860 DetailsInternetPage: DetailsInternetPage |
1856 }; | 1861 }; |
1857 }); | 1862 }); |
OLD | NEW |