| 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 cr.define('options.internet', function() { | 5 cr.define('options.internet', function() { |
| 6 var OptionsPage = options.OptionsPage; | 6 var OptionsPage = options.OptionsPage; |
| 7 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; | 7 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; |
| 8 | 8 |
| 9 /* | 9 /* |
| 10 * Helper function to set hidden attribute for elements matching a selector. | 10 * Helper function to set hidden attribute for elements matching a selector. |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 // if you can't connect to any network. | 279 // if you can't connect to any network. |
| 280 // TODO(chocobo): Once ipconfig is moved to flimflam service objects, | 280 // TODO(chocobo): Once ipconfig is moved to flimflam service objects, |
| 281 // we need to redo this logic to allow configuration of all networks. | 281 // we need to redo this logic to allow configuration of all networks. |
| 282 $('ipconfig-section').hidden = !this.connected && this.deviceConnected; | 282 $('ipconfig-section').hidden = !this.connected && this.deviceConnected; |
| 283 | 283 |
| 284 // Network type related. | 284 // Network type related. |
| 285 updateHidden('#details-internet-page .cellular-details', !this.cellular); | 285 updateHidden('#details-internet-page .cellular-details', !this.cellular); |
| 286 updateHidden('#details-internet-page .wifi-details', !this.wireless); | 286 updateHidden('#details-internet-page .wifi-details', !this.wireless); |
| 287 updateHidden('#details-internet-page .vpn-details', !this.vpn); | 287 updateHidden('#details-internet-page .vpn-details', !this.vpn); |
| 288 updateHidden('#details-internet-page .proxy-details', !this.showProxy); | 288 updateHidden('#details-internet-page .proxy-details', !this.showProxy); |
| 289 /* Network information merged into the Wifi tab for wireless networks. */ |
| 290 updateHidden('#details-internet-page .network-details', this.wireless); |
| 289 | 291 |
| 290 // Cell plan related. | 292 // Cell plan related. |
| 291 $('plan-list').hidden = this.cellplanloading; | 293 $('plan-list').hidden = this.cellplanloading; |
| 292 updateHidden('#details-internet-page .no-plan-info', | 294 updateHidden('#details-internet-page .no-plan-info', |
| 293 !this.cellular || this.cellplanloading || this.hascellplan); | 295 !this.cellular || this.cellplanloading || this.hascellplan); |
| 294 updateHidden('#details-internet-page .plan-loading-info', | 296 updateHidden('#details-internet-page .plan-loading-info', |
| 295 !this.cellular || this.nocellplan || this.hascellplan); | 297 !this.cellular || this.nocellplan || this.hascellplan); |
| 296 updateHidden('#details-internet-page .plan-details-info', | 298 updateHidden('#details-internet-page .plan-details-info', |
| 297 !this.cellular || this.nocellplan || this.cellplanloading); | 299 !this.cellular || this.nocellplan || this.cellplanloading); |
| 298 updateHidden('#details-internet-page .gsm-only', | 300 updateHidden('#details-internet-page .gsm-only', |
| 299 !this.cellular || !this.gsm); | 301 !this.cellular || !this.gsm); |
| 300 updateHidden('#details-internet-page .cdma-only', | 302 updateHidden('#details-internet-page .cdma-only', |
| 301 !this.cellular || this.gsm); | 303 !this.cellular || this.gsm); |
| 302 updateHidden('#details-internet-page .apn-list-view', | 304 updateHidden('#details-internet-page .apn-list-view', |
| 303 !this.cellular || !this.gsm); | 305 !this.cellular || !this.gsm); |
| 304 updateHidden('#details-internet-page .apn-details-view', true); | 306 updateHidden('#details-internet-page .apn-details-view', true); |
| 305 | 307 |
| 306 // Password and shared. | 308 // Password and shared. |
| 307 updateHidden('#details-internet-page .password-details', | 309 updateHidden('#details-internet-page #password-details', |
| 308 !this.wireless || !this.password); | 310 !this.wireless || !this.password); |
| 309 updateHidden('#details-internet-page .shared-network', !this.shared); | 311 updateHidden('#details-internet-page #shared-network', !this.shared); |
| 310 updateHidden('#details-internet-page .prefer-network', | 312 updateHidden('#details-internet-page #prefer-network', |
| 311 !this.showPreferred); | 313 !this.showPreferred); |
| 312 | 314 |
| 313 // Proxy | 315 // Proxy |
| 314 this.updateProxyBannerVisibility_(); | 316 this.updateProxyBannerVisibility_(); |
| 315 this.toggleSingleProxy_(); | 317 this.toggleSingleProxy_(); |
| 316 if ($('manual-proxy').checked) | 318 if ($('manual-proxy').checked) |
| 317 this.enableManualProxy_(); | 319 this.enableManualProxy_(); |
| 318 else | 320 else |
| 319 this.disableManualProxy_(); | 321 this.disableManualProxy_(); |
| 320 if (!this.proxyListInitialized_ && this.visible) { | 322 if (!this.proxyListInitialized_ && this.visible) { |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 $('hardware-address-row').style.display = 'none'; | 665 $('hardware-address-row').style.display = 'none'; |
| 664 } | 666 } |
| 665 if (data.type == options.internet.Constants.TYPE_WIFI) { | 667 if (data.type == options.internet.Constants.TYPE_WIFI) { |
| 666 OptionsPage.showTab($('wifi-network-nav-tab')); | 668 OptionsPage.showTab($('wifi-network-nav-tab')); |
| 667 detailsPage.wireless = true; | 669 detailsPage.wireless = true; |
| 668 detailsPage.vpn = false; | 670 detailsPage.vpn = false; |
| 669 detailsPage.ethernet = false; | 671 detailsPage.ethernet = false; |
| 670 detailsPage.cellular = false; | 672 detailsPage.cellular = false; |
| 671 detailsPage.gsm = false; | 673 detailsPage.gsm = false; |
| 672 detailsPage.shared = data.shared; | 674 detailsPage.shared = data.shared; |
| 673 $('inet-ssid').textContent = data.ssid; | 675 $('wifi-connection-state').textContent = data.connectionState; |
| 676 $('wifi-ssid').textContent = data.ssid; |
| 677 $('wifi-ip-address').textContent = inetAddress; |
| 678 $('wifi-subnet-address').textContent = inetSubnetAddress; |
| 679 $('wifi-gateway').textContent = inetGateway; |
| 680 $('wifi-dns').textContent = inetDns; |
| 681 if (data.encryption && data.encryption.length > 0) { |
| 682 $('wifi-security').textContent = data.encryption; |
| 683 $('wifi-security-entry').hidden = false; |
| 684 } else { |
| 685 $('wifi-security-entry').hidden = true; |
| 686 } |
| 687 if (data.hardwareAddress) { |
| 688 $('wifi-hardware-address').textContent = data.hardwareAddress; |
| 689 $('wifi-hardware-address-entry').hidden = false; |
| 690 } else { |
| 691 $('wifi-hardware-address-entry').hidden = true; |
| 692 } |
| 674 detailsPage.showPreferred = data.showPreferred; | 693 detailsPage.showPreferred = data.showPreferred; |
| 675 $('prefer-network-wifi').checked = data.preferred.value; | 694 $('prefer-network-wifi').checked = data.preferred.value; |
| 676 $('prefer-network-wifi').disabled = !data.remembered; | 695 $('prefer-network-wifi').disabled = !data.remembered; |
| 677 $('auto-connect-network-wifi').checked = data.autoConnect.value; | 696 $('auto-connect-network-wifi').checked = data.autoConnect.value; |
| 678 $('auto-connect-network-wifi').disabled = !data.remembered; | 697 $('auto-connect-network-wifi').disabled = !data.remembered; |
| 679 detailsPage.password = data.encrypted; | 698 detailsPage.password = data.encrypted; |
| 680 } else if (data.type == options.internet.Constants.TYPE_CELLULAR) { | 699 } else if (data.type == options.internet.Constants.TYPE_CELLULAR) { |
| 681 if (!data.gsm) | 700 if (!data.gsm) |
| 682 OptionsPage.showTab($('cellular-plan-nav-tab')); | 701 OptionsPage.showTab($('cellular-plan-nav-tab')); |
| 683 else | 702 else |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 815 | 834 |
| 816 // Don't show page name in address bar and in history to prevent people | 835 // Don't show page name in address bar and in history to prevent people |
| 817 // navigate here by hand and solve issue with page session restore. | 836 // navigate here by hand and solve issue with page session restore. |
| 818 OptionsPage.showPageByName('detailsInternetPage', false); | 837 OptionsPage.showPageByName('detailsInternetPage', false); |
| 819 }; | 838 }; |
| 820 | 839 |
| 821 return { | 840 return { |
| 822 DetailsInternetPage: DetailsInternetPage | 841 DetailsInternetPage: DetailsInternetPage |
| 823 }; | 842 }; |
| 824 }); | 843 }); |
| OLD | NEW |