| 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 cellular sim info. | 6 * @fileoverview Polymer element for displaying and modifying cellular sim info. |
| 7 */ | 7 */ |
| 8 (function() { | 8 (function() { |
| 9 | 9 |
| 10 /** @enum {string} */ | 10 /** @enum {string} */ |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 var guid = (this.networkProperties && this.networkProperties.GUID) || ''; | 138 var guid = (this.networkProperties && this.networkProperties.GUID) || ''; |
| 139 var pin = this.$.enterPin.value; | 139 var pin = this.$.enterPin.value; |
| 140 if (!this.validatePin_(pin)) { | 140 if (!this.validatePin_(pin)) { |
| 141 this.onEnterPinDialogCancel_(); | 141 this.onEnterPinDialogCancel_(); |
| 142 return; | 142 return; |
| 143 } | 143 } |
| 144 var simState = /** @type {!CrOnc.CellularSimState} */ ({ | 144 var simState = /** @type {!CrOnc.CellularSimState} */ ({ |
| 145 currentPin: pin, | 145 currentPin: pin, |
| 146 requirePin: this.sendSimLockEnabled_, | 146 requirePin: this.sendSimLockEnabled_, |
| 147 }); | 147 }); |
| 148 this.networkingPrivate.setCellularSimState(guid, simState, function() { | 148 this.networkingPrivate.setCellularSimState(guid, simState, () => { |
| 149 if (chrome.runtime.lastError) { | 149 if (chrome.runtime.lastError) { |
| 150 this.error_ = ErrorType.INCORRECT_PIN; | 150 this.error_ = ErrorType.INCORRECT_PIN; |
| 151 this.$.enterPin.inputElement.select(); | 151 this.$.enterPin.inputElement.select(); |
| 152 } else { | 152 } else { |
| 153 this.error_ = ErrorType.NONE; | 153 this.error_ = ErrorType.NONE; |
| 154 this.$.enterPinDialog.close(); | 154 this.$.enterPinDialog.close(); |
| 155 } | 155 } |
| 156 }.bind(this)); | 156 }); |
| 157 }, | 157 }, |
| 158 | 158 |
| 159 /** | 159 /** |
| 160 * Opens the Change PIN dialog. | 160 * Opens the Change PIN dialog. |
| 161 * @param {!Event} event | 161 * @param {!Event} event |
| 162 * @private | 162 * @private |
| 163 */ | 163 */ |
| 164 onChangePinTap_: function(event) { | 164 onChangePinTap_: function(event) { |
| 165 if (!this.networkProperties || !this.networkProperties.Cellular) | 165 if (!this.networkProperties || !this.networkProperties.Cellular) |
| 166 return; | 166 return; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 181 var guid = (this.networkProperties && this.networkProperties.GUID) || ''; | 181 var guid = (this.networkProperties && this.networkProperties.GUID) || ''; |
| 182 var newPin = this.$.changePinNew1.value; | 182 var newPin = this.$.changePinNew1.value; |
| 183 if (!this.validatePin_(newPin, this.$.changePinNew2.value)) | 183 if (!this.validatePin_(newPin, this.$.changePinNew2.value)) |
| 184 return; | 184 return; |
| 185 | 185 |
| 186 var simState = /** @type {!CrOnc.CellularSimState} */ ({ | 186 var simState = /** @type {!CrOnc.CellularSimState} */ ({ |
| 187 requirePin: true, | 187 requirePin: true, |
| 188 currentPin: this.$.changePinOld.value, | 188 currentPin: this.$.changePinOld.value, |
| 189 newPin: newPin | 189 newPin: newPin |
| 190 }); | 190 }); |
| 191 this.networkingPrivate.setCellularSimState(guid, simState, function() { | 191 this.networkingPrivate.setCellularSimState(guid, simState, () => { |
| 192 if (chrome.runtime.lastError) { | 192 if (chrome.runtime.lastError) { |
| 193 this.error_ = ErrorType.INCORRECT_PIN; | 193 this.error_ = ErrorType.INCORRECT_PIN; |
| 194 this.$.changePinOld.inputElement.select(); | 194 this.$.changePinOld.inputElement.select(); |
| 195 } else { | 195 } else { |
| 196 this.error_ = ErrorType.NONE; | 196 this.error_ = ErrorType.NONE; |
| 197 this.$.changePinDialog.close(); | 197 this.$.changePinDialog.close(); |
| 198 } | 198 } |
| 199 }.bind(this)); | 199 }); |
| 200 }, | 200 }, |
| 201 | 201 |
| 202 /** | 202 /** |
| 203 * Opens the Unlock PIN dialog. | 203 * Opens the Unlock PIN dialog. |
| 204 * @param {!Event} event | 204 * @param {!Event} event |
| 205 * @private | 205 * @private |
| 206 */ | 206 */ |
| 207 onUnlockPinTap_: function(event) { | 207 onUnlockPinTap_: function(event) { |
| 208 event.preventDefault(); | 208 event.preventDefault(); |
| 209 this.error_ = ErrorType.NONE; | 209 this.error_ = ErrorType.NONE; |
| 210 this.$.unlockPin.value = ''; | 210 this.$.unlockPin.value = ''; |
| 211 this.$.unlockPinDialog.showModal(); | 211 this.$.unlockPinDialog.showModal(); |
| 212 }, | 212 }, |
| 213 | 213 |
| 214 /** | 214 /** |
| 215 * Sends the PIN value from the Unlock PIN dialog. | 215 * Sends the PIN value from the Unlock PIN dialog. |
| 216 * @param {!Event} event | 216 * @param {!Event} event |
| 217 * @private | 217 * @private |
| 218 */ | 218 */ |
| 219 sendUnlockPin_: function(event) { | 219 sendUnlockPin_: function(event) { |
| 220 var guid = (this.networkProperties && this.networkProperties.GUID) || ''; | 220 var guid = (this.networkProperties && this.networkProperties.GUID) || ''; |
| 221 var pin = this.$.unlockPin.value; | 221 var pin = this.$.unlockPin.value; |
| 222 if (!this.validatePin_(pin)) | 222 if (!this.validatePin_(pin)) |
| 223 return; | 223 return; |
| 224 | 224 |
| 225 this.networkingPrivate.unlockCellularSim(guid, pin, '', function() { | 225 this.networkingPrivate.unlockCellularSim(guid, pin, '', () => { |
| 226 if (chrome.runtime.lastError) { | 226 if (chrome.runtime.lastError) { |
| 227 this.error_ = ErrorType.INCORRECT_PIN; | 227 this.error_ = ErrorType.INCORRECT_PIN; |
| 228 this.$.unlockPin.inputElement.select(); | 228 this.$.unlockPin.inputElement.select(); |
| 229 } else { | 229 } else { |
| 230 this.error_ = ErrorType.NONE; | 230 this.error_ = ErrorType.NONE; |
| 231 this.$.unlockPinDialog.close(); | 231 this.$.unlockPinDialog.close(); |
| 232 } | 232 } |
| 233 }.bind(this)); | 233 }); |
| 234 }, | 234 }, |
| 235 | 235 |
| 236 /** @private */ | 236 /** @private */ |
| 237 showUnlockPukDialog_: function() { | 237 showUnlockPukDialog_: function() { |
| 238 this.error_ = ErrorType.NONE; | 238 this.error_ = ErrorType.NONE; |
| 239 this.$.unlockPuk.value = ''; | 239 this.$.unlockPuk.value = ''; |
| 240 this.$.unlockPin1.value = ''; | 240 this.$.unlockPin1.value = ''; |
| 241 this.$.unlockPin2.value = ''; | 241 this.$.unlockPin2.value = ''; |
| 242 this.$.unlockPukDialog.showModal(); | 242 this.$.unlockPukDialog.showModal(); |
| 243 }, | 243 }, |
| 244 | 244 |
| 245 /** | 245 /** |
| 246 * Sends the PUK value and new PIN value from the Unblock PUK dialog. | 246 * Sends the PUK value and new PIN value from the Unblock PUK dialog. |
| 247 * @param {!Event} event | 247 * @param {!Event} event |
| 248 * @private | 248 * @private |
| 249 */ | 249 */ |
| 250 sendUnlockPuk_: function(event) { | 250 sendUnlockPuk_: function(event) { |
| 251 var guid = (this.networkProperties && this.networkProperties.GUID) || ''; | 251 var guid = (this.networkProperties && this.networkProperties.GUID) || ''; |
| 252 var puk = this.$.unlockPuk.value; | 252 var puk = this.$.unlockPuk.value; |
| 253 if (!this.validatePuk_(puk)) | 253 if (!this.validatePuk_(puk)) |
| 254 return; | 254 return; |
| 255 var pin = this.$.unlockPin1.value; | 255 var pin = this.$.unlockPin1.value; |
| 256 if (!this.validatePin_(pin, this.$.unlockPin2.value)) | 256 if (!this.validatePin_(pin, this.$.unlockPin2.value)) |
| 257 return; | 257 return; |
| 258 | 258 |
| 259 this.networkingPrivate.unlockCellularSim(guid, pin, puk, function() { | 259 this.networkingPrivate.unlockCellularSim(guid, pin, puk, () => { |
| 260 if (chrome.runtime.lastError) { | 260 if (chrome.runtime.lastError) { |
| 261 this.error_ = ErrorType.INCORRECT_PUK; | 261 this.error_ = ErrorType.INCORRECT_PUK; |
| 262 this.$.unlockPuk.inputElement.select(); | 262 this.$.unlockPuk.inputElement.select(); |
| 263 } else { | 263 } else { |
| 264 this.error_ = ErrorType.NONE; | 264 this.error_ = ErrorType.NONE; |
| 265 this.$.unlockPukDialog.close(); | 265 this.$.unlockPukDialog.close(); |
| 266 } | 266 } |
| 267 }.bind(this)); | 267 }); |
| 268 }, | 268 }, |
| 269 | 269 |
| 270 /** | 270 /** |
| 271 * @return {boolean} | 271 * @return {boolean} |
| 272 * @private | 272 * @private |
| 273 */ | 273 */ |
| 274 showSimLocked_: function() { | 274 showSimLocked_: function() { |
| 275 if (!this.networkProperties || !this.networkProperties.Cellular || | 275 if (!this.networkProperties || !this.networkProperties.Cellular || |
| 276 !this.networkProperties.Cellular.SIMPresent) { | 276 !this.networkProperties.Cellular.SIMPresent) { |
| 277 return false; | 277 return false; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 onChangePinDialogClose_: function() { | 368 onChangePinDialogClose_: function() { |
| 369 cr.ui.focusWithoutInk(assert(this.$$('#changePinButton'))); | 369 cr.ui.focusWithoutInk(assert(this.$$('#changePinButton'))); |
| 370 }, | 370 }, |
| 371 | 371 |
| 372 /** @private */ | 372 /** @private */ |
| 373 onUnlockPinDialogClose_: function() { | 373 onUnlockPinDialogClose_: function() { |
| 374 cr.ui.focusWithoutInk(assert(this.$$('#unlockPinButton'))); | 374 cr.ui.focusWithoutInk(assert(this.$$('#unlockPinButton'))); |
| 375 }, | 375 }, |
| 376 }); | 376 }); |
| 377 })(); | 377 })(); |
| OLD | NEW |