| 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 } | 8 } |
| 9 | 9 |
| 10 cr.addSingletonGetter(SimUnlock); | 10 cr.addSingletonGetter(SimUnlock); |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 if (mode == 'change-pin') | 222 if (mode == 'change-pin') |
| 223 this.mode_ = SimUnlock.SIM_DIALOG_CHANGE_PIN; | 223 this.mode_ = SimUnlock.SIM_DIALOG_CHANGE_PIN; |
| 224 else if (mode == 'set-lock-on') | 224 else if (mode == 'set-lock-on') |
| 225 this.mode_ = SimUnlock.SIM_DIALOG_SET_LOCK_ON; | 225 this.mode_ = SimUnlock.SIM_DIALOG_SET_LOCK_ON; |
| 226 else if (mode == 'set-lock-off') | 226 else if (mode == 'set-lock-off') |
| 227 this.mode_ = SimUnlock.SIM_DIALOG_SET_LOCK_OFF; | 227 this.mode_ = SimUnlock.SIM_DIALOG_SET_LOCK_OFF; |
| 228 } | 228 } |
| 229 | 229 |
| 230 // PIN input screen. | 230 // PIN input screen. |
| 231 $('pin-input').addEventListener('keydown', function(event) { | 231 $('pin-input').addEventListener('keydown', function(event) { |
| 232 if (event.keyIdentifier == 'Enter') { | 232 if (event.key == 'Enter') { |
| 233 SimUnlock.submitPin(); | 233 SimUnlock.submitPin(); |
| 234 return; | 234 return; |
| 235 } | 235 } |
| 236 }); | 236 }); |
| 237 $('pin-input').addEventListener('keyup', function(event) { | 237 $('pin-input').addEventListener('keyup', function(event) { |
| 238 $('enter-pin-confirm').disabled = | 238 $('enter-pin-confirm').disabled = |
| 239 $('enter-pin-dismiss').disabled || | 239 $('enter-pin-dismiss').disabled || |
| 240 this.value.length < SimUnlock.PIN_MIN_LENGTH; | 240 this.value.length < SimUnlock.PIN_MIN_LENGTH; |
| 241 }); | 241 }); |
| 242 $('pin-input').addEventListener('textInput', | 242 $('pin-input').addEventListener('textInput', |
| 243 SimUnlock.processInput.bind(this)); | 243 SimUnlock.processInput.bind(this)); |
| 244 $('enter-pin-confirm').addEventListener('click', function(event) { | 244 $('enter-pin-confirm').addEventListener('click', function(event) { |
| 245 SimUnlock.submitPin(); | 245 SimUnlock.submitPin(); |
| 246 }); | 246 }); |
| 247 $('enter-pin-dismiss').addEventListener('click', function(event) { | 247 $('enter-pin-dismiss').addEventListener('click', function(event) { |
| 248 SimUnlock.cancel(); | 248 SimUnlock.cancel(); |
| 249 }); | 249 }); |
| 250 | 250 |
| 251 // No PIN retries left screen. | 251 // No PIN retries left screen. |
| 252 $('pin-no-tries-proceed').addEventListener('click', function(event) { | 252 $('pin-no-tries-proceed').addEventListener('click', function(event) { |
| 253 chrome.send('proceedToPukInput'); | 253 chrome.send('proceedToPukInput'); |
| 254 }); | 254 }); |
| 255 $('pin-no-tries-dismiss').addEventListener('click', function(event) { | 255 $('pin-no-tries-dismiss').addEventListener('click', function(event) { |
| 256 SimUnlock.cancel(); | 256 SimUnlock.cancel(); |
| 257 }); | 257 }); |
| 258 | 258 |
| 259 // PUK input screen. | 259 // PUK input screen. |
| 260 $('puk-input').addEventListener('keydown', function(event) { | 260 $('puk-input').addEventListener('keydown', function(event) { |
| 261 if (event.keyIdentifier == 'Enter') { | 261 if (event.key == 'Enter') { |
| 262 SimUnlock.pukEntered($('puk-input').value); | 262 SimUnlock.pukEntered($('puk-input').value); |
| 263 return; | 263 return; |
| 264 } | 264 } |
| 265 }); | 265 }); |
| 266 $('puk-input').addEventListener('keyup', function(event) { | 266 $('puk-input').addEventListener('keyup', function(event) { |
| 267 $('enter-puk-confirm').disabled = | 267 $('enter-puk-confirm').disabled = |
| 268 $('enter-puk-dismiss').disabled || | 268 $('enter-puk-dismiss').disabled || |
| 269 this.value.length < SimUnlock.PUK_LENGTH; | 269 this.value.length < SimUnlock.PUK_LENGTH; |
| 270 }); | 270 }); |
| 271 $('puk-input').addEventListener('textInput', | 271 $('puk-input').addEventListener('textInput', |
| 272 SimUnlock.processInput.bind(this)); | 272 SimUnlock.processInput.bind(this)); |
| 273 $('enter-puk-confirm').addEventListener('click', function(event) { | 273 $('enter-puk-confirm').addEventListener('click', function(event) { |
| 274 SimUnlock.pukEntered($('puk-input').value); | 274 SimUnlock.pukEntered($('puk-input').value); |
| 275 }); | 275 }); |
| 276 $('enter-puk-dismiss').addEventListener('click', function(event) { | 276 $('enter-puk-dismiss').addEventListener('click', function(event) { |
| 277 SimUnlock.cancel(); | 277 SimUnlock.cancel(); |
| 278 }); | 278 }); |
| 279 | 279 |
| 280 // Change PIN / new PIN screen. | 280 // Change PIN / new PIN screen. |
| 281 $('old-pin-input').addEventListener('keydown', function(event) { | 281 $('old-pin-input').addEventListener('keydown', function(event) { |
| 282 if (event.keyIdentifier == 'Enter') { | 282 if (event.key == 'Enter') { |
| 283 if (this.value.length >= SimUnlock.PIN_MIN_LENGTH) | 283 if (this.value.length >= SimUnlock.PIN_MIN_LENGTH) |
| 284 $('new-pin-input').focus(); | 284 $('new-pin-input').focus(); |
| 285 return; | 285 return; |
| 286 } | 286 } |
| 287 }); | 287 }); |
| 288 $('old-pin-input').addEventListener('keyup', function(event) { | 288 $('old-pin-input').addEventListener('keyup', function(event) { |
| 289 $('choose-pin-confirm').disabled = | 289 $('choose-pin-confirm').disabled = |
| 290 $('choose-pin-dismiss').disabled || | 290 $('choose-pin-dismiss').disabled || |
| 291 this.value.length < SimUnlock.PIN_MIN_LENGTH || | 291 this.value.length < SimUnlock.PIN_MIN_LENGTH || |
| 292 $('new-pin-input').value.length < SimUnlock.PIN_MIN_LENGTH || | 292 $('new-pin-input').value.length < SimUnlock.PIN_MIN_LENGTH || |
| 293 $('retype-new-pin-input').value.length < SimUnlock.PIN_MIN_LENGTH; | 293 $('retype-new-pin-input').value.length < SimUnlock.PIN_MIN_LENGTH; |
| 294 }); | 294 }); |
| 295 $('old-pin-input').addEventListener('textInput', | 295 $('old-pin-input').addEventListener('textInput', |
| 296 SimUnlock.processInput.bind(this)); | 296 SimUnlock.processInput.bind(this)); |
| 297 $('new-pin-input').addEventListener('keydown', function(event) { | 297 $('new-pin-input').addEventListener('keydown', function(event) { |
| 298 if (event.keyIdentifier == 'Enter') { | 298 if (event.key == 'Enter') { |
| 299 if (this.value.length >= SimUnlock.PIN_MIN_LENGTH) | 299 if (this.value.length >= SimUnlock.PIN_MIN_LENGTH) |
| 300 $('retype-new-pin-input').focus(); | 300 $('retype-new-pin-input').focus(); |
| 301 return; | 301 return; |
| 302 } | 302 } |
| 303 }); | 303 }); |
| 304 $('new-pin-input').addEventListener('keyup', function(event) { | 304 $('new-pin-input').addEventListener('keyup', function(event) { |
| 305 var changePinMode = | 305 var changePinMode = |
| 306 SimUnlock.getInstance().state == SimUnlock.SIM_NOT_LOCKED_CHANGE_PIN; | 306 SimUnlock.getInstance().state == SimUnlock.SIM_NOT_LOCKED_CHANGE_PIN; |
| 307 var oldPinLengthOk = | 307 var oldPinLengthOk = |
| 308 $('old-pin-input').value.length >= SimUnlock.PIN_MIN_LENGTH; | 308 $('old-pin-input').value.length >= SimUnlock.PIN_MIN_LENGTH; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 321 var oldPinLengthOk = | 321 var oldPinLengthOk = |
| 322 $('old-pin-input').value.length >= SimUnlock.PIN_MIN_LENGTH; | 322 $('old-pin-input').value.length >= SimUnlock.PIN_MIN_LENGTH; |
| 323 var oldPinOk = !changePinMode || oldPinLengthOk; | 323 var oldPinOk = !changePinMode || oldPinLengthOk; |
| 324 $('choose-pin-confirm').disabled = | 324 $('choose-pin-confirm').disabled = |
| 325 $('choose-pin-dismiss').disabled || | 325 $('choose-pin-dismiss').disabled || |
| 326 this.value.length < SimUnlock.PIN_MIN_LENGTH || | 326 this.value.length < SimUnlock.PIN_MIN_LENGTH || |
| 327 $('new-pin-input').value.length < SimUnlock.PIN_MIN_LENGTH || | 327 $('new-pin-input').value.length < SimUnlock.PIN_MIN_LENGTH || |
| 328 !oldPinOk; | 328 !oldPinOk; |
| 329 }); | 329 }); |
| 330 $('retype-new-pin-input').addEventListener('keydown', function(event) { | 330 $('retype-new-pin-input').addEventListener('keydown', function(event) { |
| 331 if (event.keyIdentifier == 'Enter') { | 331 if (event.key == 'Enter') { |
| 332 SimUnlock.newPinEntered($('new-pin-input').value, | 332 SimUnlock.newPinEntered($('new-pin-input').value, |
| 333 $('retype-new-pin-input').value); | 333 $('retype-new-pin-input').value); |
| 334 return; | 334 return; |
| 335 } | 335 } |
| 336 }); | 336 }); |
| 337 $('retype-new-pin-input').addEventListener('textInput', | 337 $('retype-new-pin-input').addEventListener('textInput', |
| 338 SimUnlock.processInput.bind(this)); | 338 SimUnlock.processInput.bind(this)); |
| 339 $('choose-pin-confirm').addEventListener('click', function(event) { | 339 $('choose-pin-confirm').addEventListener('click', function(event) { |
| 340 SimUnlock.newPinEntered($('new-pin-input').value, | 340 SimUnlock.newPinEntered($('new-pin-input').value, |
| 341 $('retype-new-pin-input').value); | 341 $('retype-new-pin-input').value); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 }; | 420 }; |
| 421 | 421 |
| 422 // Export | 422 // Export |
| 423 return { | 423 return { |
| 424 SimUnlock: SimUnlock | 424 SimUnlock: SimUnlock |
| 425 }; | 425 }; |
| 426 | 426 |
| 427 }); | 427 }); |
| 428 | 428 |
| 429 disableTextSelectAndDrag(); | 429 disableTextSelectAndDrag(); |
| OLD | NEW |