| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 * @param {!CrOnc.IPConfigProperties|undefined} ipconfig | 133 * @param {!CrOnc.IPConfigProperties|undefined} ipconfig |
| 134 * @return {!CrOnc.IPConfigUIProperties} A new IPConfigUIProperties object | 134 * @return {!CrOnc.IPConfigUIProperties} A new IPConfigUIProperties object |
| 135 * with RoutingPrefix expressed as a string mask instead of a prefix | 135 * with RoutingPrefix expressed as a string mask instead of a prefix |
| 136 * length. Returns an empty object if |ipconfig| is undefined. | 136 * length. Returns an empty object if |ipconfig| is undefined. |
| 137 * @private | 137 * @private |
| 138 */ | 138 */ |
| 139 getIPConfigUIProperties_: function(ipconfig) { | 139 getIPConfigUIProperties_: function(ipconfig) { |
| 140 var result = {}; | 140 var result = {}; |
| 141 if (!ipconfig) | 141 if (!ipconfig) |
| 142 return result; | 142 return result; |
| 143 for (let key in ipconfig) { | 143 for (var key in ipconfig) { |
| 144 let value = ipconfig[key]; | 144 var value = ipconfig[key]; |
| 145 if (key == 'RoutingPrefix') | 145 if (key == 'RoutingPrefix') |
| 146 result.RoutingPrefix = CrOnc.getRoutingPrefixAsNetmask(value); | 146 result.RoutingPrefix = CrOnc.getRoutingPrefixAsNetmask(value); |
| 147 else | 147 else |
| 148 result[key] = value; | 148 result[key] = value; |
| 149 } | 149 } |
| 150 return result; | 150 return result; |
| 151 }, | 151 }, |
| 152 | 152 |
| 153 /** | 153 /** |
| 154 * @param {!CrOnc.IPConfigUIProperties} ipconfig The IP Config UI properties. | 154 * @param {!CrOnc.IPConfigUIProperties} ipconfig The IP Config UI properties. |
| 155 * @return {!CrOnc.IPConfigProperties} A new IPConfigProperties object with | 155 * @return {!CrOnc.IPConfigProperties} A new IPConfigProperties object with |
| 156 * RoutingPrefix expressed as a a prefix length. | 156 * RoutingPrefix expressed as a a prefix length. |
| 157 * @private | 157 * @private |
| 158 */ | 158 */ |
| 159 getIPConfigProperties_: function(ipconfig) { | 159 getIPConfigProperties_: function(ipconfig) { |
| 160 var result = {}; | 160 var result = {}; |
| 161 for (let key in ipconfig) { | 161 for (var key in ipconfig) { |
| 162 let value = ipconfig[key]; | 162 var value = ipconfig[key]; |
| 163 if (key == 'RoutingPrefix') | 163 if (key == 'RoutingPrefix') |
| 164 result.RoutingPrefix = CrOnc.getRoutingPrefixAsLength(value); | 164 result.RoutingPrefix = CrOnc.getRoutingPrefixAsLength(value); |
| 165 else | 165 else |
| 166 result[key] = value; | 166 result[key] = value; |
| 167 } | 167 } |
| 168 return result; | 168 return result; |
| 169 }, | 169 }, |
| 170 | 170 |
| 171 /** | 171 /** |
| 172 * @return {boolean} | 172 * @return {boolean} |
| (...skipping 29 matching lines...) Expand all Loading... |
| 202 var field = event.detail.field; | 202 var field = event.detail.field; |
| 203 var value = event.detail.value; | 203 var value = event.detail.value; |
| 204 // Note: |field| includes the 'ipv4.' prefix. | 204 // Note: |field| includes the 'ipv4.' prefix. |
| 205 this.set('ipConfig.' + field, value); | 205 this.set('ipConfig.' + field, value); |
| 206 this.fire('ip-change', { | 206 this.fire('ip-change', { |
| 207 field: 'StaticIPConfig', | 207 field: 'StaticIPConfig', |
| 208 value: this.getIPConfigProperties_(this.ipConfig_.ipv4) | 208 value: this.getIPConfigProperties_(this.ipConfig_.ipv4) |
| 209 }); | 209 }); |
| 210 }, | 210 }, |
| 211 }); | 211 }); |
| OLD | NEW |