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

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

Issue 544173013: Make network settings functions more closely match networkingPrivate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue_279351_internet_options_10c
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
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
11 // networkingPrivate API. See network_config.js. 11 // networkingPrivate API. See network_config.js.
12 // See crbug.com/279351 for more info. 12 // See crbug.com/279351 for more info.
13 13
14 /** @typedef {{address: (string|undefined), 14 /** @typedef {{address: (string|undefined),
15 * gateway: (string|undefined), 15 * gateway: (string|undefined),
16 * nameServers: (string|undefined), 16 * nameServers: (string|undefined),
17 * netmask: (string|undefined), 17 * netmask: (string|undefined),
18 * prefixLength: (number|undefined)}} 18 * prefixLength: (number|undefined)}}
19 * @see chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc 19 * @see chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
20 */ 20 */
21 var IPInfo; 21 var IPInfo;
22 22
23 /** 23 /**
24 * InternetDetailedInfo argument passed to showDetailedInfo. 24 * InternetDetailedInfo argument passed to showDetailedInfo.
25 * @see chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc 25 * @see chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
26 * @typedef {{ 26 * @typedef {{
27 * deviceConnected: (boolean|undefined),
28 * errorMessage: (string|undefined),
29 * servicePath: string, 27 * servicePath: string,
30 * showCarrierSelect: (boolean|undefined), 28 * showCarrierSelect: (boolean|undefined),
31 * showViewAccountButton: (boolean|undefined) 29 * showViewAccountButton: (boolean|undefined)
32 * }} 30 * }}
33 */ 31 */
34 var InternetDetailedInfo; 32 var InternetDetailedInfo;
35 33
36 cr.define('options.internet', function() { 34 cr.define('options.internet', function() {
37 var OncData = cr.onc.OncData; 35 var OncData = cr.onc.OncData;
38 var Page = cr.ui.pageManager.Page; 36 var Page = cr.ui.pageManager.Page;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 * @extends {cr.ui.pageManager.Page} 172 * @extends {cr.ui.pageManager.Page}
175 */ 173 */
176 function DetailsInternetPage() { 174 function DetailsInternetPage() {
177 // Cached Apn properties 175 // Cached Apn properties
178 this.userApnIndex_ = -1; 176 this.userApnIndex_ = -1;
179 this.selectedApnIndex_ = -1; 177 this.selectedApnIndex_ = -1;
180 this.userApn_ = {}; 178 this.userApn_ = {};
181 // We show the Proxy configuration tab for remembered networks and when 179 // We show the Proxy configuration tab for remembered networks and when
182 // configuring a proxy from the login screen. 180 // configuring a proxy from the login screen.
183 this.showProxy_ = false; 181 this.showProxy_ = false;
184 // TODO(stevenjb): Use networkingPrivate.getNetworks to set this. 182 // In Chrome we sometimes want to enable the Cellular carrier select UI.
185 this.deviceConnected_ = false; 183 this.showCarrierSelect_ = false;
184 // In Chrome we sometimes want to show the 'View Account' button.
185 this.showViewAccountButton_ = false;
186
186 Page.call(this, 'detailsInternetPage', '', 'details-internet-page'); 187 Page.call(this, 'detailsInternetPage', '', 'details-internet-page');
187 } 188 }
188 189
189 cr.addSingletonGetter(DetailsInternetPage); 190 cr.addSingletonGetter(DetailsInternetPage);
190 191
191 DetailsInternetPage.prototype = { 192 DetailsInternetPage.prototype = {
192 __proto__: Page.prototype, 193 __proto__: Page.prototype,
193 194
194 /** @override */ 195 /** @override */
195 initializePage: function() { 196 initializePage: function() {
196 Page.prototype.initializePage.call(this); 197 Page.prototype.initializePage.call(this);
197 this.initializePageContents_(); 198 this.initializePageContents_();
198 this.showNetworkDetails_(); 199 this.showNetworkDetails_();
199 }, 200 },
200 201
201 /** 202 /**
202 * Auto-activates the network details dialog if network information 203 * Auto-activates the network details dialog if network information
203 * is included in the URL. 204 * is included in the URL.
204 */ 205 */
205 showNetworkDetails_: function() { 206 showNetworkDetails_: function() {
206 var servicePath = parseQueryParams(window.location).servicePath; 207 var servicePath = parseQueryParams(window.location).servicePath;
207 if (!servicePath || !servicePath.length) 208 if (!servicePath || !servicePath.length)
208 return; 209 return;
209 var networkType = ''; // ignored for 'options' 210 var networkType = ''; // ignored for 'sendDetails'
210 chrome.send('networkCommand', [networkType, servicePath, 'options']); 211 chrome.send('networkCommand', [networkType, servicePath, 'sendDetails']);
211 }, 212 },
212 213
213 /** 214 /**
214 * Initializes the contents of the page. 215 * Initializes the contents of the page.
215 */ 216 */
216 initializePageContents_: function() { 217 initializePageContents_: function() {
217 $('details-internet-dismiss').addEventListener('click', function(event) { 218 $('details-internet-dismiss').addEventListener('click', function(event) {
218 DetailsInternetPage.setDetails(); 219 DetailsInternetPage.setDetails();
219 }); 220 });
220 221
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 $('select-apn').addEventListener('change', function(event) { 261 $('select-apn').addEventListener('change', function(event) {
261 DetailsInternetPage.getInstance().selectApn_(); 262 DetailsInternetPage.getInstance().selectApn_();
262 }); 263 });
263 264
264 $('sim-card-lock-enabled').addEventListener('click', function(event) { 265 $('sim-card-lock-enabled').addEventListener('click', function(event) {
265 var newValue = $('sim-card-lock-enabled').checked; 266 var newValue = $('sim-card-lock-enabled').checked;
266 // Leave value as is because user needs to enter PIN code first. 267 // Leave value as is because user needs to enter PIN code first.
267 // When PIN will be entered and value changed, 268 // When PIN will be entered and value changed,
268 // we'll update UI to reflect that change. 269 // we'll update UI to reflect that change.
269 $('sim-card-lock-enabled').checked = !newValue; 270 $('sim-card-lock-enabled').checked = !newValue;
270 chrome.send('setSimCardLock', [newValue]); 271 var operation = newValue ? 'setLocked' : 'setUnlocked';
272 chrome.send('simOperation', [operation]);
271 }); 273 });
272 $('change-pin').addEventListener('click', function(event) { 274 $('change-pin').addEventListener('click', function(event) {
273 chrome.send('changePin'); 275 chrome.send('simOperation', ['changePin']);
274 }); 276 });
275 277
276 // Proxy 278 // Proxy
277 ['proxy-host-single-port', 279 ['proxy-host-single-port',
278 'secure-proxy-port', 280 'secure-proxy-port',
279 'socks-port', 281 'socks-port',
280 'ftp-proxy-port', 282 'ftp-proxy-port',
281 'proxy-host-port' 283 'proxy-host-port'
282 ].forEach(function(id) { 284 ].forEach(function(id) {
283 options.PrefPortNumber.decorate($(id)); 285 options.PrefPortNumber.decorate($(id));
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 }, 440 },
439 441
440 /** 442 /**
441 * Update details page controls. 443 * Update details page controls.
442 */ 444 */
443 updateControls: function() { 445 updateControls: function() {
444 var onc = this.onc_; 446 var onc = this.onc_;
445 if (onc == undefined) 447 if (onc == undefined)
446 return; // May get called from a pref update before initialized. 448 return; // May get called from a pref update before initialized.
447 449
448 // Only show ipconfig section if network is connected OR if nothing on 450 // Always show the ipconfig section. TODO(stevenjb): Improve the display
449 // this device is connected. This is so that you can fix the ip configs 451 // for unconnected networks. Currently the IP address fields may be
450 // if you can't connect to any network. 452 // blank if the network is not connected.
451 // TODO(stevenjb): Support IP configuration (and improve the display) 453 $('ipconfig-section').hidden = false;
452 // for non connected networks. 454 $('ipconfig-dns-section').hidden = false;
453
454 var connected = onc.getActiveValue('ConnectionState') == 'Connected';
455 $('ipconfig-section').hidden = !connected && this.deviceConnected_;
456 $('ipconfig-dns-section').hidden = !connected && this.deviceConnected_;
457 455
458 // Network type related. 456 // Network type related.
459 updateHidden('#details-internet-page .cellular-details', 457 updateHidden('#details-internet-page .cellular-details',
460 this.type_ != 'Cellular'); 458 this.type_ != 'Cellular');
461 updateHidden('#details-internet-page .wifi-details', 459 updateHidden('#details-internet-page .wifi-details',
462 this.type_ != 'WiFi'); 460 this.type_ != 'WiFi');
463 updateHidden('#details-internet-page .wimax-details', 461 updateHidden('#details-internet-page .wimax-details',
464 this.type_ != 'Wimax'); 462 this.type_ != 'Wimax');
465 updateHidden('#details-internet-page .vpn-details', this.type_ != 'VPN'); 463 updateHidden('#details-internet-page .vpn-details', this.type_ != 'VPN');
466 updateHidden('#details-internet-page .proxy-details', !this.showProxy_); 464 updateHidden('#details-internet-page .proxy-details', !this.showProxy_);
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 (this.type_ == 'Wimax' || this.type_ == 'VPN'))) { 645 (this.type_ == 'Wimax' || this.type_ == 'VPN'))) {
648 $('details-internet-configure').hidden = false; 646 $('details-internet-configure').hidden = false;
649 } else { 647 } else {
650 $('details-internet-configure').hidden = true; 648 $('details-internet-configure').hidden = true;
651 } 649 }
652 }, 650 },
653 651
654 /** 652 /**
655 * Helper method called from showDetailedInfo and updateConnectionData. 653 * Helper method called from showDetailedInfo and updateConnectionData.
656 * Updates the connection state property and account / sim card links. 654 * Updates the connection state property and account / sim card links.
657 * @param {InternetDetailedInfo} data
658 * @private 655 * @private
659 */ 656 */
660 updateDetails_: function(data) { 657 updateDetails_: function() {
661 var onc = this.onc_; 658 var onc = this.onc_;
662 659
663 if ('deviceConnected' in data)
664 this.deviceConnected_ = data.deviceConnected;
665
666 var connectionStateString = onc.getTranslatedValue('ConnectionState'); 660 var connectionStateString = onc.getTranslatedValue('ConnectionState');
667 $('connection-state').textContent = connectionStateString; 661 $('connection-state').textContent = connectionStateString;
668 662
669 var type = this.type_; 663 var type = this.type_;
670 var showViewAccount = false; 664 var showViewAccount = false;
671 var showActivate = false; 665 var showActivate = false;
672 if (type == 'WiFi') { 666 if (type == 'WiFi') {
673 $('wifi-connection-state').textContent = connectionStateString; 667 $('wifi-connection-state').textContent = connectionStateString;
674 } else if (type == 'Wimax') { 668 } else if (type == 'Wimax') {
675 $('wimax-connection-state').textContent = connectionStateString; 669 $('wimax-connection-state').textContent = connectionStateString;
676 } else if (type == 'Cellular') { 670 } else if (type == 'Cellular') {
677 $('activation-state').textContent = 671 $('activation-state').textContent =
678 onc.getTranslatedValue('Cellular.ActivationState'); 672 onc.getTranslatedValue('Cellular.ActivationState');
679 if (onc.getActiveValue('Cellular.Family') == 'GSM') { 673 if (onc.getActiveValue('Cellular.Family') == 'GSM') {
680 var lockEnabled = 674 var lockEnabled =
681 onc.getActiveValue('Cellular.SIMLockStatus.LockEnabled'); 675 onc.getActiveValue('Cellular.SIMLockStatus.LockEnabled');
682 $('sim-card-lock-enabled').checked = lockEnabled; 676 $('sim-card-lock-enabled').checked = lockEnabled;
683 $('change-pin').hidden = !lockEnabled; 677 $('change-pin').hidden = !lockEnabled;
684 } 678 }
685 showViewAccount = data.showViewAccountButton; 679 showViewAccount = this.showViewAccountButton_;
686 var activationState = onc.getActiveValue('Cellular.ActivationState'); 680 var activationState = onc.getActiveValue('Cellular.ActivationState');
687 showActivate = activationState == 'NotActivated' || 681 showActivate = activationState == 'NotActivated' ||
688 activationState == 'PartiallyActivated'; 682 activationState == 'PartiallyActivated';
689 } 683 }
690 684
691 $('view-account-details').hidden = !showViewAccount; 685 $('view-account-details').hidden = !showViewAccount;
692 $('activate-details').hidden = !showActivate; 686 $('activate-details').hidden = !showActivate;
693 // If activation is not complete, hide the login button. 687 // If activation is not complete, hide the login button.
694 if (showActivate) 688 if (showActivate)
695 $('details-internet-login').hidden = true; 689 $('details-internet-login').hidden = true;
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 DetailsInternetPage.updateCarrier = function() { 1018 DetailsInternetPage.updateCarrier = function() {
1025 DetailsInternetPage.showCarrierChangeSpinner(false); 1019 DetailsInternetPage.showCarrierChangeSpinner(false);
1026 }; 1020 };
1027 1021
1028 DetailsInternetPage.loginFromDetails = function() { 1022 DetailsInternetPage.loginFromDetails = function() {
1029 var detailsPage = DetailsInternetPage.getInstance(); 1023 var detailsPage = DetailsInternetPage.getInstance();
1030 if (detailsPage.type_ == 'WiFi') 1024 if (detailsPage.type_ == 'WiFi')
1031 sendChromeMetricsAction('Options_NetworkConnectToWifi'); 1025 sendChromeMetricsAction('Options_NetworkConnectToWifi');
1032 else if (detailsPage.type_ == 'VPN') 1026 else if (detailsPage.type_ == 'VPN')
1033 sendChromeMetricsAction('Options_NetworkConnectToVPN'); 1027 sendChromeMetricsAction('Options_NetworkConnectToVPN');
1034 chrome.send('networkCommand', 1028 // TODO(stevenjb): chrome.networkingPrivate.disableNetworkType
1035 [detailsPage.type_, detailsPage.servicePath_, 'connect']); 1029 chrome.send('startConnect', [detailsPage.servicePath_]);
1036 PageManager.closeOverlay(); 1030 PageManager.closeOverlay();
1037 }; 1031 };
1038 1032
1039 DetailsInternetPage.disconnectNetwork = function() { 1033 DetailsInternetPage.disconnectNetwork = function() {
1040 var detailsPage = DetailsInternetPage.getInstance(); 1034 var detailsPage = DetailsInternetPage.getInstance();
1041 if (detailsPage.type_ == 'WiFi') 1035 if (detailsPage.type_ == 'WiFi')
1042 sendChromeMetricsAction('Options_NetworkDisconnectWifi'); 1036 sendChromeMetricsAction('Options_NetworkDisconnectWifi');
1043 else if (detailsPage.type_ == 'VPN') 1037 else if (detailsPage.type_ == 'VPN')
1044 sendChromeMetricsAction('Options_NetworkDisconnectVPN'); 1038 sendChromeMetricsAction('Options_NetworkDisconnectVPN');
1045 chrome.send('networkCommand', 1039 // TODO(stevenjb): chrome.networkingPrivate.startDisconnect
1046 [detailsPage.type_, detailsPage.servicePath_, 'disconnect']); 1040 chrome.send('startDisconnect', [detailsPage.servicePath_]);
1047 PageManager.closeOverlay(); 1041 PageManager.closeOverlay();
1048 }; 1042 };
1049 1043
1050 DetailsInternetPage.configureNetwork = function() { 1044 DetailsInternetPage.configureNetwork = function() {
1051 var detailsPage = DetailsInternetPage.getInstance(); 1045 var detailsPage = DetailsInternetPage.getInstance();
1052 chrome.send('networkCommand', 1046 chrome.send('networkCommand',
1053 [detailsPage.type_, detailsPage.servicePath_, 'configure']); 1047 [detailsPage.type_, detailsPage.servicePath_, 'configure']);
1054 PageManager.closeOverlay(); 1048 PageManager.closeOverlay();
1055 }; 1049 };
1056 1050
1057 DetailsInternetPage.activateFromDetails = function() { 1051 DetailsInternetPage.activateFromDetails = function() {
1058 var detailsPage = DetailsInternetPage.getInstance(); 1052 var detailsPage = DetailsInternetPage.getInstance();
1059 if (detailsPage.type_ == 'Cellular') { 1053 if (detailsPage.type_ == 'Cellular') {
1060 chrome.send('networkCommand', 1054 chrome.send('networkCommand',
1061 [detailsPage.type_, detailsPage.servicePath_, 'activate']); 1055 [detailsPage.type_, detailsPage.servicePath_, 'activate']);
1062 } 1056 }
1063 PageManager.closeOverlay(); 1057 PageManager.closeOverlay();
1064 }; 1058 };
1065 1059
1060 /**
1061 * Event handler called when the details page is closed. Sends changed
1062 * properties to Chrome and closes the overlay.
1063 */
1066 DetailsInternetPage.setDetails = function() { 1064 DetailsInternetPage.setDetails = function() {
1067 var detailsPage = DetailsInternetPage.getInstance(); 1065 var detailsPage = DetailsInternetPage.getInstance();
1068 var type = detailsPage.type_; 1066 var type = detailsPage.type_;
1069 var servicePath = detailsPage.servicePath_; 1067 var servicePath = detailsPage.servicePath_;
1070 if (type == 'WiFi') { 1068 if (type == 'WiFi') {
1071 sendCheckedIfEnabled(servicePath, 1069 sendCheckedIfEnabled(servicePath,
1072 'setPreferNetwork', 1070 'setPreferNetwork',
1073 'prefer-network-wifi', 1071 'prefer-network-wifi',
1074 'Options_NetworkSetPrefer'); 1072 'Options_NetworkSetPrefer');
1075 sendCheckedIfEnabled(servicePath, 1073 sendCheckedIfEnabled(servicePath,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1119 [servicePath, 1117 [servicePath,
1120 Boolean($('ip-automatic-configuration-checkbox').checked), 1118 Boolean($('ip-automatic-configuration-checkbox').checked),
1121 $('ip-address').model.value || '', 1119 $('ip-address').model.value || '',
1122 $('ip-netmask').model.value || '', 1120 $('ip-netmask').model.value || '',
1123 $('ip-gateway').model.value || '', 1121 $('ip-gateway').model.value || '',
1124 nameServerType, 1122 nameServerType,
1125 userNameServers.join(',')]); 1123 userNameServers.join(',')]);
1126 PageManager.closeOverlay(); 1124 PageManager.closeOverlay();
1127 }; 1125 };
1128 1126
1127 /**
1128 * Event handler called when the name server type changes.
1129 * @param {string} type The selected name sever type, 'automatic', 'google',
1130 * or 'user'.
1131 */
1129 DetailsInternetPage.updateNameServerDisplay = function(type) { 1132 DetailsInternetPage.updateNameServerDisplay = function(type) {
1130 var editable = type == 'user'; 1133 var editable = type == 'user';
1131 var fields = [$('ipconfig-dns1'), $('ipconfig-dns2'), 1134 var fields = [$('ipconfig-dns1'), $('ipconfig-dns2'),
1132 $('ipconfig-dns3'), $('ipconfig-dns4')]; 1135 $('ipconfig-dns3'), $('ipconfig-dns4')];
1133 for (var i = 0; i < fields.length; ++i) { 1136 for (var i = 0; i < fields.length; ++i) {
1134 fields[i].editable = editable; 1137 fields[i].editable = editable;
1135 } 1138 }
1136 if (editable) 1139 if (editable)
1137 $('ipconfig-dns1').focus(); 1140 $('ipconfig-dns1').focus();
1138 1141
(...skipping 12 matching lines...) Expand all
1151 userDns.removeAttribute('selected'); 1154 userDns.removeAttribute('selected');
1152 break; 1155 break;
1153 case 'user': 1156 case 'user':
1154 automaticDns.removeAttribute('selected'); 1157 automaticDns.removeAttribute('selected');
1155 googleDns.removeAttribute('selected'); 1158 googleDns.removeAttribute('selected');
1156 userDns.setAttribute('selected', ''); 1159 userDns.setAttribute('selected', '');
1157 break; 1160 break;
1158 } 1161 }
1159 }; 1162 };
1160 1163
1161 DetailsInternetPage.updateConnectionData = function(update) { 1164 /**
1165 * Method called from Chrome with a dictionary of non ONC configuration
1166 * properties, including the HUID and service path to be used for requiesting
armansito 2014/09/16 16:40:41 nit: requiesting -> requesting
stevenjb 2014/09/16 17:32:57 Done.
1167 * the ONC properites. Note: currently GUID is only used to confirm that the
armansito 2014/09/16 16:40:41 nit: properites -> properties
stevenjb 2014/09/16 17:32:58 Done.
1168 * selected network still exists. It will be used instead of servicePath
1169 * once switching to the networkingPrivate API (see TODO below).
1170 * @param {InternetDetailedInfo} info
1171 */
1172 DetailsInternetPage.showDetailedInfo = function(info) {
1173 if (!('GUID' in info)) {
1174 // No network was found for, close the overlay.
1175 PageManager.closeOverlay();
1176 return;
1177 }
1178 var detailsPage = DetailsInternetPage.getInstance();
1179 detailsPage.servicePath_ = info.servicePath;
1180 detailsPage.showCarrierSelect_ = info.showCarrierSelect;
1181 detailsPage.showViewAccountButton_ = info.showViewAccountButton;
1182 // Ask Chrome to call sendNetworkDetails with the ONC properties.
1183 // TODO(stevenjb): Use networkingPrivate.getManagedProperties(info.guid).
1184 chrome.send('getManagedProperties', [info.servicePath]);
1185 };
1186
1187 /**
1188 * Method called from Chrome when the ONC properties for the displayed
1189 * network may have changed.
1190 * @param {Object} update The updated ONC dictionary for the network.
1191 */
1192 DetailsInternetPage.updateConnectionData = function(oncData) {
1162 var detailsPage = DetailsInternetPage.getInstance(); 1193 var detailsPage = DetailsInternetPage.getInstance();
1163 if (!detailsPage.visible) 1194 if (!detailsPage.visible)
1164 return; 1195 return;
1165 1196
1166 if (update.servicePath != detailsPage.servicePath_) 1197 if (oncData.servicePath != detailsPage.servicePath_)
1167 return; 1198 return;
1168 1199
1169 // Update our cached data object. 1200 // Update our cached data object.
1170 var onc = detailsPage.onc_; 1201 detailsPage.onc_ = new OncData(oncData);
1171 onc.updateData(update);
1172 1202
1173 detailsPage.populateHeader_(); 1203 detailsPage.populateHeader_();
1174 detailsPage.updateConnectionButtonVisibilty_(); 1204 detailsPage.updateConnectionButtonVisibilty_();
1175 detailsPage.updateDetails_(update); 1205 detailsPage.updateDetails_();
1176 }; 1206 };
1177 1207
1178 /** 1208 /**
1179 * @param {InternetDetailedInfo} data 1209 * Method called from Chrome when the initial dictionary of ONC configuration
1210 * properties is avaliable.
1211 * @param {Object} oncData Dictionary of ONC properties.
1180 */ 1212 */
1181 DetailsInternetPage.showDetailedInfo = function(data) { 1213 DetailsInternetPage.sendNetworkDetails = function(oncData) {
1182 var onc = new OncData(data); 1214 var onc = new OncData(oncData);
1183 1215
1184 var detailsPage = DetailsInternetPage.getInstance(); 1216 var detailsPage = DetailsInternetPage.getInstance();
1185 detailsPage.onc_ = onc; 1217 detailsPage.onc_ = onc;
1186 var type = onc.getActiveValue('Type'); 1218 var type = onc.getActiveValue('Type');
1187 detailsPage.type_ = type; 1219 detailsPage.type_ = type;
1188 detailsPage.servicePath_ = data.servicePath;
1189 1220
1190 sendShowDetailsMetrics(type, onc.getActiveValue('ConnectionState')); 1221 sendShowDetailsMetrics(type, onc.getActiveValue('ConnectionState'));
1191 1222
1192 detailsPage.populateHeader_(); 1223 detailsPage.populateHeader_();
1193 detailsPage.updateConnectionButtonVisibilty_(); 1224 detailsPage.updateConnectionButtonVisibilty_();
1194 detailsPage.updateDetails_(data); 1225 detailsPage.updateDetails_();
1195 1226
1196 // TODO(stevenjb): Some of the setup below should be moved to 1227 // TODO(stevenjb): Some of the setup below should be moved to
1197 // updateDetails_() so that updates are reflected in the UI. 1228 // updateDetails_() so that updates are reflected in the UI.
1198 1229
1199 // Only show proxy for remembered networks. 1230 // Only show proxy for remembered networks.
1200 var remembered = onc.getSource() != 'None'; 1231 var remembered = onc.getSource() != 'None';
1201 if (remembered) { 1232 if (remembered) {
1202 detailsPage.showProxy_ = true; 1233 detailsPage.showProxy_ = true;
1203 // Inform Chrome which network to use for proxy configuration. 1234 // Inform Chrome which network to use for proxy configuration.
1204 chrome.send('selectNetwork', [detailsPage.servicePath_]); 1235 chrome.send('selectNetwork', [detailsPage.servicePath_]);
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
1409 $('auto-connect-network-wimax').disabled = !remembered; 1440 $('auto-connect-network-wimax').disabled = !remembered;
1410 var identity = onc.getActiveValue('Wimax.EAP.Identity'); 1441 var identity = onc.getActiveValue('Wimax.EAP.Identity');
1411 setOrHideParent('wimax-eap-identity', identity); 1442 setOrHideParent('wimax-eap-identity', identity);
1412 $('wimax-signal-strength').textContent = strengthString; 1443 $('wimax-signal-strength').textContent = strengthString;
1413 } else if (type == 'Cellular') { 1444 } else if (type == 'Cellular') {
1414 OptionsPage.showTab($('cellular-conn-nav-tab')); 1445 OptionsPage.showTab($('cellular-conn-nav-tab'));
1415 1446
1416 var isGsm = onc.getActiveValue('Cellular.Family') == 'GSM'; 1447 var isGsm = onc.getActiveValue('Cellular.Family') == 'GSM';
1417 1448
1418 var currentCarrierIndex = -1; 1449 var currentCarrierIndex = -1;
1419 if (data.showCarrierSelect) { 1450 if (this.showCarrierSelect_) {
1420 var currentCarrier = 1451 var currentCarrier =
1421 isGsm ? CarrierGenericUMTS : onc.getActiveValue('Cellular.Carrier'); 1452 isGsm ? CarrierGenericUMTS : onc.getActiveValue('Cellular.Carrier');
1422 var supportedCarriers = 1453 var supportedCarriers =
1423 onc.getActiveValue('Cellular.SupportedCarriers'); 1454 onc.getActiveValue('Cellular.SupportedCarriers');
1424 for (var c1 = 0; c1 < supportedCarriers.length; ++c1) { 1455 for (var c1 = 0; c1 < supportedCarriers.length; ++c1) {
1425 if (supportedCarriers[c1] == currentCarrier) { 1456 if (supportedCarriers[c1] == currentCarrier) {
1426 currentCarrierIndex = c1; 1457 currentCarrierIndex = c1;
1427 break; 1458 break;
1428 } 1459 }
1429 } 1460 }
(...skipping 10 matching lines...) Expand all
1440 } 1471 }
1441 } 1472 }
1442 if (currentCarrierIndex == -1) 1473 if (currentCarrierIndex == -1)
1443 $('service-name').textContent = networkName; 1474 $('service-name').textContent = networkName;
1444 1475
1445 $('network-technology').textContent = 1476 $('network-technology').textContent =
1446 onc.getActiveValue('Cellular.NetworkTechnology'); 1477 onc.getActiveValue('Cellular.NetworkTechnology');
1447 $('roaming-state').textContent = 1478 $('roaming-state').textContent =
1448 onc.getTranslatedValue('Cellular.RoamingState'); 1479 onc.getTranslatedValue('Cellular.RoamingState');
1449 $('cellular-restricted-connectivity').textContent = restrictedString; 1480 $('cellular-restricted-connectivity').textContent = restrictedString;
1450 if ('errorMessage' in data) 1481 // 'errorMessage' is a non ONC property added by Chrome.
1451 $('error-state').textContent = data.errorMessage; 1482 $('error-state').textContent = onc.getActiveValue('errorMessage');
1452 $('manufacturer').textContent = 1483 $('manufacturer').textContent =
1453 onc.getActiveValue('Cellular.Manufacturer'); 1484 onc.getActiveValue('Cellular.Manufacturer');
1454 $('model-id').textContent = onc.getActiveValue('Cellular.ModelID'); 1485 $('model-id').textContent = onc.getActiveValue('Cellular.ModelID');
1455 $('firmware-revision').textContent = 1486 $('firmware-revision').textContent =
1456 onc.getActiveValue('Cellular.FirmwareRevision'); 1487 onc.getActiveValue('Cellular.FirmwareRevision');
1457 $('hardware-revision').textContent = 1488 $('hardware-revision').textContent =
1458 onc.getActiveValue('Cellular.HardwareRevision'); 1489 onc.getActiveValue('Cellular.HardwareRevision');
1459 $('mdn').textContent = onc.getActiveValue('Cellular.MDN'); 1490 $('mdn').textContent = onc.getActiveValue('Cellular.MDN');
1460 1491
1461 // Show ServingOperator properties only if available. 1492 // Show ServingOperator properties only if available.
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
1557 1588
1558 // Don't show page name in address bar and in history to prevent people 1589 // Don't show page name in address bar and in history to prevent people
1559 // navigate here by hand and solve issue with page session restore. 1590 // navigate here by hand and solve issue with page session restore.
1560 PageManager.showPageByName('detailsInternetPage', false); 1591 PageManager.showPageByName('detailsInternetPage', false);
1561 }; 1592 };
1562 1593
1563 return { 1594 return {
1564 DetailsInternetPage: DetailsInternetPage 1595 DetailsInternetPage: DetailsInternetPage
1565 }; 1596 };
1566 }); 1597 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698