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

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

Issue 509643003: Use GetManagedProperties in InternetOptionsHandler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue_279351_internet_options_8a
Patch Set: Rebase, Clarify PrefixLengthToNetmask 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/ui/webui/options/chromeos/internet_options_handler.cc » ('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
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 cr.define('options.internet', function() { 14 cr.define('options.internet', function() {
15 var OncData = cr.onc.OncData; 15 var OncData = cr.onc.OncData;
16 var Page = cr.ui.pageManager.Page; 16 var Page = cr.ui.pageManager.Page;
17 var PageManager = cr.ui.pageManager.PageManager; 17 var PageManager = cr.ui.pageManager.PageManager;
18 /** @const */ var IPAddressField = options.internet.IPAddressField; 18 /** @const */ var IPAddressField = options.internet.IPAddressField;
19 19
20 /** @const */ var GoogleNameServersString = '8.8.4.4,8.8.8.8';
21
20 /** 22 /**
21 * Helper function to set hidden attribute for elements matching a selector. 23 * Helper function to set hidden attribute for elements matching a selector.
22 * @param {string} selector CSS selector for extracting a list of elements. 24 * @param {string} selector CSS selector for extracting a list of elements.
23 * @param {bool} hidden New hidden value. 25 * @param {bool} hidden New hidden value.
24 */ 26 */
25 function updateHidden(selector, hidden) { 27 function updateHidden(selector, hidden) {
26 var elements = cr.doc.querySelectorAll(selector); 28 var elements = cr.doc.querySelectorAll(selector);
27 for (var i = 0, el; el = elements[i]; i++) { 29 for (var i = 0, el; el = elements[i]; i++) {
28 el.hidden = hidden; 30 el.hidden = hidden;
29 } 31 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 * Sends the 'checked' state of a control to chrome for a network. 74 * Sends the 'checked' state of a control to chrome for a network.
73 * @param {string} path The service path of the network. 75 * @param {string} path The service path of the network.
74 * @param {string} message The message to send to chrome. 76 * @param {string} message The message to send to chrome.
75 * @param {HTMLInputElement} checkbox The checkbox storing the value to send. 77 * @param {HTMLInputElement} checkbox The checkbox storing the value to send.
76 */ 78 */
77 function sendCheckedIfEnabled(path, message, checkbox) { 79 function sendCheckedIfEnabled(path, message, checkbox) {
78 if (!checkbox.hidden && !checkbox.disabled) 80 if (!checkbox.hidden && !checkbox.disabled)
79 chrome.send(message, [path, checkbox.checked ? 'true' : 'false']); 81 chrome.send(message, [path, checkbox.checked ? 'true' : 'false']);
80 } 82 }
81 83
84 /**
85 * Returns the netmask as a string for a given prefix length.
86 * @param {string} prefixLength The ONC routing prefix length.
87 * @return {string} The corresponding netmask.
88 */
89 function PrefixLengthToNetmask(prefixLength) {
90 // Return the empty string for invalid inputs.
91 if (prefixLength < 0 || prefixLength > 32)
92 return '';
93 var netmask = '';
94 for (var i = 0; i < 4; ++i) {
95 var remainder = 8;
96 if (prefixLength >= 8) {
97 prefixLength -= 8;
98 } else {
99 remainder = prefixLength;
100 prefixLength = 0;
101 }
102 if (i > 0)
103 netmask += '.';
104 var value = 0;
105 if (remainder != 0)
106 value = ((2 << (remainder - 1)) - 1) << (8 - remainder);
107 netmask += value.toString();
108 }
109 return netmask;
110 }
111
82 ///////////////////////////////////////////////////////////////////////////// 112 /////////////////////////////////////////////////////////////////////////////
83 // DetailsInternetPage class: 113 // DetailsInternetPage class:
84 114
85 /** 115 /**
86 * Encapsulated handling of ChromeOS internet details overlay page. 116 * Encapsulated handling of ChromeOS internet details overlay page.
87 * @constructor 117 * @constructor
88 */ 118 */
89 function DetailsInternetPage() { 119 function DetailsInternetPage() {
90 Page.call(this, 'detailsInternetPage', null, 'details-internet-page'); 120 Page.call(this, 'detailsInternetPage', null, 'details-internet-page');
91 } 121 }
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 // because the proxy settings page on the login screen re-uses the 352 // because the proxy settings page on the login screen re-uses the
323 // proxy sub-page from the internet options, and it doesn't ever 353 // proxy sub-page from the internet options, and it doesn't ever
324 // show the DNS settings, so we don't need this string there. 354 // show the DNS settings, so we don't need this string there.
325 // The string isn't available because 355 // The string isn't available because
326 // chrome://settings-frame/strings.js (where the string is 356 // chrome://settings-frame/strings.js (where the string is
327 // stored) is not accessible from the login screen. 357 // stored) is not accessible from the login screen.
328 // TODO(pneubeck): Remove this once i18n of the proxy dialog on the login 358 // TODO(pneubeck): Remove this once i18n of the proxy dialog on the login
329 // page is fixed. http://crbug.com/242865 359 // page is fixed. http://crbug.com/242865
330 if (loadTimeData.data_) { 360 if (loadTimeData.data_) {
331 $('google-dns-label').innerHTML = 361 $('google-dns-label').innerHTML =
332 loadTimeData.getString('googleNameServers'); 362 loadTimeData.getString('googleNameServers');
333 } 363 }
334 }, 364 },
335 365
336 /** 366 /**
337 * Handler for "add" event fired from userNameEdit. 367 * Handler for "add" event fired from userNameEdit.
338 * @param {Event} e Add event fired from userNameEdit. 368 * @param {Event} e Add event fired from userNameEdit.
339 * @private 369 * @private
340 */ 370 */
341 handleAddProxyException_: function(e) { 371 handleAddProxyException_: function(e) {
342 var exception = $('new-host').value; 372 var exception = $('new-host').value;
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 // Skip any empty values. 828 // Skip any empty values.
799 var userNameServers = []; 829 var userNameServers = [];
800 for (var i = 1; i <= 4; ++i) { 830 for (var i = 1; i <= 4; ++i) {
801 var nameServerField = $('ipconfig-dns' + i); 831 var nameServerField = $('ipconfig-dns' + i);
802 if (nameServerField && nameServerField.model && 832 if (nameServerField && nameServerField.model &&
803 nameServerField.model.value) { 833 nameServerField.model.value) {
804 userNameServers.push(nameServerField.model.value); 834 userNameServers.push(nameServerField.model.value);
805 } 835 }
806 } 836 }
807 837
808 userNameServers = userNameServers.join(','); 838 userNameServers = userNameServers.sort();
809
810 chrome.send('setIPConfig', 839 chrome.send('setIPConfig',
811 [servicePath, 840 [servicePath,
812 Boolean($('ip-automatic-configuration-checkbox').checked), 841 Boolean($('ip-automatic-configuration-checkbox').checked),
813 $('ip-address').model.value || '', 842 $('ip-address').model.value || '',
814 $('ip-netmask').model.value || '', 843 $('ip-netmask').model.value || '',
815 $('ip-gateway').model.value || '', 844 $('ip-gateway').model.value || '',
816 nameServerType, 845 nameServerType,
817 userNameServers]); 846 userNameServers.join(',')]);
818 PageManager.closeOverlay(); 847 PageManager.closeOverlay();
819 }; 848 };
820 849
821 DetailsInternetPage.updateNameServerDisplay = function(type) { 850 DetailsInternetPage.updateNameServerDisplay = function(type) {
822 var editable = type == 'user'; 851 var editable = type == 'user';
823 var fields = [$('ipconfig-dns1'), $('ipconfig-dns2'), 852 var fields = [$('ipconfig-dns1'), $('ipconfig-dns2'),
824 $('ipconfig-dns3'), $('ipconfig-dns4')]; 853 $('ipconfig-dns3'), $('ipconfig-dns4')];
825 for (var i = 0; i < fields.length; ++i) { 854 for (var i = 0; i < fields.length; ++i) {
826 fields[i].editable = editable; 855 fields[i].editable = editable;
827 } 856 }
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 chrome.send('selectNetwork', [data.servicePath]); 1025 chrome.send('selectNetwork', [data.servicePath]);
997 } else { 1026 } else {
998 detailsPage.showProxy = false; 1027 detailsPage.showProxy = false;
999 } 1028 }
1000 1029
1001 var connectionStateString = onc.getTranslatedValue('ConnectionState'); 1030 var connectionStateString = onc.getTranslatedValue('ConnectionState');
1002 $('connection-state').textContent = connectionStateString; 1031 $('connection-state').textContent = connectionStateString;
1003 var restricted = onc.getActiveValue('RestrictedConnectivity'); 1032 var restricted = onc.getActiveValue('RestrictedConnectivity');
1004 var restrictedString = loadTimeData.getString( 1033 var restrictedString = loadTimeData.getString(
1005 restricted ? 'restrictedYes' : 'restrictedNo'); 1034 restricted ? 'restrictedYes' : 'restrictedNo');
1006 var ipAutoConfig = data.ipAutoConfig ? 'automatic' : 'user';
1007 $('ip-automatic-configuration-checkbox').checked = data.ipAutoConfig;
1008 var inetAddress = {autoConfig: ipAutoConfig};
1009 var inetNetmask = {autoConfig: ipAutoConfig};
1010 var inetGateway = {autoConfig: ipAutoConfig};
1011 1035
1012 if (data.ipconfig.value) { 1036 var inetAddress = {};
1013 inetAddress.automatic = data.ipconfig.value.address; 1037 var inetNetmask = {};
1014 inetAddress.value = data.ipconfig.value.address; 1038 var inetGateway = {};
1015 inetNetmask.automatic = data.ipconfig.value.netmask; 1039
1016 inetNetmask.value = data.ipconfig.value.netmask; 1040 var inetNameServersString;
1017 inetGateway.automatic = data.ipconfig.value.gateway; 1041
1018 inetGateway.value = data.ipconfig.value.gateway; 1042 if ('IPConfigs' in data) {
1019 if (data.ipconfig.value.webProxyAutoDiscoveryUrl) { 1043 var ipconfigList = onc.getActiveValue('IPConfigs');
1020 $('web-proxy-auto-discovery').hidden = false; 1044 for (var i = 0; i < ipconfigList.length; ++i) {
1021 $('web-proxy-auto-discovery-url').value = 1045 var ipconfig = ipconfigList[i];
1022 data.ipconfig.value.webProxyAutoDiscoveryUrl; 1046 var type = ipconfig['Type'];
1047 if (type != 'IPv4') {
1048 // TODO(stevenjb): Handle IPv6 properties.
1049 continue;
1050 }
1051 var address = ipconfig['IPAddress'];
1052 inetAddress.automatic = address;
1053 inetAddress.value = address;
1054 var netmask = PrefixLengthToNetmask(ipconfig['RoutingPrefix']);
1055 inetNetmask.automatic = netmask;
1056 inetNetmask.value = netmask;
1057 var gateway = ipconfig['Gateway'];
1058 inetGateway.automatic = gateway;
1059 inetGateway.value = gateway;
1060 if ('WebProxyAutoDiscoveryUrl' in ipconfig) {
1061 $('web-proxy-auto-discovery').hidden = false;
1062 $('web-proxy-auto-discovery-url').value =
1063 ipconfig['WebProxyAutoDiscoveryUrl'];
1064 }
1065 if ('NameServers' in ipconfig) {
1066 var inetNameServers = ipconfig['NameServers'];
1067 inetNameServers = inetNameServers.sort();
1068 inetNameServersString = inetNameServers.join(',');
1069 }
1070 break; // Use the first IPv4 entry.
1023 } 1071 }
1024 } 1072 }
1025 1073
1026 // Override the "automatic" values with the real saved DHCP values, 1074 // Override the "automatic" values with the real saved DHCP values,
1027 // if they are set. 1075 // if they are set.
1028 if (data.savedIP.address) { 1076 var savedNameServersString;
1029 inetAddress.automatic = data.savedIP.address; 1077 if ('SavedIPConfig' in data) {
1030 inetAddress.value = data.savedIP.address; 1078 var savedIpAddress = onc.getActiveValue('SavedIPConfig.IPAddress');
1031 } 1079 if (savedIpAddress != undefined) {
1032 if (data.savedIP.netmask) { 1080 inetAddress.automatic = savedIpAddress;
1033 inetNetmask.automatic = data.savedIP.netmask; 1081 inetAddress.value = savedIpAddress;
1034 inetNetmask.value = data.savedIP.netmask; 1082 }
1035 } 1083 var savedPrefix = onc.getActiveValue('SavedIPConfig.RoutingPrefix');
1036 if (data.savedIP.gateway) { 1084 if (savedPrefix != undefined) {
1037 inetGateway.automatic = data.savedIP.gateway; 1085 var savedNetmask = PrefixLengthToNetmask(savedPrefix);
1038 inetGateway.value = data.savedIP.gateway; 1086 inetNetmask.automatic = savedNetmask;
1087 inetNetmask.value = savedNetmask;
1088 }
1089 var savedGateway = onc.getActiveValue('SavedIPConfig.Gateway');
1090 if (savedGateway != undefined) {
1091 inetGateway.automatic = savedGateway;
1092 inetGateway.value = savedGateway;
1093 }
1094 var savedNameServers = onc.getActiveValue('SavedIPConfig.NameServers');
1095 if (savedNameServers) {
1096 savedNameServers = savedNameServers.sort();
1097 savedNameServersString = savedNameServers.join(',');
1098 }
1039 } 1099 }
1040 1100
1041 if (ipAutoConfig == 'user') { 1101 var ipAutoConfig = 'automatic';
1042 if (data.staticIP.value.address) { 1102
1043 inetAddress.value = data.staticIP.value.address; 1103 var staticNameServersString;
1044 inetAddress.user = data.staticIP.value.address; 1104 if ('StaticIPConfig' in data) {
1105 var staticIpAddress = onc.getActiveValue('StaticIPConfig.IPAddress');
1106 if (staticIpAddress != undefined) {
1107 ipAutoConfig = 'user';
1108 inetAddress.user = staticIpAddress;
1109 inetAddress.value = staticIpAddress;
1045 } 1110 }
1046 if (data.staticIP.value.netmask) { 1111 var staticPrefix = onc.getActiveValue('StaticIPConfig.RoutingPrefix');
1047 inetNetmask.value = data.staticIP.value.netmask; 1112 if (staticPrefix != undefined) {
1048 inetNetmask.user = data.staticIP.value.netmask; 1113 var staticNetmask = PrefixLengthToNetmask(staticPrefix);
1114 inetNetmask.user = staticNetmask;
1115 inetNetmask.value = staticNetmask;
1049 } 1116 }
1050 if (data.staticIP.value.gateway) { 1117 var staticGateway = onc.getActiveValue('StaticIPConfig.Gateway');
1051 inetGateway.value = data.staticIP.value.gateway; 1118 if (staticGateway != undefined) {
1052 inetGateway.user = data.staticIP.value.gateway; 1119 inetGateway.user = staticGateway;
1120 inetGateway.value = staticGateway;
1121 }
1122 var staticNameServers = onc.getActiveValue('StaticIPConfig.NameServers');
1123 if (staticNameServers) {
1124 staticNameServers = staticNameServers.sort();
1125 staticNameServersString = staticNameServers.join(',');
1053 } 1126 }
1054 } 1127 }
1055 1128
1129 $('ip-automatic-configuration-checkbox').checked =
1130 ipAutoConfig == 'automatic';
1131
1132 inetAddress.autoConfig = ipAutoConfig;
1133 inetNetmask.autoConfig = ipAutoConfig;
1134 inetGateway.autoConfig = ipAutoConfig;
1135
1056 var configureAddressField = function(field, model) { 1136 var configureAddressField = function(field, model) {
1057 IPAddressField.decorate(field); 1137 IPAddressField.decorate(field);
1058 field.model = model; 1138 field.model = model;
1059 field.editable = model.autoConfig == 'user'; 1139 field.editable = model.autoConfig == 'user';
1060 }; 1140 };
1061
1062 configureAddressField($('ip-address'), inetAddress); 1141 configureAddressField($('ip-address'), inetAddress);
1063 configureAddressField($('ip-netmask'), inetNetmask); 1142 configureAddressField($('ip-netmask'), inetNetmask);
1064 configureAddressField($('ip-gateway'), inetGateway); 1143 configureAddressField($('ip-gateway'), inetGateway);
1065 1144
1066 var inetNameServers = ''; 1145 // Set Nameserver fields.
1067 if (data.ipconfig.value && data.ipconfig.value.nameServers) { 1146 var nameServerType = 'automatic';
1068 inetNameServers = data.ipconfig.value.nameServers; 1147 if (staticNameServersString &&
1069 $('automatic-dns-display').textContent = inetNameServers; 1148 staticNameServersString == inetNameServersString) {
1149 nameServerType = 'user';
1070 } 1150 }
1151 if (inetNameServersString == GoogleNameServersString)
1152 nameServerType = 'google';
1071 1153
1072 if (data.savedIP && data.savedIP.nameServers) 1154 $('automatic-dns-display').textContent = inetNameServersString;
1073 $('automatic-dns-display').textContent = data.savedIP.nameServers; 1155 $('google-dns-display').textContent = GoogleNameServersString;
1074
1075 if (data.nameServersGoogle)
1076 $('google-dns-display').textContent = data.nameServersGoogle;
1077 1156
1078 var nameServersUser = []; 1157 var nameServersUser = [];
1079 if (data.staticIP.value.nameServers) 1158 if (staticNameServers)
1080 nameServersUser = data.staticIP.value.nameServers.split(','); 1159 nameServersUser = staticNameServers;
1081 1160
1082 var nameServerModels = []; 1161 var nameServerModels = [];
1083 for (var i = 0; i < 4; ++i) 1162 for (var i = 0; i < 4; ++i)
1084 nameServerModels.push({value: nameServersUser[i] || ''}); 1163 nameServerModels.push({value: nameServersUser[i] || ''});
1085 1164
1086 $(data.nameServerType + '-dns-radio').checked = true; 1165 $(nameServerType + '-dns-radio').checked = true;
1087 configureAddressField($('ipconfig-dns1'), nameServerModels[0]); 1166 configureAddressField($('ipconfig-dns1'), nameServerModels[0]);
1088 configureAddressField($('ipconfig-dns2'), nameServerModels[1]); 1167 configureAddressField($('ipconfig-dns2'), nameServerModels[1]);
1089 configureAddressField($('ipconfig-dns3'), nameServerModels[2]); 1168 configureAddressField($('ipconfig-dns3'), nameServerModels[2]);
1090 configureAddressField($('ipconfig-dns4'), nameServerModels[3]); 1169 configureAddressField($('ipconfig-dns4'), nameServerModels[3]);
1091 1170
1092 DetailsInternetPage.updateNameServerDisplay(data.nameServerType); 1171 DetailsInternetPage.updateNameServerDisplay(nameServerType);
1093 1172
1094 var macAddress = onc.getActiveValue('MacAddress'); 1173 var macAddress = onc.getActiveValue('MacAddress');
1095 if (macAddress) { 1174 if (macAddress) {
1096 $('hardware-address').textContent = macAddress; 1175 $('hardware-address').textContent = macAddress;
1097 $('hardware-address-row').style.display = 'table-row'; 1176 $('hardware-address-row').style.display = 'table-row';
1098 } else { 1177 } else {
1099 // This is most likely a device without a hardware address. 1178 // This is most likely a device without a hardware address.
1100 $('hardware-address-row').style.display = 'none'; 1179 $('hardware-address-row').style.display = 'none';
1101 } 1180 }
1102 1181
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1230 $('iccid').textContent = onc.getActiveValue('Cellular.ICCID'); 1309 $('iccid').textContent = onc.getActiveValue('Cellular.ICCID');
1231 $('imsi').textContent = onc.getActiveValue('Cellular.IMSI'); 1310 $('imsi').textContent = onc.getActiveValue('Cellular.IMSI');
1232 1311
1233 var apnSelector = $('select-apn'); 1312 var apnSelector = $('select-apn');
1234 // Clear APN lists, keep only last element that "other". 1313 // Clear APN lists, keep only last element that "other".
1235 while (apnSelector.length != 1) 1314 while (apnSelector.length != 1)
1236 apnSelector.remove(0); 1315 apnSelector.remove(0);
1237 var otherOption = apnSelector[0]; 1316 var otherOption = apnSelector[0];
1238 data.selectedApn = -1; 1317 data.selectedApn = -1;
1239 data.userApnIndex = -1; 1318 data.userApnIndex = -1;
1240 var activeApn = onc.getActiveValue('Cellular.APN'); 1319 var activeApn = onc.getActiveValue('Cellular.APN.AccessPointName');
1241 var lastGoodApn = onc.getActiveValue('Cellular.LastGoodAPN'); 1320 var activeUsername = onc.getActiveValue('Cellular.APN.Username');
1321 var activePassword = onc.getActiveValue('Cellular.APN.Password');
1322 var lastGoodApn =
1323 onc.getActiveValue('Cellular.LastGoodAPN.AccessPointName');
1324 var lastGoodUsername =
1325 onc.getActiveValue('Cellular.LastGoodAPN.Username');
1326 var lastGoodPassword =
1327 onc.getActiveValue('Cellular.LastGoodAPN.Password');
1242 var apnList = onc.getActiveValue('Cellular.APNList'); 1328 var apnList = onc.getActiveValue('Cellular.APNList');
1243 for (var i = 0; i < apnList.length; i++) { 1329 for (var i = 0; i < apnList.length; i++) {
1244 var apnDict = apnList[i]; 1330 var apnDict = apnList[i];
1245 var option = document.createElement('option'); 1331 var option = document.createElement('option');
1246 var localizedName = apnDict['LocalizedName']; 1332 var localizedName = apnDict['LocalizedName'];
1247 var name = localizedName ? localizedName : apnDict['Name']; 1333 var name = localizedName ? localizedName : apnDict['Name'];
1248 var accessPointName = apnDict['AccessPointName']; 1334 var accessPointName = apnDict['AccessPointName'];
1249 option.textContent = 1335 option.textContent =
1250 name ? (name + ' (' + accessPointName + ')') : accessPointName; 1336 name ? (name + ' (' + accessPointName + ')') : accessPointName;
1251 option.value = i; 1337 option.value = i;
1252 // If this matches the active Apn, or LastGoodApn, set it as the 1338 // If this matches the active Apn, or LastGoodApn, set it as the
1253 // selected Apn. 1339 // selected Apn.
1254 if ((activeApn != undefined && 1340 if ((activeApn == accessPointName &&
1255 activeApn['AccessPointName'] == accessPointName && 1341 activeUsername == apnDict['Username'] &&
1256 activeApn['Username'] == apnDict['Username'] && 1342 activePassword == apnDict['Password']) ||
1257 activeApn['Password'] == apnDict['Password']) || 1343 (!activeApn &&
1258 ((activeApn == undefined || !activeApn['AccessPointName']) && 1344 lastGoodApn == accessPointName &&
1259 lastGoodApn != undefined && 1345 lastGoodUsername == apnDict['Username'] &&
1260 lastGoodApn['AccessPointName'] == accessPointName && 1346 lastGoodPassword == apnDict['Password'])) {
1261 lastGoodApn['Username'] == apnDict['Username'] &&
1262 lastGoodApn['Password'] == apnDict['Password'])) {
1263 data.selectedApn = i; 1347 data.selectedApn = i;
1264 } 1348 }
1265 // Insert new option before "other" option. 1349 // Insert new option before "other" option.
1266 apnSelector.add(option, otherOption); 1350 apnSelector.add(option, otherOption);
1267 } 1351 }
1268 if (data.selectedApn == -1 && 1352 if (data.selectedApn == -1 && activeApn) {
1269 activeApn != undefined && activeApn['AccessPointName']) {
1270 var option = document.createElement('option'); 1353 var option = document.createElement('option');
1271 option.textContent = activeApn['AccessPointName']; 1354 option.textContent = activeApn;
1272 option.value = -1; 1355 option.value = -1;
1273 apnSelector.add(option, otherOption); 1356 apnSelector.add(option, otherOption);
1274 data.selectedApn = apnSelector.length - 2; 1357 data.selectedApn = apnSelector.length - 2;
1275 data.userApnIndex = data.selectedApn; 1358 data.userApnIndex = data.selectedApn;
1276 } 1359 }
1277 apnSelector.selectedIndex = data.selectedApn; 1360 apnSelector.selectedIndex = data.selectedApn;
1278 updateHidden('.apn-list-view', false); 1361 updateHidden('.apn-list-view', false);
1279 updateHidden('.apn-details-view', true); 1362 updateHidden('.apn-details-view', true);
1280 var lockEnabled = 1363 var lockEnabled =
1281 onc.getActiveValue('Cellular.SIMLockStatus.LockEnabled'); 1364 onc.getActiveValue('Cellular.SIMLockStatus.LockEnabled');
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1350 1433
1351 // Don't show page name in address bar and in history to prevent people 1434 // Don't show page name in address bar and in history to prevent people
1352 // navigate here by hand and solve issue with page session restore. 1435 // navigate here by hand and solve issue with page session restore.
1353 PageManager.showPageByName('detailsInternetPage', false); 1436 PageManager.showPageByName('detailsInternetPage', false);
1354 }; 1437 };
1355 1438
1356 return { 1439 return {
1357 DetailsInternetPage: DetailsInternetPage 1440 DetailsInternetPage: DetailsInternetPage
1358 }; 1441 };
1359 }); 1442 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698