| 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 | 8 |
| 9 /** | 9 /** |
| 10 * Network settings constants. These enums must match their C++ | 10 * Network settings constants. These enums must match their C++ |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 updateProxyBannerVisibility_: function() { | 400 updateProxyBannerVisibility_: function() { |
| 401 var bannerDiv = $('info-banner'); | 401 var bannerDiv = $('info-banner'); |
| 402 // Show banner and determine its message if necessary. | 402 // Show banner and determine its message if necessary. |
| 403 var controlledBy = $('direct-proxy').controlledBy; | 403 var controlledBy = $('direct-proxy').controlledBy; |
| 404 if (!controlledBy || controlledBy == '') { | 404 if (!controlledBy || controlledBy == '') { |
| 405 bannerDiv.hidden = true; | 405 bannerDiv.hidden = true; |
| 406 } else { | 406 } else { |
| 407 bannerDiv.hidden = false; | 407 bannerDiv.hidden = false; |
| 408 // controlledBy must match strings loaded in proxy_handler.cc and | 408 // controlledBy must match strings loaded in proxy_handler.cc and |
| 409 // set in proxy_cros_settings_provider.cc. | 409 // set in proxy_cros_settings_provider.cc. |
| 410 $('banner-text').textContent = localStrings.getString(controlledBy); | 410 $('banner-text').textContent = loadTimeData.getString(controlledBy); |
| 411 } | 411 } |
| 412 }, | 412 }, |
| 413 | 413 |
| 414 /** | 414 /** |
| 415 * Handler for when the user clicks on the checkbox to allow a | 415 * Handler for when the user clicks on the checkbox to allow a |
| 416 * single proxy usage. | 416 * single proxy usage. |
| 417 * @private | 417 * @private |
| 418 * @param {Event} e Click Event. | 418 * @param {Event} e Click Event. |
| 419 */ | 419 */ |
| 420 toggleSingleProxy_: function(e) { | 420 toggleSingleProxy_: function(e) { |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 }; | 591 }; |
| 592 | 592 |
| 593 DetailsInternetPage.showDetailedInfo = function(data) { | 593 DetailsInternetPage.showDetailedInfo = function(data) { |
| 594 var detailsPage = DetailsInternetPage.getInstance(); | 594 var detailsPage = DetailsInternetPage.getInstance(); |
| 595 | 595 |
| 596 // Populate header | 596 // Populate header |
| 597 $('network-details-title').textContent = data.networkName; | 597 $('network-details-title').textContent = data.networkName; |
| 598 var statusKey = data.connected ? 'networkConnected' : | 598 var statusKey = data.connected ? 'networkConnected' : |
| 599 'networkNotConnected'; | 599 'networkNotConnected'; |
| 600 $('network-details-subtitle-status').textContent = | 600 $('network-details-subtitle-status').textContent = |
| 601 localStrings.getString(statusKey); | 601 loadTimeData.getString(statusKey); |
| 602 var typeKey = null; | 602 var typeKey = null; |
| 603 switch (data.type) { | 603 switch (data.type) { |
| 604 case Constants.TYPE_ETHERNET: | 604 case Constants.TYPE_ETHERNET: |
| 605 typeKey = 'ethernetTitle'; | 605 typeKey = 'ethernetTitle'; |
| 606 break; | 606 break; |
| 607 case Constants.TYPE_WIFI: | 607 case Constants.TYPE_WIFI: |
| 608 typeKey = 'wifiTitle'; | 608 typeKey = 'wifiTitle'; |
| 609 break; | 609 break; |
| 610 case Constants.TYPE_CELLULAR: | 610 case Constants.TYPE_CELLULAR: |
| 611 typeKey = 'cellularTitle'; | 611 typeKey = 'cellularTitle'; |
| 612 break; | 612 break; |
| 613 case Constants.TYPE_VPN: | 613 case Constants.TYPE_VPN: |
| 614 typeKey = 'vpnTitle'; | 614 typeKey = 'vpnTitle'; |
| 615 break; | 615 break; |
| 616 } | 616 } |
| 617 var typeLabel = $('network-details-subtitle-type'); | 617 var typeLabel = $('network-details-subtitle-type'); |
| 618 var typeSeparator = $('network-details-subtitle-separator'); | 618 var typeSeparator = $('network-details-subtitle-separator'); |
| 619 if (typeKey) { | 619 if (typeKey) { |
| 620 typeLabel.textContent = localStrings.getString(typeKey); | 620 typeLabel.textContent = loadTimeData.getString(typeKey); |
| 621 typeLabel.hidden = false; | 621 typeLabel.hidden = false; |
| 622 typeSeparator.hidden = false; | 622 typeSeparator.hidden = false; |
| 623 } else { | 623 } else { |
| 624 typeLabel.hidden = true; | 624 typeLabel.hidden = true; |
| 625 typeSeparator.hidden = true; | 625 typeSeparator.hidden = true; |
| 626 } | 626 } |
| 627 | 627 |
| 628 // TODO(chocobo): Is this hack to cache the data here reasonable? | 628 // TODO(chocobo): Is this hack to cache the data here reasonable? |
| 629 // TODO(kevers): Find more appropriate place to cache data. | 629 // TODO(kevers): Find more appropriate place to cache data. |
| 630 $('connection-state').data = data; | 630 $('connection-state').data = data; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 $('ip-type-static-div').hidden = !data.showStaticIPConfig; | 668 $('ip-type-static-div').hidden = !data.showStaticIPConfig; |
| 669 | 669 |
| 670 var ipConfigList = $('ip-config-list'); | 670 var ipConfigList = $('ip-config-list'); |
| 671 options.internet.IPConfigList.decorate(ipConfigList); | 671 options.internet.IPConfigList.decorate(ipConfigList); |
| 672 ipConfigList.disabled = | 672 ipConfigList.disabled = |
| 673 $('ip-type-dhcp').checked || data.ipconfigStatic.controlledBy || | 673 $('ip-type-dhcp').checked || data.ipconfigStatic.controlledBy || |
| 674 !data.showStaticIPConfig; | 674 !data.showStaticIPConfig; |
| 675 ipConfigList.autoExpands = true; | 675 ipConfigList.autoExpands = true; |
| 676 var model = new ArrayDataModel([]); | 676 var model = new ArrayDataModel([]); |
| 677 model.push({ | 677 model.push({ |
| 678 'property': 'inetAddress', | 678 property: 'inetAddress', |
| 679 'name': localStrings.getString('inetAddress'), | 679 name: loadTimeData.getString('inetAddress'), |
| 680 'value': inetAddress, | 680 value: inetAddress, |
| 681 }); | 681 }); |
| 682 model.push({ | 682 model.push({ |
| 683 'property': 'inetSubnetAddress', | 683 property: 'inetSubnetAddress', |
| 684 'name': localStrings.getString('inetSubnetAddress'), | 684 name: loadTimeData.getString('inetSubnetAddress'), |
| 685 'value': inetSubnetAddress, | 685 value: inetSubnetAddress, |
| 686 }); | 686 }); |
| 687 model.push({ | 687 model.push({ |
| 688 'property': 'inetGateway', | 688 property: 'inetGateway', |
| 689 'name': localStrings.getString('inetGateway'), | 689 name: loadTimeData.getString('inetGateway'), |
| 690 'value': inetGateway, | 690 value: inetGateway, |
| 691 }); | 691 }); |
| 692 model.push({ | 692 model.push({ |
| 693 'property': 'inetDns', | 693 property: 'inetDns', |
| 694 'name': localStrings.getString('inetDns'), | 694 name: loadTimeData.getString('inetDns'), |
| 695 'value': inetDns, | 695 value: inetDns, |
| 696 }); | 696 }); |
| 697 ipConfigList.dataModel = model; | 697 ipConfigList.dataModel = model; |
| 698 | 698 |
| 699 $('ip-type-dhcp').addEventListener('click', function(event) { | 699 $('ip-type-dhcp').addEventListener('click', function(event) { |
| 700 // Disable ipConfigList and switch back to dhcp values (if any). | 700 // Disable ipConfigList and switch back to dhcp values (if any). |
| 701 if (data.ipconfigDHCP.value) { | 701 if (data.ipconfigDHCP.value) { |
| 702 var config = data.ipconfigDHCP.value; | 702 var config = data.ipconfigDHCP.value; |
| 703 ipConfigList.dataModel.item(0).value = config.address; | 703 ipConfigList.dataModel.item(0).value = config.address; |
| 704 ipConfigList.dataModel.item(1).value = config.subnetAddress; | 704 ipConfigList.dataModel.item(1).value = config.subnetAddress; |
| 705 ipConfigList.dataModel.item(2).value = config.gateway; | 705 ipConfigList.dataModel.item(2).value = config.gateway; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 $('wifi-subnet-address').textContent = inetSubnetAddress; | 748 $('wifi-subnet-address').textContent = inetSubnetAddress; |
| 749 $('wifi-gateway').textContent = inetGateway; | 749 $('wifi-gateway').textContent = inetGateway; |
| 750 $('wifi-dns').textContent = inetDns; | 750 $('wifi-dns').textContent = inetDns; |
| 751 if (data.encryption && data.encryption.length > 0) { | 751 if (data.encryption && data.encryption.length > 0) { |
| 752 $('wifi-security').textContent = data.encryption; | 752 $('wifi-security').textContent = data.encryption; |
| 753 $('wifi-security-entry').hidden = false; | 753 $('wifi-security-entry').hidden = false; |
| 754 } else { | 754 } else { |
| 755 $('wifi-security-entry').hidden = true; | 755 $('wifi-security-entry').hidden = true; |
| 756 } | 756 } |
| 757 // Frequency is in MHz. | 757 // Frequency is in MHz. |
| 758 var frequency = localStrings.getString('inetFrequencyFormat'); | 758 var frequency = loadTimeData.getString('inetFrequencyFormat'); |
| 759 frequency = frequency.replace('$1', data.frequency); | 759 frequency = frequency.replace('$1', data.frequency); |
| 760 $('wifi-frequency').textContent = frequency; | 760 $('wifi-frequency').textContent = frequency; |
| 761 // Signal strength as percentage. | 761 // Signal strength as percentage. |
| 762 var signalStrength = localStrings.getString('inetSignalStrengthFormat'); | 762 var signalStrength = loadTimeData.getString('inetSignalStrengthFormat'); |
| 763 signalStrength = signalStrength.replace('$1', data.strength); | 763 signalStrength = signalStrength.replace('$1', data.strength); |
| 764 $('wifi-signal-strength').textContent = signalStrength; | 764 $('wifi-signal-strength').textContent = signalStrength; |
| 765 if (data.hardwareAddress) { | 765 if (data.hardwareAddress) { |
| 766 $('wifi-hardware-address').textContent = data.hardwareAddress; | 766 $('wifi-hardware-address').textContent = data.hardwareAddress; |
| 767 $('wifi-hardware-address-entry').hidden = false; | 767 $('wifi-hardware-address-entry').hidden = false; |
| 768 } else { | 768 } else { |
| 769 $('wifi-hardware-address-entry').hidden = true; | 769 $('wifi-hardware-address-entry').hidden = true; |
| 770 } | 770 } |
| 771 detailsPage.showPreferred = data.showPreferred; | 771 detailsPage.showPreferred = data.showPreferred; |
| 772 $('prefer-network-wifi').checked = data.preferred.value; | 772 $('prefer-network-wifi').checked = data.preferred.value; |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 | 912 |
| 913 // Don't show page name in address bar and in history to prevent people | 913 // Don't show page name in address bar and in history to prevent people |
| 914 // navigate here by hand and solve issue with page session restore. | 914 // navigate here by hand and solve issue with page session restore. |
| 915 OptionsPage.showPageByName('detailsInternetPage', false); | 915 OptionsPage.showPageByName('detailsInternetPage', false); |
| 916 }; | 916 }; |
| 917 | 917 |
| 918 return { | 918 return { |
| 919 DetailsInternetPage: DetailsInternetPage | 919 DetailsInternetPage: DetailsInternetPage |
| 920 }; | 920 }; |
| 921 }); | 921 }); |
| OLD | NEW |