Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: chrome/browser/resources/settings/internet_page/internet_detail_page.js

Issue 2651483002: MD Settings: Eliminate use of ES6 for Chrome OS (Closed)
Patch Set: . Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * 'settings-internet-detail' is the settings subpage containing details 7 * 'settings-internet-detail' is the settings subpage containing details
8 * for a network. 8 * for a network.
9 */ 9 */
10 (function() { 10 (function() {
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 this.networksChangedListener_); 150 this.networksChangedListener_);
151 this.networksChangedListener_ = null; 151 this.networksChangedListener_ = null;
152 } 152 }
153 return; 153 return;
154 } 154 }
155 if (!this.networksChangedListener_) { 155 if (!this.networksChangedListener_) {
156 this.networksChangedListener_ = this.onNetworksChangedEvent_.bind(this); 156 this.networksChangedListener_ = this.onNetworksChangedEvent_.bind(this);
157 this.networkingPrivate.onNetworksChanged.addListener( 157 this.networkingPrivate.onNetworksChanged.addListener(
158 this.networksChangedListener_); 158 this.networksChangedListener_);
159 } 159 }
160 let queryParams = settings.getQueryParameters(); 160 var queryParams = settings.getQueryParameters();
161 this.guid = queryParams.get('guid') || ''; 161 this.guid = queryParams.get('guid') || '';
162 if (!this.guid) { 162 if (!this.guid) {
163 console.error('No guid specified for page:' + route); 163 console.error('No guid specified for page:' + route);
164 this.close_(); 164 this.close_();
165 } 165 }
166 this.getNetworkDetails_(); 166 this.getNetworkDetails_();
167 }, 167 },
168 168
169 /** @private */ 169 /** @private */
170 close_: function() { 170 close_: function() {
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 /** @type {chrome.networkingPrivate.IPConfigType|undefined} */ ( 575 /** @type {chrome.networkingPrivate.IPConfigType|undefined} */ (
576 CrOnc.getActiveValue( 576 CrOnc.getActiveValue(
577 this.networkProperties.NameServersConfigType)); 577 this.networkProperties.NameServersConfigType));
578 var newNsConfigType = 578 var newNsConfigType =
579 /** @type {chrome.networkingPrivate.IPConfigType} */ (value); 579 /** @type {chrome.networkingPrivate.IPConfigType} */ (value);
580 if (newNsConfigType == nsConfigType) 580 if (newNsConfigType == nsConfigType)
581 return; 581 return;
582 onc.NameServersConfigType = newNsConfigType; 582 onc.NameServersConfigType = newNsConfigType;
583 } else if (field == 'StaticIPConfig') { 583 } else if (field == 'StaticIPConfig') {
584 if (ipConfigType == CrOnc.IPConfigType.STATIC) { 584 if (ipConfigType == CrOnc.IPConfigType.STATIC) {
585 let staticIpConfig = this.networkProperties.StaticIPConfig; 585 var staticIpConfig = this.networkProperties.StaticIPConfig;
586 let ipConfigValue = /** @type {!Object} */ (value); 586 var ipConfigValue = /** @type {!Object} */ (value);
587 if (staticIpConfig && 587 if (staticIpConfig &&
588 this.allPropertiesMatch_(staticIpConfig, ipConfigValue)) { 588 this.allPropertiesMatch_(staticIpConfig, ipConfigValue)) {
589 return; 589 return;
590 } 590 }
591 } 591 }
592 onc.IPAddressConfigType = CrOnc.IPConfigType.STATIC; 592 onc.IPAddressConfigType = CrOnc.IPConfigType.STATIC;
593 if (!onc.StaticIPConfig) { 593 if (!onc.StaticIPConfig) {
594 onc.StaticIPConfig = 594 onc.StaticIPConfig =
595 /** @type {!chrome.networkingPrivate.IPConfigProperties} */ ({}); 595 /** @type {!chrome.networkingPrivate.IPConfigProperties} */ ({});
596 } 596 }
597 for (let key in value) 597 for (var key in value)
598 onc.StaticIPConfig[key] = value[key]; 598 onc.StaticIPConfig[key] = value[key];
599 } else if (field == 'NameServers') { 599 } else if (field == 'NameServers') {
600 // If a StaticIPConfig property is specified and its NameServers value 600 // If a StaticIPConfig property is specified and its NameServers value
601 // matches the new value, no need to set anything. 601 // matches the new value, no need to set anything.
602 let nameServers = /** @type {!Array<string>} */ (value); 602 var nameServers = /** @type {!Array<string>} */ (value);
603 if (onc.NameServersConfigType == CrOnc.IPConfigType.STATIC && 603 if (onc.NameServersConfigType == CrOnc.IPConfigType.STATIC &&
604 onc.StaticIPConfig && onc.StaticIPConfig.NameServers == nameServers) { 604 onc.StaticIPConfig && onc.StaticIPConfig.NameServers == nameServers) {
605 return; 605 return;
606 } 606 }
607 onc.NameServersConfigType = CrOnc.IPConfigType.STATIC; 607 onc.NameServersConfigType = CrOnc.IPConfigType.STATIC;
608 if (!onc.StaticIPConfig) { 608 if (!onc.StaticIPConfig) {
609 onc.StaticIPConfig = 609 onc.StaticIPConfig =
610 /** @type {!chrome.networkingPrivate.IPConfigProperties} */ ({}); 610 /** @type {!chrome.networkingPrivate.IPConfigProperties} */ ({});
611 } 611 }
612 onc.StaticIPConfig.NameServers = nameServers; 612 onc.StaticIPConfig.NameServers = nameServers;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 // networkProperties.Type == CrOnc.Type.ETHERNET. 693 // networkProperties.Type == CrOnc.Type.ETHERNET.
694 return this.isRemembered_(networkProperties); 694 return this.isRemembered_(networkProperties);
695 }, 695 },
696 696
697 /** 697 /**
698 * @param {!Array<string>} fields 698 * @param {!Array<string>} fields
699 * @return {boolean} 699 * @return {boolean}
700 * @private 700 * @private
701 */ 701 */
702 hasVisibleFields_: function(fields) { 702 hasVisibleFields_: function(fields) {
703 for (let key of fields) { 703 for (var f = 0; f < fields.length; ++f) {
704 let value = this.get(key, this.networkProperties); 704 var value = this.get(fields[f], this.networkProperties);
705 if (value !== undefined && value !== '') 705 if (value !== undefined && value !== '')
706 return true; 706 return true;
707 } 707 }
708 return false; 708 return false;
709 }, 709 },
710 710
711 /** 711 /**
712 * @return {boolean} 712 * @return {boolean}
713 * @private 713 * @private
714 */ 714 */
715 hasInfoFields_: function() { 715 hasInfoFields_: function() {
716 return this.hasVisibleFields_(this.getInfoFields_()); 716 return this.hasVisibleFields_(this.getInfoFields_());
717 }, 717 },
718 718
719 /** 719 /**
720 * @return {!Array<string>} The fields to display in the info section. 720 * @return {!Array<string>} The fields to display in the info section.
721 * @private 721 * @private
722 */ 722 */
723 getInfoFields_: function() { 723 getInfoFields_: function() {
724 /** @type {!Array<string>} */ var fields = []; 724 /** @type {!Array<string>} */ var fields = [];
725 if (this.networkProperties.Type == CrOnc.Type.CELLULAR) { 725 if (this.networkProperties.Type == CrOnc.Type.CELLULAR) {
726 fields.push( 726 fields.push(
727 'Cellular.ActivationState', 'Cellular.RoamingState', 727 'Cellular.ActivationState', 'Cellular.RoamingState',
728 'RestrictedConnectivity', 'Cellular.ServingOperator.Name'); 728 'RestrictedConnectivity', 'Cellular.ServingOperator.Name');
729 } 729 }
730 if (this.networkProperties.Type == CrOnc.Type.VPN) { 730 if (this.networkProperties.Type == CrOnc.Type.VPN) {
731 let vpnType = CrOnc.getActiveValue(this.networkProperties.VPN.Type); 731 var vpnType = CrOnc.getActiveValue(this.networkProperties.VPN.Type);
732 if (vpnType == 'ThirdPartyVPN') { 732 if (vpnType == 'ThirdPartyVPN') {
733 fields.push('VPN.ThirdPartyVPN.ProviderName'); 733 fields.push('VPN.ThirdPartyVPN.ProviderName');
734 } else { 734 } else {
735 fields.push('VPN.Host', 'VPN.Type'); 735 fields.push('VPN.Host', 'VPN.Type');
736 if (vpnType == 'OpenVPN') 736 if (vpnType == 'OpenVPN')
737 fields.push('VPN.OpenVPN.Username'); 737 fields.push('VPN.OpenVPN.Username');
738 else if (vpnType == 'L2TP-IPsec') 738 else if (vpnType == 'L2TP-IPsec')
739 fields.push('VPN.L2TP.Username'); 739 fields.push('VPN.L2TP.Username');
740 } 740 }
741 } 741 }
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 /** 858 /**
859 * @param {!Object} curValue 859 * @param {!Object} curValue
860 * @param {!Object} newValue 860 * @param {!Object} newValue
861 * @return {boolean} True if all properties set in |newValue| are equal to 861 * @return {boolean} True if all properties set in |newValue| are equal to
862 * the corresponding properties in |curValue|. Note: Not all properties 862 * the corresponding properties in |curValue|. Note: Not all properties
863 * of |curValue| need to be specified in |newValue| for this to return 863 * of |curValue| need to be specified in |newValue| for this to return
864 * true. 864 * true.
865 * @private 865 * @private
866 */ 866 */
867 allPropertiesMatch_: function(curValue, newValue) { 867 allPropertiesMatch_: function(curValue, newValue) {
868 for (let key in newValue) { 868 for (var key in newValue) {
869 if (newValue[key] != curValue[key]) 869 if (newValue[key] != curValue[key])
870 return false; 870 return false;
871 } 871 }
872 return true; 872 return true;
873 } 873 }
874 }); 874 });
875 })(); 875 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698