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