| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 } else if (error == SimUnlock.ERROR_PIN) { | 96 } else if (error == SimUnlock.ERROR_PIN) { |
| 97 pinMessage = SimUnlock.localStrings_.getStringF( | 97 pinMessage = SimUnlock.localStrings_.getStringF( |
| 98 'incorrectPinTriesMessage', tries); | 98 'incorrectPinTriesMessage', tries); |
| 99 $('choose-pin-msg').classList.add('error'); | 99 $('choose-pin-msg').classList.add('error'); |
| 100 } | 100 } |
| 101 $('choose-pin-msg').textContent = pinMessage; | 101 $('choose-pin-msg').textContent = pinMessage; |
| 102 $('old-pin-input').value = ''; | 102 $('old-pin-input').value = ''; |
| 103 $('new-pin-input').value = ''; | 103 $('new-pin-input').value = ''; |
| 104 $('retype-new-pin-input').value = ''; | 104 $('retype-new-pin-input').value = ''; |
| 105 $('choose-pin-overlay').hidden = false; | 105 $('choose-pin-overlay').hidden = false; |
| 106 SimUnlock.enableChoosePinDialog(true); |
| 106 $('old-pin-input').focus(); | 107 $('old-pin-input').focus(); |
| 107 SimUnlock.enableChoosePinDialog(true); | |
| 108 break; | 108 break; |
| 109 case SimUnlock.SIM_LOCKED_NO_PIN_TRIES_LEFT: | 109 case SimUnlock.SIM_LOCKED_NO_PIN_TRIES_LEFT: |
| 110 $('locked-pin-no-tries-overlay').hidden = false; | 110 $('locked-pin-no-tries-overlay').hidden = false; |
| 111 break; | 111 break; |
| 112 case SimUnlock.SIM_LOCKED_PUK: | 112 case SimUnlock.SIM_LOCKED_PUK: |
| 113 $('puk-input').value = ''; | 113 $('puk-input').value = ''; |
| 114 if (tries && tries >= 0) { | 114 if (tries && tries >= 0) { |
| 115 var pukMessage = SimUnlock.localStrings_.getStringF( | 115 var pukMessage = SimUnlock.localStrings_.getStringF( |
| 116 'enterPukWarning', tries); | 116 'enterPukWarning', tries); |
| 117 $('puk-warning-msg').textContent = pukMessage; | 117 $('puk-warning-msg').textContent = pukMessage; |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 SimUnlock.submitPin(); | 227 SimUnlock.submitPin(); |
| 228 return; | 228 return; |
| 229 } | 229 } |
| 230 if (event.keyCode > SimUnlock.DOM_VK_9 || | 230 if (event.keyCode > SimUnlock.DOM_VK_9 || |
| 231 (event.shiftKey && event.keyCode != SimUnlock.DOM_VK_TAB)) { | 231 (event.shiftKey && event.keyCode != SimUnlock.DOM_VK_TAB)) { |
| 232 event.preventDefault(); | 232 event.preventDefault(); |
| 233 } | 233 } |
| 234 }); | 234 }); |
| 235 $('pin-input').addEventListener('keyup', function(event) { | 235 $('pin-input').addEventListener('keyup', function(event) { |
| 236 $('enter-pin-confirm').disabled = | 236 $('enter-pin-confirm').disabled = |
| 237 $('enter-pin-dismiss').disabled || |
| 237 this.value.length < SimUnlock.PIN_MIN_LENGTH; | 238 this.value.length < SimUnlock.PIN_MIN_LENGTH; |
| 238 }); | 239 }); |
| 239 $('enter-pin-confirm').addEventListener('click', function(event) { | 240 $('enter-pin-confirm').addEventListener('click', function(event) { |
| 240 SimUnlock.submitPin() | 241 SimUnlock.submitPin() |
| 241 }); | 242 }); |
| 242 $('enter-pin-dismiss').addEventListener('click', function(event) { | 243 $('enter-pin-dismiss').addEventListener('click', function(event) { |
| 243 SimUnlock.cancel(); | 244 SimUnlock.cancel(); |
| 244 }); | 245 }); |
| 245 | 246 |
| 246 // No PIN retries left screen. | 247 // No PIN retries left screen. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 257 SimUnlock.pukEntered($('puk-input').value); | 258 SimUnlock.pukEntered($('puk-input').value); |
| 258 return; | 259 return; |
| 259 } | 260 } |
| 260 if (event.keyCode > SimUnlock.DOM_VK_9 || | 261 if (event.keyCode > SimUnlock.DOM_VK_9 || |
| 261 (event.shiftKey && event.keyCode != SimUnlock.DOM_VK_TAB)) { | 262 (event.shiftKey && event.keyCode != SimUnlock.DOM_VK_TAB)) { |
| 262 event.preventDefault(); | 263 event.preventDefault(); |
| 263 } | 264 } |
| 264 }); | 265 }); |
| 265 $('puk-input').addEventListener('keyup', function(event) { | 266 $('puk-input').addEventListener('keyup', function(event) { |
| 266 $('enter-puk-confirm').disabled = | 267 $('enter-puk-confirm').disabled = |
| 268 $('enter-puk-dismiss').disabled || |
| 267 this.value.length < SimUnlock.PUK_LENGTH; | 269 this.value.length < SimUnlock.PUK_LENGTH; |
| 268 }); | 270 }); |
| 269 $('enter-puk-confirm').addEventListener('click', function(event) { | 271 $('enter-puk-confirm').addEventListener('click', function(event) { |
| 270 SimUnlock.pukEntered($('puk-input').value); | 272 SimUnlock.pukEntered($('puk-input').value); |
| 271 }); | 273 }); |
| 272 $('enter-puk-dismiss').addEventListener('click', function(event) { | 274 $('enter-puk-dismiss').addEventListener('click', function(event) { |
| 273 SimUnlock.cancel(); | 275 SimUnlock.cancel(); |
| 274 }); | 276 }); |
| 275 | 277 |
| 276 // Change PIN / new PIN screen. | 278 // Change PIN / new PIN screen. |
| 277 $('old-pin-input').addEventListener('keydown', function(event) { | 279 $('old-pin-input').addEventListener('keydown', function(event) { |
| 278 if (event.keyIdentifier == 'Enter') { | 280 if (event.keyIdentifier == 'Enter') { |
| 279 if (this.value.length >= SimUnlock.PIN_MIN_LENGTH) | 281 if (this.value.length >= SimUnlock.PIN_MIN_LENGTH) |
| 280 $('new-pin-input').focus(); | 282 $('new-pin-input').focus(); |
| 281 return; | 283 return; |
| 282 } | 284 } |
| 283 if (event.keyCode > SimUnlock.DOM_VK_9 || | 285 if (event.keyCode > SimUnlock.DOM_VK_9 || |
| 284 (event.shiftKey && event.keyCode != SimUnlock.DOM_VK_TAB)) { | 286 (event.shiftKey && event.keyCode != SimUnlock.DOM_VK_TAB)) { |
| 285 event.preventDefault(); | 287 event.preventDefault(); |
| 286 } | 288 } |
| 287 }); | 289 }); |
| 288 $('old-pin-input').addEventListener('keyup', function(event) { | 290 $('old-pin-input').addEventListener('keyup', function(event) { |
| 289 $('choose-pin-confirm').disabled = | 291 $('choose-pin-confirm').disabled = |
| 292 $('choose-pin-dismiss').disabled || |
| 290 this.value.length < SimUnlock.PIN_MIN_LENGTH || | 293 this.value.length < SimUnlock.PIN_MIN_LENGTH || |
| 291 $('new-pin-input').value.length < SimUnlock.PIN_MIN_LENGTH || | 294 $('new-pin-input').value.length < SimUnlock.PIN_MIN_LENGTH || |
| 292 $('retype-new-pin-input').value.length < SimUnlock.PIN_MIN_LENGTH; | 295 $('retype-new-pin-input').value.length < SimUnlock.PIN_MIN_LENGTH; |
| 293 }); | 296 }); |
| 294 $('new-pin-input').addEventListener('keydown', function(event) { | 297 $('new-pin-input').addEventListener('keydown', function(event) { |
| 295 if (event.keyIdentifier == 'Enter') { | 298 if (event.keyIdentifier == 'Enter') { |
| 296 if (this.value.length >= SimUnlock.PIN_MIN_LENGTH) | 299 if (this.value.length >= SimUnlock.PIN_MIN_LENGTH) |
| 297 $('retype-new-pin-input').focus(); | 300 $('retype-new-pin-input').focus(); |
| 298 return; | 301 return; |
| 299 } | 302 } |
| 300 if (event.keyCode > SimUnlock.DOM_VK_9 || | 303 if (event.keyCode > SimUnlock.DOM_VK_9 || |
| 301 (event.shiftKey && event.keyCode != SimUnlock.DOM_VK_TAB)) { | 304 (event.shiftKey && event.keyCode != SimUnlock.DOM_VK_TAB)) { |
| 302 event.preventDefault(); | 305 event.preventDefault(); |
| 303 } | 306 } |
| 304 }); | 307 }); |
| 305 $('new-pin-input').addEventListener('keyup', function(event) { | 308 $('new-pin-input').addEventListener('keyup', function(event) { |
| 306 var oldPinOk = SimUnlock.state != SimUnlock.SIM_NOT_LOCKED_CHANGE_PIN || | 309 var oldPinOk = SimUnlock.state != SimUnlock.SIM_NOT_LOCKED_CHANGE_PIN || |
| 307 $('old-pin-input').value.length >= SimUnlock.PIN_MIN_LENGTH; | 310 $('old-pin-input').value.length >= SimUnlock.PIN_MIN_LENGTH; |
| 308 $('choose-pin-confirm').disabled = | 311 $('choose-pin-confirm').disabled = |
| 312 $('choose-pin-dismiss').disabled || |
| 309 this.value.length < SimUnlock.PIN_MIN_LENGTH || | 313 this.value.length < SimUnlock.PIN_MIN_LENGTH || |
| 310 $('retype-new-pin-input').value.length < SimUnlock.PIN_MIN_LENGTH || | 314 $('retype-new-pin-input').value.length < SimUnlock.PIN_MIN_LENGTH || |
| 311 !oldPinOk; | 315 !oldPinOk; |
| 312 }); | 316 }); |
| 313 $('retype-new-pin-input').addEventListener('keyup', function(event) { | 317 $('retype-new-pin-input').addEventListener('keyup', function(event) { |
| 314 var oldPinOk = SimUnlock.state != SimUnlock.SIM_NOT_LOCKED_CHANGE_PIN || | 318 var oldPinOk = SimUnlock.state != SimUnlock.SIM_NOT_LOCKED_CHANGE_PIN || |
| 315 $('old-pin-input').value.length >= SimUnlock.PIN_MIN_LENGTH; | 319 $('old-pin-input').value.length >= SimUnlock.PIN_MIN_LENGTH; |
| 316 $('choose-pin-confirm').disabled = | 320 $('choose-pin-confirm').disabled = |
| 321 $('choose-pin-dismiss').disabled || |
| 317 this.value.length < SimUnlock.PIN_MIN_LENGTH || | 322 this.value.length < SimUnlock.PIN_MIN_LENGTH || |
| 318 $('new-pin-input').value.length < SimUnlock.PIN_MIN_LENGTH || | 323 $('new-pin-input').value.length < SimUnlock.PIN_MIN_LENGTH || |
| 319 !oldPinOk; | 324 !oldPinOk; |
| 320 }); | 325 }); |
| 321 $('retype-new-pin-input').addEventListener('keydown', function(event) { | 326 $('retype-new-pin-input').addEventListener('keydown', function(event) { |
| 322 if (event.keyIdentifier == 'Enter') { | 327 if (event.keyIdentifier == 'Enter') { |
| 323 SimUnlock.newPinEntered($('new-pin-input').value, | 328 SimUnlock.newPinEntered($('new-pin-input').value, |
| 324 $('retype-new-pin-input').value); | 329 $('retype-new-pin-input').value); |
| 325 return; | 330 return; |
| 326 } | 331 } |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 SimUnlock.simStateChanged = function(simInfo) { | 408 SimUnlock.simStateChanged = function(simInfo) { |
| 404 SimUnlock.getInstance().updateSimStatus_(simInfo); | 409 SimUnlock.getInstance().updateSimStatus_(simInfo); |
| 405 }; | 410 }; |
| 406 | 411 |
| 407 // Export | 412 // Export |
| 408 return { | 413 return { |
| 409 SimUnlock: SimUnlock | 414 SimUnlock: SimUnlock |
| 410 }; | 415 }; |
| 411 | 416 |
| 412 }); | 417 }); |
| OLD | NEW |