| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 cr.define('options', function() { | 5 cr.define('options', function() { |
| 6 var OptionsPage = options.OptionsPage; | 6 var OptionsPage = options.OptionsPage; |
| 7 const ArrayDataModel = cr.ui.ArrayDataModel; | 7 const ArrayDataModel = cr.ui.ArrayDataModel; |
| 8 | 8 |
| 9 ///////////////////////////////////////////////////////////////////////////// | 9 ///////////////////////////////////////////////////////////////////////////// |
| 10 // InternetOptions class: | 10 // InternetOptions class: |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 options.internet.NetworkElement.decorate($('wired-list')); | 38 options.internet.NetworkElement.decorate($('wired-list')); |
| 39 $('wired-list').load(templateData.wiredList); | 39 $('wired-list').load(templateData.wiredList); |
| 40 options.internet.NetworkElement.decorate($('wireless-list')); | 40 options.internet.NetworkElement.decorate($('wireless-list')); |
| 41 $('wireless-list').load(templateData.wirelessList); | 41 $('wireless-list').load(templateData.wirelessList); |
| 42 options.internet.NetworkElement.decorate($('vpn-list')); | 42 options.internet.NetworkElement.decorate($('vpn-list')); |
| 43 $('vpn-list').load(templateData.vpnList); | 43 $('vpn-list').load(templateData.vpnList); |
| 44 options.internet.NetworkElement.decorate($('remembered-list')); | 44 options.internet.NetworkElement.decorate($('remembered-list')); |
| 45 $('remembered-list').load(templateData.rememberedList); | 45 $('remembered-list').load(templateData.rememberedList); |
| 46 | 46 |
| 47 this.updatePolicyIndicatorVisibility_(); |
| 48 |
| 47 options.internet.CellularPlanElement.decorate($('planList')); | 49 options.internet.CellularPlanElement.decorate($('planList')); |
| 48 | 50 |
| 49 $('wired-section').hidden = (templateData.wiredList.length == 0); | 51 $('wired-section').hidden = (templateData.wiredList.length == 0); |
| 50 $('wireless-section').hidden = (templateData.wirelessList.length == 0); | 52 $('wireless-section').hidden = (templateData.wirelessList.length == 0); |
| 51 $('vpn-section').hidden = (templateData.vpnList.length == 0); | 53 $('vpn-section').hidden = (templateData.vpnList.length == 0); |
| 52 $('remembered-section').hidden = | 54 $('remembered-section').hidden = |
| 53 (templateData.rememberedList.length == 0); | 55 (templateData.rememberedList.length == 0); |
| 54 InternetOptions.setupAttributes(templateData); | 56 InternetOptions.setupAttributes(templateData); |
| 55 $('detailsInternetDismiss').addEventListener('click', function(event) { | 57 $('detailsInternetDismiss').addEventListener('click', function(event) { |
| 56 InternetOptions.setDetails(); | 58 InternetOptions.setDetails(); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 }); | 104 }); |
| 103 $('cellularApnUseDefault').addEventListener('click', function(event) { | 105 $('cellularApnUseDefault').addEventListener('click', function(event) { |
| 104 var data = $('connectionState').data; | 106 var data = $('connectionState').data; |
| 105 var apnSelector = $('selectApn'); | 107 var apnSelector = $('selectApn'); |
| 106 | 108 |
| 107 if (data.userApnIndex != -1) { | 109 if (data.userApnIndex != -1) { |
| 108 apnSelector.remove(data.userApnIndex); | 110 apnSelector.remove(data.userApnIndex); |
| 109 data.userApnIndex = -1; | 111 data.userApnIndex = -1; |
| 110 } | 112 } |
| 111 | 113 |
| 112 if (data.providerApnList.length > 0) { | 114 if (data.providerApnList.value.length > 0) { |
| 113 var iApn = 0; | 115 var iApn = 0; |
| 114 data.apn.apn = data.providerApnList[iApn].apn; | 116 data.apn.apn = data.providerApnList.value[iApn].apn; |
| 115 data.apn.username = data.providerApnList[iApn].username; | 117 data.apn.username = data.providerApnList.value[iApn].username; |
| 116 data.apn.password = data.providerApnList[iApn].password; | 118 data.apn.password = data.providerApnList.value[iApn].password; |
| 117 chrome.send('setApn', [String(data.servicePath), | 119 chrome.send('setApn', [String(data.servicePath), |
| 118 String(data.apn.apn), | 120 String(data.apn.apn), |
| 119 String(data.apn.username), | 121 String(data.apn.username), |
| 120 String(data.apn.password)]); | 122 String(data.apn.password)]); |
| 121 apnSelector.selectedIndex = iApn; | 123 apnSelector.selectedIndex = iApn; |
| 122 data.selectedApn = iApn; | 124 data.selectedApn = iApn; |
| 123 } else { | 125 } else { |
| 124 data.apn.apn = ''; | 126 data.apn.apn = ''; |
| 125 data.apn.username = ''; | 127 data.apn.username = ''; |
| 126 data.apn.password = ''; | 128 data.apn.password = ''; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 cr.doc.querySelectorAll('.apn-list-view'), | 179 cr.doc.querySelectorAll('.apn-list-view'), |
| 178 false); | 180 false); |
| 179 InternetOptions.prototype.updateHidden_( | 181 InternetOptions.prototype.updateHidden_( |
| 180 cr.doc.querySelectorAll('.apn-details-view'), | 182 cr.doc.querySelectorAll('.apn-details-view'), |
| 181 true); | 183 true); |
| 182 }); | 184 }); |
| 183 $('selectApn').addEventListener('change', function(event) { | 185 $('selectApn').addEventListener('change', function(event) { |
| 184 var data = $('connectionState').data; | 186 var data = $('connectionState').data; |
| 185 var apnSelector = $('selectApn'); | 187 var apnSelector = $('selectApn'); |
| 186 if (apnSelector[apnSelector.selectedIndex].value != -1) { | 188 if (apnSelector[apnSelector.selectedIndex].value != -1) { |
| 189 var apnList = data.providerApnList.value; |
| 187 chrome.send('setApn', [String(data.servicePath), | 190 chrome.send('setApn', [String(data.servicePath), |
| 188 String(data.providerApnList[apnSelector.selectedIndex].apn), | 191 String(apnList[apnSelector.selectedIndex].apn), |
| 189 String(data.providerApnList[apnSelector.selectedIndex].username), | 192 String(apnList[apnSelector.selectedIndex].username), |
| 190 String(data.providerApnList[apnSelector.selectedIndex].password) | 193 String(apnList[apnSelector.selectedIndex].password) |
| 191 ]); | 194 ]); |
| 192 data.selectedApn = apnSelector.selectedIndex; | 195 data.selectedApn = apnSelector.selectedIndex; |
| 193 } else if (apnSelector.selectedIndex == data.userApnIndex) { | 196 } else if (apnSelector.selectedIndex == data.userApnIndex) { |
| 194 chrome.send('setApn', [String(data.servicePath), | 197 chrome.send('setApn', [String(data.servicePath), |
| 195 String(data.apn.apn), | 198 String(data.apn.apn), |
| 196 String(data.apn.username), | 199 String(data.apn.username), |
| 197 String(data.apn.password)]); | 200 String(data.apn.password)]); |
| 198 data.selectedApn = apnSelector.selectedIndex; | 201 data.selectedApn = apnSelector.selectedIndex; |
| 199 } else { | 202 } else { |
| 200 $('cellularApn').value = data.apn.apn; | 203 $('cellularApn').value = data.apn.apn; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 $('wireless-buttons').hidden = accesslocked; | 257 $('wireless-buttons').hidden = accesslocked; |
| 255 $('wired-section').hidden = accesslocked; | 258 $('wired-section').hidden = accesslocked; |
| 256 $('wireless-section').hidden = accesslocked; | 259 $('wireless-section').hidden = accesslocked; |
| 257 $('vpn-section').hidden = accesslocked; | 260 $('vpn-section').hidden = accesslocked; |
| 258 $('remembered-section').hidden = accesslocked; | 261 $('remembered-section').hidden = accesslocked; |
| 259 | 262 |
| 260 // Don't change hidden attribute on OptionsPage divs directly because it | 263 // Don't change hidden attribute on OptionsPage divs directly because it |
| 261 // is used in supporting infrastructure now. | 264 // is used in supporting infrastructure now. |
| 262 if (accesslocked && DetailsInternetPage.getInstance().visible) | 265 if (accesslocked && DetailsInternetPage.getInstance().visible) |
| 263 this.closeOverlay(); | 266 this.closeOverlay(); |
| 267 }, |
| 268 |
| 269 /** |
| 270 * Updates the policy indicator visibility. Space is only allocated for the |
| 271 * policy indicators if there is at least one visible. |
| 272 * @private |
| 273 */ |
| 274 updatePolicyIndicatorVisibility_: function() { |
| 275 var page = $('internetPage'); |
| 276 if (page.querySelectorAll( |
| 277 '.network-item > .controlled-setting-indicator[controlled-by]') |
| 278 .length) { |
| 279 page.classList.remove('hide-indicators'); |
| 280 } else { |
| 281 page.classList.add('hide-indicators'); |
| 282 } |
| 264 } | 283 } |
| 265 }; | 284 }; |
| 266 | 285 |
| 267 /** | 286 /** |
| 268 * Whether access to this page is locked. | 287 * Whether access to this page is locked. |
| 269 * @type {boolean} | 288 * @type {boolean} |
| 270 */ | 289 */ |
| 271 cr.defineProperty(InternetOptions, 'accesslocked', cr.PropertyKind.JS, | 290 cr.defineProperty(InternetOptions, 'accesslocked', cr.PropertyKind.JS, |
| 272 InternetOptions.prototype.updateControls_); | 291 InternetOptions.prototype.updateControls_); |
| 273 | 292 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 if (data.accessLocked) { | 384 if (data.accessLocked) { |
| 366 self.accesslocked = true; | 385 self.accesslocked = true; |
| 367 return; | 386 return; |
| 368 } | 387 } |
| 369 self.accesslocked = false; | 388 self.accesslocked = false; |
| 370 $('wired-list').load(data.wiredList); | 389 $('wired-list').load(data.wiredList); |
| 371 $('wireless-list').load(data.wirelessList); | 390 $('wireless-list').load(data.wirelessList); |
| 372 $('vpn-list').load(data.vpnList); | 391 $('vpn-list').load(data.vpnList); |
| 373 $('remembered-list').load(data.rememberedList); | 392 $('remembered-list').load(data.rememberedList); |
| 374 | 393 |
| 394 self.updatePolicyIndicatorVisibility_(); |
| 395 |
| 375 $('wired-section').hidden = (data.wiredList.length == 0); | 396 $('wired-section').hidden = (data.wiredList.length == 0); |
| 376 $('wireless-section').hidden = (data.wirelessList.length == 0); | 397 $('wireless-section').hidden = (data.wirelessList.length == 0); |
| 377 $('vpn-section').hidden = (data.vpnList.length == 0); | 398 $('vpn-section').hidden = (data.vpnList.length == 0); |
| 378 InternetOptions.setupAttributes(data); | 399 InternetOptions.setupAttributes(data); |
| 379 $('remembered-section').hidden = (data.rememberedList.length == 0); | 400 $('remembered-section').hidden = (data.rememberedList.length == 0); |
| 380 }; | 401 }; |
| 381 | 402 |
| 382 // TODO(xiyuan): This function seems belonging to DetailsInternetPage. | 403 // TODO(xiyuan): This function seems belonging to DetailsInternetPage. |
| 383 InternetOptions.updateCellularPlans = function (data) { | 404 InternetOptions.updateCellularPlans = function (data) { |
| 384 var detailsPage = DetailsInternetPage.getInstance(); | 405 var detailsPage = DetailsInternetPage.getInstance(); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 } else { | 447 } else { |
| 427 $('inetTitle').textContent = localStrings.getString('inetConnect'); | 448 $('inetTitle').textContent = localStrings.getString('inetConnect'); |
| 428 } | 449 } |
| 429 $('connectionState').textContent = data.connectionState; | 450 $('connectionState').textContent = data.connectionState; |
| 430 | 451 |
| 431 var inetAddress = ''; | 452 var inetAddress = ''; |
| 432 var inetSubnetAddress = ''; | 453 var inetSubnetAddress = ''; |
| 433 var inetGateway = ''; | 454 var inetGateway = ''; |
| 434 var inetDns = ''; | 455 var inetDns = ''; |
| 435 $('ipTypeDHCP').checked = true; | 456 $('ipTypeDHCP').checked = true; |
| 436 if (data.ipconfigStatic) { | 457 if (data.ipconfigStatic.value) { |
| 437 inetAddress = data.ipconfigStatic.address; | 458 inetAddress = data.ipconfigStatic.value.address; |
| 438 inetSubnetAddress = data.ipconfigStatic.subnetAddress; | 459 inetSubnetAddress = data.ipconfigStatic.value.subnetAddress; |
| 439 inetGateway = data.ipconfigStatic.gateway; | 460 inetGateway = data.ipconfigStatic.value.gateway; |
| 440 inetDns = data.ipconfigStatic.dns; | 461 inetDns = data.ipconfigStatic.value.dns; |
| 441 $('ipTypeStatic').checked = true; | 462 $('ipTypeStatic').checked = true; |
| 442 } else if (data.ipconfigDHCP) { | 463 } else if (data.ipconfigDHCP.value) { |
| 443 inetAddress = data.ipconfigDHCP.address; | 464 inetAddress = data.ipconfigDHCP.value.address; |
| 444 inetSubnetAddress = data.ipconfigDHCP.subnetAddress; | 465 inetSubnetAddress = data.ipconfigDHCP.value.subnetAddress; |
| 445 inetGateway = data.ipconfigDHCP.gateway; | 466 inetGateway = data.ipconfigDHCP.value.gateway; |
| 446 inetDns = data.ipconfigDHCP.dns; | 467 inetDns = data.ipconfigDHCP.value.dns; |
| 447 } | 468 } |
| 448 | 469 |
| 449 // Hide the dhcp/static radio if needed. | 470 // Hide the dhcp/static radio if needed. |
| 450 $('ipTypeDHCPDiv').hidden = !data.showStaticIPConfig; | 471 $('ipTypeDHCPDiv').hidden = !data.showStaticIPConfig; |
| 451 $('ipTypeStaticDiv').hidden = !data.showStaticIPConfig; | 472 $('ipTypeStaticDiv').hidden = !data.showStaticIPConfig; |
| 452 | 473 |
| 453 // Hide change-proxy-button and change-proxy-section if not showing proxy. | 474 // Hide change-proxy-button and change-proxy-section if not showing proxy. |
| 454 $('change-proxy-button').hidden = !data.showProxy; | 475 $('change-proxy-button').hidden = !data.showProxy; |
| 455 $('change-proxy-section').hidden = !data.showProxy; | 476 $('change-proxy-section').hidden = !data.showProxy; |
| 456 | 477 |
| 457 var ipConfigList = $('ipConfigList'); | 478 var ipConfigList = $('ipConfigList'); |
| 458 ipConfigList.disabled = $('ipTypeDHCP').checked || !data.showStaticIPConfig; | 479 ipConfigList.disabled = |
| 480 $('ipTypeDHCP').checked || data.ipconfigStatic.controlledBy || |
| 481 !data.showStaticIPConfig; |
| 459 options.internet.IPConfigList.decorate(ipConfigList); | 482 options.internet.IPConfigList.decorate(ipConfigList); |
| 460 ipConfigList.autoExpands = true; | 483 ipConfigList.autoExpands = true; |
| 461 var model = new ArrayDataModel([]); | 484 var model = new ArrayDataModel([]); |
| 462 model.push({ | 485 model.push({ |
| 463 'property': 'inetAddress', | 486 'property': 'inetAddress', |
| 464 'name': localStrings.getString('inetAddress'), | 487 'name': localStrings.getString('inetAddress'), |
| 465 'value': inetAddress, | 488 'value': inetAddress, |
| 466 }); | 489 }); |
| 467 model.push({ | 490 model.push({ |
| 468 'property': 'inetSubnetAddress', | 491 'property': 'inetSubnetAddress', |
| 469 'name': localStrings.getString('inetSubnetAddress'), | 492 'name': localStrings.getString('inetSubnetAddress'), |
| 470 'value': inetSubnetAddress, | 493 'value': inetSubnetAddress, |
| 471 }); | 494 }); |
| 472 model.push({ | 495 model.push({ |
| 473 'property': 'inetGateway', | 496 'property': 'inetGateway', |
| 474 'name': localStrings.getString('inetGateway'), | 497 'name': localStrings.getString('inetGateway'), |
| 475 'value': inetGateway, | 498 'value': inetGateway, |
| 476 }); | 499 }); |
| 477 model.push({ | 500 model.push({ |
| 478 'property': 'inetDns', | 501 'property': 'inetDns', |
| 479 'name': localStrings.getString('inetDns'), | 502 'name': localStrings.getString('inetDns'), |
| 480 'value': inetDns, | 503 'value': inetDns, |
| 481 }); | 504 }); |
| 482 ipConfigList.dataModel = model; | 505 ipConfigList.dataModel = model; |
| 483 | 506 |
| 484 $('ipTypeDHCP').addEventListener('click', function(event) { | 507 $('ipTypeDHCP').addEventListener('click', function(event) { |
| 485 // disable ipConfigList and switch back to dhcp values (if any) | 508 // disable ipConfigList and switch back to dhcp values (if any) |
| 486 if (data.ipconfigDHCP) { | 509 if (data.ipconfigDHCP.value) { |
| 487 ipConfigList.dataModel.item(0).value = data.ipconfigDHCP.address; | 510 var config = data.ipconfigDHCP.value; |
| 488 ipConfigList.dataModel.item(1).value = data.ipconfigDHCP.subnetAddress; | 511 ipConfigList.dataModel.item(0).value = config.address; |
| 489 ipConfigList.dataModel.item(2).value = data.ipconfigDHCP.gateway; | 512 ipConfigList.dataModel.item(1).value = config.subnetAddress; |
| 490 ipConfigList.dataModel.item(3).value = data.ipconfigDHCP.dns; | 513 ipConfigList.dataModel.item(2).value = config.gateway; |
| 514 ipConfigList.dataModel.item(3).value = config.dns; |
| 491 } | 515 } |
| 492 ipConfigList.dataModel.updateIndex(0); | 516 ipConfigList.dataModel.updateIndex(0); |
| 493 ipConfigList.dataModel.updateIndex(1); | 517 ipConfigList.dataModel.updateIndex(1); |
| 494 ipConfigList.dataModel.updateIndex(2); | 518 ipConfigList.dataModel.updateIndex(2); |
| 495 ipConfigList.dataModel.updateIndex(3); | 519 ipConfigList.dataModel.updateIndex(3); |
| 496 // Unselect all so we don't keep the currently selected field editable. | 520 // Unselect all so we don't keep the currently selected field editable. |
| 497 ipConfigList.selectionModel.unselectAll(); | 521 ipConfigList.selectionModel.unselectAll(); |
| 498 ipConfigList.disabled = true; | 522 ipConfigList.disabled = true; |
| 499 }); | 523 }); |
| 500 | 524 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 515 if (data.type == options.internet.Constants.TYPE_WIFI) { | 539 if (data.type == options.internet.Constants.TYPE_WIFI) { |
| 516 OptionsPage.showTab($('wifiNetworkNavTab')); | 540 OptionsPage.showTab($('wifiNetworkNavTab')); |
| 517 detailsPage.wireless = true; | 541 detailsPage.wireless = true; |
| 518 detailsPage.vpn = false; | 542 detailsPage.vpn = false; |
| 519 detailsPage.ethernet = false; | 543 detailsPage.ethernet = false; |
| 520 detailsPage.cellular = false; | 544 detailsPage.cellular = false; |
| 521 detailsPage.gsm = false; | 545 detailsPage.gsm = false; |
| 522 detailsPage.shared = data.shared; | 546 detailsPage.shared = data.shared; |
| 523 $('inetSsid').textContent = data.ssid; | 547 $('inetSsid').textContent = data.ssid; |
| 524 detailsPage.showPreferred = data.showPreferred; | 548 detailsPage.showPreferred = data.showPreferred; |
| 525 $('preferNetworkWifi').checked = data.preferred; | 549 $('preferNetworkWifi').checked = data.preferred.value; |
| 526 $('preferNetworkWifi').disabled = !data.remembered; | 550 $('preferNetworkWifi').disabled = !data.remembered; |
| 527 $('autoConnectNetworkWifi').checked = data.autoConnect; | 551 $('autoConnectNetworkWifi').checked = data.autoConnect.value; |
| 528 $('autoConnectNetworkWifi').disabled = !data.remembered; | 552 $('autoConnectNetworkWifi').disabled = !data.remembered; |
| 529 detailsPage.password = data.encrypted; | 553 detailsPage.password = data.encrypted; |
| 530 } else if(data.type == options.internet.Constants.TYPE_CELLULAR) { | 554 } else if(data.type == options.internet.Constants.TYPE_CELLULAR) { |
| 531 if (!data.gsm) | 555 if (!data.gsm) |
| 532 OptionsPage.showTab($('cellularPlanNavTab')); | 556 OptionsPage.showTab($('cellularPlanNavTab')); |
| 533 else | 557 else |
| 534 OptionsPage.showTab($('cellularConnNavTab')); | 558 OptionsPage.showTab($('cellularConnNavTab')); |
| 535 detailsPage.ethernet = false; | 559 detailsPage.ethernet = false; |
| 536 detailsPage.wireless = false; | 560 detailsPage.wireless = false; |
| 537 detailsPage.vpn = false; | 561 detailsPage.vpn = false; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 $('operatorCode').textContent = data.operatorCode; | 594 $('operatorCode').textContent = data.operatorCode; |
| 571 $('imsi').textContent = data.imsi; | 595 $('imsi').textContent = data.imsi; |
| 572 | 596 |
| 573 var apnSelector = $('selectApn'); | 597 var apnSelector = $('selectApn'); |
| 574 // Clear APN lists, keep only last element that "other". | 598 // Clear APN lists, keep only last element that "other". |
| 575 while (apnSelector.length != 1) | 599 while (apnSelector.length != 1) |
| 576 apnSelector.remove(0); | 600 apnSelector.remove(0); |
| 577 var otherOption = apnSelector[0]; | 601 var otherOption = apnSelector[0]; |
| 578 data.selectedApn = -1; | 602 data.selectedApn = -1; |
| 579 data.userApnIndex = -1; | 603 data.userApnIndex = -1; |
| 580 for (var i = 0; i < data.providerApnList.length; i++) { | 604 var apnList = data.providerApnList.value; |
| 605 for (var i = 0; i < apnList.length; i++) { |
| 581 var option = document.createElement('option'); | 606 var option = document.createElement('option'); |
| 582 var name = data.providerApnList[i].localizedName; | 607 var name = apnList[i].localizedName; |
| 583 if (name == '' && data.providerApnList[i].name != '') | 608 if (name == '' && apnList[i].name != '') |
| 584 name = data.providerApnList[i].name; | 609 name = apnList[i].name; |
| 585 if (name == '') | 610 if (name == '') |
| 586 name = data.providerApnList[i].apn; | 611 name = apnList[i].apn; |
| 587 else | 612 else |
| 588 name = name + ' (' + data.providerApnList[i].apn + ')'; | 613 name = name + ' (' + apnList[i].apn + ')'; |
| 589 option.textContent = name; | 614 option.textContent = name; |
| 590 option.value = i; | 615 option.value = i; |
| 591 if ((data.apn.apn == data.providerApnList[i].apn && | 616 if ((data.apn.apn == apnList[i].apn && |
| 592 data.apn.username == data.providerApnList[i].username && | 617 data.apn.username == apnList[i].username && |
| 593 data.apn.password == data.providerApnList[i].password) || | 618 data.apn.password == apnList[i].password) || |
| 594 (data.apn.apn == '' && | 619 (data.apn.apn == '' && |
| 595 data.lastGoodApn.apn == data.providerApnList[i].apn && | 620 data.lastGoodApn.apn == apnList[i].apn && |
| 596 data.lastGoodApn.username == data.providerApnList[i].username && | 621 data.lastGoodApn.username == apnList[i].username && |
| 597 data.lastGoodApn.password == data.providerApnList[i].password)) { | 622 data.lastGoodApn.password == apnList[i].password)) { |
| 598 data.selectedApn = i; | 623 data.selectedApn = i; |
| 599 } | 624 } |
| 600 // Insert new option before "other" option. | 625 // Insert new option before "other" option. |
| 601 apnSelector.add(option, otherOption); | 626 apnSelector.add(option, otherOption); |
| 602 } | 627 } |
| 603 if (data.selectedApn == -1 && data.apn.apn != '') { | 628 if (data.selectedApn == -1 && data.apn.apn != '') { |
| 604 var option = document.createElement('option'); | 629 var option = document.createElement('option'); |
| 605 option.textContent = data.apn.apn; | 630 option.textContent = data.apn.apn; |
| 606 option.value = -1; | 631 option.value = -1; |
| 607 apnSelector.add(option, otherOption); | 632 apnSelector.add(option, otherOption); |
| 608 data.selectedApn = apnSelector.length - 2; | 633 data.selectedApn = apnSelector.length - 2; |
| 609 data.userApnIndex = data.selectedApn; | 634 data.userApnIndex = data.selectedApn; |
| 610 } | 635 } |
| 611 apnSelector.selectedIndex = data.selectedApn; | 636 apnSelector.selectedIndex = data.selectedApn; |
| 612 InternetOptions.prototype.updateHidden_( | 637 InternetOptions.prototype.updateHidden_( |
| 613 cr.doc.querySelectorAll('.apn-list-view'), | 638 cr.doc.querySelectorAll('.apn-list-view'), |
| 614 false); | 639 false); |
| 615 InternetOptions.prototype.updateHidden_( | 640 InternetOptions.prototype.updateHidden_( |
| 616 cr.doc.querySelectorAll('.apn-details-view'), | 641 cr.doc.querySelectorAll('.apn-details-view'), |
| 617 true); | 642 true); |
| 618 | 643 |
| 619 InternetOptions.updateSecurityTab(data.simCardLockEnabled); | 644 InternetOptions.updateSecurityTab(data.simCardLockEnabled.value); |
| 620 } | 645 } |
| 621 $('autoConnectNetworkCellular').checked = data.autoConnect; | 646 $('autoConnectNetworkCellular').checked = data.autoConnect.value; |
| 622 $('autoConnectNetworkCellular').disabled = false; | 647 $('autoConnectNetworkCellular').disabled = false; |
| 623 | 648 |
| 624 $('buyplanDetails').hidden = !data.showBuyButton; | 649 $('buyplanDetails').hidden = !data.showBuyButton; |
| 625 $('activateDetails').hidden = !data.showActivateButton; | 650 $('activateDetails').hidden = !data.showActivateButton; |
| 626 if (data.showActivateButton) { | 651 if (data.showActivateButton) { |
| 627 $('detailsInternetLogin').hidden = true; | 652 $('detailsInternetLogin').hidden = true; |
| 628 } | 653 } |
| 629 | 654 |
| 630 detailsPage.hascellplan = false; | 655 detailsPage.hascellplan = false; |
| 631 if (data.connected) { | 656 if (data.connected) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 648 $('inetProviderType').textContent = data.provider_type; | 673 $('inetProviderType').textContent = data.provider_type; |
| 649 $('inetUsername').textContent = data.username; | 674 $('inetUsername').textContent = data.username; |
| 650 } else { | 675 } else { |
| 651 OptionsPage.showTab($('internetNavTab')); | 676 OptionsPage.showTab($('internetNavTab')); |
| 652 detailsPage.ethernet = true; | 677 detailsPage.ethernet = true; |
| 653 detailsPage.wireless = false; | 678 detailsPage.wireless = false; |
| 654 detailsPage.vpn = false; | 679 detailsPage.vpn = false; |
| 655 detailsPage.cellular = false; | 680 detailsPage.cellular = false; |
| 656 detailsPage.gsm = false; | 681 detailsPage.gsm = false; |
| 657 } | 682 } |
| 683 |
| 684 // Update controlled option indicators. |
| 685 indicators = cr.doc.querySelectorAll( |
| 686 '#detailsInternetPage .controlled-setting-indicator'); |
| 687 for (var i = 0; i < indicators.length; i++) { |
| 688 var dataProperty = indicators[i].getAttribute('data'); |
| 689 if (dataProperty && data[dataProperty]) { |
| 690 var controlledBy = data[dataProperty].controlledBy; |
| 691 if (controlledBy) { |
| 692 indicators[i].controlledBy = controlledBy; |
| 693 var forElement = $(indicators[i].getAttribute('for')); |
| 694 if (forElement) |
| 695 forElement.disabled = true; |
| 696 if (forElement.type == 'radio' && !forElement.checked) |
| 697 indicators[i].hidden = true; |
| 698 } else { |
| 699 indicators[i].controlledBy = null; |
| 700 } |
| 701 } |
| 702 } |
| 703 |
| 658 // Don't show page name in address bar and in history to prevent people | 704 // Don't show page name in address bar and in history to prevent people |
| 659 // navigate here by hand and solve issue with page session restore. | 705 // navigate here by hand and solve issue with page session restore. |
| 660 OptionsPage.showPageByName('detailsInternetPage', false); | 706 OptionsPage.showPageByName('detailsInternetPage', false); |
| 661 }; | 707 }; |
| 662 | 708 |
| 663 InternetOptions.invalidNetworkSettings = function () { | 709 InternetOptions.invalidNetworkSettings = function () { |
| 664 alert(localStrings.getString('invalidNetworkSettings')); | 710 alert(localStrings.getString('invalidNetworkSettings')); |
| 665 }; | 711 }; |
| 666 | 712 |
| 667 // Export | 713 // Export |
| 668 return { | 714 return { |
| 669 InternetOptions: InternetOptions | 715 InternetOptions: InternetOptions |
| 670 }; | 716 }; |
| 671 }); | 717 }); |
| OLD | NEW |