Chromium Code Reviews| 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 // NOTE(stevenjb): This code is in the process of being converted to be | 5 // NOTE(stevenjb): This code is in the process of being converted to be |
| 6 // compatible with the networkingPrivate extension API: | 6 // compatible with the networkingPrivate extension API: |
| 7 // * The network property dictionaries are being converted to use ONC values. | 7 // * The network property dictionaries are being converted to use ONC values. |
| 8 // * chrome.send calls will be replaced with an API object that simulates the | 8 // * chrome.send calls will be replaced with an API object that simulates the |
| 9 // networkingPrivate API. See network_config.js. | 9 // networkingPrivate API. See network_config.js. |
| 10 // See crbug.com/279351 for more info. | 10 // See crbug.com/279351 for more info. |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 29 * @param {string} key The property key. | 29 * @param {string} key The property key. |
| 30 * @param {string} type (Optional) The type of property to get as defined in | 30 * @param {string} type (Optional) The type of property to get as defined in |
| 31 * GetManagedTypes: | 31 * GetManagedTypes: |
| 32 * 'ACTIVE' (default) - gets the active value | 32 * 'ACTIVE' (default) - gets the active value |
| 33 * 'TRANSLATED' - gets the traslated or active value | 33 * 'TRANSLATED' - gets the traslated or active value |
| 34 * 'RECOMMENDED' - gets the recommended value | 34 * 'RECOMMENDED' - gets the recommended value |
| 35 * @return {*} The property value or undefined. | 35 * @return {*} The property value or undefined. |
| 36 */ | 36 */ |
| 37 function getManagedValue(data, key, type) { | 37 function getManagedValue(data, key, type) { |
| 38 var property = getManagedProperty(data, key); | 38 var property = getManagedProperty(data, key); |
| 39 if (typeof property != 'object') | 39 if (Array.isArray(property) || typeof property != 'object') |
| 40 return property; | 40 return property; |
| 41 if (type == GetManagedTypes.RECOMMENDED) | 41 if (type == GetManagedTypes.RECOMMENDED) |
| 42 return getRecommendedValue(property); | 42 return getRecommendedValue(property); |
| 43 if (type == GetManagedTypes.TRANSLATED && 'Translated' in property) | 43 if (type == GetManagedTypes.TRANSLATED && 'Translated' in property) |
| 44 return property['Translated']; | 44 return property['Translated']; |
| 45 // Otherwise get the Active value (defalt behavior). | 45 // Otherwise get the Active value (defalt behavior). |
| 46 if ('Active' in property) | 46 if ('Active' in property) |
| 47 return property['Active']; | 47 return property['Active']; |
| 48 // If no Active value is defined, return the effective value. | 48 // If no Active value is defined, return the effective value if present. |
| 49 return getEffectiveValue(property); | 49 var effective = getEffectiveValue(property); |
| 50 if (effective != undefined) | |
| 51 return effective; | |
| 52 // Otherwise this is an Object but not a Managed one. | |
| 53 return property; | |
| 50 } | 54 } |
| 51 | 55 |
| 52 /** | 56 /** |
| 53 * Get the recommended value from a Managed property ONC dictionary. | 57 * Get the recommended value from a Managed property ONC dictionary. |
| 54 * @param {object} property The managed property ONC dictionary. | 58 * @param {object} property The managed property ONC dictionary. |
| 55 * @return {*} the effective value or undefined. | 59 * @return {*} the effective value or undefined. |
| 56 */ | 60 */ |
| 57 function getRecommendedValue(property) { | 61 function getRecommendedValue(property) { |
| 58 if (property['UserEditable']) | 62 if (property['UserEditable']) |
| 59 return property['UserPolicy']; | 63 return property['UserPolicy']; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 94 var keyComponent = key.substr(0, index); | 98 var keyComponent = key.substr(0, index); |
| 95 if (!(keyComponent in data)) | 99 if (!(keyComponent in data)) |
| 96 return undefined; | 100 return undefined; |
| 97 data = data[keyComponent]; | 101 data = data[keyComponent]; |
| 98 key = key.substr(index + 1); | 102 key = key.substr(index + 1); |
| 99 } | 103 } |
| 100 return data[key]; | 104 return data[key]; |
| 101 } | 105 } |
| 102 | 106 |
| 103 /** | 107 /** |
| 108 * Set the value of a property in dictionary |data| that includes ONC | |
| 109 * managed properties, e.g. setManagedValue(data, 'Name', 'MyNetwork'). | |
| 110 * See notes for getManagedProperty. | |
| 111 * @param {object} data The properties dictionary. | |
| 112 * @param {string} key The property key. | |
| 113 * @param {string} value The property value to set. | |
| 114 */ | |
| 115 function setManagedProperty(data, key, value) { | |
| 116 while (true) { | |
| 117 var index = key.indexOf('.'); | |
| 118 if (index < 0) | |
| 119 break; | |
| 120 var keyComponent = key.substr(0, index); | |
| 121 if (!(keyComponent in data)) | |
| 122 data[keyComponent] = {}; | |
| 123 data = data[keyComponent]; | |
| 124 key = key.substr(index + 1); | |
| 125 } | |
| 126 if (!(key in data) || | |
| 127 (typeof data[key] != 'object') || !('Active' in data[key])) { | |
|
pneubeck (no reviews)
2014/08/22 08:55:32
Active might not be present if the value from Shil
stevenjb
2014/08/22 17:08:43
Done.
| |
| 128 data[key] = value; | |
| 129 } else { | |
| 130 // For now, just uodare the active value. TODO(stevenjb): Possibly check | |
|
pneubeck (no reviews)
2014/08/22 08:55:32
typo: uodare -> update
stevenjb
2014/08/22 17:08:43
Done.
| |
| 131 // the policy attributes and update appropriately. | |
| 132 data[key]['Active'] = value; | |
|
pneubeck (no reviews)
2014/08/22 08:55:32
If I get it right, then you want to use the ONC pr
stevenjb
2014/08/22 17:08:43
My intention was to do something better than clobb
| |
| 133 } | |
| 134 } | |
| 135 | |
| 136 /** | |
| 104 * Helper function to set hidden attribute for elements matching a selector. | 137 * Helper function to set hidden attribute for elements matching a selector. |
| 105 * @param {string} selector CSS selector for extracting a list of elements. | 138 * @param {string} selector CSS selector for extracting a list of elements. |
| 106 * @param {bool} hidden New hidden value. | 139 * @param {bool} hidden New hidden value. |
| 107 */ | 140 */ |
| 108 function updateHidden(selector, hidden) { | 141 function updateHidden(selector, hidden) { |
| 109 var elements = cr.doc.querySelectorAll(selector); | 142 var elements = cr.doc.querySelectorAll(selector); |
| 110 for (var i = 0, el; el = elements[i]; i++) { | 143 for (var i = 0, el; el = elements[i]; i++) { |
| 111 el.hidden = hidden; | 144 el.hidden = hidden; |
| 112 } | 145 } |
| 113 } | 146 } |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 265 | 298 |
| 266 $('cellular-apn-use-default').addEventListener('click', function(event) { | 299 $('cellular-apn-use-default').addEventListener('click', function(event) { |
| 267 var data = $('connection-state').data; | 300 var data = $('connection-state').data; |
| 268 var apnSelector = $('select-apn'); | 301 var apnSelector = $('select-apn'); |
| 269 | 302 |
| 270 if (data.userApnIndex != -1) { | 303 if (data.userApnIndex != -1) { |
| 271 apnSelector.remove(data.userApnIndex); | 304 apnSelector.remove(data.userApnIndex); |
| 272 data.userApnIndex = -1; | 305 data.userApnIndex = -1; |
| 273 } | 306 } |
| 274 | 307 |
| 275 if (data.providerApnList.value.length > 0) { | 308 var activeApn; |
| 276 var iApn = 0; | 309 var iApn = -1; |
| 277 var defaultApn = data.providerApnList.value[iApn]; | 310 var apnList = getManagedValue(data, 'Cellular.APNList'); |
| 278 data.apn.apn = stringFromValue(defaultApn.apn); | 311 if (apnList != undefined && apnList.length > 0) { |
| 279 data.apn.username = stringFromValue(defaultApn.username); | 312 iApn = 0; |
| 280 data.apn.password = stringFromValue(defaultApn.password); | 313 var defaultApn = apnList[iApn]; |
| 314 activeApn['APN'] = stringFromValue(defaultApn['APN']); | |
| 315 activeApn['Username'] = stringFromValue(defaultApn['Username']); | |
| 316 activeApn['Password'] = stringFromValue(defaultApn['Password']); | |
| 281 chrome.send('setApn', [data.servicePath, | 317 chrome.send('setApn', [data.servicePath, |
| 282 data.apn.apn, | 318 activeApn['APN'], |
| 283 data.apn.username, | 319 activeApn['Username'], |
| 284 data.apn.password]); | 320 activeApn['Password']]); |
| 285 apnSelector.selectedIndex = iApn; | |
| 286 data.selectedApn = iApn; | |
| 287 } else { | |
| 288 data.apn.apn = ''; | |
| 289 data.apn.username = ''; | |
| 290 data.apn.password = ''; | |
| 291 apnSelector.selectedIndex = -1; | |
| 292 data.selectedApn = -1; | |
| 293 } | 321 } |
| 322 setManagedProperty(data, 'Cellular.APN', activeApn); | |
| 323 apnSelector.selectedIndex = iApn; | |
| 324 data.selectedApn = iApn; | |
| 325 | |
| 294 updateHidden('.apn-list-view', false); | 326 updateHidden('.apn-list-view', false); |
| 295 updateHidden('.apn-details-view', true); | 327 updateHidden('.apn-details-view', true); |
| 296 }); | 328 }); |
| 297 | 329 |
| 298 $('cellular-apn-set').addEventListener('click', function(event) { | 330 $('cellular-apn-set').addEventListener('click', function(event) { |
| 299 if ($('cellular-apn').value == '') | 331 if ($('cellular-apn').value == '') |
| 300 return; | 332 return; |
| 301 | 333 |
| 302 var data = $('connection-state').data; | 334 var data = $('connection-state').data; |
| 303 var apnSelector = $('select-apn'); | 335 var apnSelector = $('select-apn'); |
| 304 | 336 |
| 305 data.apn.apn = stringFromValue($('cellular-apn').value); | 337 var activeApn = {}; |
| 306 data.apn.username = stringFromValue($('cellular-apn-username').value); | 338 activeApn['APN'] = stringFromValue($('cellular-apn').value); |
| 307 data.apn.password = stringFromValue($('cellular-apn-password').value); | 339 activeApn['Username'] = |
| 308 data.userApn = { | 340 stringFromValue($('cellular-apn-username').value); |
| 309 'apn': data.apn.apn, | 341 activeApn['Password'] = |
| 310 'username': data.apn.username, | 342 stringFromValue($('cellular-apn-password').value); |
| 311 'password': data.apn.password | 343 setManagedProperty(data, 'Cellular.APN', activeApn); |
| 312 }; | 344 data.userApn = activeApn; |
| 313 chrome.send('setApn', [data.servicePath, | 345 chrome.send('setApn', [data.servicePath, |
| 314 data.apn.apn, | 346 activeApn['APN'], |
| 315 data.apn.username, | 347 activeApn['Username'], |
| 316 data.apn.password]); | 348 activeApn['Password']]); |
| 317 | 349 |
| 318 if (data.userApnIndex != -1) { | 350 if (data.userApnIndex != -1) { |
| 319 apnSelector.remove(data.userApnIndex); | 351 apnSelector.remove(data.userApnIndex); |
| 320 data.userApnIndex = -1; | 352 data.userApnIndex = -1; |
| 321 } | 353 } |
| 322 | 354 |
| 323 var option = document.createElement('option'); | 355 var option = document.createElement('option'); |
| 324 option.textContent = data.apn.apn; | 356 option.textContent = activeApn['APN']; |
| 325 option.value = -1; | 357 option.value = -1; |
| 326 option.selected = true; | 358 option.selected = true; |
| 327 apnSelector.add(option, apnSelector[apnSelector.length - 1]); | 359 apnSelector.add(option, apnSelector[apnSelector.length - 1]); |
| 328 data.userApnIndex = apnSelector.length - 2; | 360 data.userApnIndex = apnSelector.length - 2; |
| 329 data.selectedApn = data.userApnIndex; | 361 data.selectedApn = data.userApnIndex; |
| 330 | 362 |
| 331 updateHidden('.apn-list-view', false); | 363 updateHidden('.apn-list-view', false); |
| 332 updateHidden('.apn-details-view', true); | 364 updateHidden('.apn-details-view', true); |
| 333 }); | 365 }); |
| 334 | 366 |
| 335 $('cellular-apn-cancel').addEventListener('click', function(event) { | 367 $('cellular-apn-cancel').addEventListener('click', function(event) { |
| 336 $('select-apn').selectedIndex = $('connection-state').data.selectedApn; | 368 $('select-apn').selectedIndex = $('connection-state').data.selectedApn; |
| 337 updateHidden('.apn-list-view', false); | 369 updateHidden('.apn-list-view', false); |
| 338 updateHidden('.apn-details-view', true); | 370 updateHidden('.apn-details-view', true); |
| 339 }); | 371 }); |
| 340 | 372 |
| 341 $('select-apn').addEventListener('change', function(event) { | 373 $('select-apn').addEventListener('change', function(event) { |
| 342 var data = $('connection-state').data; | 374 var data = $('connection-state').data; |
| 343 var apnSelector = $('select-apn'); | 375 var apnSelector = $('select-apn'); |
| 344 if (apnSelector[apnSelector.selectedIndex].value != -1) { | 376 if (apnSelector[apnSelector.selectedIndex].value != -1) { |
| 345 var apnList = data.providerApnList.value; | 377 var apnList = getManagedValue(data, 'Cellular.APNList'); |
| 378 var apnIndex = apnSelector.selectedIndex; | |
| 379 assert(apnIndex < apnList.length); | |
| 380 var apnDict = apnList[apnIndex]; | |
| 346 chrome.send('setApn', [data.servicePath, | 381 chrome.send('setApn', [data.servicePath, |
| 347 stringFromValue(apnList[apnSelector.selectedIndex].apn), | 382 stringFromValue(apnDict['Name']), |
|
armansito
2014/08/22 00:56:45
Shouldn't this be 'APN' rather than 'Name'?
stevenjb
2014/08/22 17:08:43
Done.
| |
| 348 stringFromValue(apnList[apnSelector.selectedIndex].username), | 383 stringFromValue(apnDict['Username']), |
| 349 stringFromValue(apnList[apnSelector.selectedIndex].password)] | 384 stringFromValue(apnDict['Password'])]); |
| 350 ); | 385 data.selectedApn = apnIndex; |
| 351 data.selectedApn = apnSelector.selectedIndex; | |
| 352 } else if (apnSelector.selectedIndex == data.userApnIndex) { | 386 } else if (apnSelector.selectedIndex == data.userApnIndex) { |
| 353 chrome.send('setApn', [data.servicePath, | 387 chrome.send('setApn', [data.servicePath, |
| 354 stringFromValue(data.userApn.apn), | 388 stringFromValue(data.userApn.apn), |
| 355 stringFromValue(data.userApn.username), | 389 stringFromValue(data.userApn.username), |
| 356 stringFromValue(data.userApn.password)]); | 390 stringFromValue(data.userApn.password)]); |
| 357 data.selectedApn = apnSelector.selectedIndex; | 391 data.selectedApn = apnSelector.selectedIndex; |
| 358 } else { | 392 } else { |
| 359 $('cellular-apn').value = stringFromValue(data.apn.apn); | 393 var activeApn = getManagedValue(data, 'Cellular.APN'); |
| 360 $('cellular-apn-username').value = stringFromValue(data.apn.username); | 394 $('cellular-apn').value = stringFromValue(activeApn['APN']); |
| 361 $('cellular-apn-password').value = stringFromValue(data.apn.password); | 395 $('cellular-apn-username').value = |
| 396 stringFromValue(activeApn['Username']); | |
| 397 $('cellular-apn-password').value = | |
| 398 stringFromValue(activeApn['Password']); | |
| 362 | 399 |
| 363 updateHidden('.apn-list-view', true); | 400 updateHidden('.apn-list-view', true); |
| 364 updateHidden('.apn-details-view', false); | 401 updateHidden('.apn-details-view', false); |
| 365 } | 402 } |
| 366 }); | 403 }); |
| 367 | 404 |
| 368 $('sim-card-lock-enabled').addEventListener('click', function(event) { | 405 $('sim-card-lock-enabled').addEventListener('click', function(event) { |
| 369 var newValue = $('sim-card-lock-enabled').checked; | 406 var newValue = $('sim-card-lock-enabled').checked; |
| 370 // Leave value as is because user needs to enter PIN code first. | 407 // Leave value as is because user needs to enter PIN code first. |
| 371 // When PIN will be entered and value changed, | 408 // When PIN will be entered and value changed, |
| (...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1010 $('activation-state').textContent = data.activationState; | 1047 $('activation-state').textContent = data.activationState; |
| 1011 | 1048 |
| 1012 $('buyplan-details').hidden = !data.showBuyButton; | 1049 $('buyplan-details').hidden = !data.showBuyButton; |
| 1013 $('view-account-details').hidden = !data.showViewAccountButton; | 1050 $('view-account-details').hidden = !data.showViewAccountButton; |
| 1014 | 1051 |
| 1015 $('activate-details').hidden = !data.showActivateButton; | 1052 $('activate-details').hidden = !data.showActivateButton; |
| 1016 if (data.showActivateButton) | 1053 if (data.showActivateButton) |
| 1017 $('details-internet-login').hidden = true; | 1054 $('details-internet-login').hidden = true; |
| 1018 | 1055 |
| 1019 if (detailsPage.gsm) { | 1056 if (detailsPage.gsm) { |
| 1020 // TODO(stevenjb): Use managed properties for policy controlled values. | 1057 var lockEnabled = |
| 1021 var lockEnabled = data.simCardLockEnabled.value; | 1058 getManagedValue(data, 'Cellular.SIMLockStatus.LockEnabled'); |
| 1022 $('sim-card-lock-enabled').checked = lockEnabled; | 1059 $('sim-card-lock-enabled').checked = lockEnabled; |
| 1023 $('change-pin').hidden = !lockEnabled; | 1060 $('change-pin').hidden = !lockEnabled; |
| 1024 } | 1061 } |
| 1025 } | 1062 } |
| 1026 | 1063 |
| 1027 $('connection-state').data = data; | 1064 $('connection-state').data = data; |
| 1028 }; | 1065 }; |
| 1029 | 1066 |
| 1030 DetailsInternetPage.showDetailedInfo = function(data) { | 1067 DetailsInternetPage.showDetailedInfo = function(data) { |
| 1031 var detailsPage = DetailsInternetPage.getInstance(); | 1068 var detailsPage = DetailsInternetPage.getInstance(); |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1308 updateHidden('#details-internet-page .cdma-only', false); | 1345 updateHidden('#details-internet-page .cdma-only', false); |
| 1309 | 1346 |
| 1310 // Show IMEI/ESN/MEID/MIN/PRL only if they are available. | 1347 // Show IMEI/ESN/MEID/MIN/PRL only if they are available. |
| 1311 setOrHideParent('esn', getManagedValue(data, 'Cellular.ESN')); | 1348 setOrHideParent('esn', getManagedValue(data, 'Cellular.ESN')); |
| 1312 setOrHideParent('imei', getManagedValue(data, 'Cellular.IMEI')); | 1349 setOrHideParent('imei', getManagedValue(data, 'Cellular.IMEI')); |
| 1313 setOrHideParent('meid', getManagedValue(data, 'Cellular.MEID')); | 1350 setOrHideParent('meid', getManagedValue(data, 'Cellular.MEID')); |
| 1314 setOrHideParent('min', getManagedValue(data, 'Cellular.MIN')); | 1351 setOrHideParent('min', getManagedValue(data, 'Cellular.MIN')); |
| 1315 setOrHideParent('prl-version', | 1352 setOrHideParent('prl-version', |
| 1316 getManagedValue(data, 'Cellular.PRLVersion')); | 1353 getManagedValue(data, 'Cellular.PRLVersion')); |
| 1317 | 1354 |
| 1318 var family = getManagedValue(data, 'Cellular.GSM'); | 1355 var family = getManagedValue(data, 'Cellular.Family'); |
| 1319 detailsPage.gsm = family == 'GSM'; | 1356 detailsPage.gsm = family == 'GSM'; |
| 1320 if (detailsPage.gsm) { | 1357 if (detailsPage.gsm) { |
| 1321 $('iccid').textContent = getManagedValue(data, 'Cellular.ICCID'); | 1358 $('iccid').textContent = getManagedValue(data, 'Cellular.ICCID'); |
| 1322 $('imsi').textContent = getManagedValue(data, 'Cellular.IMSI'); | 1359 $('imsi').textContent = getManagedValue(data, 'Cellular.IMSI'); |
| 1323 | 1360 |
| 1324 var apnSelector = $('select-apn'); | 1361 var apnSelector = $('select-apn'); |
| 1325 // Clear APN lists, keep only last element that "other". | 1362 // Clear APN lists, keep only last element that "other". |
| 1326 while (apnSelector.length != 1) | 1363 while (apnSelector.length != 1) |
| 1327 apnSelector.remove(0); | 1364 apnSelector.remove(0); |
| 1328 var otherOption = apnSelector[0]; | 1365 var otherOption = apnSelector[0]; |
| 1329 data.selectedApn = -1; | 1366 data.selectedApn = -1; |
| 1330 data.userApnIndex = -1; | 1367 data.userApnIndex = -1; |
| 1331 var apnList = data.providerApnList.value; | 1368 var activeApn = getManagedValue(data, 'Cellular.APN'); |
| 1369 var lastGoodApn = getManagedValue(data, 'Cellular.LastGoodAPN'); | |
| 1370 var apnList = getManagedValue(data, 'Cellular.APNList'); | |
| 1332 for (var i = 0; i < apnList.length; i++) { | 1371 for (var i = 0; i < apnList.length; i++) { |
| 1372 var apnDict = apnList[i]; | |
| 1333 var option = document.createElement('option'); | 1373 var option = document.createElement('option'); |
| 1334 var localizedName = apnList[i].localizedName; | 1374 var localizedName = apnDict['LocalizedName']; |
| 1335 var name = localizedName ? localizedName : apnList[i].name; | 1375 var name = localizedName ? localizedName : apnDict['Name']; |
| 1336 var apn = apnList[i].apn; | 1376 var apn = apnDict['APN']; |
| 1337 option.textContent = name ? (name + ' (' + apn + ')') : apn; | 1377 option.textContent = name ? (name + ' (' + apn + ')') : apn; |
| 1338 option.value = i; | 1378 option.value = i; |
| 1339 // data.apn and data.lastGoodApn will always be defined, however | 1379 // If this matches the active Apn, or LastGoodApn, set it as the |
| 1340 // data.apn.apn and data.lastGoodApn.apn may not be. This is not a | 1380 // selected Apn. |
| 1341 // problem, as apnList[i].apn will always be defined and the | 1381 if ((activeApn != undefined && |
| 1342 // comparisons below will work as expected. | 1382 activeApn['APN'] == apn && |
| 1343 if ((data.apn.apn == apn && | 1383 activeApn['Username'] == apnDict['Username'] && |
| 1344 data.apn.username == apnList[i].username && | 1384 activeApn['Password'] == apnDict['Password']) || |
| 1345 data.apn.password == apnList[i].password) || | 1385 ((activeApn == undefined || !activeApn['APN']) && |
| 1346 (!data.apn.apn && | 1386 lastGoodApn != undefined && |
| 1347 data.lastGoodApn.apn == apn && | 1387 lastGoodApn['APN'] == apn && |
| 1348 data.lastGoodApn.username == apnList[i].username && | 1388 lastGoodApn['Username'] == apnDict['Username'] && |
| 1349 data.lastGoodApn.password == apnList[i].password)) { | 1389 lastGoodApn['Password'] == apnDict['Password'])) { |
| 1350 data.selectedApn = i; | 1390 data.selectedApn = i; |
| 1351 } | 1391 } |
| 1352 // Insert new option before "other" option. | 1392 // Insert new option before "other" option. |
| 1353 apnSelector.add(option, otherOption); | 1393 apnSelector.add(option, otherOption); |
| 1354 } | 1394 } |
| 1355 if (data.selectedApn == -1 && data.apn.apn) { | 1395 if (data.selectedApn == -1 && |
| 1396 activeApn != undefined && activeApn['APN']) { | |
| 1356 var option = document.createElement('option'); | 1397 var option = document.createElement('option'); |
| 1357 option.textContent = data.apn.apn; | 1398 option.textContent = activeApn['APN']; |
| 1358 option.value = -1; | 1399 option.value = -1; |
| 1359 apnSelector.add(option, otherOption); | 1400 apnSelector.add(option, otherOption); |
| 1360 data.selectedApn = apnSelector.length - 2; | 1401 data.selectedApn = apnSelector.length - 2; |
| 1361 data.userApnIndex = data.selectedApn; | 1402 data.userApnIndex = data.selectedApn; |
| 1362 } | 1403 } |
| 1363 apnSelector.selectedIndex = data.selectedApn; | 1404 apnSelector.selectedIndex = data.selectedApn; |
| 1364 updateHidden('.apn-list-view', false); | 1405 updateHidden('.apn-list-view', false); |
| 1365 updateHidden('.apn-details-view', true); | 1406 updateHidden('.apn-details-view', true); |
| 1366 // TODO(stevenjb): Used managed properties for policy controlled value. | 1407 var lockEnabled = |
| 1367 var lockEnabled = data.simCardLockEnabled.value; | 1408 getManagedValue(data, 'Cellular.SIMLockStatus.LockEnabled'); |
| 1368 $('sim-card-lock-enabled').checked = lockEnabled; | 1409 $('sim-card-lock-enabled').checked = lockEnabled; |
| 1369 $('change-pin').hidden = !lockEnabled; | 1410 $('change-pin').hidden = !lockEnabled; |
| 1370 } | 1411 } |
| 1371 $('auto-connect-network-cellular').checked = | 1412 $('auto-connect-network-cellular').checked = |
| 1372 getManagedValue(data, 'AutoConnect'); | 1413 getManagedValue(data, 'AutoConnect'); |
| 1373 $('auto-connect-network-cellular').disabled = false; | 1414 $('auto-connect-network-cellular').disabled = false; |
| 1374 | 1415 |
| 1375 $('buyplan-details').hidden = !data.showBuyButton; | 1416 $('buyplan-details').hidden = !data.showBuyButton; |
| 1376 $('view-account-details').hidden = !data.showViewAccountButton; | 1417 $('view-account-details').hidden = !data.showViewAccountButton; |
| 1377 $('activate-details').hidden = !data.showActivateButton; | 1418 $('activate-details').hidden = !data.showActivateButton; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1437 | 1478 |
| 1438 // Don't show page name in address bar and in history to prevent people | 1479 // Don't show page name in address bar and in history to prevent people |
| 1439 // navigate here by hand and solve issue with page session restore. | 1480 // navigate here by hand and solve issue with page session restore. |
| 1440 PageManager.showPageByName('detailsInternetPage', false); | 1481 PageManager.showPageByName('detailsInternetPage', false); |
| 1441 }; | 1482 }; |
| 1442 | 1483 |
| 1443 return { | 1484 return { |
| 1444 DetailsInternetPage: DetailsInternetPage | 1485 DetailsInternetPage: DetailsInternetPage |
| 1445 }; | 1486 }; |
| 1446 }); | 1487 }); |
| OLD | NEW |