OLD | NEW |
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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 if (preferNetwork != this.preferNetwork_) | 157 if (preferNetwork != this.preferNetwork_) |
158 this.preferNetwork_ = preferNetwork; | 158 this.preferNetwork_ = preferNetwork; |
159 | 159 |
160 // Set the IPAddress property to the IPV4 Address. | 160 // Set the IPAddress property to the IPV4 Address. |
161 var ipv4 = | 161 var ipv4 = |
162 CrOnc.getIPConfigForType(this.networkProperties, CrOnc.IPType.IPV4); | 162 CrOnc.getIPConfigForType(this.networkProperties, CrOnc.IPType.IPV4); |
163 this.IPAddress_ = (ipv4 && ipv4.IPAddress) || ''; | 163 this.IPAddress_ = (ipv4 && ipv4.IPAddress) || ''; |
164 | 164 |
165 // Update the detail page title. | 165 // Update the detail page title. |
166 this.parentNode.pageTitle = | 166 this.parentNode.pageTitle = |
167 CrOnc.getNetworkName(this.networkProperties, this.i18n); | 167 CrOnc.getNetworkName(this.networkProperties, this, this.i18n); |
168 }, | 168 }, |
169 | 169 |
170 /** @private */ | 170 /** @private */ |
171 autoConnectChanged_: function() { | 171 autoConnectChanged_: function() { |
172 if (!this.networkProperties || !this.guid) | 172 if (!this.networkProperties || !this.guid) |
173 return; | 173 return; |
174 var onc = this.getEmptyNetworkProperties_(); | 174 var onc = this.getEmptyNetworkProperties_(); |
175 CrOnc.setTypeProperty(onc, 'AutoConnect', this.autoConnect_); | 175 CrOnc.setTypeProperty(onc, 'AutoConnect', this.autoConnect_); |
176 this.setNetworkProperties_(onc); | 176 this.setNetworkProperties_(onc); |
177 }, | 177 }, |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 * @private | 614 * @private |
615 */ | 615 */ |
616 getInfoFields_: function() { | 616 getInfoFields_: function() { |
617 /** @type {!Array<string>} */ var fields = []; | 617 /** @type {!Array<string>} */ var fields = []; |
618 if (this.networkProperties.Type == CrOnc.Type.CELLULAR) { | 618 if (this.networkProperties.Type == CrOnc.Type.CELLULAR) { |
619 fields.push( | 619 fields.push( |
620 'Cellular.ActivationState', 'Cellular.RoamingState', | 620 'Cellular.ActivationState', 'Cellular.RoamingState', |
621 'RestrictedConnectivity', 'Cellular.ServingOperator.Name'); | 621 'RestrictedConnectivity', 'Cellular.ServingOperator.Name'); |
622 } | 622 } |
623 if (this.networkProperties.Type == CrOnc.Type.VPN) { | 623 if (this.networkProperties.Type == CrOnc.Type.VPN) { |
624 fields.push('VPN.Host', 'VPN.Type'); | 624 let vpnType = CrOnc.getActiveValue(this.networkProperties.VPN.Type); |
625 if (this.networkProperties.VPN.Type == 'OpenVPN') | 625 if (vpnType == 'ThirdPartyVPN') { |
626 fields.push('VPN.OpenVPN.Username'); | |
627 else if (this.networkProperties.VPN.Type == 'L2TP-IPsec') | |
628 fields.push('VPN.L2TP.Username'); | |
629 else if (this.networkProperties.VPN.Type == 'ThirdPartyVPN') | |
630 fields.push('VPN.ThirdPartyVPN.ProviderName'); | 626 fields.push('VPN.ThirdPartyVPN.ProviderName'); |
| 627 } else { |
| 628 fields.push('VPN.Host', 'VPN.Type'); |
| 629 if (vpnType == 'OpenVPN') |
| 630 fields.push('VPN.OpenVPN.Username'); |
| 631 else if (vpnType == 'L2TP-IPsec') |
| 632 fields.push('VPN.L2TP.Username'); |
| 633 } |
631 } | 634 } |
632 if (this.networkProperties.Type == CrOnc.Type.WI_FI) | 635 if (this.networkProperties.Type == CrOnc.Type.WI_FI) |
633 fields.push('RestrictedConnectivity'); | 636 fields.push('RestrictedConnectivity'); |
634 if (this.networkProperties.Type == CrOnc.Type.WI_MAX) { | 637 if (this.networkProperties.Type == CrOnc.Type.WI_MAX) { |
635 fields.push('RestrictedConnectivity', 'WiMAX.EAP.Identity'); | 638 fields.push('RestrictedConnectivity', 'WiMAX.EAP.Identity'); |
636 } | 639 } |
637 return fields; | 640 return fields; |
638 }, | 641 }, |
639 | 642 |
640 /** | 643 /** |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 | 699 |
697 /** | 700 /** |
698 * @return {boolean} | 701 * @return {boolean} |
699 * @private | 702 * @private |
700 */ | 703 */ |
701 hasDeviceFields_: function() { | 704 hasDeviceFields_: function() { |
702 return this.hasVisibleFields_(this.getDeviceFields_()); | 705 return this.hasVisibleFields_(this.getDeviceFields_()); |
703 }, | 706 }, |
704 | 707 |
705 /** | 708 /** |
| 709 * @return {boolean} |
| 710 * @private |
| 711 */ |
| 712 hasAdvancedOrDeviceFields_: function() { |
| 713 return this.hasAdvancedFields_() || this.hasDeviceFields_(); |
| 714 }, |
| 715 |
| 716 /** |
706 * @return {boolean} True if the network section should be shown. | 717 * @return {boolean} True if the network section should be shown. |
707 * @private | 718 * @private |
708 */ | 719 */ |
709 hasNetworkSection_: function() { | 720 hasNetworkSection_: function() { |
710 if (this.networkProperties.Type == CrOnc.Type.VPN) | 721 if (this.networkProperties.Type == CrOnc.Type.VPN) |
711 return false; | 722 return false; |
712 if (this.networkProperties.Type == CrOnc.Type.CELLULAR) | 723 if (this.networkProperties.Type == CrOnc.Type.CELLULAR) |
713 return true; | 724 return true; |
714 return this.isRememberedOrConnected_(); | 725 return this.isRememberedOrConnected_(); |
715 }, | 726 }, |
(...skipping 30 matching lines...) Expand all Loading... |
746 */ | 757 */ |
747 allPropertiesMatch_: function(curValue, newValue) { | 758 allPropertiesMatch_: function(curValue, newValue) { |
748 for (let key in newValue) { | 759 for (let key in newValue) { |
749 if (newValue[key] != curValue[key]) | 760 if (newValue[key] != curValue[key]) |
750 return false; | 761 return false; |
751 } | 762 } |
752 return true; | 763 return true; |
753 } | 764 } |
754 }); | 765 }); |
755 })(); | 766 })(); |
OLD | NEW |