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 |
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 /** | |
24 * InternetDetailedInfo argument passed to showDetailedInfo. | |
25 * @see chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc | |
26 * @typedef {{ | |
27 * servicePath: string, | |
28 * showCarrierSelect: (boolean|undefined), | |
29 * showViewAccountButton: (boolean|undefined) | |
30 * }} | |
31 */ | |
32 var InternetDetailedInfo; | |
33 | |
34 cr.define('options.internet', function() { | 23 cr.define('options.internet', function() { |
35 var OncData = cr.onc.OncData; | 24 var OncData = cr.onc.OncData; |
36 var Page = cr.ui.pageManager.Page; | 25 var Page = cr.ui.pageManager.Page; |
37 var PageManager = cr.ui.pageManager.PageManager; | 26 var PageManager = cr.ui.pageManager.PageManager; |
38 /** @const */ var IPAddressField = options.internet.IPAddressField; | 27 /** @const */ var IPAddressField = options.internet.IPAddressField; |
39 | 28 |
40 /** @const */ var GoogleNameServersString = '8.8.4.4,8.8.8.8'; | 29 /** @const */ var GoogleNameServersString = '8.8.4.4,8.8.8.8'; |
41 /** @const */ var CarrierGenericUMTS = 'Generic UMTS'; | 30 /** @const */ var CarrierGenericUMTS = 'Generic UMTS'; |
42 | 31 |
43 /** | 32 /** |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 /** | 90 /** |
102 * Sends the 'checked' state of a control to chrome for a network. | 91 * Sends the 'checked' state of a control to chrome for a network. |
103 * @param {string} path The service path of the network. | 92 * @param {string} path The service path of the network. |
104 * @param {string} message The message to send to chrome. | 93 * @param {string} message The message to send to chrome. |
105 * @param {string} checkboxId The id of the checkbox with the value to send. | 94 * @param {string} checkboxId The id of the checkbox with the value to send. |
106 * @param {string=} opt_action Optional action to record. | 95 * @param {string=} opt_action Optional action to record. |
107 */ | 96 */ |
108 function sendCheckedIfEnabled(path, message, checkboxId, opt_action) { | 97 function sendCheckedIfEnabled(path, message, checkboxId, opt_action) { |
109 var checkbox = assertInstanceof($(checkboxId), HTMLInputElement); | 98 var checkbox = assertInstanceof($(checkboxId), HTMLInputElement); |
110 if (!checkbox.hidden && !checkbox.disabled) { | 99 if (!checkbox.hidden && !checkbox.disabled) { |
111 chrome.send(message, [path, checkbox.checked ? 'true' : 'false']); | 100 chrome.send(message, [path, !!checkbox.checked]); |
112 if (opt_action) | 101 if (opt_action) |
113 sendChromeMetricsAction(opt_action); | 102 sendChromeMetricsAction(opt_action); |
114 } | 103 } |
115 } | 104 } |
116 | 105 |
117 /** | 106 /** |
118 * Send metrics to Chrome when the detailed page is opened. | 107 * Send metrics to Chrome when the detailed page is opened. |
119 * @param {string} type The ONC type of the network being shown. | 108 * @param {string} type The ONC type of the network being shown. |
120 * @param {string} state The ONC network state. | 109 * @param {string} state The ONC network state. |
121 */ | 110 */ |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 * @extends {cr.ui.pageManager.Page} | 161 * @extends {cr.ui.pageManager.Page} |
173 */ | 162 */ |
174 function DetailsInternetPage() { | 163 function DetailsInternetPage() { |
175 // Cached Apn properties | 164 // Cached Apn properties |
176 this.userApnIndex_ = -1; | 165 this.userApnIndex_ = -1; |
177 this.selectedApnIndex_ = -1; | 166 this.selectedApnIndex_ = -1; |
178 this.userApn_ = {}; | 167 this.userApn_ = {}; |
179 // We show the Proxy configuration tab for remembered networks and when | 168 // We show the Proxy configuration tab for remembered networks and when |
180 // configuring a proxy from the login screen. | 169 // configuring a proxy from the login screen. |
181 this.showProxy_ = false; | 170 this.showProxy_ = false; |
182 // In Chrome we sometimes want to enable the Cellular carrier select UI. | |
183 this.showCarrierSelect_ = false; | |
184 // In Chrome we sometimes want to show the 'View Account' button. | |
185 this.showViewAccountButton_ = false; | |
186 | 171 |
187 Page.call(this, 'detailsInternetPage', '', 'details-internet-page'); | 172 Page.call(this, 'detailsInternetPage', '', 'details-internet-page'); |
188 } | 173 } |
189 | 174 |
190 cr.addSingletonGetter(DetailsInternetPage); | 175 cr.addSingletonGetter(DetailsInternetPage); |
191 | 176 |
192 DetailsInternetPage.prototype = { | 177 DetailsInternetPage.prototype = { |
193 __proto__: Page.prototype, | 178 __proto__: Page.prototype, |
194 | 179 |
195 /** @override */ | 180 /** @override */ |
196 initializePage: function() { | 181 initializePage: function() { |
197 Page.prototype.initializePage.call(this); | 182 Page.prototype.initializePage.call(this); |
198 this.initializePageContents_(); | 183 this.initializePageContents_(); |
199 this.showNetworkDetails_(); | 184 this.showNetworkDetails_(); |
200 }, | 185 }, |
201 | 186 |
202 /** | 187 /** |
203 * Auto-activates the network details dialog if network information | 188 * Auto-activates the network details dialog if network information |
204 * is included in the URL. | 189 * is included in the URL. |
205 */ | 190 */ |
206 showNetworkDetails_: function() { | 191 showNetworkDetails_: function() { |
207 var servicePath = parseQueryParams(window.location).servicePath; | 192 var servicePath = parseQueryParams(window.location).servicePath; |
208 if (!servicePath || !servicePath.length) | 193 if (!servicePath || !servicePath.length) |
209 return; | 194 return; |
210 var networkType = ''; // ignored for 'showDetails' | 195 // TODO(stevenjb): chrome.networkingPrivate.getManagedProperties |
211 chrome.send('networkCommand', [networkType, servicePath, 'showDetails']); | 196 // with initializeDetailsPage as the callback. |
| 197 chrome.send('getManagedProperties', [servicePath]); |
212 }, | 198 }, |
213 | 199 |
214 /** | 200 /** |
215 * Initializes the contents of the page. | 201 * Initializes the contents of the page. |
216 */ | 202 */ |
217 initializePageContents_: function() { | 203 initializePageContents_: function() { |
218 $('details-internet-dismiss').addEventListener('click', function(event) { | 204 $('details-internet-dismiss').addEventListener('click', function(event) { |
219 DetailsInternetPage.setDetails(); | 205 DetailsInternetPage.setDetails(); |
220 }); | 206 }); |
221 | 207 |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 } | 455 } |
470 | 456 |
471 return event; | 457 return event; |
472 }, | 458 }, |
473 | 459 |
474 /** | 460 /** |
475 * Update details page controls. | 461 * Update details page controls. |
476 */ | 462 */ |
477 updateControls: function() { | 463 updateControls: function() { |
478 // Note: onc may be undefined when called from a pref update before | 464 // Note: onc may be undefined when called from a pref update before |
479 // initialized in sendNetworkDetails. | 465 // initialized in initializeDetailsPage. |
480 var onc = this.onc_; | 466 var onc = this.onc_; |
481 | 467 |
482 // Always show the ipconfig section. TODO(stevenjb): Improve the display | 468 // Always show the ipconfig section. TODO(stevenjb): Improve the display |
483 // for unconnected networks. Currently the IP address fields may be | 469 // for unconnected networks. Currently the IP address fields may be |
484 // blank if the network is not connected. | 470 // blank if the network is not connected. |
485 $('ipconfig-section').hidden = false; | 471 $('ipconfig-section').hidden = false; |
486 $('ipconfig-dns-section').hidden = false; | 472 $('ipconfig-dns-section').hidden = false; |
487 | 473 |
488 // Network type related. | 474 // Network type related. |
489 updateHidden('#details-internet-page .cellular-details', | 475 updateHidden('#details-internet-page .cellular-details', |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 $('socks-host').disabled = allDisabled; | 623 $('socks-host').disabled = allDisabled; |
638 $('socks-port').disabled = allDisabled; | 624 $('socks-port').disabled = allDisabled; |
639 $('proxy-use-pac-url').disabled = true; | 625 $('proxy-use-pac-url').disabled = true; |
640 $('proxy-pac-url').disabled = true; | 626 $('proxy-pac-url').disabled = true; |
641 $('auto-proxy-parms').hidden = !$('auto-proxy').checked; | 627 $('auto-proxy-parms').hidden = !$('auto-proxy').checked; |
642 $('manual-proxy-parms').hidden = !$('manual-proxy').checked; | 628 $('manual-proxy-parms').hidden = !$('manual-proxy').checked; |
643 sendChromeMetricsAction('Options_NetworkManualProxy_Enable'); | 629 sendChromeMetricsAction('Options_NetworkManualProxy_Enable'); |
644 }, | 630 }, |
645 | 631 |
646 /** | 632 /** |
647 * Helper method called from showDetailedInfo and updateConnectionData. | 633 * Helper method called from initializeDetailsPage and updateConnectionData. |
648 * Updates visibility/enabled of the login/disconnect/configure buttons. | 634 * Updates visibility/enabled of the login/disconnect/configure buttons. |
649 * @private | 635 * @private |
650 */ | 636 */ |
651 updateConnectionButtonVisibilty_: function() { | 637 updateConnectionButtonVisibilty_: function() { |
652 var onc = this.onc_; | 638 var onc = this.onc_; |
653 if (this.type_ == 'Ethernet') { | 639 if (this.type_ == 'Ethernet') { |
654 // Ethernet can never be connected or disconnected and can always be | 640 // Ethernet can never be connected or disconnected and can always be |
655 // configured (e.g. to set security). | 641 // configured (e.g. to set security). |
656 $('details-internet-login').hidden = true; | 642 $('details-internet-login').hidden = true; |
657 $('details-internet-disconnect').hidden = true; | 643 $('details-internet-disconnect').hidden = true; |
(...skipping 18 matching lines...) Expand all Loading... |
676 if (connectState != 'Connected' && | 662 if (connectState != 'Connected' && |
677 (!connectable || onc.getWiFiSecurity() != 'None' || | 663 (!connectable || onc.getWiFiSecurity() != 'None' || |
678 (this.type_ == 'WiMAX' || this.type_ == 'VPN'))) { | 664 (this.type_ == 'WiMAX' || this.type_ == 'VPN'))) { |
679 $('details-internet-configure').hidden = false; | 665 $('details-internet-configure').hidden = false; |
680 } else { | 666 } else { |
681 $('details-internet-configure').hidden = true; | 667 $('details-internet-configure').hidden = true; |
682 } | 668 } |
683 }, | 669 }, |
684 | 670 |
685 /** | 671 /** |
686 * Helper method called from showDetailedInfo and updateConnectionData. | 672 * Helper method called from initializeDetailsPage and updateConnectionData. |
687 * Updates the connection state property and account / sim card links. | 673 * Updates the connection state property and account / sim card links. |
688 * @private | 674 * @private |
689 */ | 675 */ |
690 updateDetails_: function() { | 676 updateDetails_: function() { |
691 var onc = this.onc_; | 677 var onc = this.onc_; |
692 | 678 |
693 var connectionStateString = onc.getTranslatedValue('ConnectionState'); | 679 var connectionStateString = onc.getTranslatedValue('ConnectionState'); |
694 $('connection-state').textContent = connectionStateString; | 680 $('connection-state').textContent = connectionStateString; |
695 | 681 |
696 var type = this.type_; | 682 var type = this.type_; |
697 var showViewAccount = false; | 683 var showViewAccount = false; |
698 var showActivate = false; | 684 var showActivate = false; |
699 if (type == 'WiFi') { | 685 if (type == 'WiFi') { |
700 $('wifi-connection-state').textContent = connectionStateString; | 686 $('wifi-connection-state').textContent = connectionStateString; |
701 } else if (type == 'WiMAX') { | 687 } else if (type == 'WiMAX') { |
702 $('wimax-connection-state').textContent = connectionStateString; | 688 $('wimax-connection-state').textContent = connectionStateString; |
703 } else if (type == 'Cellular') { | 689 } else if (type == 'Cellular') { |
704 $('activation-state').textContent = | 690 $('activation-state').textContent = |
705 onc.getTranslatedValue('Cellular.ActivationState'); | 691 onc.getTranslatedValue('Cellular.ActivationState'); |
706 if (onc.getActiveValue('Cellular.Family') == 'GSM') { | 692 if (onc.getActiveValue('Cellular.Family') == 'GSM') { |
707 var lockEnabled = | 693 var lockEnabled = |
708 onc.getActiveValue('Cellular.SIMLockStatus.LockEnabled'); | 694 onc.getActiveValue('Cellular.SIMLockStatus.LockEnabled'); |
709 $('sim-card-lock-enabled').checked = lockEnabled; | 695 $('sim-card-lock-enabled').checked = lockEnabled; |
710 $('change-pin').hidden = !lockEnabled; | 696 $('change-pin').hidden = !lockEnabled; |
711 } | 697 } |
712 showViewAccount = this.showViewAccountButton_; | 698 showViewAccount = onc.getActiveValue('showViewAccountButton'); |
713 var activationState = onc.getActiveValue('Cellular.ActivationState'); | 699 var activationState = onc.getActiveValue('Cellular.ActivationState'); |
714 showActivate = activationState == 'NotActivated' || | 700 showActivate = activationState == 'NotActivated' || |
715 activationState == 'PartiallyActivated'; | 701 activationState == 'PartiallyActivated'; |
716 } | 702 } |
717 | 703 |
718 $('view-account-details').hidden = !showViewAccount; | 704 $('view-account-details').hidden = !showViewAccount; |
719 $('activate-details').hidden = !showActivate; | 705 $('activate-details').hidden = !showActivate; |
720 // If activation is not complete, hide the login button. | 706 // If activation is not complete, hide the login button. |
721 if (showActivate) | 707 if (showActivate) |
722 $('details-internet-login').hidden = true; | 708 $('details-internet-login').hidden = true; |
723 }, | 709 }, |
724 | 710 |
725 /** | 711 /** |
726 * Helper method called from showDetailedInfo and updateConnectionData. | 712 * Helper method called from initializeDetailsPage and updateConnectionData. |
727 * Updates the fields in the header section of the details frame. | 713 * Updates the fields in the header section of the details frame. |
728 * @private | 714 * @private |
729 */ | 715 */ |
730 populateHeader_: function() { | 716 populateHeader_: function() { |
731 var onc = this.onc_; | 717 var onc = this.onc_; |
732 | 718 |
733 $('network-details-title').textContent = onc.getTranslatedValue('Name'); | 719 $('network-details-title').textContent = onc.getTranslatedValue('Name'); |
734 var connectionState = onc.getActiveValue('ConnectionState'); | 720 var connectionState = onc.getActiveValue('ConnectionState'); |
735 var connectionStateString = onc.getTranslatedValue('ConnectionState'); | 721 var connectionStateString = onc.getTranslatedValue('ConnectionState'); |
736 $('network-details-subtitle-status').textContent = connectionStateString; | 722 $('network-details-subtitle-status').textContent = connectionStateString; |
(...skipping 18 matching lines...) Expand all Loading... |
755 typeLabel.textContent = loadTimeData.getString(typeKey); | 741 typeLabel.textContent = loadTimeData.getString(typeKey); |
756 typeLabel.hidden = false; | 742 typeLabel.hidden = false; |
757 typeSeparator.hidden = false; | 743 typeSeparator.hidden = false; |
758 } else { | 744 } else { |
759 typeLabel.hidden = true; | 745 typeLabel.hidden = true; |
760 typeSeparator.hidden = true; | 746 typeSeparator.hidden = true; |
761 } | 747 } |
762 }, | 748 }, |
763 | 749 |
764 /** | 750 /** |
765 * Helper method called from showDetailedInfo to initialize the Apn list. | 751 * Helper method called from initializeDetailsPage to initialize the Apn |
| 752 * list. |
766 * @private | 753 * @private |
767 */ | 754 */ |
768 initializeApnList_: function() { | 755 initializeApnList_: function() { |
769 var onc = this.onc_; | 756 var onc = this.onc_; |
770 | 757 |
771 var apnSelector = $('select-apn'); | 758 var apnSelector = $('select-apn'); |
772 // Clear APN lists, keep only last element that "other". | 759 // Clear APN lists, keep only last element that "other". |
773 while (apnSelector.length != 1) { | 760 while (apnSelector.length != 1) { |
774 apnSelector.remove(0); | 761 apnSelector.remove(0); |
775 } | 762 } |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1069 sendChromeMetricsAction('Options_NetworkDisconnectWifi'); | 1056 sendChromeMetricsAction('Options_NetworkDisconnectWifi'); |
1070 else if (detailsPage.type_ == 'VPN') | 1057 else if (detailsPage.type_ == 'VPN') |
1071 sendChromeMetricsAction('Options_NetworkDisconnectVPN'); | 1058 sendChromeMetricsAction('Options_NetworkDisconnectVPN'); |
1072 // TODO(stevenjb): chrome.networkingPrivate.startDisconnect | 1059 // TODO(stevenjb): chrome.networkingPrivate.startDisconnect |
1073 chrome.send('startDisconnect', [detailsPage.servicePath_]); | 1060 chrome.send('startDisconnect', [detailsPage.servicePath_]); |
1074 PageManager.closeOverlay(); | 1061 PageManager.closeOverlay(); |
1075 }; | 1062 }; |
1076 | 1063 |
1077 DetailsInternetPage.configureNetwork = function() { | 1064 DetailsInternetPage.configureNetwork = function() { |
1078 var detailsPage = DetailsInternetPage.getInstance(); | 1065 var detailsPage = DetailsInternetPage.getInstance(); |
1079 chrome.send('networkCommand', | 1066 chrome.send('configureNetwork', [detailsPage.servicePath_]); |
1080 [detailsPage.type_, detailsPage.servicePath_, 'configure']); | |
1081 PageManager.closeOverlay(); | 1067 PageManager.closeOverlay(); |
1082 }; | 1068 }; |
1083 | 1069 |
1084 DetailsInternetPage.activateFromDetails = function() { | 1070 DetailsInternetPage.activateFromDetails = function() { |
1085 var detailsPage = DetailsInternetPage.getInstance(); | 1071 var detailsPage = DetailsInternetPage.getInstance(); |
1086 if (detailsPage.type_ == 'Cellular') { | 1072 if (detailsPage.type_ == 'Cellular') { |
1087 chrome.send('networkCommand', | 1073 chrome.send('activateNetwork', [detailsPage.servicePath_]); |
1088 [detailsPage.type_, detailsPage.servicePath_, 'activate']); | |
1089 } | 1074 } |
1090 PageManager.closeOverlay(); | 1075 PageManager.closeOverlay(); |
1091 }; | 1076 }; |
1092 | 1077 |
1093 /** | 1078 /** |
1094 * Event handler called when the details page is closed. Sends changed | 1079 * Event handler called when the details page is closed. Sends changed |
1095 * properties to Chrome and closes the overlay. | 1080 * properties to Chrome and closes the overlay. |
1096 */ | 1081 */ |
1097 DetailsInternetPage.setDetails = function() { | 1082 DetailsInternetPage.setDetails = function() { |
1098 var detailsPage = DetailsInternetPage.getInstance(); | 1083 var detailsPage = DetailsInternetPage.getInstance(); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1170 break; | 1155 break; |
1171 case 'user': | 1156 case 'user': |
1172 automaticDns.removeAttribute('selected'); | 1157 automaticDns.removeAttribute('selected'); |
1173 googleDns.removeAttribute('selected'); | 1158 googleDns.removeAttribute('selected'); |
1174 userDns.setAttribute('selected', ''); | 1159 userDns.setAttribute('selected', ''); |
1175 break; | 1160 break; |
1176 } | 1161 } |
1177 }; | 1162 }; |
1178 | 1163 |
1179 /** | 1164 /** |
1180 * Method called from Chrome with a dictionary of non ONC configuration | |
1181 * properties, including the HUID and service path to be used for requesting | |
1182 * the ONC properties. Note: currently GUID is only used to confirm that the | |
1183 * selected network still exists. It will be used instead of servicePath | |
1184 * once switching to the networkingPrivate API (see TODO below). | |
1185 * @param {InternetDetailedInfo} info | |
1186 */ | |
1187 DetailsInternetPage.showDetailedInfo = function(info) { | |
1188 if (!('GUID' in info)) { | |
1189 // No network was found for, close the overlay. | |
1190 PageManager.closeOverlay(); | |
1191 return; | |
1192 } | |
1193 var detailsPage = DetailsInternetPage.getInstance(); | |
1194 detailsPage.servicePath_ = info.servicePath; | |
1195 detailsPage.showCarrierSelect_ = info.showCarrierSelect; | |
1196 detailsPage.showViewAccountButton_ = info.showViewAccountButton; | |
1197 // Ask Chrome to call sendNetworkDetails with the ONC properties. | |
1198 // TODO(stevenjb): Use networkingPrivate.getManagedProperties(info.guid). | |
1199 chrome.send('getManagedProperties', [info.servicePath]); | |
1200 }; | |
1201 | |
1202 /** | |
1203 * Method called from Chrome when the ONC properties for the displayed | 1165 * Method called from Chrome when the ONC properties for the displayed |
1204 * network may have changed. | 1166 * network may have changed. |
1205 * @param {Object} oncData The updated ONC dictionary for the network. | 1167 * @param {Object} oncData The updated ONC dictionary for the network. |
1206 */ | 1168 */ |
1207 DetailsInternetPage.updateConnectionData = function(oncData) { | 1169 DetailsInternetPage.updateConnectionData = function(oncData) { |
1208 var detailsPage = DetailsInternetPage.getInstance(); | 1170 var detailsPage = DetailsInternetPage.getInstance(); |
1209 if (!detailsPage.visible) | 1171 if (!detailsPage.visible) |
1210 return; | 1172 return; |
1211 | 1173 |
1212 if (oncData.servicePath != detailsPage.servicePath_) | 1174 if (oncData.servicePath != detailsPage.servicePath_) |
1213 return; | 1175 return; |
1214 | 1176 |
1215 // Update our cached data object. | 1177 // Update our cached data object. |
1216 detailsPage.onc_ = new OncData(oncData); | 1178 detailsPage.onc_ = new OncData(oncData); |
1217 | 1179 |
1218 detailsPage.populateHeader_(); | 1180 detailsPage.populateHeader_(); |
1219 detailsPage.updateConnectionButtonVisibilty_(); | 1181 detailsPage.updateConnectionButtonVisibilty_(); |
1220 detailsPage.updateDetails_(); | 1182 detailsPage.updateDetails_(); |
1221 }; | 1183 }; |
1222 | 1184 |
1223 /** | 1185 /** |
1224 * Method called from Chrome when the initial dictionary of ONC configuration | 1186 * Method called from Chrome in response to getManagedProperties. |
1225 * properties is available. | 1187 * We only use this when we want to call initializeDetailsPage. |
| 1188 * TODO(stevenjb): Eliminate when we switch to networkingPrivate |
| 1189 * (initializeDetailsPage will be provided as the callback). |
1226 * @param {Object} oncData Dictionary of ONC properties. | 1190 * @param {Object} oncData Dictionary of ONC properties. |
1227 */ | 1191 */ |
1228 DetailsInternetPage.sendNetworkDetails = function(oncData) { | 1192 DetailsInternetPage.getManagedPropertiesResult = function(oncData) { |
| 1193 DetailsInternetPage.initializeDetailsPage(oncData); |
| 1194 }; |
| 1195 |
| 1196 /** |
| 1197 * Initializes the details page with the provided ONC data. |
| 1198 * @param {Object} oncData Dictionary of ONC properties. |
| 1199 */ |
| 1200 DetailsInternetPage.initializeDetailsPage = function(oncData) { |
1229 var onc = new OncData(oncData); | 1201 var onc = new OncData(oncData); |
1230 | 1202 |
1231 var detailsPage = DetailsInternetPage.getInstance(); | 1203 var detailsPage = DetailsInternetPage.getInstance(); |
| 1204 detailsPage.servicePath_ = oncData.servicePath; |
1232 detailsPage.onc_ = onc; | 1205 detailsPage.onc_ = onc; |
1233 var type = onc.getActiveValue('Type'); | 1206 var type = onc.getActiveValue('Type'); |
1234 detailsPage.type_ = type; | 1207 detailsPage.type_ = type; |
1235 | 1208 |
1236 sendShowDetailsMetrics(type, onc.getActiveValue('ConnectionState')); | 1209 sendShowDetailsMetrics(type, onc.getActiveValue('ConnectionState')); |
1237 | 1210 |
1238 detailsPage.populateHeader_(); | 1211 detailsPage.populateHeader_(); |
1239 detailsPage.updateConnectionButtonVisibilty_(); | 1212 detailsPage.updateConnectionButtonVisibilty_(); |
1240 detailsPage.updateDetails_(); | 1213 detailsPage.updateDetails_(); |
1241 | 1214 |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1467 $('auto-connect-network-wimax').disabled = !remembered; | 1440 $('auto-connect-network-wimax').disabled = !remembered; |
1468 var identity = onc.getActiveValue('WiMAX.EAP.Identity'); | 1441 var identity = onc.getActiveValue('WiMAX.EAP.Identity'); |
1469 setOrHideParent('wimax-eap-identity', identity); | 1442 setOrHideParent('wimax-eap-identity', identity); |
1470 $('wimax-signal-strength').textContent = strengthString; | 1443 $('wimax-signal-strength').textContent = strengthString; |
1471 } else if (type == 'Cellular') { | 1444 } else if (type == 'Cellular') { |
1472 OptionsPage.showTab($('cellular-conn-nav-tab')); | 1445 OptionsPage.showTab($('cellular-conn-nav-tab')); |
1473 | 1446 |
1474 var isGsm = onc.getActiveValue('Cellular.Family') == 'GSM'; | 1447 var isGsm = onc.getActiveValue('Cellular.Family') == 'GSM'; |
1475 | 1448 |
1476 var currentCarrierIndex = -1; | 1449 var currentCarrierIndex = -1; |
1477 if (this.showCarrierSelect_) { | 1450 if (loadTimeData.getValue('showCarrierSelect')) { |
1478 var currentCarrier = | 1451 var currentCarrier = |
1479 isGsm ? CarrierGenericUMTS : onc.getActiveValue('Cellular.Carrier'); | 1452 isGsm ? CarrierGenericUMTS : onc.getActiveValue('Cellular.Carrier'); |
1480 var supportedCarriers = | 1453 var supportedCarriers = |
1481 onc.getActiveValue('Cellular.SupportedCarriers'); | 1454 onc.getActiveValue('Cellular.SupportedCarriers'); |
1482 for (var c1 = 0; c1 < supportedCarriers.length; ++c1) { | 1455 for (var c1 = 0; c1 < supportedCarriers.length; ++c1) { |
1483 if (supportedCarriers[c1] == currentCarrier) { | 1456 if (supportedCarriers[c1] == currentCarrier) { |
1484 currentCarrierIndex = c1; | 1457 currentCarrierIndex = c1; |
1485 break; | 1458 break; |
1486 } | 1459 } |
1487 } | 1460 } |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1618 | 1591 |
1619 // Don't show page name in address bar and in history to prevent people | 1592 // Don't show page name in address bar and in history to prevent people |
1620 // navigate here by hand and solve issue with page session restore. | 1593 // navigate here by hand and solve issue with page session restore. |
1621 PageManager.showPageByName('detailsInternetPage', false); | 1594 PageManager.showPageByName('detailsInternetPage', false); |
1622 }; | 1595 }; |
1623 | 1596 |
1624 return { | 1597 return { |
1625 DetailsInternetPage: DetailsInternetPage | 1598 DetailsInternetPage: DetailsInternetPage |
1626 }; | 1599 }; |
1627 }); | 1600 }); |
OLD | NEW |