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 Polymer element for displaying the IP Config properties for | 6 * @fileoverview Polymer element for displaying the IP Config properties for |
7 * a network state. TODO(stevenjb): Allow editing of static IP configurations | 7 * a network state. TODO(stevenjb): Allow editing of static IP configurations |
8 * when 'editable' is true. | 8 * when 'editable' is true. |
9 */ | 9 */ |
10 Polymer({ | 10 Polymer({ |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 * Polymer networkProperties changed method. | 80 * Polymer networkProperties changed method. |
81 */ | 81 */ |
82 networkPropertiesChanged_: function(newValue, oldValue) { | 82 networkPropertiesChanged_: function(newValue, oldValue) { |
83 if (!this.networkProperties) | 83 if (!this.networkProperties) |
84 return; | 84 return; |
85 | 85 |
86 if (newValue.GUID != (oldValue && oldValue.GUID)) | 86 if (newValue.GUID != (oldValue && oldValue.GUID)) |
87 this.savedStaticIp_ = undefined; | 87 this.savedStaticIp_ = undefined; |
88 | 88 |
89 // Update the 'automatic' property. | 89 // Update the 'automatic' property. |
90 if (this.networkProperties.IPAddressConfigType ) { | 90 if (this.networkProperties.IPAddressConfigType) { |
91 var ipConfigType = | 91 var ipConfigType = |
92 CrOnc.getActiveValue(this.networkProperties.IPAddressConfigType); | 92 CrOnc.getActiveValue(this.networkProperties.IPAddressConfigType); |
93 this.automatic_ = (ipConfigType != CrOnc.IPConfigType.STATIC); | 93 this.automatic_ = (ipConfigType != CrOnc.IPConfigType.STATIC); |
94 } | 94 } |
95 | 95 |
96 if (this.networkProperties.IPConfigs) { | 96 if (this.networkProperties.IPConfigs) { |
97 // Update the 'ipConfig' property. | 97 // Update the 'ipConfig' property. |
98 var ipv4 = | 98 var ipv4 = |
99 CrOnc.getIPConfigForType(this.networkProperties, CrOnc.IPType.IPV4); | 99 CrOnc.getIPConfigForType(this.networkProperties, CrOnc.IPType.IPV4); |
100 var ipv6 = | 100 var ipv6 = |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 var value = event.detail.value; | 196 var value = event.detail.value; |
197 // Note: |field| includes the 'ipv4.' prefix. | 197 // Note: |field| includes the 'ipv4.' prefix. |
198 this.set('ipConfig_.' + field, value); | 198 this.set('ipConfig_.' + field, value); |
199 // This will also set IPAddressConfigType to STATIC. | 199 // This will also set IPAddressConfigType to STATIC. |
200 this.fire('ip-change', { | 200 this.fire('ip-change', { |
201 field: 'StaticIPConfig', | 201 field: 'StaticIPConfig', |
202 value: this.getIPConfigProperties_(this.ipConfig_.ipv4) | 202 value: this.getIPConfigProperties_(this.ipConfig_.ipv4) |
203 }); | 203 }); |
204 }, | 204 }, |
205 }); | 205 }); |
OLD | NEW |