| 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 an API object that simulates the | 10 // * chrome.send calls will be replaced with an API object that simulates the |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 function sendCheckedIfEnabled(path, message, checkbox) { | 79 function sendCheckedIfEnabled(path, message, checkbox) { |
| 80 if (!checkbox.hidden && !checkbox.disabled) | 80 if (!checkbox.hidden && !checkbox.disabled) |
| 81 chrome.send(message, [path, checkbox.checked ? 'true' : 'false']); | 81 chrome.send(message, [path, checkbox.checked ? 'true' : 'false']); |
| 82 } | 82 } |
| 83 | 83 |
| 84 /** | 84 /** |
| 85 * Returns the netmask as a string for a given prefix length. | 85 * Returns the netmask as a string for a given prefix length. |
| 86 * @param {string} prefixLength The ONC routing prefix length. | 86 * @param {string} prefixLength The ONC routing prefix length. |
| 87 * @return {string} The corresponding netmask. | 87 * @return {string} The corresponding netmask. |
| 88 */ | 88 */ |
| 89 function PrefixLengthToNetmask(prefixLength) { | 89 function prefixLengthToNetmask(prefixLength) { |
| 90 // Return the empty string for invalid inputs. | 90 // Return the empty string for invalid inputs. |
| 91 if (prefixLength < 0 || prefixLength > 32) | 91 if (prefixLength < 0 || prefixLength > 32) |
| 92 return ''; | 92 return ''; |
| 93 var netmask = ''; | 93 var netmask = ''; |
| 94 for (var i = 0; i < 4; ++i) { | 94 for (var i = 0; i < 4; ++i) { |
| 95 var remainder = 8; | 95 var remainder = 8; |
| 96 if (prefixLength >= 8) { | 96 if (prefixLength >= 8) { |
| 97 prefixLength -= 8; | 97 prefixLength -= 8; |
| 98 } else { | 98 } else { |
| 99 remainder = prefixLength; | 99 remainder = prefixLength; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 110 } | 110 } |
| 111 | 111 |
| 112 ///////////////////////////////////////////////////////////////////////////// | 112 ///////////////////////////////////////////////////////////////////////////// |
| 113 // DetailsInternetPage class: | 113 // DetailsInternetPage class: |
| 114 | 114 |
| 115 /** | 115 /** |
| 116 * Encapsulated handling of ChromeOS internet details overlay page. | 116 * Encapsulated handling of ChromeOS internet details overlay page. |
| 117 * @constructor | 117 * @constructor |
| 118 */ | 118 */ |
| 119 function DetailsInternetPage() { | 119 function DetailsInternetPage() { |
| 120 // Cached Apn properties |
| 120 this.userApnIndex_ = -1; | 121 this.userApnIndex_ = -1; |
| 121 this.selectedApnIndex_ = -1; | 122 this.selectedApnIndex_ = -1; |
| 122 this.userApn_ = {}; | 123 this.userApn_ = {}; |
| 124 // We show the Proxy configuration tab for remembered networks and when |
| 125 // configuring a proxy from the login screen. |
| 126 this.showProxy_ = false; |
| 127 // TODO(stevenjb): Use networkingPrivate.getNetworks to set this. |
| 128 this.deviceConnected_ = false; |
| 123 Page.call(this, 'detailsInternetPage', null, 'details-internet-page'); | 129 Page.call(this, 'detailsInternetPage', null, 'details-internet-page'); |
| 124 } | 130 } |
| 125 | 131 |
| 126 cr.addSingletonGetter(DetailsInternetPage); | 132 cr.addSingletonGetter(DetailsInternetPage); |
| 127 | 133 |
| 128 DetailsInternetPage.prototype = { | 134 DetailsInternetPage.prototype = { |
| 129 __proto__: Page.prototype, | 135 __proto__: Page.prototype, |
| 130 | 136 |
| 131 /** @override */ | 137 /** @override */ |
| 132 initializePage: function() { | 138 initializePage: function() { |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 * Update details page controls. | 385 * Update details page controls. |
| 380 */ | 386 */ |
| 381 updateControls: function() { | 387 updateControls: function() { |
| 382 var onc = this.onc_; | 388 var onc = this.onc_; |
| 383 if (onc == undefined) | 389 if (onc == undefined) |
| 384 return; // May get called from a pref update before initialized. | 390 return; // May get called from a pref update before initialized. |
| 385 | 391 |
| 386 // Only show ipconfig section if network is connected OR if nothing on | 392 // Only show ipconfig section if network is connected OR if nothing on |
| 387 // this device is connected. This is so that you can fix the ip configs | 393 // this device is connected. This is so that you can fix the ip configs |
| 388 // if you can't connect to any network. | 394 // if you can't connect to any network. |
| 389 // TODO(chocobo): Once ipconfig is moved to flimflam service objects, | 395 // TODO(stevenjb): Support IP configuration (and improve the display) |
| 390 // we need to redo this logic to allow configuration of all networks. | 396 // for non connected networks. |
| 397 |
| 391 var connected = onc.getActiveValue('ConnectionState') == 'Connected'; | 398 var connected = onc.getActiveValue('ConnectionState') == 'Connected'; |
| 392 $('ipconfig-section').hidden = !connected && this.deviceConnected; | 399 $('ipconfig-section').hidden = !connected && this.deviceConnected_; |
| 393 $('ipconfig-dns-section').hidden = !connected && this.deviceConnected; | 400 $('ipconfig-dns-section').hidden = !connected && this.deviceConnected_; |
| 394 | 401 |
| 395 // Network type related. | 402 // Network type related. |
| 396 updateHidden('#details-internet-page .cellular-details', | 403 updateHidden('#details-internet-page .cellular-details', |
| 397 this.type_ != 'Cellular'); | 404 this.type_ != 'Cellular'); |
| 398 updateHidden('#details-internet-page .wifi-details', | 405 updateHidden('#details-internet-page .wifi-details', |
| 399 this.type_ != 'WiFi'); | 406 this.type_ != 'WiFi'); |
| 400 updateHidden('#details-internet-page .wimax-details', | 407 updateHidden('#details-internet-page .wimax-details', |
| 401 this.type_ != 'Wimax'); | 408 this.type_ != 'Wimax'); |
| 402 updateHidden('#details-internet-page .vpn-details', this.type_ != 'VPN'); | 409 updateHidden('#details-internet-page .vpn-details', this.type_ != 'VPN'); |
| 403 updateHidden('#details-internet-page .proxy-details', !this.showProxy); | 410 updateHidden('#details-internet-page .proxy-details', !this.showProxy_); |
| 404 | 411 |
| 405 // Cellular | 412 // Cellular |
| 406 | 413 if (this.type_ == 'Cellular') { |
| 407 // Conditionally call updateHidden on .gsm-only, so that we don't unhide | 414 // Hide gsm/cdma specific elements. |
| 408 // a previously hidden element. | 415 if (onc.getActiveValue('Cellular.Family') == 'GSM') |
| 409 if (this.gsm) | 416 updateHidden('#details-internet-page .cdma-only', true); |
| 410 updateHidden('#details-internet-page .cdma-only', true); | 417 else |
| 411 else | 418 updateHidden('#details-internet-page .gsm-only', true); |
| 412 updateHidden('#details-internet-page .gsm-only', true); | 419 } |
| 413 | 420 |
| 414 // Wifi | 421 // Wifi |
| 415 | 422 |
| 416 // Hide network tab for VPN. | 423 // Hide network tab for VPN. |
| 417 updateHidden('#details-internet-page .network-details', | 424 updateHidden('#details-internet-page .network-details', |
| 418 this.type_ == 'VPN'); | 425 this.type_ == 'VPN'); |
| 419 | 426 |
| 420 // Password and shared. | 427 // Password and shared. |
| 421 var source = onc.getSource(); | 428 var source = onc.getSource(); |
| 422 var shared = (source == 'Device' || source == 'DevicePolicy'); | 429 var shared = (source == 'Device' || source == 'DevicePolicy'); |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 var connectable = onc.getActiveValue('Connectable'); | 589 var connectable = onc.getActiveValue('Connectable'); |
| 583 if (connectState != 'Connected' && | 590 if (connectState != 'Connected' && |
| 584 (!connectable || onc.getWiFiSecurity() != 'None' || | 591 (!connectable || onc.getWiFiSecurity() != 'None' || |
| 585 (this.type_ == 'Wimax' || this.type_ == 'VPN'))) { | 592 (this.type_ == 'Wimax' || this.type_ == 'VPN'))) { |
| 586 $('details-internet-configure').hidden = false; | 593 $('details-internet-configure').hidden = false; |
| 587 } else { | 594 } else { |
| 588 $('details-internet-configure').hidden = true; | 595 $('details-internet-configure').hidden = true; |
| 589 } | 596 } |
| 590 }, | 597 }, |
| 591 | 598 |
| 599 updateDetails_: function(data) { |
| 600 var onc = this.onc_; |
| 601 |
| 602 if ('deviceConnected' in data) |
| 603 this.deviceConnected_ = data.deviceConnected; |
| 604 |
| 605 var connectionStateString = onc.getTranslatedValue('ConnectionState'); |
| 606 $('connection-state').textContent = connectionStateString; |
| 607 |
| 608 var type = this.type_; |
| 609 var showViewAccount = false; |
| 610 var showActivate = false; |
| 611 if (type == 'WiFi') { |
| 612 $('wifi-connection-state').textContent = connectionStateString; |
| 613 } else if (type == 'Wimax') { |
| 614 $('wimax-connection-state').textContent = connectionStateString; |
| 615 } else if (type == 'Cellular') { |
| 616 $('activation-state').textContent = |
| 617 onc.getTranslatedValue('Cellular.ActivationState'); |
| 618 if (onc.getActiveValue('Cellular.Family') == 'GSM') { |
| 619 var lockEnabled = |
| 620 onc.getActiveValue('Cellular.SIMLockStatus.LockEnabled'); |
| 621 $('sim-card-lock-enabled').checked = lockEnabled; |
| 622 $('change-pin').hidden = !lockEnabled; |
| 623 } |
| 624 showViewAccount = data.showViewAccountButton; |
| 625 var activationState = onc.getActiveValue('Cellular.ActivationState'); |
| 626 showActivate = activationState == 'NotActivated' || |
| 627 activationState == 'PartiallyActivated'; |
| 628 } |
| 629 |
| 630 $('view-account-details').hidden = !showViewAccount; |
| 631 $('activate-details').hidden = !showActivate; |
| 632 // If activation is not complete, hide the login button. |
| 633 if (showActivate) |
| 634 $('details-internet-login').hidden = true; |
| 635 }, |
| 636 |
| 592 populateHeader_: function() { | 637 populateHeader_: function() { |
| 593 var onc = this.onc_; | 638 var onc = this.onc_; |
| 594 | 639 |
| 595 $('network-details-title').textContent = onc.getTranslatedValue('Name'); | 640 $('network-details-title').textContent = onc.getTranslatedValue('Name'); |
| 596 var connectionState = onc.getActiveValue('ConnectionState'); | 641 var connectionState = onc.getActiveValue('ConnectionState'); |
| 597 var connectionStateString = onc.getTranslatedValue('ConnectionState'); | 642 var connectionStateString = onc.getTranslatedValue('ConnectionState'); |
| 598 $('network-details-subtitle-status').textContent = connectionStateString; | 643 $('network-details-subtitle-status').textContent = connectionStateString; |
| 644 |
| 599 var typeKey; | 645 var typeKey; |
| 600 var type = this.type_; | 646 var type = this.type_; |
| 601 if (type == 'Ethernet') | 647 if (type == 'Ethernet') |
| 602 typeKey = 'ethernetTitle'; | 648 typeKey = 'ethernetTitle'; |
| 603 else if (type == 'WiFi') | 649 else if (type == 'WiFi') |
| 604 typeKey = 'wifiTitle'; | 650 typeKey = 'wifiTitle'; |
| 605 else if (type == 'Wimax') | 651 else if (type == 'Wimax') |
| 606 typeKey = 'wimaxTitle'; | 652 typeKey = 'wimaxTitle'; |
| 607 else if (type == 'Cellular') | 653 else if (type == 'Cellular') |
| 608 typeKey = 'cellularTitle'; | 654 typeKey = 'cellularTitle'; |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 | 877 |
| 832 /** | 878 /** |
| 833 * Displays the InternetDetails dialog with only the proxy settings visible. | 879 * Displays the InternetDetails dialog with only the proxy settings visible. |
| 834 */ | 880 */ |
| 835 DetailsInternetPage.showProxySettings = function() { | 881 DetailsInternetPage.showProxySettings = function() { |
| 836 var detailsPage = DetailsInternetPage.getInstance(); | 882 var detailsPage = DetailsInternetPage.getInstance(); |
| 837 $('network-details-header').hidden = true; | 883 $('network-details-header').hidden = true; |
| 838 $('activate-details').hidden = true; | 884 $('activate-details').hidden = true; |
| 839 $('view-account-details').hidden = true; | 885 $('view-account-details').hidden = true; |
| 840 $('web-proxy-auto-discovery').hidden = true; | 886 $('web-proxy-auto-discovery').hidden = true; |
| 841 detailsPage.showProxy = true; | 887 detailsPage.showProxy_ = true; |
| 842 updateHidden('#internet-tab', true); | 888 updateHidden('#internet-tab', true); |
| 843 updateHidden('#details-tab-strip', true); | 889 updateHidden('#details-tab-strip', true); |
| 844 updateHidden('#details-internet-page .action-area', true); | 890 updateHidden('#details-internet-page .action-area', true); |
| 845 detailsPage.updateControls(); | 891 detailsPage.updateControls(); |
| 846 detailsPage.visible = true; | 892 detailsPage.visible = true; |
| 847 chrome.send('coreOptionsUserMetricsAction', | 893 chrome.send('coreOptionsUserMetricsAction', |
| 848 ['Options_NetworkShowProxyTab']); | 894 ['Options_NetworkShowProxyTab']); |
| 849 }; | 895 }; |
| 850 | 896 |
| 851 /** | 897 /** |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1014 return; | 1060 return; |
| 1015 | 1061 |
| 1016 if (update.servicePath != detailsPage.servicePath_) | 1062 if (update.servicePath != detailsPage.servicePath_) |
| 1017 return; | 1063 return; |
| 1018 | 1064 |
| 1019 // Update our cached data object. | 1065 // Update our cached data object. |
| 1020 var onc = detailsPage.onc_; | 1066 var onc = detailsPage.onc_; |
| 1021 onc.updateData(update); | 1067 onc.updateData(update); |
| 1022 | 1068 |
| 1023 detailsPage.populateHeader_(); | 1069 detailsPage.populateHeader_(); |
| 1024 | |
| 1025 var connectionState = onc.getActiveValue('ConnectionState'); | |
| 1026 var connectionStateString = onc.getTranslatedValue('ConnectionState'); | |
| 1027 if ('deviceConnected' in update) | |
| 1028 detailsPage.deviceConnected = update.deviceConnected; | |
| 1029 $('connection-state').textContent = connectionStateString; | |
| 1030 | |
| 1031 detailsPage.updateConnectionButtonVisibilty_(); | 1070 detailsPage.updateConnectionButtonVisibilty_(); |
| 1032 | 1071 detailsPage.updateDetails_(update); |
| 1033 var type = detailsPage.type_; | |
| 1034 if (type == 'WiFi') { | |
| 1035 $('wifi-connection-state').textContent = connectionStateString; | |
| 1036 } else if (type == 'Wimax') { | |
| 1037 $('wimax-connection-state').textContent = connectionStateString; | |
| 1038 } else if (type == 'Cellular') { | |
| 1039 $('activation-state').textContent = | |
| 1040 onc.getTranslatedValue('Cellular.ActivationState'); | |
| 1041 // These properties are only defined if they are true. | |
| 1042 $('view-account-details').hidden = !update.showViewAccountButton; | |
| 1043 $('activate-details').hidden = !update.showActivateButton; | |
| 1044 if (update.showActivateButton) | |
| 1045 $('details-internet-login').hidden = true; | |
| 1046 | |
| 1047 if (detailsPage.gsm) { | |
| 1048 var lockEnabled = | |
| 1049 onc.getActiveValue('Cellular.SIMLockStatus.LockEnabled'); | |
| 1050 $('sim-card-lock-enabled').checked = lockEnabled; | |
| 1051 $('change-pin').hidden = !lockEnabled; | |
| 1052 } | |
| 1053 } | |
| 1054 }; | 1072 }; |
| 1055 | 1073 |
| 1056 DetailsInternetPage.showDetailedInfo = function(data) { | 1074 DetailsInternetPage.showDetailedInfo = function(data) { |
| 1057 var onc = new OncData(data); | 1075 var onc = new OncData(data); |
| 1058 | 1076 |
| 1059 var detailsPage = DetailsInternetPage.getInstance(); | 1077 var detailsPage = DetailsInternetPage.getInstance(); |
| 1060 detailsPage.onc_ = onc; | 1078 detailsPage.onc_ = onc; |
| 1061 var type = onc.getActiveValue('Type'); | 1079 var type = onc.getActiveValue('Type'); |
| 1062 detailsPage.type_ = type; | 1080 detailsPage.type_ = type; |
| 1063 detailsPage.servicePath_ = data.servicePath; | 1081 detailsPage.servicePath_ = data.servicePath; |
| 1064 | 1082 |
| 1065 detailsPage.populateHeader_(); | 1083 detailsPage.populateHeader_(); |
| 1084 detailsPage.updateConnectionButtonVisibilty_(); |
| 1085 detailsPage.updateDetails_(data); |
| 1066 | 1086 |
| 1067 $('activate-details').hidden = true; | 1087 // TODO(stevenjb): Some of the setup below should be moved to |
| 1068 $('view-account-details').hidden = true; | 1088 // updateDetails_() so that updates are reflected in the UI. |
| 1069 | |
| 1070 detailsPage.updateConnectionButtonVisibilty_(); | |
| 1071 | |
| 1072 $('web-proxy-auto-discovery').hidden = true; | |
| 1073 | |
| 1074 detailsPage.deviceConnected = data.deviceConnected; | |
| 1075 | 1089 |
| 1076 // Only show proxy for remembered networks. | 1090 // Only show proxy for remembered networks. |
| 1077 var remembered = onc.getSource() != 'None'; | 1091 var remembered = onc.getSource() != 'None'; |
| 1078 if (remembered) { | 1092 if (remembered) { |
| 1079 detailsPage.showProxy = true; | 1093 detailsPage.showProxy_ = true; |
| 1094 // Inform Chrome which network to use for proxy configuration. |
| 1080 chrome.send('selectNetwork', [detailsPage.servicePath_]); | 1095 chrome.send('selectNetwork', [detailsPage.servicePath_]); |
| 1081 } else { | 1096 } else { |
| 1082 detailsPage.showProxy = false; | 1097 detailsPage.showProxy_ = false; |
| 1083 } | 1098 } |
| 1084 | 1099 |
| 1085 var connectionStateString = onc.getTranslatedValue('ConnectionState'); | 1100 $('web-proxy-auto-discovery').hidden = true; |
| 1086 $('connection-state').textContent = connectionStateString; | 1101 |
| 1087 var restricted = onc.getActiveValue('RestrictedConnectivity'); | 1102 var restricted = onc.getActiveValue('RestrictedConnectivity'); |
| 1088 var restrictedString = loadTimeData.getString( | 1103 var restrictedString = loadTimeData.getString( |
| 1089 restricted ? 'restrictedYes' : 'restrictedNo'); | 1104 restricted ? 'restrictedYes' : 'restrictedNo'); |
| 1090 | 1105 |
| 1091 var inetAddress = {}; | 1106 var inetAddress = {}; |
| 1092 var inetNetmask = {}; | 1107 var inetNetmask = {}; |
| 1093 var inetGateway = {}; | 1108 var inetGateway = {}; |
| 1094 | 1109 |
| 1095 var inetNameServersString; | 1110 var inetNameServersString; |
| 1096 | 1111 |
| 1097 var ipconfigList = onc.getActiveValue('IPConfigs'); | 1112 var ipconfigList = onc.getActiveValue('IPConfigs'); |
| 1098 if (Array.isArray(ipconfigList)) { | 1113 if (Array.isArray(ipconfigList)) { |
| 1099 for (var i = 0; i < ipconfigList.length; ++i) { | 1114 for (var i = 0; i < ipconfigList.length; ++i) { |
| 1100 var ipconfig = ipconfigList[i]; | 1115 var ipconfig = ipconfigList[i]; |
| 1101 var ipType = ipconfig['Type']; | 1116 var ipType = ipconfig['Type']; |
| 1102 if (ipType != 'IPv4') { | 1117 if (ipType != 'IPv4') { |
| 1103 // TODO(stevenjb): Handle IPv6 properties. | 1118 // TODO(stevenjb): Handle IPv6 properties. |
| 1104 continue; | 1119 continue; |
| 1105 } | 1120 } |
| 1106 var address = ipconfig['IPAddress']; | 1121 var address = ipconfig['IPAddress']; |
| 1107 inetAddress.automatic = address; | 1122 inetAddress.automatic = address; |
| 1108 inetAddress.value = address; | 1123 inetAddress.value = address; |
| 1109 var netmask = PrefixLengthToNetmask(ipconfig['RoutingPrefix']); | 1124 var netmask = prefixLengthToNetmask(ipconfig['RoutingPrefix']); |
| 1110 inetNetmask.automatic = netmask; | 1125 inetNetmask.automatic = netmask; |
| 1111 inetNetmask.value = netmask; | 1126 inetNetmask.value = netmask; |
| 1112 var gateway = ipconfig['Gateway']; | 1127 var gateway = ipconfig['Gateway']; |
| 1113 inetGateway.automatic = gateway; | 1128 inetGateway.automatic = gateway; |
| 1114 inetGateway.value = gateway; | 1129 inetGateway.value = gateway; |
| 1115 if ('WebProxyAutoDiscoveryUrl' in ipconfig) { | 1130 if ('WebProxyAutoDiscoveryUrl' in ipconfig) { |
| 1116 $('web-proxy-auto-discovery').hidden = false; | 1131 $('web-proxy-auto-discovery').hidden = false; |
| 1117 $('web-proxy-auto-discovery-url').value = | 1132 $('web-proxy-auto-discovery-url').value = |
| 1118 ipconfig['WebProxyAutoDiscoveryUrl']; | 1133 ipconfig['WebProxyAutoDiscoveryUrl']; |
| 1119 } | 1134 } |
| 1120 if ('NameServers' in ipconfig) { | 1135 if ('NameServers' in ipconfig) { |
| 1121 var inetNameServers = ipconfig['NameServers']; | 1136 var inetNameServers = ipconfig['NameServers']; |
| 1122 inetNameServers = inetNameServers.sort(); | 1137 inetNameServers = inetNameServers.sort(); |
| 1123 inetNameServersString = inetNameServers.join(','); | 1138 inetNameServersString = inetNameServers.join(','); |
| 1124 } | 1139 } |
| 1125 break; // Use the first IPv4 entry. | 1140 break; // Use the first IPv4 entry. |
| 1126 } | 1141 } |
| 1127 } | 1142 } |
| 1128 | 1143 |
| 1129 // Override the "automatic" values with the real saved DHCP values, | 1144 // Override the "automatic" values with the real saved DHCP values, |
| 1130 // if they are set. | 1145 // if they are set. |
| 1131 var savedNameServersString; | 1146 var savedNameServersString; |
| 1132 var savedIpAddress = onc.getActiveValue('SavedIPConfig.IPAddress'); | 1147 var savedIpAddress = onc.getActiveValue('SavedIPConfig.IPAddress'); |
| 1133 if (savedIpAddress != undefined) { | 1148 if (savedIpAddress != undefined) { |
| 1134 inetAddress.automatic = savedIpAddress; | 1149 inetAddress.automatic = savedIpAddress; |
| 1135 inetAddress.value = savedIpAddress; | 1150 inetAddress.value = savedIpAddress; |
| 1136 } | 1151 } |
| 1137 var savedPrefix = onc.getActiveValue('SavedIPConfig.RoutingPrefix'); | 1152 var savedPrefix = onc.getActiveValue('SavedIPConfig.RoutingPrefix'); |
| 1138 if (savedPrefix != undefined) { | 1153 if (savedPrefix != undefined) { |
| 1139 var savedNetmask = PrefixLengthToNetmask(savedPrefix); | 1154 var savedNetmask = prefixLengthToNetmask(savedPrefix); |
| 1140 inetNetmask.automatic = savedNetmask; | 1155 inetNetmask.automatic = savedNetmask; |
| 1141 inetNetmask.value = savedNetmask; | 1156 inetNetmask.value = savedNetmask; |
| 1142 } | 1157 } |
| 1143 var savedGateway = onc.getActiveValue('SavedIPConfig.Gateway'); | 1158 var savedGateway = onc.getActiveValue('SavedIPConfig.Gateway'); |
| 1144 if (savedGateway != undefined) { | 1159 if (savedGateway != undefined) { |
| 1145 inetGateway.automatic = savedGateway; | 1160 inetGateway.automatic = savedGateway; |
| 1146 inetGateway.value = savedGateway; | 1161 inetGateway.value = savedGateway; |
| 1147 } | 1162 } |
| 1148 var savedNameServers = onc.getActiveValue('SavedIPConfig.NameServers'); | 1163 var savedNameServers = onc.getActiveValue('SavedIPConfig.NameServers'); |
| 1149 if (savedNameServers) { | 1164 if (savedNameServers) { |
| 1150 savedNameServers = savedNameServers.sort(); | 1165 savedNameServers = savedNameServers.sort(); |
| 1151 savedNameServersString = savedNameServers.join(','); | 1166 savedNameServersString = savedNameServers.join(','); |
| 1152 } | 1167 } |
| 1153 | 1168 |
| 1154 var ipAutoConfig = 'automatic'; | 1169 var ipAutoConfig = 'automatic'; |
| 1155 | 1170 |
| 1156 var staticNameServersString; | 1171 var staticNameServersString; |
| 1157 var staticIpAddress = onc.getActiveValue('StaticIPConfig.IPAddress'); | 1172 var staticIpAddress = onc.getActiveValue('StaticIPConfig.IPAddress'); |
| 1158 if (staticIpAddress != undefined) { | 1173 if (staticIpAddress != undefined) { |
| 1159 ipAutoConfig = 'user'; | 1174 ipAutoConfig = 'user'; |
| 1160 inetAddress.user = staticIpAddress; | 1175 inetAddress.user = staticIpAddress; |
| 1161 inetAddress.value = staticIpAddress; | 1176 inetAddress.value = staticIpAddress; |
| 1162 } | 1177 } |
| 1163 var staticPrefix = onc.getActiveValue('StaticIPConfig.RoutingPrefix'); | 1178 var staticPrefix = onc.getActiveValue('StaticIPConfig.RoutingPrefix'); |
| 1164 if (staticPrefix != undefined) { | 1179 if (staticPrefix != undefined) { |
| 1165 var staticNetmask = PrefixLengthToNetmask(staticPrefix); | 1180 var staticNetmask = prefixLengthToNetmask(staticPrefix); |
| 1166 inetNetmask.user = staticNetmask; | 1181 inetNetmask.user = staticNetmask; |
| 1167 inetNetmask.value = staticNetmask; | 1182 inetNetmask.value = staticNetmask; |
| 1168 } | 1183 } |
| 1169 var staticGateway = onc.getActiveValue('StaticIPConfig.Gateway'); | 1184 var staticGateway = onc.getActiveValue('StaticIPConfig.Gateway'); |
| 1170 if (staticGateway != undefined) { | 1185 if (staticGateway != undefined) { |
| 1171 inetGateway.user = staticGateway; | 1186 inetGateway.user = staticGateway; |
| 1172 inetGateway.value = staticGateway; | 1187 inetGateway.value = staticGateway; |
| 1173 } | 1188 } |
| 1174 var staticNameServers = onc.getActiveValue('StaticIPConfig.NameServers'); | 1189 var staticNameServers = onc.getActiveValue('StaticIPConfig.NameServers'); |
| 1175 if (staticNameServers) { | 1190 if (staticNameServers) { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1245 var signalStrength; | 1260 var signalStrength; |
| 1246 if (type == 'WiFi' || type == 'Wimax') | 1261 if (type == 'WiFi' || type == 'Wimax') |
| 1247 signalStrength = onc.getActiveValue(type + '.SignalStrength'); | 1262 signalStrength = onc.getActiveValue(type + '.SignalStrength'); |
| 1248 if (!signalStrength) | 1263 if (!signalStrength) |
| 1249 signalStrength = 0; | 1264 signalStrength = 0; |
| 1250 var strengthFormat = loadTimeData.getString('inetSignalStrengthFormat'); | 1265 var strengthFormat = loadTimeData.getString('inetSignalStrengthFormat'); |
| 1251 var strengthString = strengthFormat.replace('$1', signalStrength); | 1266 var strengthString = strengthFormat.replace('$1', signalStrength); |
| 1252 | 1267 |
| 1253 if (type == 'WiFi') { | 1268 if (type == 'WiFi') { |
| 1254 OptionsPage.showTab($('wifi-network-nav-tab')); | 1269 OptionsPage.showTab($('wifi-network-nav-tab')); |
| 1255 detailsPage.gsm = false; | |
| 1256 $('wifi-connection-state').textContent = connectionStateString; | |
| 1257 $('wifi-restricted-connectivity').textContent = restrictedString; | 1270 $('wifi-restricted-connectivity').textContent = restrictedString; |
| 1258 var ssid = onc.getActiveValue('WiFi.SSID'); | 1271 var ssid = onc.getActiveValue('WiFi.SSID'); |
| 1259 $('wifi-ssid').textContent = ssid ? ssid : networkName; | 1272 $('wifi-ssid').textContent = ssid ? ssid : networkName; |
| 1260 setOrHideParent('wifi-bssid', onc.getActiveValue('WiFi.BSSID')); | 1273 setOrHideParent('wifi-bssid', onc.getActiveValue('WiFi.BSSID')); |
| 1261 var security = onc.getWiFiSecurity(); | 1274 var security = onc.getWiFiSecurity(); |
| 1262 if (security == 'None') | 1275 if (security == 'None') |
| 1263 security = undefined; | 1276 security = undefined; |
| 1264 setOrHideParent('wifi-security', security); | 1277 setOrHideParent('wifi-security', security); |
| 1265 // Frequency is in MHz. | 1278 // Frequency is in MHz. |
| 1266 var frequency = onc.getActiveValue('WiFi.Frequency'); | 1279 var frequency = onc.getActiveValue('WiFi.Frequency'); |
| 1267 if (!frequency) | 1280 if (!frequency) |
| 1268 frequency = 0; | 1281 frequency = 0; |
| 1269 var frequencyFormat = loadTimeData.getString('inetFrequencyFormat'); | 1282 var frequencyFormat = loadTimeData.getString('inetFrequencyFormat'); |
| 1270 frequencyFormat = frequencyFormat.replace('$1', frequency); | 1283 frequencyFormat = frequencyFormat.replace('$1', frequency); |
| 1271 $('wifi-frequency').textContent = frequencyFormat; | 1284 $('wifi-frequency').textContent = frequencyFormat; |
| 1272 $('wifi-signal-strength').textContent = strengthString; | 1285 $('wifi-signal-strength').textContent = strengthString; |
| 1273 setOrHideParent('wifi-hardware-address', | 1286 setOrHideParent('wifi-hardware-address', |
| 1274 onc.getActiveValue('MacAddress')); | 1287 onc.getActiveValue('MacAddress')); |
| 1275 var priority = onc.getActiveValue('Priority'); | 1288 var priority = onc.getActiveValue('Priority'); |
| 1276 $('prefer-network-wifi').checked = priority > 0; | 1289 $('prefer-network-wifi').checked = priority > 0; |
| 1277 $('prefer-network-wifi').disabled = !remembered; | 1290 $('prefer-network-wifi').disabled = !remembered; |
| 1278 $('auto-connect-network-wifi').checked = | 1291 $('auto-connect-network-wifi').checked = |
| 1279 onc.getActiveValue('AutoConnect'); | 1292 onc.getActiveValue('AutoConnect'); |
| 1280 $('auto-connect-network-wifi').disabled = !remembered; | 1293 $('auto-connect-network-wifi').disabled = !remembered; |
| 1281 } else if (type == 'Wimax') { | 1294 } else if (type == 'Wimax') { |
| 1282 OptionsPage.showTab($('wimax-network-nav-tab')); | 1295 OptionsPage.showTab($('wimax-network-nav-tab')); |
| 1283 detailsPage.gsm = false; | |
| 1284 $('wimax-connection-state').textContent = connectionStateString; | |
| 1285 $('wimax-restricted-connectivity').textContent = restrictedString; | 1296 $('wimax-restricted-connectivity').textContent = restrictedString; |
| 1286 $('auto-connect-network-wimax').checked = | 1297 $('auto-connect-network-wimax').checked = |
| 1287 onc.getActiveValue('AutoConnect'); | 1298 onc.getActiveValue('AutoConnect'); |
| 1288 $('auto-connect-network-wimax').disabled = !remembered; | 1299 $('auto-connect-network-wimax').disabled = !remembered; |
| 1289 var identity = onc.getActiveValue('Wimax.EAP.Identity'); | 1300 var identity = onc.getActiveValue('Wimax.EAP.Identity'); |
| 1290 setOrHideParent('wimax-eap-identity', identity); | 1301 setOrHideParent('wimax-eap-identity', identity); |
| 1291 $('wimax-signal-strength').textContent = strengthString; | 1302 $('wimax-signal-strength').textContent = strengthString; |
| 1292 } else if (type == 'Cellular') { | 1303 } else if (type == 'Cellular') { |
| 1293 OptionsPage.showTab($('cellular-conn-nav-tab')); | 1304 OptionsPage.showTab($('cellular-conn-nav-tab')); |
| 1294 if (data.showCarrierSelect && data.currentCarrierIndex != -1) { | 1305 if (data.showCarrierSelect && data.currentCarrierIndex != -1) { |
| 1295 var carrierSelector = $('select-carrier'); | 1306 var carrierSelector = $('select-carrier'); |
| 1296 carrierSelector.onchange = DetailsInternetPage.handleCarrierChanged; | 1307 carrierSelector.onchange = DetailsInternetPage.handleCarrierChanged; |
| 1297 carrierSelector.options.length = 0; | 1308 carrierSelector.options.length = 0; |
| 1298 for (var i = 0; i < data.carriers.length; ++i) { | 1309 for (var i = 0; i < data.carriers.length; ++i) { |
| 1299 var option = document.createElement('option'); | 1310 var option = document.createElement('option'); |
| 1300 option.textContent = data.carriers[i]; | 1311 option.textContent = data.carriers[i]; |
| 1301 carrierSelector.add(option); | 1312 carrierSelector.add(option); |
| 1302 } | 1313 } |
| 1303 carrierSelector.selectedIndex = data.currentCarrierIndex; | 1314 carrierSelector.selectedIndex = data.currentCarrierIndex; |
| 1304 } else { | 1315 } else { |
| 1305 $('service-name').textContent = networkName; | 1316 $('service-name').textContent = networkName; |
| 1306 } | 1317 } |
| 1307 | 1318 |
| 1308 $('network-technology').textContent = | 1319 $('network-technology').textContent = |
| 1309 onc.getActiveValue('Cellular.NetworkTechnology'); | 1320 onc.getActiveValue('Cellular.NetworkTechnology'); |
| 1310 $('activation-state').textContent = | |
| 1311 onc.getTranslatedValue('Cellular.ActivationState'); | |
| 1312 $('roaming-state').textContent = | 1321 $('roaming-state').textContent = |
| 1313 onc.getTranslatedValue('Cellular.RoamingState'); | 1322 onc.getTranslatedValue('Cellular.RoamingState'); |
| 1314 $('cellular-restricted-connectivity').textContent = restrictedString; | 1323 $('cellular-restricted-connectivity').textContent = restrictedString; |
| 1315 $('error-state').textContent = data.errorMessage; | 1324 $('error-state').textContent = data.errorMessage; |
| 1316 $('manufacturer').textContent = | 1325 $('manufacturer').textContent = |
| 1317 onc.getActiveValue('Cellular.Manufacturer'); | 1326 onc.getActiveValue('Cellular.Manufacturer'); |
| 1318 $('model-id').textContent = onc.getActiveValue('Cellular.ModelID'); | 1327 $('model-id').textContent = onc.getActiveValue('Cellular.ModelID'); |
| 1319 $('firmware-revision').textContent = | 1328 $('firmware-revision').textContent = |
| 1320 onc.getActiveValue('Cellular.FirmwareRevision'); | 1329 onc.getActiveValue('Cellular.FirmwareRevision'); |
| 1321 $('hardware-revision').textContent = | 1330 $('hardware-revision').textContent = |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1340 updateHidden('#details-internet-page .gsm-only', false); | 1349 updateHidden('#details-internet-page .gsm-only', false); |
| 1341 updateHidden('#details-internet-page .cdma-only', false); | 1350 updateHidden('#details-internet-page .cdma-only', false); |
| 1342 | 1351 |
| 1343 // Show IMEI/ESN/MEID/MIN/PRL only if they are available. | 1352 // Show IMEI/ESN/MEID/MIN/PRL only if they are available. |
| 1344 setOrHideParent('esn', onc.getActiveValue('Cellular.ESN')); | 1353 setOrHideParent('esn', onc.getActiveValue('Cellular.ESN')); |
| 1345 setOrHideParent('imei', onc.getActiveValue('Cellular.IMEI')); | 1354 setOrHideParent('imei', onc.getActiveValue('Cellular.IMEI')); |
| 1346 setOrHideParent('meid', onc.getActiveValue('Cellular.MEID')); | 1355 setOrHideParent('meid', onc.getActiveValue('Cellular.MEID')); |
| 1347 setOrHideParent('min', onc.getActiveValue('Cellular.MIN')); | 1356 setOrHideParent('min', onc.getActiveValue('Cellular.MIN')); |
| 1348 setOrHideParent('prl-version', onc.getActiveValue('Cellular.PRLVersion')); | 1357 setOrHideParent('prl-version', onc.getActiveValue('Cellular.PRLVersion')); |
| 1349 | 1358 |
| 1350 var family = onc.getActiveValue('Cellular.Family'); | 1359 if (onc.getActiveValue('Cellular.Family') == 'GSM') { |
| 1351 detailsPage.gsm = family == 'GSM'; | |
| 1352 if (detailsPage.gsm) { | |
| 1353 $('iccid').textContent = onc.getActiveValue('Cellular.ICCID'); | 1360 $('iccid').textContent = onc.getActiveValue('Cellular.ICCID'); |
| 1354 $('imsi').textContent = onc.getActiveValue('Cellular.IMSI'); | 1361 $('imsi').textContent = onc.getActiveValue('Cellular.IMSI'); |
| 1355 detailsPage.initializeApnList_(onc); | 1362 detailsPage.initializeApnList_(onc); |
| 1356 var lockEnabled = | |
| 1357 onc.getActiveValue('Cellular.SIMLockStatus.LockEnabled'); | |
| 1358 $('sim-card-lock-enabled').checked = lockEnabled; | |
| 1359 $('change-pin').hidden = !lockEnabled; | |
| 1360 } | 1363 } |
| 1361 $('auto-connect-network-cellular').checked = | 1364 $('auto-connect-network-cellular').checked = |
| 1362 onc.getActiveValue('AutoConnect'); | 1365 onc.getActiveValue('AutoConnect'); |
| 1363 $('auto-connect-network-cellular').disabled = false; | 1366 $('auto-connect-network-cellular').disabled = false; |
| 1364 | |
| 1365 $('view-account-details').hidden = !data.showViewAccountButton; | |
| 1366 $('activate-details').hidden = !data.showActivateButton; | |
| 1367 if (data.showActivateButton) | |
| 1368 $('details-internet-login').hidden = true; | |
| 1369 } else if (type == 'VPN') { | 1367 } else if (type == 'VPN') { |
| 1370 OptionsPage.showTab($('vpn-nav-tab')); | 1368 OptionsPage.showTab($('vpn-nav-tab')); |
| 1371 detailsPage.gsm = false; | |
| 1372 $('inet-service-name').textContent = networkName; | 1369 $('inet-service-name').textContent = networkName; |
| 1373 $('inet-provider-type').textContent = | 1370 $('inet-provider-type').textContent = |
| 1374 onc.getTranslatedValue('VPN.Type'); | 1371 onc.getTranslatedValue('VPN.Type'); |
| 1375 var providerType = onc.getActiveValue('VPN.Type'); | 1372 var providerType = onc.getActiveValue('VPN.Type'); |
| 1376 var providerKey = 'VPN.' + providerType; | 1373 var providerKey = 'VPN.' + providerType; |
| 1377 $('inet-username').textContent = | 1374 $('inet-username').textContent = |
| 1378 onc.getActiveValue(providerKey + '.Username'); | 1375 onc.getActiveValue(providerKey + '.Username'); |
| 1379 var inetServerHostname = $('inet-server-hostname'); | 1376 var inetServerHostname = $('inet-server-hostname'); |
| 1380 inetServerHostname.value = onc.getActiveValue('VPN.Host'); | 1377 inetServerHostname.value = onc.getActiveValue('VPN.Host'); |
| 1381 inetServerHostname.resetHandler = function() { | 1378 inetServerHostname.resetHandler = function() { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1424 | 1421 |
| 1425 // Don't show page name in address bar and in history to prevent people | 1422 // Don't show page name in address bar and in history to prevent people |
| 1426 // navigate here by hand and solve issue with page session restore. | 1423 // navigate here by hand and solve issue with page session restore. |
| 1427 PageManager.showPageByName('detailsInternetPage', false); | 1424 PageManager.showPageByName('detailsInternetPage', false); |
| 1428 }; | 1425 }; |
| 1429 | 1426 |
| 1430 return { | 1427 return { |
| 1431 DetailsInternetPage: DetailsInternetPage | 1428 DetailsInternetPage: DetailsInternetPage |
| 1432 }; | 1429 }; |
| 1433 }); | 1430 }); |
| OLD | NEW |