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

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

Issue 563553004: Some additional network settings cleanup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue_279351_internet_options_9b
Patch Set: . Created 6 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/resources/options/chromeos/onc_data.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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
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
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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 } 379 }
374 380
375 return event; 381 return event;
376 }, 382 },
377 383
378 /** 384 /**
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_;
389 if (onc == undefined)
390 return; // May get called from a pref update before initialized.
383 391
384 // 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
385 // 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
386 // if you can't connect to any network. 394 // if you can't connect to any network.
387 // TODO(chocobo): Once ipconfig is moved to flimflam service objects, 395 // TODO(stevenjb): Support IP configuration (and improve the display)
388 // we need to redo this logic to allow configuration of all networks. 396 // for non connected networks.
397
389 var connected = onc.getActiveValue('ConnectionState') == 'Connected'; 398 var connected = onc.getActiveValue('ConnectionState') == 'Connected';
390 $('ipconfig-section').hidden = !connected && this.deviceConnected; 399 $('ipconfig-section').hidden = !connected && this.deviceConnected_;
391 $('ipconfig-dns-section').hidden = !connected && this.deviceConnected; 400 $('ipconfig-dns-section').hidden = !connected && this.deviceConnected_;
401
402 var isCellular = this.type_ == 'Cellular';
403 var isWiFi = this.type_ == 'WiFi';
404 var isWimax = this.type_ == 'Wimax';
405 var isVPN = this.type_ == 'VPN';
armansito 2014/09/11 17:01:15 Maybe add instance methods for these, which you ca
stevenjb 2014/09/11 17:22:33 Hm. I really only pulled these out for brevity in
armansito 2014/09/11 17:28:12 Up to you then. I'd just be consistent here and be
stevenjb 2014/09/11 17:38:23 Removed.
392 406
393 // Network type related. 407 // Network type related.
394 updateHidden('#details-internet-page .cellular-details', 408 updateHidden('#details-internet-page .cellular-details', !isCellular);
395 this.type_ != 'Cellular'); 409 updateHidden('#details-internet-page .wifi-details', !isWiFi);
396 updateHidden('#details-internet-page .wifi-details', 410 updateHidden('#details-internet-page .wimax-details', !isWimax);
397 this.type_ != 'WiFi'); 411 updateHidden('#details-internet-page .vpn-details', !isVPN);
398 updateHidden('#details-internet-page .wimax-details', 412
399 this.type_ != 'Wimax'); 413 updateHidden('#details-internet-page .proxy-details', !this.showProxy_);
400 updateHidden('#details-internet-page .vpn-details', this.type_ != 'VPN');
401 updateHidden('#details-internet-page .proxy-details', !this.showProxy);
402 414
403 // Cellular 415 // Cellular
404 416 if (isCellular) {
405 // Conditionally call updateHidden on .gsm-only, so that we don't unhide 417 // Hide gsm/cdma specific elements.
406 // a previously hidden element. 418 if (onc.getActiveValue('Cellular.Family') == 'GSM')
407 if (this.gsm) 419 updateHidden('#details-internet-page .cdma-only', true);
408 updateHidden('#details-internet-page .cdma-only', true); 420 else
409 else 421 updateHidden('#details-internet-page .gsm-only', true);
410 updateHidden('#details-internet-page .gsm-only', true); 422 }
411 423
412 // Wifi 424 // Wifi
413 425
414 // Hide network tab for VPN. 426 // Hide network tab for VPN.
415 updateHidden('#details-internet-page .network-details', 427 updateHidden('#details-internet-page .network-details', isVPN);
416 this.type_ == 'VPN');
417 428
418 // Password and shared. 429 // Password and shared.
419 var source = onc.getSource(); 430 var source = onc.getSource();
420 var shared = (source == 'Device' || source == 'DevicePolicy'); 431 var shared = (source == 'Device' || source == 'DevicePolicy');
421 updateHidden('#details-internet-page #password-details', 432 updateHidden('#details-internet-page #password-details',
422 this.type_ != 'WiFi' || onc.getWiFiSecurity() == 'None'); 433 this.type_ != 'WiFi' || onc.getWiFiSecurity() == 'None');
423 updateHidden('#details-internet-page #wifi-shared-network', !shared); 434 updateHidden('#details-internet-page #wifi-shared-network', !shared);
424 updateHidden('#details-internet-page #prefer-network', source == 'None'); 435 updateHidden('#details-internet-page #prefer-network', source == 'None');
425 436
426 // WiMAX. 437 // WiMAX.
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 var connectable = onc.getActiveValue('Connectable'); 591 var connectable = onc.getActiveValue('Connectable');
581 if (connectState != 'Connected' && 592 if (connectState != 'Connected' &&
582 (!connectable || onc.getWiFiSecurity() != 'None' || 593 (!connectable || onc.getWiFiSecurity() != 'None' ||
583 (this.type_ == 'Wimax' || this.type_ == 'VPN'))) { 594 (this.type_ == 'Wimax' || this.type_ == 'VPN'))) {
584 $('details-internet-configure').hidden = false; 595 $('details-internet-configure').hidden = false;
585 } else { 596 } else {
586 $('details-internet-configure').hidden = true; 597 $('details-internet-configure').hidden = true;
587 } 598 }
588 }, 599 },
589 600
601 updateDetails_: function(data) {
602 var onc = this.onc_;
603
604 if ('deviceConnected' in data)
605 this.deviceConnected_ = data.deviceConnected;
606
607 var connectionStateString = onc.getTranslatedValue('ConnectionState');
608 $('connection-state').textContent = connectionStateString;
609
610 var type = this.type_;
611 var showViewAccount = false;
612 var showActivate = false;
613 if (type == 'WiFi') {
614 $('wifi-connection-state').textContent = connectionStateString;
615 } else if (type == 'Wimax') {
616 $('wimax-connection-state').textContent = connectionStateString;
617 } else if (type == 'Cellular') {
618 $('activation-state').textContent =
619 onc.getTranslatedValue('Cellular.ActivationState');
620 if (onc.getActiveValue('Cellular.Family') == 'GSM') {
621 var lockEnabled =
622 onc.getActiveValue('Cellular.SIMLockStatus.LockEnabled');
623 $('sim-card-lock-enabled').checked = lockEnabled;
624 $('change-pin').hidden = !lockEnabled;
625 }
626 showViewAccount = data.showViewAccountButton;
627 var activationState = onc.getActiveValue('Cellular.ActivationState');
628 showActivate = activationState == 'NotActivated' ||
629 activationState == 'PartiallyActivated';
630 }
631
632 $('view-account-details').hidden = !showViewAccount;
633 $('activate-details').hidden = !showActivate;
634 // If activation is not complete, hide the login button.
635 if (showActivate)
636 $('details-internet-login').hidden = true;
637 },
638
590 populateHeader_: function() { 639 populateHeader_: function() {
591 var onc = this.onc_; 640 var onc = this.onc_;
592 641
593 $('network-details-title').textContent = onc.getTranslatedValue('Name'); 642 $('network-details-title').textContent = onc.getTranslatedValue('Name');
594 var connectionState = onc.getActiveValue('ConnectionState'); 643 var connectionState = onc.getActiveValue('ConnectionState');
595 var connectionStateString = onc.getTranslatedValue('ConnectionState'); 644 var connectionStateString = onc.getTranslatedValue('ConnectionState');
596 $('network-details-subtitle-status').textContent = connectionStateString; 645 $('network-details-subtitle-status').textContent = connectionStateString;
646
597 var typeKey; 647 var typeKey;
598 var type = this.type_; 648 var type = this.type_;
599 if (type == 'Ethernet') 649 if (type == 'Ethernet')
600 typeKey = 'ethernetTitle'; 650 typeKey = 'ethernetTitle';
601 else if (type == 'WiFi') 651 else if (type == 'WiFi')
602 typeKey = 'wifiTitle'; 652 typeKey = 'wifiTitle';
603 else if (type == 'Wimax') 653 else if (type == 'Wimax')
604 typeKey = 'wimaxTitle'; 654 typeKey = 'wimaxTitle';
605 else if (type == 'Cellular') 655 else if (type == 'Cellular')
606 typeKey = 'cellularTitle'; 656 typeKey = 'cellularTitle';
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 879
830 /** 880 /**
831 * Displays the InternetDetails dialog with only the proxy settings visible. 881 * Displays the InternetDetails dialog with only the proxy settings visible.
832 */ 882 */
833 DetailsInternetPage.showProxySettings = function() { 883 DetailsInternetPage.showProxySettings = function() {
834 var detailsPage = DetailsInternetPage.getInstance(); 884 var detailsPage = DetailsInternetPage.getInstance();
835 $('network-details-header').hidden = true; 885 $('network-details-header').hidden = true;
836 $('activate-details').hidden = true; 886 $('activate-details').hidden = true;
837 $('view-account-details').hidden = true; 887 $('view-account-details').hidden = true;
838 $('web-proxy-auto-discovery').hidden = true; 888 $('web-proxy-auto-discovery').hidden = true;
839 detailsPage.showProxy = true; 889 detailsPage.showProxy_ = true;
840 updateHidden('#internet-tab', true); 890 updateHidden('#internet-tab', true);
841 updateHidden('#details-tab-strip', true); 891 updateHidden('#details-tab-strip', true);
842 updateHidden('#details-internet-page .action-area', true); 892 updateHidden('#details-internet-page .action-area', true);
843 detailsPage.updateControls(); 893 detailsPage.updateControls();
844 detailsPage.visible = true; 894 detailsPage.visible = true;
845 chrome.send('coreOptionsUserMetricsAction', 895 chrome.send('coreOptionsUserMetricsAction',
846 ['Options_NetworkShowProxyTab']); 896 ['Options_NetworkShowProxyTab']);
847 }; 897 };
848 898
849 /** 899 /**
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 return; 1062 return;
1013 1063
1014 if (update.servicePath != detailsPage.servicePath_) 1064 if (update.servicePath != detailsPage.servicePath_)
1015 return; 1065 return;
1016 1066
1017 // Update our cached data object. 1067 // Update our cached data object.
1018 var onc = detailsPage.onc_; 1068 var onc = detailsPage.onc_;
1019 onc.updateData(update); 1069 onc.updateData(update);
1020 1070
1021 detailsPage.populateHeader_(); 1071 detailsPage.populateHeader_();
1022
1023 var connectionState = onc.getActiveValue('ConnectionState');
1024 var connectionStateString = onc.getTranslatedValue('ConnectionState');
1025 if ('deviceConnected' in update)
1026 detailsPage.deviceConnected = update.deviceConnected;
1027 $('connection-state').textContent = connectionStateString;
1028
1029 detailsPage.updateConnectionButtonVisibilty_(); 1072 detailsPage.updateConnectionButtonVisibilty_();
1030 1073 detailsPage.updateDetails_(update);
1031 var type = detailsPage.type_;
1032 if (type == 'WiFi') {
1033 $('wifi-connection-state').textContent = connectionStateString;
1034 } else if (type == 'Wimax') {
1035 $('wimax-connection-state').textContent = connectionStateString;
1036 } else if (type == 'Cellular') {
1037 $('activation-state').textContent =
1038 onc.getTranslatedValue('Cellular.ActivationState');
1039 // These properties are only defined if they are true.
1040 $('view-account-details').hidden = !update.showViewAccountButton;
1041 $('activate-details').hidden = !update.showActivateButton;
1042 if (update.showActivateButton)
1043 $('details-internet-login').hidden = true;
1044
1045 if (detailsPage.gsm) {
1046 var lockEnabled =
1047 onc.getActiveValue('Cellular.SIMLockStatus.LockEnabled');
1048 $('sim-card-lock-enabled').checked = lockEnabled;
1049 $('change-pin').hidden = !lockEnabled;
1050 }
1051 }
1052 }; 1074 };
1053 1075
1054 DetailsInternetPage.showDetailedInfo = function(data) { 1076 DetailsInternetPage.showDetailedInfo = function(data) {
1055 var onc = new OncData(data); 1077 var onc = new OncData(data);
1056 1078
1057 var detailsPage = DetailsInternetPage.getInstance(); 1079 var detailsPage = DetailsInternetPage.getInstance();
1058 detailsPage.onc_ = onc; 1080 detailsPage.onc_ = onc;
1059 var type = onc.getActiveValue('Type'); 1081 var type = onc.getActiveValue('Type');
1060 detailsPage.type_ = type; 1082 detailsPage.type_ = type;
1061 detailsPage.servicePath_ = data.servicePath; 1083 detailsPage.servicePath_ = data.servicePath;
1062 1084
1063 detailsPage.populateHeader_(); 1085 detailsPage.populateHeader_();
1086 detailsPage.updateConnectionButtonVisibilty_();
1087 detailsPage.updateDetails_(data);
1064 1088
1065 $('activate-details').hidden = true; 1089 // TODO(stevenjb): Some of the setup below should be moved to
1066 $('view-account-details').hidden = true; 1090 // updateDetails_() so that updates are reflected in the UI.
1067
1068 detailsPage.updateConnectionButtonVisibilty_();
1069
1070 $('web-proxy-auto-discovery').hidden = true;
1071
1072 detailsPage.deviceConnected = data.deviceConnected;
1073 1091
1074 // Only show proxy for remembered networks. 1092 // Only show proxy for remembered networks.
1075 var remembered = onc.getSource() != 'None'; 1093 var remembered = onc.getSource() != 'None';
1076 if (remembered) { 1094 if (remembered) {
1077 detailsPage.showProxy = true; 1095 detailsPage.showProxy_ = true;
1096 // Inform Chrome which network to use for proxy configuration.
1078 chrome.send('selectNetwork', [detailsPage.servicePath_]); 1097 chrome.send('selectNetwork', [detailsPage.servicePath_]);
1079 } else { 1098 } else {
1080 detailsPage.showProxy = false; 1099 detailsPage.showProxy_ = false;
1081 } 1100 }
1082 1101
1083 var connectionStateString = onc.getTranslatedValue('ConnectionState'); 1102 $('web-proxy-auto-discovery').hidden = true;
1084 $('connection-state').textContent = connectionStateString; 1103
1085 var restricted = onc.getActiveValue('RestrictedConnectivity'); 1104 var restricted = onc.getActiveValue('RestrictedConnectivity');
1086 var restrictedString = loadTimeData.getString( 1105 var restrictedString = loadTimeData.getString(
1087 restricted ? 'restrictedYes' : 'restrictedNo'); 1106 restricted ? 'restrictedYes' : 'restrictedNo');
1088 1107
1089 var inetAddress = {}; 1108 var inetAddress = {};
1090 var inetNetmask = {}; 1109 var inetNetmask = {};
1091 var inetGateway = {}; 1110 var inetGateway = {};
1092 1111
1093 var inetNameServersString; 1112 var inetNameServersString;
1094 1113
1095 var ipconfigList = onc.getActiveValue('IPConfigs'); 1114 var ipconfigList = onc.getActiveValue('IPConfigs');
1096 if (Array.isArray(ipconfigList)) { 1115 if (Array.isArray(ipconfigList)) {
1097 for (var i = 0; i < ipconfigList.length; ++i) { 1116 for (var i = 0; i < ipconfigList.length; ++i) {
1098 var ipconfig = ipconfigList[i]; 1117 var ipconfig = ipconfigList[i];
1099 var ipType = ipconfig['Type']; 1118 var ipType = ipconfig['Type'];
1100 if (ipType != 'IPv4') { 1119 if (ipType != 'IPv4') {
1101 // TODO(stevenjb): Handle IPv6 properties. 1120 // TODO(stevenjb): Handle IPv6 properties.
1102 continue; 1121 continue;
1103 } 1122 }
1104 var address = ipconfig['IPAddress']; 1123 var address = ipconfig['IPAddress'];
1105 inetAddress.automatic = address; 1124 inetAddress.automatic = address;
1106 inetAddress.value = address; 1125 inetAddress.value = address;
1107 var netmask = PrefixLengthToNetmask(ipconfig['RoutingPrefix']); 1126 var netmask = prefixLengthToNetmask(ipconfig['RoutingPrefix']);
1108 inetNetmask.automatic = netmask; 1127 inetNetmask.automatic = netmask;
1109 inetNetmask.value = netmask; 1128 inetNetmask.value = netmask;
1110 var gateway = ipconfig['Gateway']; 1129 var gateway = ipconfig['Gateway'];
1111 inetGateway.automatic = gateway; 1130 inetGateway.automatic = gateway;
1112 inetGateway.value = gateway; 1131 inetGateway.value = gateway;
1113 if ('WebProxyAutoDiscoveryUrl' in ipconfig) { 1132 if ('WebProxyAutoDiscoveryUrl' in ipconfig) {
1114 $('web-proxy-auto-discovery').hidden = false; 1133 $('web-proxy-auto-discovery').hidden = false;
1115 $('web-proxy-auto-discovery-url').value = 1134 $('web-proxy-auto-discovery-url').value =
1116 ipconfig['WebProxyAutoDiscoveryUrl']; 1135 ipconfig['WebProxyAutoDiscoveryUrl'];
1117 } 1136 }
1118 if ('NameServers' in ipconfig) { 1137 if ('NameServers' in ipconfig) {
1119 var inetNameServers = ipconfig['NameServers']; 1138 var inetNameServers = ipconfig['NameServers'];
1120 inetNameServers = inetNameServers.sort(); 1139 inetNameServers = inetNameServers.sort();
1121 inetNameServersString = inetNameServers.join(','); 1140 inetNameServersString = inetNameServers.join(',');
1122 } 1141 }
1123 break; // Use the first IPv4 entry. 1142 break; // Use the first IPv4 entry.
1124 } 1143 }
1125 } 1144 }
1126 1145
1127 // Override the "automatic" values with the real saved DHCP values, 1146 // Override the "automatic" values with the real saved DHCP values,
1128 // if they are set. 1147 // if they are set.
1129 var savedNameServersString; 1148 var savedNameServersString;
1130 var savedIpAddress = onc.getActiveValue('SavedIPConfig.IPAddress'); 1149 var savedIpAddress = onc.getActiveValue('SavedIPConfig.IPAddress');
1131 if (savedIpAddress != undefined) { 1150 if (savedIpAddress != undefined) {
1132 inetAddress.automatic = savedIpAddress; 1151 inetAddress.automatic = savedIpAddress;
1133 inetAddress.value = savedIpAddress; 1152 inetAddress.value = savedIpAddress;
1134 } 1153 }
1135 var savedPrefix = onc.getActiveValue('SavedIPConfig.RoutingPrefix'); 1154 var savedPrefix = onc.getActiveValue('SavedIPConfig.RoutingPrefix');
1136 if (savedPrefix != undefined) { 1155 if (savedPrefix != undefined) {
1137 var savedNetmask = PrefixLengthToNetmask(savedPrefix); 1156 var savedNetmask = prefixLengthToNetmask(savedPrefix);
1138 inetNetmask.automatic = savedNetmask; 1157 inetNetmask.automatic = savedNetmask;
1139 inetNetmask.value = savedNetmask; 1158 inetNetmask.value = savedNetmask;
1140 } 1159 }
1141 var savedGateway = onc.getActiveValue('SavedIPConfig.Gateway'); 1160 var savedGateway = onc.getActiveValue('SavedIPConfig.Gateway');
1142 if (savedGateway != undefined) { 1161 if (savedGateway != undefined) {
1143 inetGateway.automatic = savedGateway; 1162 inetGateway.automatic = savedGateway;
1144 inetGateway.value = savedGateway; 1163 inetGateway.value = savedGateway;
1145 } 1164 }
1146 var savedNameServers = onc.getActiveValue('SavedIPConfig.NameServers'); 1165 var savedNameServers = onc.getActiveValue('SavedIPConfig.NameServers');
1147 if (savedNameServers) { 1166 if (savedNameServers) {
1148 savedNameServers = savedNameServers.sort(); 1167 savedNameServers = savedNameServers.sort();
1149 savedNameServersString = savedNameServers.join(','); 1168 savedNameServersString = savedNameServers.join(',');
1150 } 1169 }
1151 1170
1152 var ipAutoConfig = 'automatic'; 1171 var ipAutoConfig = 'automatic';
1153 1172
1154 var staticNameServersString; 1173 var staticNameServersString;
1155 var staticIpAddress = onc.getActiveValue('StaticIPConfig.IPAddress'); 1174 var staticIpAddress = onc.getActiveValue('StaticIPConfig.IPAddress');
1156 if (staticIpAddress != undefined) { 1175 if (staticIpAddress != undefined) {
1157 ipAutoConfig = 'user'; 1176 ipAutoConfig = 'user';
1158 inetAddress.user = staticIpAddress; 1177 inetAddress.user = staticIpAddress;
1159 inetAddress.value = staticIpAddress; 1178 inetAddress.value = staticIpAddress;
1160 } 1179 }
1161 var staticPrefix = onc.getActiveValue('StaticIPConfig.RoutingPrefix'); 1180 var staticPrefix = onc.getActiveValue('StaticIPConfig.RoutingPrefix');
1162 if (staticPrefix != undefined) { 1181 if (staticPrefix != undefined) {
1163 var staticNetmask = PrefixLengthToNetmask(staticPrefix); 1182 var staticNetmask = prefixLengthToNetmask(staticPrefix);
1164 inetNetmask.user = staticNetmask; 1183 inetNetmask.user = staticNetmask;
1165 inetNetmask.value = staticNetmask; 1184 inetNetmask.value = staticNetmask;
1166 } 1185 }
1167 var staticGateway = onc.getActiveValue('StaticIPConfig.Gateway'); 1186 var staticGateway = onc.getActiveValue('StaticIPConfig.Gateway');
1168 if (staticGateway != undefined) { 1187 if (staticGateway != undefined) {
1169 inetGateway.user = staticGateway; 1188 inetGateway.user = staticGateway;
1170 inetGateway.value = staticGateway; 1189 inetGateway.value = staticGateway;
1171 } 1190 }
1172 var staticNameServers = onc.getActiveValue('StaticIPConfig.NameServers'); 1191 var staticNameServers = onc.getActiveValue('StaticIPConfig.NameServers');
1173 if (staticNameServers) { 1192 if (staticNameServers) {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1243 var signalStrength; 1262 var signalStrength;
1244 if (type == 'WiFi' || type == 'Wimax') 1263 if (type == 'WiFi' || type == 'Wimax')
1245 signalStrength = onc.getActiveValue(type + '.SignalStrength'); 1264 signalStrength = onc.getActiveValue(type + '.SignalStrength');
1246 if (!signalStrength) 1265 if (!signalStrength)
1247 signalStrength = 0; 1266 signalStrength = 0;
1248 var strengthFormat = loadTimeData.getString('inetSignalStrengthFormat'); 1267 var strengthFormat = loadTimeData.getString('inetSignalStrengthFormat');
1249 var strengthString = strengthFormat.replace('$1', signalStrength); 1268 var strengthString = strengthFormat.replace('$1', signalStrength);
1250 1269
1251 if (type == 'WiFi') { 1270 if (type == 'WiFi') {
1252 OptionsPage.showTab($('wifi-network-nav-tab')); 1271 OptionsPage.showTab($('wifi-network-nav-tab'));
1253 detailsPage.gsm = false;
1254 $('wifi-connection-state').textContent = connectionStateString;
1255 $('wifi-restricted-connectivity').textContent = restrictedString; 1272 $('wifi-restricted-connectivity').textContent = restrictedString;
1256 var ssid = onc.getActiveValue('WiFi.SSID'); 1273 var ssid = onc.getActiveValue('WiFi.SSID');
1257 $('wifi-ssid').textContent = ssid ? ssid : networkName; 1274 $('wifi-ssid').textContent = ssid ? ssid : networkName;
1258 setOrHideParent('wifi-bssid', onc.getActiveValue('WiFi.BSSID')); 1275 setOrHideParent('wifi-bssid', onc.getActiveValue('WiFi.BSSID'));
1259 var security = onc.getWiFiSecurity(); 1276 var security = onc.getWiFiSecurity();
1260 if (security == 'None') 1277 if (security == 'None')
1261 security = undefined; 1278 security = undefined;
1262 setOrHideParent('wifi-security', security); 1279 setOrHideParent('wifi-security', security);
1263 // Frequency is in MHz. 1280 // Frequency is in MHz.
1264 var frequency = onc.getActiveValue('WiFi.Frequency'); 1281 var frequency = onc.getActiveValue('WiFi.Frequency');
1265 if (!frequency) 1282 if (!frequency)
1266 frequency = 0; 1283 frequency = 0;
1267 var frequencyFormat = loadTimeData.getString('inetFrequencyFormat'); 1284 var frequencyFormat = loadTimeData.getString('inetFrequencyFormat');
1268 frequencyFormat = frequencyFormat.replace('$1', frequency); 1285 frequencyFormat = frequencyFormat.replace('$1', frequency);
1269 $('wifi-frequency').textContent = frequencyFormat; 1286 $('wifi-frequency').textContent = frequencyFormat;
1270 $('wifi-signal-strength').textContent = strengthString; 1287 $('wifi-signal-strength').textContent = strengthString;
1271 setOrHideParent('wifi-hardware-address', 1288 setOrHideParent('wifi-hardware-address',
1272 onc.getActiveValue('MacAddress')); 1289 onc.getActiveValue('MacAddress'));
1273 var priority = onc.getActiveValue('Priority'); 1290 var priority = onc.getActiveValue('Priority');
1274 $('prefer-network-wifi').checked = priority > 0; 1291 $('prefer-network-wifi').checked = priority > 0;
1275 $('prefer-network-wifi').disabled = !remembered; 1292 $('prefer-network-wifi').disabled = !remembered;
1276 $('auto-connect-network-wifi').checked = 1293 $('auto-connect-network-wifi').checked =
1277 onc.getActiveValue('AutoConnect'); 1294 onc.getActiveValue('AutoConnect');
1278 $('auto-connect-network-wifi').disabled = !remembered; 1295 $('auto-connect-network-wifi').disabled = !remembered;
1279 } else if (type == 'Wimax') { 1296 } else if (type == 'Wimax') {
1280 OptionsPage.showTab($('wimax-network-nav-tab')); 1297 OptionsPage.showTab($('wimax-network-nav-tab'));
1281 detailsPage.gsm = false;
1282 $('wimax-connection-state').textContent = connectionStateString;
1283 $('wimax-restricted-connectivity').textContent = restrictedString; 1298 $('wimax-restricted-connectivity').textContent = restrictedString;
1284 $('auto-connect-network-wimax').checked = 1299 $('auto-connect-network-wimax').checked =
1285 onc.getActiveValue('AutoConnect'); 1300 onc.getActiveValue('AutoConnect');
1286 $('auto-connect-network-wimax').disabled = !remembered; 1301 $('auto-connect-network-wimax').disabled = !remembered;
1287 var identity = onc.getActiveValue('Wimax.EAP.Identity'); 1302 var identity = onc.getActiveValue('Wimax.EAP.Identity');
1288 setOrHideParent('wimax-eap-identity', identity); 1303 setOrHideParent('wimax-eap-identity', identity);
1289 $('wimax-signal-strength').textContent = strengthString; 1304 $('wimax-signal-strength').textContent = strengthString;
1290 } else if (type == 'Cellular') { 1305 } else if (type == 'Cellular') {
1291 OptionsPage.showTab($('cellular-conn-nav-tab')); 1306 OptionsPage.showTab($('cellular-conn-nav-tab'));
1292 if (data.showCarrierSelect && data.currentCarrierIndex != -1) { 1307 if (data.showCarrierSelect && data.currentCarrierIndex != -1) {
1293 var carrierSelector = $('select-carrier'); 1308 var carrierSelector = $('select-carrier');
1294 carrierSelector.onchange = DetailsInternetPage.handleCarrierChanged; 1309 carrierSelector.onchange = DetailsInternetPage.handleCarrierChanged;
1295 carrierSelector.options.length = 0; 1310 carrierSelector.options.length = 0;
1296 for (var i = 0; i < data.carriers.length; ++i) { 1311 for (var i = 0; i < data.carriers.length; ++i) {
1297 var option = document.createElement('option'); 1312 var option = document.createElement('option');
1298 option.textContent = data.carriers[i]; 1313 option.textContent = data.carriers[i];
1299 carrierSelector.add(option); 1314 carrierSelector.add(option);
1300 } 1315 }
1301 carrierSelector.selectedIndex = data.currentCarrierIndex; 1316 carrierSelector.selectedIndex = data.currentCarrierIndex;
1302 } else { 1317 } else {
1303 $('service-name').textContent = networkName; 1318 $('service-name').textContent = networkName;
1304 } 1319 }
1305 1320
1306 $('network-technology').textContent = 1321 $('network-technology').textContent =
1307 onc.getActiveValue('Cellular.NetworkTechnology'); 1322 onc.getActiveValue('Cellular.NetworkTechnology');
1308 $('activation-state').textContent =
1309 onc.getTranslatedValue('Cellular.ActivationState');
1310 $('roaming-state').textContent = 1323 $('roaming-state').textContent =
1311 onc.getTranslatedValue('Cellular.RoamingState'); 1324 onc.getTranslatedValue('Cellular.RoamingState');
1312 $('cellular-restricted-connectivity').textContent = restrictedString; 1325 $('cellular-restricted-connectivity').textContent = restrictedString;
1313 $('error-state').textContent = data.errorMessage; 1326 $('error-state').textContent = data.errorMessage;
1314 $('manufacturer').textContent = 1327 $('manufacturer').textContent =
1315 onc.getActiveValue('Cellular.Manufacturer'); 1328 onc.getActiveValue('Cellular.Manufacturer');
1316 $('model-id').textContent = onc.getActiveValue('Cellular.ModelID'); 1329 $('model-id').textContent = onc.getActiveValue('Cellular.ModelID');
1317 $('firmware-revision').textContent = 1330 $('firmware-revision').textContent =
1318 onc.getActiveValue('Cellular.FirmwareRevision'); 1331 onc.getActiveValue('Cellular.FirmwareRevision');
1319 $('hardware-revision').textContent = 1332 $('hardware-revision').textContent =
(...skipping 18 matching lines...) Expand all
1338 updateHidden('#details-internet-page .gsm-only', false); 1351 updateHidden('#details-internet-page .gsm-only', false);
1339 updateHidden('#details-internet-page .cdma-only', false); 1352 updateHidden('#details-internet-page .cdma-only', false);
1340 1353
1341 // Show IMEI/ESN/MEID/MIN/PRL only if they are available. 1354 // Show IMEI/ESN/MEID/MIN/PRL only if they are available.
1342 setOrHideParent('esn', onc.getActiveValue('Cellular.ESN')); 1355 setOrHideParent('esn', onc.getActiveValue('Cellular.ESN'));
1343 setOrHideParent('imei', onc.getActiveValue('Cellular.IMEI')); 1356 setOrHideParent('imei', onc.getActiveValue('Cellular.IMEI'));
1344 setOrHideParent('meid', onc.getActiveValue('Cellular.MEID')); 1357 setOrHideParent('meid', onc.getActiveValue('Cellular.MEID'));
1345 setOrHideParent('min', onc.getActiveValue('Cellular.MIN')); 1358 setOrHideParent('min', onc.getActiveValue('Cellular.MIN'));
1346 setOrHideParent('prl-version', onc.getActiveValue('Cellular.PRLVersion')); 1359 setOrHideParent('prl-version', onc.getActiveValue('Cellular.PRLVersion'));
1347 1360
1348 var family = onc.getActiveValue('Cellular.Family'); 1361 if (onc.getActiveValue('Cellular.Family') == 'GSM') {
1349 detailsPage.gsm = family == 'GSM';
1350 if (detailsPage.gsm) {
1351 $('iccid').textContent = onc.getActiveValue('Cellular.ICCID'); 1362 $('iccid').textContent = onc.getActiveValue('Cellular.ICCID');
1352 $('imsi').textContent = onc.getActiveValue('Cellular.IMSI'); 1363 $('imsi').textContent = onc.getActiveValue('Cellular.IMSI');
1353 detailsPage.initializeApnList_(onc); 1364 detailsPage.initializeApnList_(onc);
1354 var lockEnabled =
1355 onc.getActiveValue('Cellular.SIMLockStatus.LockEnabled');
1356 $('sim-card-lock-enabled').checked = lockEnabled;
1357 $('change-pin').hidden = !lockEnabled;
1358 } 1365 }
1359 $('auto-connect-network-cellular').checked = 1366 $('auto-connect-network-cellular').checked =
1360 onc.getActiveValue('AutoConnect'); 1367 onc.getActiveValue('AutoConnect');
1361 $('auto-connect-network-cellular').disabled = false; 1368 $('auto-connect-network-cellular').disabled = false;
1362
1363 $('view-account-details').hidden = !data.showViewAccountButton;
1364 $('activate-details').hidden = !data.showActivateButton;
1365 if (data.showActivateButton)
1366 $('details-internet-login').hidden = true;
1367 } else if (type == 'VPN') { 1369 } else if (type == 'VPN') {
1368 OptionsPage.showTab($('vpn-nav-tab')); 1370 OptionsPage.showTab($('vpn-nav-tab'));
1369 detailsPage.gsm = false;
1370 $('inet-service-name').textContent = networkName; 1371 $('inet-service-name').textContent = networkName;
1371 $('inet-provider-type').textContent = 1372 $('inet-provider-type').textContent =
1372 onc.getTranslatedValue('VPN.Type'); 1373 onc.getTranslatedValue('VPN.Type');
1373 var providerType = onc.getActiveValue('VPN.Type'); 1374 var providerType = onc.getActiveValue('VPN.Type');
1374 var providerKey = 'VPN.' + providerType; 1375 var providerKey = 'VPN.' + providerType;
1375 $('inet-username').textContent = 1376 $('inet-username').textContent =
1376 onc.getActiveValue(providerKey + '.Username'); 1377 onc.getActiveValue(providerKey + '.Username');
1377 var inetServerHostname = $('inet-server-hostname'); 1378 var inetServerHostname = $('inet-server-hostname');
1378 inetServerHostname.value = onc.getActiveValue('VPN.Host'); 1379 inetServerHostname.value = onc.getActiveValue('VPN.Host');
1379 inetServerHostname.resetHandler = function() { 1380 inetServerHostname.resetHandler = function() {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1422 1423
1423 // Don't show page name in address bar and in history to prevent people 1424 // Don't show page name in address bar and in history to prevent people
1424 // navigate here by hand and solve issue with page session restore. 1425 // navigate here by hand and solve issue with page session restore.
1425 PageManager.showPageByName('detailsInternetPage', false); 1426 PageManager.showPageByName('detailsInternetPage', false);
1426 }; 1427 };
1427 1428
1428 return { 1429 return {
1429 DetailsInternetPage: DetailsInternetPage 1430 DetailsInternetPage: DetailsInternetPage
1430 }; 1431 };
1431 }); 1432 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/options/chromeos/onc_data.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698