| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 cr.define('mobile', function() { | 5 cr.define('mobile', function() { |
| 6 | 6 |
| 7 function SimUnlock() { | 7 function SimUnlock() {} |
| 8 } | |
| 9 | 8 |
| 10 cr.addSingletonGetter(SimUnlock); | 9 cr.addSingletonGetter(SimUnlock); |
| 11 | 10 |
| 12 // State of the dialog. | 11 // State of the dialog. |
| 13 SimUnlock.SIM_UNLOCK_LOADING = -1; | 12 SimUnlock.SIM_UNLOCK_LOADING = -1; |
| 14 SimUnlock.SIM_ABSENT_NOT_LOCKED = 0, | 13 SimUnlock.SIM_ABSENT_NOT_LOCKED = 0, SimUnlock.SIM_NOT_LOCKED_ASK_PIN = 1; |
| 15 SimUnlock.SIM_NOT_LOCKED_ASK_PIN = 1; | |
| 16 SimUnlock.SIM_NOT_LOCKED_CHANGE_PIN = 2; | 14 SimUnlock.SIM_NOT_LOCKED_CHANGE_PIN = 2; |
| 17 SimUnlock.SIM_LOCKED_PIN = 3; | 15 SimUnlock.SIM_LOCKED_PIN = 3; |
| 18 SimUnlock.SIM_LOCKED_NO_PIN_TRIES_LEFT = 4; | 16 SimUnlock.SIM_LOCKED_NO_PIN_TRIES_LEFT = 4; |
| 19 SimUnlock.SIM_LOCKED_PUK = 5; | 17 SimUnlock.SIM_LOCKED_PUK = 5; |
| 20 SimUnlock.SIM_LOCKED_NO_PUK_TRIES_LEFT = 6; | 18 SimUnlock.SIM_LOCKED_NO_PUK_TRIES_LEFT = 6; |
| 21 SimUnlock.SIM_DISABLED = 7; | 19 SimUnlock.SIM_DISABLED = 7; |
| 22 | 20 |
| 23 // Mode of the dialog. | 21 // Mode of the dialog. |
| 24 SimUnlock.SIM_DIALOG_UNLOCK = 0; | 22 SimUnlock.SIM_DIALOG_UNLOCK = 0; |
| 25 SimUnlock.SIM_DIALOG_CHANGE_PIN = 1; | 23 SimUnlock.SIM_DIALOG_CHANGE_PIN = 1; |
| 26 SimUnlock.SIM_DIALOG_SET_LOCK_ON = 2; | 24 SimUnlock.SIM_DIALOG_SET_LOCK_ON = 2; |
| 27 SimUnlock.SIM_DIALOG_SET_LOCK_OFF = 3; | 25 SimUnlock.SIM_DIALOG_SET_LOCK_OFF = 3; |
| 28 | 26 |
| 29 // Error codes. | 27 // Error codes. |
| 30 SimUnlock.ERROR_PIN = 'incorrectPin'; | 28 SimUnlock.ERROR_PIN = 'incorrectPin'; |
| 31 SimUnlock.ERROR_PUK = 'incorrectPuk'; | 29 SimUnlock.ERROR_PUK = 'incorrectPuk'; |
| 32 SimUnlock.ERROR_OK = 'ok'; | 30 SimUnlock.ERROR_OK = 'ok'; |
| 33 | 31 |
| 34 // Misc constants. | 32 // Misc constants. |
| 35 SimUnlock.PIN_MIN_LENGTH = 4; | 33 SimUnlock.PIN_MIN_LENGTH = 4; |
| 36 SimUnlock.PUK_LENGTH = 8; | 34 SimUnlock.PUK_LENGTH = 8; |
| 37 | 35 |
| 38 SimUnlock.prototype = { | 36 SimUnlock.prototype = { |
| 39 initialized_: false, | 37 initialized_: false, |
| 40 mode_: SimUnlock.SIM_DIALOG_UNLOCK, | 38 mode_: SimUnlock.SIM_DIALOG_UNLOCK, |
| 41 pukValue_: '', | 39 pukValue_: '', |
| 42 defaultDialogSize_: { | 40 defaultDialogSize_: |
| 43 'width': window.innerWidth, | 41 {'width': window.innerWidth, 'height': window.innerHeight}, |
| 44 'height': window.innerHeight | |
| 45 }, | |
| 46 state_: SimUnlock.SIM_UNLOCK_LOADING, | 42 state_: SimUnlock.SIM_UNLOCK_LOADING, |
| 47 | 43 |
| 48 changeState_: function(simInfo) { | 44 changeState_: function(simInfo) { |
| 49 var newState = simInfo.state; | 45 var newState = simInfo.state; |
| 50 var error = simInfo.error; | 46 var error = simInfo.error; |
| 51 var tries = simInfo.tries; | 47 var tries = simInfo.tries; |
| 52 var pinMessage; | 48 var pinMessage; |
| 53 this.hideAll_(); | 49 this.hideAll_(); |
| 54 switch (newState) { | 50 switch (newState) { |
| 55 case SimUnlock.SIM_UNLOCK_LOADING: | 51 case SimUnlock.SIM_UNLOCK_LOADING: |
| 56 break; | 52 break; |
| 57 case SimUnlock.SIM_ABSENT_NOT_LOCKED: | 53 case SimUnlock.SIM_ABSENT_NOT_LOCKED: |
| 58 SimUnlock.close(); | 54 SimUnlock.close(); |
| 59 break; | 55 break; |
| 60 case SimUnlock.SIM_LOCKED_PIN: | 56 case SimUnlock.SIM_LOCKED_PIN: |
| 61 if (error == SimUnlock.ERROR_OK) { | 57 if (error == SimUnlock.ERROR_OK) { |
| 62 pinMessage = loadTimeData.getStringF('enterPinTriesMessage', tries); | 58 pinMessage = loadTimeData.getStringF('enterPinTriesMessage', tries); |
| 63 $('pin-error-msg').classList.remove('error'); | 59 $('pin-error-msg').classList.remove('error'); |
| 64 } else if (error == SimUnlock.ERROR_PIN) { | 60 } else if (error == SimUnlock.ERROR_PIN) { |
| 65 pinMessage = loadTimeData.getStringF( | 61 pinMessage = |
| 66 'incorrectPinTriesMessage', tries); | 62 loadTimeData.getStringF('incorrectPinTriesMessage', tries); |
| 67 $('pin-error-msg').classList.add('error'); | 63 $('pin-error-msg').classList.add('error'); |
| 68 } | 64 } |
| 69 $('pin-error-msg').textContent = pinMessage; | 65 $('pin-error-msg').textContent = pinMessage; |
| 70 $('pin-input').value = ''; | 66 $('pin-input').value = ''; |
| 71 SimUnlock.enablePinDialog(true); | 67 SimUnlock.enablePinDialog(true); |
| 72 $('locked-pin-overlay').hidden = false; | 68 $('locked-pin-overlay').hidden = false; |
| 73 $('pin-input').focus(); | 69 $('pin-input').focus(); |
| 74 break; | 70 break; |
| 75 case SimUnlock.SIM_NOT_LOCKED_ASK_PIN: | 71 case SimUnlock.SIM_NOT_LOCKED_ASK_PIN: |
| 76 if (error == SimUnlock.ERROR_OK) { | 72 if (error == SimUnlock.ERROR_OK) { |
| 77 pinMessage = loadTimeData.getString('enterPinMessage'); | 73 pinMessage = loadTimeData.getString('enterPinMessage'); |
| 78 $('pin-error-msg').classList.remove('error'); | 74 $('pin-error-msg').classList.remove('error'); |
| 79 } else if (error == SimUnlock.ERROR_PIN) { | 75 } else if (error == SimUnlock.ERROR_PIN) { |
| 80 pinMessage = loadTimeData.getStringF( | 76 pinMessage = |
| 81 'incorrectPinTriesMessage', tries); | 77 loadTimeData.getStringF('incorrectPinTriesMessage', tries); |
| 82 $('pin-error-msg').classList.add('error'); | 78 $('pin-error-msg').classList.add('error'); |
| 83 } | 79 } |
| 84 $('pin-error-msg').textContent = pinMessage; | 80 $('pin-error-msg').textContent = pinMessage; |
| 85 $('pin-input').value = ''; | 81 $('pin-input').value = ''; |
| 86 SimUnlock.enablePinDialog(true); | 82 SimUnlock.enablePinDialog(true); |
| 87 $('locked-pin-overlay').hidden = false; | 83 $('locked-pin-overlay').hidden = false; |
| 88 $('pin-input').focus(); | 84 $('pin-input').focus(); |
| 89 break; | 85 break; |
| 90 case SimUnlock.SIM_NOT_LOCKED_CHANGE_PIN: | 86 case SimUnlock.SIM_NOT_LOCKED_CHANGE_PIN: |
| 91 SimUnlock.prepareChoosePinDialog(true); | 87 SimUnlock.prepareChoosePinDialog(true); |
| 92 if (error == SimUnlock.ERROR_OK) { | 88 if (error == SimUnlock.ERROR_OK) { |
| 93 pinMessage = loadTimeData.getString('changePinMessage'); | 89 pinMessage = loadTimeData.getString('changePinMessage'); |
| 94 $('choose-pin-msg').classList.remove('error'); | 90 $('choose-pin-msg').classList.remove('error'); |
| 95 } else if (error == SimUnlock.ERROR_PIN) { | 91 } else if (error == SimUnlock.ERROR_PIN) { |
| 96 pinMessage = loadTimeData.getStringF( | 92 pinMessage = |
| 97 'incorrectPinTriesMessage', tries); | 93 loadTimeData.getStringF('incorrectPinTriesMessage', tries); |
| 98 $('choose-pin-msg').classList.add('error'); | 94 $('choose-pin-msg').classList.add('error'); |
| 99 } | 95 } |
| 100 $('choose-pin-msg').textContent = pinMessage; | 96 $('choose-pin-msg').textContent = pinMessage; |
| 101 $('old-pin-input').value = ''; | 97 $('old-pin-input').value = ''; |
| 102 $('new-pin-input').value = ''; | 98 $('new-pin-input').value = ''; |
| 103 $('retype-new-pin-input').value = ''; | 99 $('retype-new-pin-input').value = ''; |
| 104 $('choose-pin-overlay').hidden = false; | 100 $('choose-pin-overlay').hidden = false; |
| 105 SimUnlock.enableChoosePinDialog(true); | 101 SimUnlock.enableChoosePinDialog(true); |
| 106 $('old-pin-input').focus(); | 102 $('old-pin-input').focus(); |
| 107 break; | 103 break; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 133 | 129 |
| 134 /** | 130 /** |
| 135 * Returns current state of the dialog. | 131 * Returns current state of the dialog. |
| 136 * @type {number} value of the state. | 132 * @type {number} value of the state. |
| 137 */ | 133 */ |
| 138 get state() { | 134 get state() { |
| 139 return this.state_; | 135 return this.state_; |
| 140 }, | 136 }, |
| 141 | 137 |
| 142 updateDialogSize_: function(deltaX, deltaY) { | 138 updateDialogSize_: function(deltaX, deltaY) { |
| 143 window.resizeTo(this.defaultDialogSize_.width + deltaX, | 139 window.resizeTo( |
| 144 this.defaultDialogSize_.height + deltaY); | 140 this.defaultDialogSize_.width + deltaX, |
| 141 this.defaultDialogSize_.height + deltaY); |
| 145 }, | 142 }, |
| 146 | 143 |
| 147 hideAll_: function() { | 144 hideAll_: function() { |
| 148 $('locked-pin-overlay').hidden = true; | 145 $('locked-pin-overlay').hidden = true; |
| 149 $('locked-pin-no-tries-overlay').hidden = true; | 146 $('locked-pin-no-tries-overlay').hidden = true; |
| 150 $('locked-puk-overlay').hidden = true; | 147 $('locked-puk-overlay').hidden = true; |
| 151 $('choose-pin-overlay').hidden = true; | 148 $('choose-pin-overlay').hidden = true; |
| 152 $('locked-puk-no-tries-overlay').hidden = true; | 149 $('locked-puk-no-tries-overlay').hidden = true; |
| 153 $('sim-disabled-overlay').hidden = true; | 150 $('sim-disabled-overlay').hidden = true; |
| 154 }, | 151 }, |
| 155 | 152 |
| 156 newPinEntered_: function(newPin, newPin2) { | 153 newPinEntered_: function(newPin, newPin2) { |
| 157 var changePinMode = this.state_ == SimUnlock.SIM_NOT_LOCKED_CHANGE_PIN; | 154 var changePinMode = this.state_ == SimUnlock.SIM_NOT_LOCKED_CHANGE_PIN; |
| 158 if (newPin.length < SimUnlock.PIN_MIN_LENGTH || | 155 if (newPin.length < SimUnlock.PIN_MIN_LENGTH || |
| 159 newPin2.length < SimUnlock.PIN_MIN_LENGTH || | 156 newPin2.length < SimUnlock.PIN_MIN_LENGTH || |
| 160 (changePinMode && | 157 (changePinMode && |
| 161 $('old-pin-input').value.length < SimUnlock.PIN_MIN_LENGTH)) { | 158 $('old-pin-input').value.length < SimUnlock.PIN_MIN_LENGTH)) { |
| 162 return; | 159 return; |
| 163 } | 160 } |
| 164 if (newPin != newPin2) { | 161 if (newPin != newPin2) { |
| 165 $('choose-pin-error').hidden = false; | 162 $('choose-pin-error').hidden = false; |
| 166 $('old-pin-input').value = ''; | 163 $('old-pin-input').value = ''; |
| 167 $('new-pin-input').value = ''; | 164 $('new-pin-input').value = ''; |
| 168 $('retype-new-pin-input').value = ''; | 165 $('retype-new-pin-input').value = ''; |
| 169 if (changePinMode) | 166 if (changePinMode) |
| 170 $('old-pin-input').focus(); | 167 $('old-pin-input').focus(); |
| 171 else | 168 else |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 } | 225 } |
| 229 | 226 |
| 230 // PIN input screen. | 227 // PIN input screen. |
| 231 $('pin-input').addEventListener('keydown', function(event) { | 228 $('pin-input').addEventListener('keydown', function(event) { |
| 232 if (event.key == 'Enter') { | 229 if (event.key == 'Enter') { |
| 233 SimUnlock.submitPin(); | 230 SimUnlock.submitPin(); |
| 234 return; | 231 return; |
| 235 } | 232 } |
| 236 }); | 233 }); |
| 237 $('pin-input').addEventListener('keyup', function(event) { | 234 $('pin-input').addEventListener('keyup', function(event) { |
| 238 $('enter-pin-confirm').disabled = | 235 $('enter-pin-confirm').disabled = $('enter-pin-dismiss').disabled || |
| 239 $('enter-pin-dismiss').disabled || | |
| 240 this.value.length < SimUnlock.PIN_MIN_LENGTH; | 236 this.value.length < SimUnlock.PIN_MIN_LENGTH; |
| 241 }); | 237 }); |
| 242 $('pin-input').addEventListener('textInput', | 238 $('pin-input') |
| 243 SimUnlock.processInput.bind(this)); | 239 .addEventListener('textInput', SimUnlock.processInput.bind(this)); |
| 244 $('enter-pin-confirm').addEventListener('click', function(event) { | 240 $('enter-pin-confirm').addEventListener('click', function(event) { |
| 245 SimUnlock.submitPin(); | 241 SimUnlock.submitPin(); |
| 246 }); | 242 }); |
| 247 $('enter-pin-dismiss').addEventListener('click', function(event) { | 243 $('enter-pin-dismiss').addEventListener('click', function(event) { |
| 248 SimUnlock.cancel(); | 244 SimUnlock.cancel(); |
| 249 }); | 245 }); |
| 250 | 246 |
| 251 // No PIN retries left screen. | 247 // No PIN retries left screen. |
| 252 $('pin-no-tries-proceed').addEventListener('click', function(event) { | 248 $('pin-no-tries-proceed').addEventListener('click', function(event) { |
| 253 chrome.send('proceedToPukInput'); | 249 chrome.send('proceedToPukInput'); |
| 254 }); | 250 }); |
| 255 $('pin-no-tries-dismiss').addEventListener('click', function(event) { | 251 $('pin-no-tries-dismiss').addEventListener('click', function(event) { |
| 256 SimUnlock.cancel(); | 252 SimUnlock.cancel(); |
| 257 }); | 253 }); |
| 258 | 254 |
| 259 // PUK input screen. | 255 // PUK input screen. |
| 260 $('puk-input').addEventListener('keydown', function(event) { | 256 $('puk-input').addEventListener('keydown', function(event) { |
| 261 if (event.key == 'Enter') { | 257 if (event.key == 'Enter') { |
| 262 SimUnlock.pukEntered($('puk-input').value); | 258 SimUnlock.pukEntered($('puk-input').value); |
| 263 return; | 259 return; |
| 264 } | 260 } |
| 265 }); | 261 }); |
| 266 $('puk-input').addEventListener('keyup', function(event) { | 262 $('puk-input').addEventListener('keyup', function(event) { |
| 267 $('enter-puk-confirm').disabled = | 263 $('enter-puk-confirm').disabled = $('enter-puk-dismiss').disabled || |
| 268 $('enter-puk-dismiss').disabled || | |
| 269 this.value.length < SimUnlock.PUK_LENGTH; | 264 this.value.length < SimUnlock.PUK_LENGTH; |
| 270 }); | 265 }); |
| 271 $('puk-input').addEventListener('textInput', | 266 $('puk-input') |
| 272 SimUnlock.processInput.bind(this)); | 267 .addEventListener('textInput', SimUnlock.processInput.bind(this)); |
| 273 $('enter-puk-confirm').addEventListener('click', function(event) { | 268 $('enter-puk-confirm').addEventListener('click', function(event) { |
| 274 SimUnlock.pukEntered($('puk-input').value); | 269 SimUnlock.pukEntered($('puk-input').value); |
| 275 }); | 270 }); |
| 276 $('enter-puk-dismiss').addEventListener('click', function(event) { | 271 $('enter-puk-dismiss').addEventListener('click', function(event) { |
| 277 SimUnlock.cancel(); | 272 SimUnlock.cancel(); |
| 278 }); | 273 }); |
| 279 | 274 |
| 280 // Change PIN / new PIN screen. | 275 // Change PIN / new PIN screen. |
| 281 $('old-pin-input').addEventListener('keydown', function(event) { | 276 $('old-pin-input').addEventListener('keydown', function(event) { |
| 282 if (event.key == 'Enter') { | 277 if (event.key == 'Enter') { |
| 283 if (this.value.length >= SimUnlock.PIN_MIN_LENGTH) | 278 if (this.value.length >= SimUnlock.PIN_MIN_LENGTH) |
| 284 $('new-pin-input').focus(); | 279 $('new-pin-input').focus(); |
| 285 return; | 280 return; |
| 286 } | 281 } |
| 287 }); | 282 }); |
| 288 $('old-pin-input').addEventListener('keyup', function(event) { | 283 $('old-pin-input').addEventListener('keyup', function(event) { |
| 289 $('choose-pin-confirm').disabled = | 284 $('choose-pin-confirm').disabled = $('choose-pin-dismiss').disabled || |
| 290 $('choose-pin-dismiss').disabled || | |
| 291 this.value.length < SimUnlock.PIN_MIN_LENGTH || | 285 this.value.length < SimUnlock.PIN_MIN_LENGTH || |
| 292 $('new-pin-input').value.length < SimUnlock.PIN_MIN_LENGTH || | 286 $('new-pin-input').value.length < SimUnlock.PIN_MIN_LENGTH || |
| 293 $('retype-new-pin-input').value.length < SimUnlock.PIN_MIN_LENGTH; | 287 $('retype-new-pin-input').value.length < SimUnlock.PIN_MIN_LENGTH; |
| 294 }); | 288 }); |
| 295 $('old-pin-input').addEventListener('textInput', | 289 $('old-pin-input') |
| 296 SimUnlock.processInput.bind(this)); | 290 .addEventListener('textInput', SimUnlock.processInput.bind(this)); |
| 297 $('new-pin-input').addEventListener('keydown', function(event) { | 291 $('new-pin-input').addEventListener('keydown', function(event) { |
| 298 if (event.key == 'Enter') { | 292 if (event.key == 'Enter') { |
| 299 if (this.value.length >= SimUnlock.PIN_MIN_LENGTH) | 293 if (this.value.length >= SimUnlock.PIN_MIN_LENGTH) |
| 300 $('retype-new-pin-input').focus(); | 294 $('retype-new-pin-input').focus(); |
| 301 return; | 295 return; |
| 302 } | 296 } |
| 303 }); | 297 }); |
| 304 $('new-pin-input').addEventListener('keyup', function(event) { | 298 $('new-pin-input').addEventListener('keyup', function(event) { |
| 305 var changePinMode = | 299 var changePinMode = |
| 306 SimUnlock.getInstance().state == SimUnlock.SIM_NOT_LOCKED_CHANGE_PIN; | 300 SimUnlock.getInstance().state == SimUnlock.SIM_NOT_LOCKED_CHANGE_PIN; |
| 307 var oldPinLengthOk = | 301 var oldPinLengthOk = |
| 308 $('old-pin-input').value.length >= SimUnlock.PIN_MIN_LENGTH; | 302 $('old-pin-input').value.length >= SimUnlock.PIN_MIN_LENGTH; |
| 309 var oldPinOk = !changePinMode || oldPinLengthOk; | 303 var oldPinOk = !changePinMode || oldPinLengthOk; |
| 310 $('choose-pin-confirm').disabled = | 304 $('choose-pin-confirm').disabled = $('choose-pin-dismiss').disabled || |
| 311 $('choose-pin-dismiss').disabled || | |
| 312 this.value.length < SimUnlock.PIN_MIN_LENGTH || | 305 this.value.length < SimUnlock.PIN_MIN_LENGTH || |
| 313 $('retype-new-pin-input').value.length < SimUnlock.PIN_MIN_LENGTH || | 306 $('retype-new-pin-input').value.length < SimUnlock.PIN_MIN_LENGTH || |
| 314 !oldPinOk; | 307 !oldPinOk; |
| 315 }); | 308 }); |
| 316 $('new-pin-input').addEventListener('textInput', | 309 $('new-pin-input') |
| 317 SimUnlock.processInput.bind(this)); | 310 .addEventListener('textInput', SimUnlock.processInput.bind(this)); |
| 318 $('retype-new-pin-input').addEventListener('keyup', function(event) { | 311 $('retype-new-pin-input').addEventListener('keyup', function(event) { |
| 319 var changePinMode = | 312 var changePinMode = |
| 320 SimUnlock.getInstance().state == SimUnlock.SIM_NOT_LOCKED_CHANGE_PIN; | 313 SimUnlock.getInstance().state == SimUnlock.SIM_NOT_LOCKED_CHANGE_PIN; |
| 321 var oldPinLengthOk = | 314 var oldPinLengthOk = |
| 322 $('old-pin-input').value.length >= SimUnlock.PIN_MIN_LENGTH; | 315 $('old-pin-input').value.length >= SimUnlock.PIN_MIN_LENGTH; |
| 323 var oldPinOk = !changePinMode || oldPinLengthOk; | 316 var oldPinOk = !changePinMode || oldPinLengthOk; |
| 324 $('choose-pin-confirm').disabled = | 317 $('choose-pin-confirm').disabled = $('choose-pin-dismiss').disabled || |
| 325 $('choose-pin-dismiss').disabled || | |
| 326 this.value.length < SimUnlock.PIN_MIN_LENGTH || | 318 this.value.length < SimUnlock.PIN_MIN_LENGTH || |
| 327 $('new-pin-input').value.length < SimUnlock.PIN_MIN_LENGTH || | 319 $('new-pin-input').value.length < SimUnlock.PIN_MIN_LENGTH || |
| 328 !oldPinOk; | 320 !oldPinOk; |
| 329 }); | 321 }); |
| 330 $('retype-new-pin-input').addEventListener('keydown', function(event) { | 322 $('retype-new-pin-input').addEventListener('keydown', function(event) { |
| 331 if (event.key == 'Enter') { | 323 if (event.key == 'Enter') { |
| 332 SimUnlock.newPinEntered($('new-pin-input').value, | 324 SimUnlock.newPinEntered( |
| 333 $('retype-new-pin-input').value); | 325 $('new-pin-input').value, $('retype-new-pin-input').value); |
| 334 return; | 326 return; |
| 335 } | 327 } |
| 336 }); | 328 }); |
| 337 $('retype-new-pin-input').addEventListener('textInput', | 329 $('retype-new-pin-input') |
| 338 SimUnlock.processInput.bind(this)); | 330 .addEventListener('textInput', SimUnlock.processInput.bind(this)); |
| 339 $('choose-pin-confirm').addEventListener('click', function(event) { | 331 $('choose-pin-confirm').addEventListener('click', function(event) { |
| 340 SimUnlock.newPinEntered($('new-pin-input').value, | 332 SimUnlock.newPinEntered( |
| 341 $('retype-new-pin-input').value); | 333 $('new-pin-input').value, $('retype-new-pin-input').value); |
| 342 }); | 334 }); |
| 343 $('choose-pin-dismiss').addEventListener('click', function(event) { | 335 $('choose-pin-dismiss').addEventListener('click', function(event) { |
| 344 SimUnlock.cancel(); | 336 SimUnlock.cancel(); |
| 345 }); | 337 }); |
| 346 | 338 |
| 347 // SIM blocked screens. | 339 // SIM blocked screens. |
| 348 $('puk-no-tries-confirm').addEventListener('click', function(event) { | 340 $('puk-no-tries-confirm').addEventListener('click', function(event) { |
| 349 SimUnlock.close(); | 341 SimUnlock.close(); |
| 350 }); | 342 }); |
| 351 $('sim-disabled-confirm').addEventListener('click', function(event) { | 343 $('sim-disabled-confirm').addEventListener('click', function(event) { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 SimUnlock.processInput = function(event) { | 405 SimUnlock.processInput = function(event) { |
| 414 if (/[^0-9]+/gi.test(event.data)) | 406 if (/[^0-9]+/gi.test(event.data)) |
| 415 event.preventDefault(); | 407 event.preventDefault(); |
| 416 }; | 408 }; |
| 417 | 409 |
| 418 SimUnlock.simStateChanged = function(simInfo) { | 410 SimUnlock.simStateChanged = function(simInfo) { |
| 419 SimUnlock.getInstance().updateSimStatus_(simInfo); | 411 SimUnlock.getInstance().updateSimStatus_(simInfo); |
| 420 }; | 412 }; |
| 421 | 413 |
| 422 // Export | 414 // Export |
| 423 return { | 415 return {SimUnlock: SimUnlock}; |
| 424 SimUnlock: SimUnlock | |
| 425 }; | |
| 426 | 416 |
| 427 }); | 417 }); |
| 428 | 418 |
| 429 disableTextSelectAndDrag(); | 419 disableTextSelectAndDrag(); |
| OLD | NEW |