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 // NOTE(stevenjb): This code is in the process of being converted to be | 5 // NOTE(stevenjb): This code is in the process of being converted to be |
6 // compatible with the networkingPrivate extension API: | 6 // compatible with the networkingPrivate extension API: |
7 // * The network property dictionaries are being converted to use ONC values. | 7 // * The network property dictionaries are being converted to use ONC values. |
8 // * chrome.send calls will be replaced with an API object that simulates the | 8 // * chrome.send calls will be replaced with an API object that simulates the |
9 // networkingPrivate API. See network_config.js. | 9 // networkingPrivate API. See network_config.js. |
10 // See crbug.com/279351 for more info. | 10 // See crbug.com/279351 for more info. |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 $('ipconfig-section').hidden = !this.connected && this.deviceConnected; | 428 $('ipconfig-section').hidden = !this.connected && this.deviceConnected; |
429 $('ipconfig-dns-section').hidden = | 429 $('ipconfig-dns-section').hidden = |
430 !this.connected && this.deviceConnected; | 430 !this.connected && this.deviceConnected; |
431 | 431 |
432 // Network type related. | 432 // Network type related. |
433 updateHidden('#details-internet-page .cellular-details', !this.cellular); | 433 updateHidden('#details-internet-page .cellular-details', !this.cellular); |
434 updateHidden('#details-internet-page .wifi-details', !this.wireless); | 434 updateHidden('#details-internet-page .wifi-details', !this.wireless); |
435 updateHidden('#details-internet-page .wimax-details', !this.wimax); | 435 updateHidden('#details-internet-page .wimax-details', !this.wimax); |
436 updateHidden('#details-internet-page .vpn-details', !this.vpn); | 436 updateHidden('#details-internet-page .vpn-details', !this.vpn); |
437 updateHidden('#details-internet-page .proxy-details', !this.showProxy); | 437 updateHidden('#details-internet-page .proxy-details', !this.showProxy); |
| 438 |
| 439 // Cellular |
| 440 |
438 // Conditionally call updateHidden on .gsm-only, so that we don't unhide | 441 // Conditionally call updateHidden on .gsm-only, so that we don't unhide |
439 // a previously hidden element. | 442 // a previously hidden element. |
440 if (this.gsm) | 443 if (this.gsm) |
441 updateHidden('#details-internet-page .cdma-only', true); | 444 updateHidden('#details-internet-page .cdma-only', true); |
442 else | 445 else |
443 updateHidden('#details-internet-page .gsm-only', true); | 446 updateHidden('#details-internet-page .gsm-only', true); |
444 /* Network information merged into the Wifi tab for wireless networks | 447 |
445 unless the option is set for enabling a static IP configuration. */ | 448 // Wifi |
| 449 |
| 450 // Network information merged into the Wifi tab for wireless networks |
| 451 // unless the option is set for enabling a static IP configuration. |
446 updateHidden('#details-internet-page .network-details', | 452 updateHidden('#details-internet-page .network-details', |
447 (this.wireless && !this.showStaticIPConfig) || this.vpn); | 453 (this.wireless && !this.showStaticIPConfig) || this.vpn); |
448 updateHidden('#details-internet-page .wifi-network-setting', | 454 updateHidden('#details-internet-page .wifi-network-setting', |
449 this.showStaticIPConfig); | 455 this.showStaticIPConfig); |
450 | 456 |
451 // Wifi - Password and shared. | 457 // Password and shared. |
452 updateHidden('#details-internet-page #password-details', | 458 updateHidden('#details-internet-page #password-details', |
453 !this.wireless || !this.hasSecurity); | 459 !this.wireless || !this.hasSecurity); |
454 updateHidden('#details-internet-page #wifi-shared-network', | 460 updateHidden('#details-internet-page #wifi-shared-network', |
455 !this.shared); | 461 !this.shared); |
456 updateHidden('#details-internet-page #prefer-network', | 462 updateHidden('#details-internet-page #prefer-network', |
457 !this.showPreferred); | 463 !this.showPreferred); |
458 | 464 |
459 // WiMAX. | 465 // WiMAX. |
460 updateHidden('#details-internet-page #wimax-shared-network', | 466 updateHidden('#details-internet-page #wimax-shared-network', |
461 !this.shared); | 467 !this.shared); |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 $(proxyHost).value = hostValue[0]; | 702 $(proxyHost).value = hostValue[0]; |
697 $(proxyPort).value = hostValue[1]; | 703 $(proxyPort).value = hostValue[1]; |
698 } | 704 } |
699 } | 705 } |
700 }; | 706 }; |
701 | 707 |
702 DetailsInternetPage.updateCarrier = function() { | 708 DetailsInternetPage.updateCarrier = function() { |
703 DetailsInternetPage.showCarrierChangeSpinner(false); | 709 DetailsInternetPage.showCarrierChangeSpinner(false); |
704 }; | 710 }; |
705 | 711 |
706 DetailsInternetPage.updateSecurityTab = function(requirePin) { | |
707 $('sim-card-lock-enabled').checked = requirePin; | |
708 $('change-pin').hidden = !requirePin; | |
709 }; | |
710 | |
711 DetailsInternetPage.loginFromDetails = function() { | 712 DetailsInternetPage.loginFromDetails = function() { |
712 var data = $('connection-state').data; | 713 var data = $('connection-state').data; |
713 var servicePath = data.servicePath; | 714 var servicePath = data.servicePath; |
714 chrome.send('networkCommand', [data.Type, servicePath, 'connect']); | 715 chrome.send('networkCommand', [data.Type, servicePath, 'connect']); |
715 OptionsPage.closeOverlay(); | 716 OptionsPage.closeOverlay(); |
716 }; | 717 }; |
717 | 718 |
718 DetailsInternetPage.disconnectNetwork = function() { | 719 DetailsInternetPage.disconnectNetwork = function() { |
719 var data = $('connection-state').data; | 720 var data = $('connection-state').data; |
720 var servicePath = data.servicePath; | 721 var servicePath = data.servicePath; |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 $('wimax-connection-state').textContent = connectionStateString; | 875 $('wimax-connection-state').textContent = connectionStateString; |
875 } else if (data.Type == 'Cellular') { | 876 } else if (data.Type == 'Cellular') { |
876 $('activation-state').textContent = data.activationState; | 877 $('activation-state').textContent = data.activationState; |
877 | 878 |
878 $('buyplan-details').hidden = !data.showBuyButton; | 879 $('buyplan-details').hidden = !data.showBuyButton; |
879 $('view-account-details').hidden = !data.showViewAccountButton; | 880 $('view-account-details').hidden = !data.showViewAccountButton; |
880 | 881 |
881 $('activate-details').hidden = !data.showActivateButton; | 882 $('activate-details').hidden = !data.showActivateButton; |
882 if (data.showActivateButton) | 883 if (data.showActivateButton) |
883 $('details-internet-login').hidden = true; | 884 $('details-internet-login').hidden = true; |
| 885 |
| 886 if (detailsPage.gsm) { |
| 887 // TODO(stevenjb): Use managed properties for policy controlled values. |
| 888 var lockEnabled = data.simCardLockEnabled.value; |
| 889 $('sim-card-lock-enabled').checked = lockEnabled; |
| 890 $('change-pin').hidden = !lockEnabled; |
| 891 } |
884 } | 892 } |
885 | 893 |
886 $('connection-state').data = data; | 894 $('connection-state').data = data; |
887 }; | 895 }; |
888 | 896 |
889 DetailsInternetPage.showDetailedInfo = function(data) { | 897 DetailsInternetPage.showDetailedInfo = function(data) { |
890 var detailsPage = DetailsInternetPage.getInstance(); | 898 var detailsPage = DetailsInternetPage.getInstance(); |
891 | 899 |
892 // Populate header | 900 // Populate header |
893 $('network-details-title').textContent = getNetworkName(data); | 901 $('network-details-title').textContent = getNetworkName(data); |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1216 var option = document.createElement('option'); | 1224 var option = document.createElement('option'); |
1217 option.textContent = data.apn.apn; | 1225 option.textContent = data.apn.apn; |
1218 option.value = -1; | 1226 option.value = -1; |
1219 apnSelector.add(option, otherOption); | 1227 apnSelector.add(option, otherOption); |
1220 data.selectedApn = apnSelector.length - 2; | 1228 data.selectedApn = apnSelector.length - 2; |
1221 data.userApnIndex = data.selectedApn; | 1229 data.userApnIndex = data.selectedApn; |
1222 } | 1230 } |
1223 apnSelector.selectedIndex = data.selectedApn; | 1231 apnSelector.selectedIndex = data.selectedApn; |
1224 updateHidden('.apn-list-view', false); | 1232 updateHidden('.apn-list-view', false); |
1225 updateHidden('.apn-details-view', true); | 1233 updateHidden('.apn-details-view', true); |
1226 DetailsInternetPage.updateSecurityTab(data.simCardLockEnabled.value); | 1234 // TODO(stevenjb): Used managed properties for policy controlled value. |
| 1235 var lockEnabled = data.simCardLockEnabled.value; |
| 1236 $('sim-card-lock-enabled').checked = lockEnabled; |
| 1237 $('change-pin').hidden = !lockEnabled; |
1227 } | 1238 } |
1228 $('auto-connect-network-cellular').checked = data.autoConnect.value; | 1239 $('auto-connect-network-cellular').checked = data.autoConnect.value; |
1229 $('auto-connect-network-cellular').disabled = false; | 1240 $('auto-connect-network-cellular').disabled = false; |
1230 | 1241 |
1231 $('buyplan-details').hidden = !data.showBuyButton; | 1242 $('buyplan-details').hidden = !data.showBuyButton; |
1232 $('view-account-details').hidden = !data.showViewAccountButton; | 1243 $('view-account-details').hidden = !data.showViewAccountButton; |
1233 $('activate-details').hidden = !data.showActivateButton; | 1244 $('activate-details').hidden = !data.showActivateButton; |
1234 if (data.showActivateButton) { | 1245 if (data.showActivateButton) { |
1235 $('details-internet-login').hidden = true; | 1246 $('details-internet-login').hidden = true; |
1236 } | 1247 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1293 | 1304 |
1294 // Don't show page name in address bar and in history to prevent people | 1305 // Don't show page name in address bar and in history to prevent people |
1295 // navigate here by hand and solve issue with page session restore. | 1306 // navigate here by hand and solve issue with page session restore. |
1296 OptionsPage.showPageByName('detailsInternetPage', false); | 1307 OptionsPage.showPageByName('detailsInternetPage', false); |
1297 }; | 1308 }; |
1298 | 1309 |
1299 return { | 1310 return { |
1300 DetailsInternetPage: DetailsInternetPage | 1311 DetailsInternetPage: DetailsInternetPage |
1301 }; | 1312 }; |
1302 }); | 1313 }); |
OLD | NEW |