| 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 result[key] = value; | 159 result[key] = value; |
| 160 } | 160 } |
| 161 return result; | 161 return result; |
| 162 }, | 162 }, |
| 163 | 163 |
| 164 /** | 164 /** |
| 165 * @return {boolean} | 165 * @return {boolean} |
| 166 * @private | 166 * @private |
| 167 */ | 167 */ |
| 168 showIPEditFields_: function() { | 168 showIPEditFields_: function() { |
| 169 return this.editable && !this.automatic_; | 169 return !!this.networkProperties.IPConfigs; |
| 170 }, | 170 }, |
| 171 | 171 |
| 172 /** | 172 /** |
| 173 * @return {Object} An object with the edit type for each editable field. | 173 * @return {Object} An object with the edit type for each editable field. |
| 174 * @private | 174 * @private |
| 175 */ | 175 */ |
| 176 getIPEditFields_: function() { | 176 getIPEditFields_: function() { |
| 177 if (!this.editable || this.automatic_) | 177 if (!this.editable || this.automatic_) |
| 178 return {}; | 178 return {}; |
| 179 return { | 179 return { |
| (...skipping 16 matching lines...) Expand all 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 |