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 cr.define('options.internet', function() { | 5 cr.define('options.internet', function() { |
| 6 var OptionsPage = options.OptionsPage; | 6 var OptionsPage = options.OptionsPage; |
| 7 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; | 7 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; |
| 8 /** @const */ var IPAddressField = options.internet.IPAddressField; | |
| 8 | 9 |
| 9 /** | 10 /** |
| 10 * Network settings constants. These enums must match their C++ | 11 * Network settings constants. These enums must match their C++ |
| 11 * counterparts. | 12 * counterparts. |
| 12 */ | 13 */ |
| 13 function Constants() {} | 14 function Constants() {} |
| 14 | 15 |
| 15 // Network types: | 16 // Network types: |
| 16 Constants.TYPE_UNKNOWN = 0; | 17 Constants.TYPE_UNKNOWN = 0; |
| 17 Constants.TYPE_ETHERNET = 1; | 18 Constants.TYPE_ETHERNET = 1; |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 245 // Proxy | 246 // Proxy |
| 246 options.proxyexceptions.ProxyExceptions.decorate($('ignored-host-list')); | 247 options.proxyexceptions.ProxyExceptions.decorate($('ignored-host-list')); |
| 247 $('remove-host').addEventListener('click', | 248 $('remove-host').addEventListener('click', |
| 248 this.handleRemoveProxyExceptions_); | 249 this.handleRemoveProxyExceptions_); |
| 249 $('add-host').addEventListener('click', this.handleAddProxyException_); | 250 $('add-host').addEventListener('click', this.handleAddProxyException_); |
| 250 $('direct-proxy').addEventListener('click', this.disableManualProxy_); | 251 $('direct-proxy').addEventListener('click', this.disableManualProxy_); |
| 251 $('manual-proxy').addEventListener('click', this.enableManualProxy_); | 252 $('manual-proxy').addEventListener('click', this.enableManualProxy_); |
| 252 $('auto-proxy').addEventListener('click', this.disableManualProxy_); | 253 $('auto-proxy').addEventListener('click', this.disableManualProxy_); |
| 253 $('proxy-all-protocols').addEventListener('click', | 254 $('proxy-all-protocols').addEventListener('click', |
| 254 this.toggleSingleProxy_); | 255 this.toggleSingleProxy_); |
| 256 | |
| 255 observePrefsUI($('direct-proxy')); | 257 observePrefsUI($('direct-proxy')); |
| 256 observePrefsUI($('manual-proxy')); | 258 observePrefsUI($('manual-proxy')); |
| 257 observePrefsUI($('auto-proxy')); | 259 observePrefsUI($('auto-proxy')); |
| 258 observePrefsUI($('proxy-all-protocols')); | 260 observePrefsUI($('proxy-all-protocols')); |
| 261 | |
| 262 $('ip-automatic-configuration-checkbox').addEventListener('click', | |
| 263 this.handleIpAutoConfig_); | |
| 264 $('automatic-dns-radio').addEventListener('click', | |
| 265 this.handleNameServerTypeChange_); | |
| 266 $('google-dns-radio').addEventListener('click', | |
| 267 this.handleNameServerTypeChange_); | |
| 268 $('user-dns-radio').addEventListener('click', | |
| 269 this.handleNameServerTypeChange_); | |
| 259 }, | 270 }, |
| 260 | 271 |
| 261 /** | 272 /** |
| 262 * Handler for "add" event fired from userNameEdit. | 273 * Handler for "add" event fired from userNameEdit. |
| 263 * @param {Event} e Add event fired from userNameEdit. | 274 * @param {Event} e Add event fired from userNameEdit. |
| 264 * @private | 275 * @private |
| 265 */ | 276 */ |
| 266 handleAddProxyException_: function(e) { | 277 handleAddProxyException_: function(e) { |
| 267 var exception = $('new-host').value; | 278 var exception = $('new-host').value; |
| 268 $('new-host').value = ''; | 279 $('new-host').value = ''; |
| 269 | 280 |
| 270 exception = exception.trim(); | 281 exception = exception.trim(); |
| 271 if (exception) | 282 if (exception) |
| 272 $('ignored-host-list').addException(exception); | 283 $('ignored-host-list').addException(exception); |
| 273 }, | 284 }, |
| 274 | 285 |
| 275 /** | 286 /** |
| 276 * Handler for when the remove button is clicked | 287 * Handler for when the remove button is clicked |
| 277 * @param {Event} e The click event. | 288 * @param {Event} e The click event. |
| 278 * @private | 289 * @private |
| 279 */ | 290 */ |
| 280 handleRemoveProxyExceptions_: function(e) { | 291 handleRemoveProxyExceptions_: function(e) { |
| 281 var selectedItems = $('ignored-host-list').selectedItems; | 292 var selectedItems = $('ignored-host-list').selectedItems; |
| 282 for (var x = 0; x < selectedItems.length; x++) { | 293 for (var x = 0; x < selectedItems.length; x++) { |
| 283 $('ignored-host-list').removeException(selectedItems[x]); | 294 $('ignored-host-list').removeException(selectedItems[x]); |
| 284 } | 295 } |
| 285 }, | 296 }, |
| 286 | 297 |
| 287 /** | 298 /** |
| 299 * Handler for when the IP automatic configuration checkbox is clicked. | |
| 300 * @param {Event} e The click event. | |
| 301 * @private | |
| 302 */ | |
| 303 handleIpAutoConfig_: function(e) { | |
| 304 var checked = $('ip-automatic-configuration-checkbox').checked; | |
| 305 var fields = [$('ip-address'), | |
| 306 $('ip-netmask'), | |
| 307 $('ip-gateway')]; | |
|
Dan Beam
2012/08/11 01:38:02
nit: you can probably fit all these $('id')s on th
Greg Spencer (Chromium)
2012/08/13 19:20:04
Done.
| |
| 308 for (var i = 0; i < fields.length; ++i) { | |
| 309 fields[i].editable = !checked; | |
| 310 if (checked) { | |
| 311 var model = fields[i].model; | |
| 312 model.value = model.automatic; | |
| 313 fields[i].model = model; | |
| 314 } | |
| 315 } | |
| 316 if (!checked) | |
| 317 $('ip-address').focus(); | |
| 318 }, | |
| 319 | |
| 320 /** | |
| 321 * Handler for when the name server selection changes. | |
| 322 * @param {Event} e The click event. | |
| 323 * @private | |
| 324 */ | |
| 325 handleNameServerTypeChange_: function(event) { | |
| 326 var type = event.target.value; | |
| 327 DetailsInternetPage.updateNameServerDisplay(type); | |
| 328 }, | |
| 329 | |
| 330 /** | |
| 288 * Update details page controls. | 331 * Update details page controls. |
| 289 * @private | 332 * @private |
| 290 */ | 333 */ |
| 291 updateControls: function() { | 334 updateControls: function() { |
| 292 // Only show ipconfig section if network is connected OR if nothing on | 335 // Only show ipconfig section if network is connected OR if nothing on |
| 293 // this device is connected. This is so that you can fix the ip configs | 336 // this device is connected. This is so that you can fix the ip configs |
| 294 // if you can't connect to any network. | 337 // if you can't connect to any network. |
| 295 // TODO(chocobo): Once ipconfig is moved to flimflam service objects, | 338 // TODO(chocobo): Once ipconfig is moved to flimflam service objects, |
| 296 // we need to redo this logic to allow configuration of all networks. | 339 // we need to redo this logic to allow configuration of all networks. |
| 297 $('ipconfig-section').hidden = !this.connected && this.deviceConnected; | 340 $('ipconfig-section').hidden = !this.connected && this.deviceConnected; |
| 341 $('ipconfig-dns-section').hidden = | |
| 342 !this.connected && this.deviceConnected; | |
| 298 | 343 |
| 299 // Network type related. | 344 // Network type related. |
| 300 updateHidden('#details-internet-page .cellular-details', !this.cellular); | 345 updateHidden('#details-internet-page .cellular-details', !this.cellular); |
| 301 updateHidden('#details-internet-page .wifi-details', !this.wireless); | 346 updateHidden('#details-internet-page .wifi-details', !this.wireless); |
| 302 updateHidden('#details-internet-page .wimax-details', !this.wimax); | 347 updateHidden('#details-internet-page .wimax-details', !this.wimax); |
| 303 updateHidden('#details-internet-page .vpn-details', !this.vpn); | 348 updateHidden('#details-internet-page .vpn-details', !this.vpn); |
| 304 updateHidden('#details-internet-page .proxy-details', !this.showProxy); | 349 updateHidden('#details-internet-page .proxy-details', !this.showProxy); |
| 305 /* Network information merged into the Wifi tab for wireless networks | 350 /* Network information merged into the Wifi tab for wireless networks |
| 306 unless the option is set for enabling a static IP configuration. */ | 351 unless the option is set for enabling a static IP configuration. */ |
| 307 updateHidden('#details-internet-page .network-details', | 352 updateHidden('#details-internet-page .network-details', |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 535 } else if (data.type == Constants.TYPE_WIMAX) { | 580 } else if (data.type == Constants.TYPE_WIMAX) { |
| 536 chrome.send('setAutoConnect', | 581 chrome.send('setAutoConnect', |
| 537 [String(servicePath), | 582 [String(servicePath), |
| 538 $('auto-connect-network-wimax').checked ? 'true' : 'false']); | 583 $('auto-connect-network-wimax').checked ? 'true' : 'false']); |
| 539 } else if (data.type == Constants.TYPE_CELLULAR) { | 584 } else if (data.type == Constants.TYPE_CELLULAR) { |
| 540 chrome.send('setAutoConnect', | 585 chrome.send('setAutoConnect', |
| 541 [String(servicePath), | 586 [String(servicePath), |
| 542 $('auto-connect-network-cellular').checked ? 'true' : | 587 $('auto-connect-network-cellular').checked ? 'true' : |
| 543 'false']); | 588 'false']); |
| 544 } | 589 } |
| 545 var ipConfigList = $('ip-config-list'); | 590 var ipFromDHCP = $('ip-automatic-configuration-checkbox').checked; |
|
Dan Beam
2012/08/11 01:38:02
nit: ipFromDhcp (is probably the preferred capital
Greg Spencer (Chromium)
2012/08/13 19:20:04
Yeah, I actually prefer the CamelCase capitalizati
| |
| 546 chrome.send('setIPConfig', [String(servicePath), | 591 |
| 547 $('ip-type-dhcp').checked ? 'true' : 'false', | 592 var nameServerTypes = ['automatic', 'google', 'user']; |
| 548 ipConfigList.dataModel.item(0).value, | 593 var nameServerType = 'automatic'; |
| 549 ipConfigList.dataModel.item(1).value, | 594 for (var i = 0; i < nameServerTypes.length; ++i) { |
| 550 ipConfigList.dataModel.item(2).value, | 595 if ($(nameServerTypes[i] + '-dns-radio').checked) { |
| 551 ipConfigList.dataModel.item(3).value]); | 596 nameServerType = nameServerTypes[i]; |
| 597 break; | |
| 598 } | |
| 599 } | |
| 600 | |
| 601 var userNameServers = [$('ipconfig-dns1').model.value, | |
| 602 $('ipconfig-dns2').model.value, | |
| 603 $('ipconfig-dns3').model.value, | |
| 604 $('ipconfig-dns4').model.value]; | |
| 605 // Clean out any empty values. | |
|
Dan Beam
2012/08/11 01:38:02
nit: this is fine, but it may be less error prone
Greg Spencer (Chromium)
2012/08/13 19:20:04
Hmm. Good point. I've rearranged it that way.
| |
| 606 for (var i = 0; i < userNameServers.length; ++i) { | |
| 607 if (!userNameServers[i]) { | |
| 608 userNameServers.splice(i, 1); | |
| 609 --i; | |
| 610 } | |
| 611 } | |
| 612 userNameServers = userNameServers.join(','); | |
| 613 var ipAddress = | |
| 614 $('ip-address').model.value ? $('ip-address').model.value : ''; | |
|
Dan Beam
2012/08/11 01:38:02
how I'd write this:
chrome.send('setIPConfig',
Greg Spencer (Chromium)
2012/08/13 19:20:04
Both good points. I was just inheriting how it wa
Dan Beam
2012/08/13 19:48:55
OK, that's fine. You can also say Boolean(someTru
Greg Spencer (Chromium)
2012/08/13 22:17:44
Ooh, I like that better.
| |
| 615 var ipNetmask = | |
| 616 $('ip-netmask').model.value ? $('ip-netmask').model.value : ''; | |
| 617 var ipGateway = | |
| 618 $('ip-gateway').model.value ? $('ip-gateway').model.value : ''; | |
| 619 chrome.send('setIPConfig', | |
| 620 [String(servicePath), | |
| 621 ipFromDHCP ? 'true' : 'false', | |
| 622 ipAddress, | |
| 623 ipNetmask, | |
| 624 ipGateway, | |
| 625 nameServerType, | |
| 626 userNameServers]); | |
| 552 OptionsPage.closeOverlay(); | 627 OptionsPage.closeOverlay(); |
| 553 }; | 628 }; |
| 554 | 629 |
| 630 DetailsInternetPage.updateNameServerDisplay = function(type) { | |
| 631 var editable = (type == 'user'); | |
|
Dan Beam
2012/08/11 01:38:02
nit: you don't really need these (), and the style
Greg Spencer (Chromium)
2012/08/13 19:20:04
Done.
| |
| 632 var fields = [$('ipconfig-dns1'), $('ipconfig-dns2'), | |
| 633 $('ipconfig-dns3'), $('ipconfig-dns4')]; | |
| 634 for (var i = 0; i < fields.length; ++i) { | |
| 635 fields[i].editable = editable; | |
| 636 } | |
| 637 if (editable) | |
| 638 $('ipconfig-dns1').focus(); | |
| 639 | |
| 640 var automaticDns = $('automatic-dns-display'); | |
| 641 var googleDns = $('google-dns-display'); | |
| 642 var userDns = $('user-dns-settings'); | |
| 643 if (type == 'automatic') { | |
| 644 automaticDns.setAttribute('selected', ''); | |
| 645 googleDns.removeAttribute('selected'); | |
| 646 userDns.removeAttribute('selected'); | |
| 647 } | |
| 648 if (type == 'google') { | |
| 649 automaticDns.removeAttribute('selected'); | |
| 650 googleDns.setAttribute('selected', ''); | |
| 651 userDns.removeAttribute('selected'); | |
| 652 } | |
| 653 if (type == 'user') { | |
| 654 automaticDns.removeAttribute('selected'); | |
| 655 googleDns.removeAttribute('selected'); | |
| 656 userDns.setAttribute('selected', ''); | |
| 657 } | |
| 658 }; | |
| 659 | |
| 555 DetailsInternetPage.showDetailedInfo = function(data) { | 660 DetailsInternetPage.showDetailedInfo = function(data) { |
| 556 var detailsPage = DetailsInternetPage.getInstance(); | 661 var detailsPage = DetailsInternetPage.getInstance(); |
| 557 | 662 |
| 558 // Populate header | 663 // Populate header |
| 559 $('network-details-title').textContent = data.networkName; | 664 $('network-details-title').textContent = data.networkName; |
| 560 var statusKey = data.connected ? 'networkConnected' : | 665 var statusKey = data.connected ? 'networkConnected' : |
| 561 'networkNotConnected'; | 666 'networkNotConnected'; |
| 562 $('network-details-subtitle-status').textContent = | 667 $('network-details-subtitle-status').textContent = |
| 563 loadTimeData.getString(statusKey); | 668 loadTimeData.getString(statusKey); |
| 564 var typeKey = null; | 669 var typeKey = null; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 603 else | 708 else |
| 604 $('details-internet-disconnect').hidden = !data.connected; | 709 $('details-internet-disconnect').hidden = !data.connected; |
| 605 | 710 |
| 606 detailsPage.deviceConnected = data.deviceConnected; | 711 detailsPage.deviceConnected = data.deviceConnected; |
| 607 detailsPage.connecting = data.connecting; | 712 detailsPage.connecting = data.connecting; |
| 608 detailsPage.connected = data.connected; | 713 detailsPage.connected = data.connected; |
| 609 detailsPage.showProxy = data.showProxy; | 714 detailsPage.showProxy = data.showProxy; |
| 610 detailsPage.showStaticIPConfig = data.showStaticIPConfig; | 715 detailsPage.showStaticIPConfig = data.showStaticIPConfig; |
| 611 $('connection-state').textContent = data.connectionState; | 716 $('connection-state').textContent = data.connectionState; |
| 612 | 717 |
| 613 var inetAddress = ''; | 718 var ipAutoConfig = data.ipAutoConfig ? 'automatic' : 'user'; |
| 614 var inetSubnetAddress = ''; | 719 $('ip-automatic-configuration-checkbox').checked = data.ipAutoConfig; |
| 615 var inetGateway = ''; | 720 var inetAddress = { |
| 616 var inetDns = ''; | 721 autoConfig: ipAutoConfig, |
| 617 $('ip-type-dhcp').checked = true; | 722 }; |
| 618 if (data.ipconfigStatic.value) { | 723 var inetNetmask = { |
| 619 inetAddress = data.ipconfigStatic.value.address; | 724 autoConfig: ipAutoConfig, |
| 620 inetSubnetAddress = data.ipconfigStatic.value.subnetAddress; | 725 }; |
| 621 inetGateway = data.ipconfigStatic.value.gateway; | 726 var inetGateway = { |
| 622 inetDns = data.ipconfigStatic.value.dns; | 727 autoConfig: ipAutoConfig, |
| 623 $('ip-type-static').checked = true; | 728 }; |
|
Dan Beam
2012/08/11 01:38:02
nit: could probably fit these all on the same line
Greg Spencer (Chromium)
2012/08/13 19:20:04
Done.
| |
| 624 } else if (data.ipconfigDHCP.value) { | 729 |
| 625 inetAddress = data.ipconfigDHCP.value.address; | 730 if (data.ipconfig.value) { |
| 626 inetSubnetAddress = data.ipconfigDHCP.value.subnetAddress; | 731 inetAddress.automatic = data.ipconfig.value.address; |
| 627 inetGateway = data.ipconfigDHCP.value.gateway; | 732 inetAddress.value = data.ipconfig.value.address; |
| 628 inetDns = data.ipconfigDHCP.value.dns; | 733 inetNetmask.automatic = data.ipconfig.value.netmask; |
| 734 inetNetmask.value = data.ipconfig.value.netmask; | |
| 735 inetGateway.automatic = data.ipconfig.value.gateway; | |
| 736 inetGateway.value = data.ipconfig.value.gateway; | |
| 629 } | 737 } |
| 630 | 738 |
| 631 // Hide the dhcp/static radio if needed. | 739 // Override the "automatic" values with the real saved DHCP values, |
| 632 $('ip-type-dhcp-div').hidden = !data.showStaticIPConfig; | 740 // if they are set. |
| 633 $('ip-type-static-div').hidden = !data.showStaticIPConfig; | 741 if (data.savedIP.address) { |
| 742 inetAddress.automatic = data.savedIP.address; | |
| 743 inetAddress.value = data.savedIP.address; | |
| 744 } | |
| 745 if (data.savedIP.netmask) { | |
| 746 inetNetmask.automatic = data.savedIP.netmask; | |
| 747 inetNetmask.value = data.savedIP.netmask; | |
| 748 } | |
| 749 if (data.savedIP.gateway) { | |
| 750 inetGateway.automatic = data.savedIP.gateway; | |
| 751 inetGateway.value = data.savedIP.gateway; | |
| 752 } | |
| 634 | 753 |
| 635 var ipConfigList = $('ip-config-list'); | 754 if (ipAutoConfig == 'user') { |
| 636 options.internet.IPConfigList.decorate(ipConfigList); | 755 if (data.staticIP.value.address) { |
| 637 ipConfigList.disabled = | 756 inetAddress.value = data.staticIP.value.address; |
| 638 $('ip-type-dhcp').checked || data.ipconfigStatic.controlledBy || | 757 inetAddress.user = data.staticIP.value.address; |
| 639 !data.showStaticIPConfig; | 758 } |
| 640 ipConfigList.autoExpands = true; | 759 if (data.staticIP.value.netmask) { |
| 641 var model = new ArrayDataModel([]); | 760 inetNetmask.value = data.staticIP.value.netmask; |
| 642 model.push({ | 761 inetNetmask.user = data.staticIP.value.netmask; |
| 643 property: 'inetAddress', | 762 } |
| 644 name: loadTimeData.getString('inetAddress'), | 763 if (data.staticIP.value.gateway) { |
| 645 value: inetAddress, | 764 inetGateway.value = data.staticIP.value.gateway; |
| 646 }); | 765 inetGateway.user = data.staticIP.value.gateway; |
| 647 model.push({ | 766 } |
| 648 property: 'inetSubnetAddress', | 767 } |
| 649 name: loadTimeData.getString('inetSubnetAddress'), | |
| 650 value: inetSubnetAddress, | |
| 651 }); | |
| 652 model.push({ | |
| 653 property: 'inetGateway', | |
| 654 name: loadTimeData.getString('inetGateway'), | |
| 655 value: inetGateway, | |
| 656 }); | |
| 657 model.push({ | |
| 658 property: 'inetDns', | |
| 659 name: loadTimeData.getString('inetDns'), | |
| 660 value: inetDns, | |
| 661 }); | |
| 662 ipConfigList.dataModel = model; | |
| 663 | 768 |
| 664 $('ip-type-dhcp').addEventListener('click', function(event) { | 769 var configureAddressField = function(field, model) { |
| 665 // Disable ipConfigList and switch back to dhcp values (if any). | 770 IPAddressField.decorate(field); |
| 666 if (data.ipconfigDHCP.value) { | 771 field.model = model; |
| 667 var config = data.ipconfigDHCP.value; | 772 field.editable = (model.autoConfig == 'user'); |
| 668 ipConfigList.dataModel.item(0).value = config.address; | 773 } |
|
Dan Beam
2012/08/11 01:38:02
};
Greg Spencer (Chromium)
2012/08/13 19:20:04
Done.
| |
| 669 ipConfigList.dataModel.item(1).value = config.subnetAddress; | |
| 670 ipConfigList.dataModel.item(2).value = config.gateway; | |
| 671 ipConfigList.dataModel.item(3).value = config.dns; | |
| 672 } | |
| 673 ipConfigList.dataModel.updateIndex(0); | |
| 674 ipConfigList.dataModel.updateIndex(1); | |
| 675 ipConfigList.dataModel.updateIndex(2); | |
| 676 ipConfigList.dataModel.updateIndex(3); | |
| 677 // Unselect all so we don't keep the currently selected field editable. | |
| 678 ipConfigList.selectionModel.unselectAll(); | |
| 679 ipConfigList.disabled = true; | |
| 680 }); | |
| 681 | 774 |
| 682 $('ip-type-static').addEventListener('click', function(event) { | 775 configureAddressField($('ip-address'), inetAddress); |
| 683 // Enable ipConfigList. | 776 configureAddressField($('ip-netmask'), inetNetmask); |
| 684 ipConfigList.disabled = false; | 777 configureAddressField($('ip-gateway'), inetGateway); |
| 685 ipConfigList.focus(); | 778 |
| 686 ipConfigList.selectionModel.selectedIndex = 0; | 779 if (data.ipconfig.value && data.ipconfig.value.nameServers) |
| 687 }); | 780 $('automatic-dns-display').textContent = data.ipconfig.value.nameServers; |
| 781 if (data.savedIP && data.savedIP.nameServers) | |
| 782 $('automatic-dns-display').textContent = data.savedIP.nameServers; | |
| 783 if (data.nameServersGoogle) | |
| 784 $('google-dns-display').textContent = data.nameServersGoogle; | |
| 785 var nameServersUser = []; | |
| 786 if (data.staticIP.value.nameServers) | |
| 787 nameServersUser = data.staticIP.value.nameServers.split(','); | |
| 788 | |
| 789 var nameServerModels = []; | |
| 790 for (var i = 0; i < 4; ++i) { | |
| 791 nameServerModels.push({ | |
| 792 value: nameServersUser[i] ? nameServersUser[i] : '' | |
|
Dan Beam
2012/08/11 01:38:02
nit: same trick here:
value: nameServersUser[i]
Greg Spencer (Chromium)
2012/08/13 19:20:04
Done.
| |
| 793 }); | |
| 794 } | |
| 795 | |
| 796 $(data.nameServerType + '-dns-radio').checked = true; | |
| 797 configureAddressField($('ipconfig-dns1'), nameServerModels[0]); | |
| 798 configureAddressField($('ipconfig-dns2'), nameServerModels[1]); | |
| 799 configureAddressField($('ipconfig-dns3'), nameServerModels[2]); | |
| 800 configureAddressField($('ipconfig-dns4'), nameServerModels[3]); | |
| 801 | |
| 802 DetailsInternetPage.updateNameServerDisplay(data.nameServerType); | |
| 688 | 803 |
| 689 if (data.hardwareAddress) { | 804 if (data.hardwareAddress) { |
| 690 $('hardware-address').textContent = data.hardwareAddress; | 805 $('hardware-address').textContent = data.hardwareAddress; |
| 691 $('hardware-address-row').style.display = 'table-row'; | 806 $('hardware-address-row').style.display = 'table-row'; |
| 692 } else { | 807 } else { |
| 693 // This is most likely a device without a hardware address. | 808 // This is most likely a device without a hardware address. |
| 694 $('hardware-address-row').style.display = 'none'; | 809 $('hardware-address-row').style.display = 'none'; |
| 695 } | 810 } |
| 696 if (data.type == Constants.TYPE_WIFI) { | 811 if (data.type == Constants.TYPE_WIFI) { |
| 697 OptionsPage.showTab($('wifi-network-nav-tab')); | 812 OptionsPage.showTab($('wifi-network-nav-tab')); |
| 698 detailsPage.wireless = true; | 813 detailsPage.wireless = true; |
| 699 detailsPage.vpn = false; | 814 detailsPage.vpn = false; |
| 700 detailsPage.ethernet = false; | 815 detailsPage.ethernet = false; |
| 701 detailsPage.cellular = false; | 816 detailsPage.cellular = false; |
| 702 detailsPage.gsm = false; | 817 detailsPage.gsm = false; |
| 703 detailsPage.wimax = false; | 818 detailsPage.wimax = false; |
| 704 detailsPage.shared = data.shared; | 819 detailsPage.shared = data.shared; |
| 705 $('wifi-connection-state').textContent = data.connectionState; | 820 $('wifi-connection-state').textContent = data.connectionState; |
| 706 $('wifi-ssid').textContent = data.ssid; | 821 $('wifi-ssid').textContent = data.ssid; |
| 707 if (data.bssid && data.bssid.length > 0) { | 822 if (data.bssid && data.bssid.length > 0) { |
| 708 $('wifi-bssid').textContent = data.bssid; | 823 $('wifi-bssid').textContent = data.bssid; |
| 709 $('wifi-bssid-entry').hidden = false; | 824 $('wifi-bssid-entry').hidden = false; |
| 710 } else { | 825 } else { |
| 711 $('wifi-bssid-entry').hidden = true; | 826 $('wifi-bssid-entry').hidden = true; |
| 712 } | 827 } |
| 713 $('wifi-ip-address').textContent = inetAddress; | 828 $('wifi-ip-address').textContent = inetAddress; |
| 714 $('wifi-subnet-address').textContent = inetSubnetAddress; | 829 $('wifi-netmask').textContent = inetNetmask; |
| 715 $('wifi-gateway').textContent = inetGateway; | 830 $('wifi-gateway').textContent = inetGateway; |
| 716 $('wifi-dns').textContent = inetDns; | 831 $('wifi-name-servers').textContent = inetNameServers; |
| 717 if (data.encryption && data.encryption.length > 0) { | 832 if (data.encryption && data.encryption.length > 0) { |
| 718 $('wifi-security').textContent = data.encryption; | 833 $('wifi-security').textContent = data.encryption; |
| 719 $('wifi-security-entry').hidden = false; | 834 $('wifi-security-entry').hidden = false; |
| 720 } else { | 835 } else { |
| 721 $('wifi-security-entry').hidden = true; | 836 $('wifi-security-entry').hidden = true; |
| 722 } | 837 } |
| 723 // Frequency is in MHz. | 838 // Frequency is in MHz. |
| 724 var frequency = loadTimeData.getString('inetFrequencyFormat'); | 839 var frequency = loadTimeData.getString('inetFrequencyFormat'); |
| 725 frequency = frequency.replace('$1', data.frequency); | 840 frequency = frequency.replace('$1', data.frequency); |
| 726 $('wifi-frequency').textContent = frequency; | 841 $('wifi-frequency').textContent = frequency; |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 904 | 1019 |
| 905 // Don't show page name in address bar and in history to prevent people | 1020 // Don't show page name in address bar and in history to prevent people |
| 906 // navigate here by hand and solve issue with page session restore. | 1021 // navigate here by hand and solve issue with page session restore. |
| 907 OptionsPage.showPageByName('detailsInternetPage', false); | 1022 OptionsPage.showPageByName('detailsInternetPage', false); |
| 908 }; | 1023 }; |
| 909 | 1024 |
| 910 return { | 1025 return { |
| 911 DetailsInternetPage: DetailsInternetPage | 1026 DetailsInternetPage: DetailsInternetPage |
| 912 }; | 1027 }; |
| 913 }); | 1028 }); |
| OLD | NEW |