| 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 and modifying a list of cellular | 6 * @fileoverview Polymer element for displaying and modifying a list of cellular |
| 7 * access points. | 7 * access points. |
| 8 */ | 8 */ |
| 9 Polymer({ | 9 Polymer({ |
| 10 is: 'network-apnlist', | 10 is: 'network-apnlist', |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 return /** @type {!Array<!CrOnc.APNProperties>} */ ( | 174 return /** @type {!Array<!CrOnc.APNProperties>} */ ( |
| 175 CrOnc.getActiveValue(apnlist)); | 175 CrOnc.getActiveValue(apnlist)); |
| 176 }, | 176 }, |
| 177 | 177 |
| 178 /** | 178 /** |
| 179 * Event triggered when the selectApn selection changes. | 179 * Event triggered when the selectApn selection changes. |
| 180 * @param {!Event} event | 180 * @param {!Event} event |
| 181 * @private | 181 * @private |
| 182 */ | 182 */ |
| 183 onSelectApnChange_: function(event) { | 183 onSelectApnChange_: function(event) { |
| 184 let target = /** @type {!HTMLSelectElement} */(event.target); | 184 var target = /** @type {!HTMLSelectElement} */(event.target); |
| 185 var accessPointName = target.value; | 185 var accessPointName = target.value; |
| 186 // When selecting 'Other', don't set a change event unless a valid | 186 // When selecting 'Other', don't set a change event unless a valid |
| 187 // non-default value has been set for Other. | 187 // non-default value has been set for Other. |
| 188 if (this.isOtherSelected_(accessPointName) && | 188 if (this.isOtherSelected_(accessPointName) && |
| 189 (!this.otherApn_ || !this.otherApn_.AccessPointName || | 189 (!this.otherApn_ || !this.otherApn_.AccessPointName || |
| 190 this.otherApn_.AccessPointName == this.DefaultAccessPointName)) { | 190 this.otherApn_.AccessPointName == this.DefaultAccessPointName)) { |
| 191 this.selectedApn_ = accessPointName; | 191 this.selectedApn_ = accessPointName; |
| 192 return; | 192 return; |
| 193 } | 193 } |
| 194 this.sendApnChange_(accessPointName); | 194 this.sendApnChange_(accessPointName); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 }, | 255 }, |
| 256 | 256 |
| 257 /** | 257 /** |
| 258 * @param {!Array<!CrOnc.APNProperties>} apnList | 258 * @param {!Array<!CrOnc.APNProperties>} apnList |
| 259 * @param {string} accessPointName | 259 * @param {string} accessPointName |
| 260 * @return {CrOnc.APNProperties|undefined} The entry in |apnList| matching | 260 * @return {CrOnc.APNProperties|undefined} The entry in |apnList| matching |
| 261 * |accessPointName| if it exists, or undefined. | 261 * |accessPointName| if it exists, or undefined. |
| 262 * @private | 262 * @private |
| 263 */ | 263 */ |
| 264 findApnInList: function(apnList, accessPointName) { | 264 findApnInList: function(apnList, accessPointName) { |
| 265 for (let a of apnList) { | 265 return apnList.find(function(a) { |
| 266 if (a.AccessPointName == accessPointName) | 266 return a.AccessPointName == accessPointName; |
| 267 return a; | 267 }); |
| 268 } | |
| 269 return undefined; | |
| 270 } | 268 } |
| 271 }); | 269 }); |
| OLD | NEW |