| 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 var value = ipconfig[key]; | 155 var value = ipconfig[key]; |
| 156 if (key == 'RoutingPrefix') | 156 if (key == 'RoutingPrefix') |
| 157 result.RoutingPrefix = CrOnc.getRoutingPrefixAsLength(value); | 157 result.RoutingPrefix = CrOnc.getRoutingPrefixAsLength(value); |
| 158 else | 158 else |
| 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} | |
| 166 * @private | |
| 167 */ | |
| 168 showIPEditFields_: function() { | |
| 169 return this.editable && !this.automatic_; | |
| 170 }, | |
| 171 | |
| 172 /** | |
| 173 * @return {Object} An object with the edit type for each editable field. | 165 * @return {Object} An object with the edit type for each editable field. |
| 174 * @private | 166 * @private |
| 175 */ | 167 */ |
| 176 getIPEditFields_: function() { | 168 getIPEditFields_: function() { |
| 177 if (!this.editable || this.automatic_) | 169 if (!this.editable || this.automatic_) |
| 178 return {}; | 170 return {}; |
| 179 return { | 171 return { |
| 180 'ipv4.IPAddress': 'String', | 172 'ipv4.IPAddress': 'String', |
| 181 'ipv4.RoutingPrefix': 'String', | 173 'ipv4.RoutingPrefix': 'String', |
| 182 'ipv4.Gateway': 'String' | 174 'ipv4.Gateway': 'String' |
| (...skipping 13 matching lines...) Expand all Loading... |
| 196 var value = event.detail.value; | 188 var value = event.detail.value; |
| 197 // Note: |field| includes the 'ipv4.' prefix. | 189 // Note: |field| includes the 'ipv4.' prefix. |
| 198 this.set('ipConfig_.' + field, value); | 190 this.set('ipConfig_.' + field, value); |
| 199 // This will also set IPAddressConfigType to STATIC. | 191 // This will also set IPAddressConfigType to STATIC. |
| 200 this.fire('ip-change', { | 192 this.fire('ip-change', { |
| 201 field: 'StaticIPConfig', | 193 field: 'StaticIPConfig', |
| 202 value: this.getIPConfigProperties_(this.ipConfig_.ipv4) | 194 value: this.getIPConfigProperties_(this.ipConfig_.ipv4) |
| 203 }); | 195 }); |
| 204 }, | 196 }, |
| 205 }); | 197 }); |
| OLD | NEW |