OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // require: onc_data.js | 5 // require: onc_data.js |
6 | 6 |
7 // NOTE(stevenjb): This code is in the process of being converted to be | 7 // NOTE(stevenjb): This code is in the process of being converted to be |
8 // compatible with the networkingPrivate extension API: | 8 // compatible with the networkingPrivate extension API: |
9 // * The network property dictionaries are being converted to use ONC values. | 9 // * The network property dictionaries are being converted to use ONC values. |
10 // * chrome.send calls will be replaced with an API object that simulates the | 10 // * chrome.send calls will be replaced with an API object that simulates the |
(...skipping 1289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1300 var frequencyFormat = loadTimeData.getString('inetFrequencyFormat'); | 1300 var frequencyFormat = loadTimeData.getString('inetFrequencyFormat'); |
1301 frequencyFormat = frequencyFormat.replace('$1', frequency); | 1301 frequencyFormat = frequencyFormat.replace('$1', frequency); |
1302 $('wifi-frequency').textContent = frequencyFormat; | 1302 $('wifi-frequency').textContent = frequencyFormat; |
1303 $('wifi-signal-strength').textContent = strengthString; | 1303 $('wifi-signal-strength').textContent = strengthString; |
1304 setOrHideParent('wifi-hardware-address', | 1304 setOrHideParent('wifi-hardware-address', |
1305 onc.getActiveValue('MacAddress')); | 1305 onc.getActiveValue('MacAddress')); |
1306 var priority = onc.getActiveValue('Priority'); | 1306 var priority = onc.getActiveValue('Priority'); |
1307 $('prefer-network-wifi').checked = priority > 0; | 1307 $('prefer-network-wifi').checked = priority > 0; |
1308 $('prefer-network-wifi').disabled = !remembered; | 1308 $('prefer-network-wifi').disabled = !remembered; |
1309 $('auto-connect-network-wifi').checked = | 1309 $('auto-connect-network-wifi').checked = |
1310 onc.getActiveValue('AutoConnect'); | 1310 onc.getActiveValue('WiFi.AutoConnect'); |
1311 $('auto-connect-network-wifi').disabled = !remembered; | 1311 $('auto-connect-network-wifi').disabled = !remembered; |
1312 } else if (type == 'Wimax') { | 1312 } else if (type == 'Wimax') { |
1313 OptionsPage.showTab($('wimax-network-nav-tab')); | 1313 OptionsPage.showTab($('wimax-network-nav-tab')); |
1314 $('wimax-restricted-connectivity').textContent = restrictedString; | 1314 $('wimax-restricted-connectivity').textContent = restrictedString; |
| 1315 |
1315 $('auto-connect-network-wimax').checked = | 1316 $('auto-connect-network-wimax').checked = |
1316 onc.getActiveValue('AutoConnect'); | 1317 onc.getActiveValue('Wimax.AutoConnect'); |
1317 $('auto-connect-network-wimax').disabled = !remembered; | 1318 $('auto-connect-network-wimax').disabled = !remembered; |
1318 var identity = onc.getActiveValue('Wimax.EAP.Identity'); | 1319 var identity = onc.getActiveValue('Wimax.EAP.Identity'); |
1319 setOrHideParent('wimax-eap-identity', identity); | 1320 setOrHideParent('wimax-eap-identity', identity); |
1320 $('wimax-signal-strength').textContent = strengthString; | 1321 $('wimax-signal-strength').textContent = strengthString; |
1321 } else if (type == 'Cellular') { | 1322 } else if (type == 'Cellular') { |
1322 OptionsPage.showTab($('cellular-conn-nav-tab')); | 1323 OptionsPage.showTab($('cellular-conn-nav-tab')); |
1323 if (data.showCarrierSelect && data.currentCarrierIndex != -1) { | 1324 if (data.showCarrierSelect && data.currentCarrierIndex != -1) { |
1324 var carrierSelector = $('select-carrier'); | 1325 var carrierSelector = $('select-carrier'); |
1325 carrierSelector.onchange = DetailsInternetPage.handleCarrierChanged; | 1326 carrierSelector.onchange = DetailsInternetPage.handleCarrierChanged; |
1326 carrierSelector.options.length = 0; | 1327 carrierSelector.options.length = 0; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1373 setOrHideParent('meid', onc.getActiveValue('Cellular.MEID')); | 1374 setOrHideParent('meid', onc.getActiveValue('Cellular.MEID')); |
1374 setOrHideParent('min', onc.getActiveValue('Cellular.MIN')); | 1375 setOrHideParent('min', onc.getActiveValue('Cellular.MIN')); |
1375 setOrHideParent('prl-version', onc.getActiveValue('Cellular.PRLVersion')); | 1376 setOrHideParent('prl-version', onc.getActiveValue('Cellular.PRLVersion')); |
1376 | 1377 |
1377 if (onc.getActiveValue('Cellular.Family') == 'GSM') { | 1378 if (onc.getActiveValue('Cellular.Family') == 'GSM') { |
1378 $('iccid').textContent = onc.getActiveValue('Cellular.ICCID'); | 1379 $('iccid').textContent = onc.getActiveValue('Cellular.ICCID'); |
1379 $('imsi').textContent = onc.getActiveValue('Cellular.IMSI'); | 1380 $('imsi').textContent = onc.getActiveValue('Cellular.IMSI'); |
1380 detailsPage.initializeApnList_(onc); | 1381 detailsPage.initializeApnList_(onc); |
1381 } | 1382 } |
1382 $('auto-connect-network-cellular').checked = | 1383 $('auto-connect-network-cellular').checked = |
1383 onc.getActiveValue('AutoConnect'); | 1384 onc.getActiveValue('Cellular.AutoConnect'); |
1384 $('auto-connect-network-cellular').disabled = false; | 1385 $('auto-connect-network-cellular').disabled = false; |
1385 } else if (type == 'VPN') { | 1386 } else if (type == 'VPN') { |
1386 OptionsPage.showTab($('vpn-nav-tab')); | 1387 OptionsPage.showTab($('vpn-nav-tab')); |
1387 $('inet-service-name').textContent = networkName; | 1388 $('inet-service-name').textContent = networkName; |
1388 $('inet-provider-type').textContent = | 1389 $('inet-provider-type').textContent = |
1389 onc.getTranslatedValue('VPN.Type'); | 1390 onc.getTranslatedValue('VPN.Type'); |
1390 var providerType = onc.getActiveValue('VPN.Type'); | 1391 var providerType = onc.getActiveValue('VPN.Type'); |
1391 var providerKey = 'VPN.' + providerType; | 1392 var usernameKey; |
1392 $('inet-username').textContent = | 1393 if (providerType == 'OpenVPN') |
1393 onc.getActiveValue(providerKey + '.Username'); | 1394 usernameKey = 'VPN.OpenVPN.Username'; |
| 1395 else if (providerType == 'L2TP-IPsec') |
| 1396 usernameKey = 'VPN.L2TP.Username'; |
| 1397 |
| 1398 if (usernameKey) { |
| 1399 $('inet-username').parentElement.hidden = false; |
| 1400 $('inet-username').textContent = onc.getActiveValue(usernameKey); |
| 1401 } else { |
| 1402 $('inet-username').parentElement.hidden = true; |
| 1403 } |
1394 var inetServerHostname = $('inet-server-hostname'); | 1404 var inetServerHostname = $('inet-server-hostname'); |
1395 inetServerHostname.value = onc.getActiveValue('VPN.Host'); | 1405 inetServerHostname.value = onc.getActiveValue('VPN.Host'); |
1396 inetServerHostname.resetHandler = function() { | 1406 inetServerHostname.resetHandler = function() { |
1397 PageManager.hideBubble(); | 1407 PageManager.hideBubble(); |
1398 var recommended = onc.getRecommendedValue('VPN.Host'); | 1408 var recommended = onc.getRecommendedValue('VPN.Host'); |
1399 if (recommended != undefined) | 1409 if (recommended != undefined) |
1400 inetServerHostname.value = recommended; | 1410 inetServerHostname.value = recommended; |
1401 }; | 1411 }; |
1402 $('auto-connect-network-vpn').checked = | 1412 $('auto-connect-network-vpn').checked = |
1403 onc.getActiveValue('AutoConnect'); | 1413 onc.getActiveValue('VPN.AutoConnect'); |
1404 $('auto-connect-network-vpn').disabled = false; | 1414 $('auto-connect-network-vpn').disabled = false; |
1405 } else { | 1415 } else { |
1406 OptionsPage.showTab($('internet-nav-tab')); | 1416 OptionsPage.showTab($('internet-nav-tab')); |
1407 } | 1417 } |
1408 | 1418 |
1409 // Update controlled option indicators. | 1419 // Update controlled option indicators. |
1410 var indicators = cr.doc.querySelectorAll( | 1420 var indicators = cr.doc.querySelectorAll( |
1411 '#details-internet-page .controlled-setting-indicator'); | 1421 '#details-internet-page .controlled-setting-indicator'); |
1412 for (var i = 0; i < indicators.length; i++) { | 1422 for (var i = 0; i < indicators.length; i++) { |
1413 var managed = indicators[i].hasAttribute('managed'); | 1423 var managed = indicators[i].hasAttribute('managed'); |
(...skipping 25 matching lines...) Expand all Loading... |
1439 | 1449 |
1440 // Don't show page name in address bar and in history to prevent people | 1450 // Don't show page name in address bar and in history to prevent people |
1441 // navigate here by hand and solve issue with page session restore. | 1451 // navigate here by hand and solve issue with page session restore. |
1442 PageManager.showPageByName('detailsInternetPage', false); | 1452 PageManager.showPageByName('detailsInternetPage', false); |
1443 }; | 1453 }; |
1444 | 1454 |
1445 return { | 1455 return { |
1446 DetailsInternetPage: DetailsInternetPage | 1456 DetailsInternetPage: DetailsInternetPage |
1447 }; | 1457 }; |
1448 }); | 1458 }); |
OLD | NEW |