Chromium Code Reviews| Index: chrome/browser/resources/settings/internet_page/network_siminfo.js |
| diff --git a/chrome/browser/resources/settings/internet_page/network_siminfo.js b/chrome/browser/resources/settings/internet_page/network_siminfo.js |
| index 9d8b710ebfa789e707cdcff9beca99b523a96684..2fc55fcc82f10ecfca5c8bf158a3af3fcbb4eb19 100644 |
| --- a/chrome/browser/resources/settings/internet_page/network_siminfo.js |
| +++ b/chrome/browser/resources/settings/internet_page/network_siminfo.js |
| @@ -40,6 +40,16 @@ Polymer({ |
| networkingPrivate: Object, |
| /** |
| + * Reflects networkProperties.Cellular.SIMLockStatus.LockEnabled for the |
| + * toggle button. |
| + * @private |
| + */ |
| + lockEnabled_: { |
| + type: Boolean, |
| + value: false, |
| + }, |
| + |
| + /** |
| * Set to true when a PUK is required to unlock the SIM. |
| * @private |
| */ |
| @@ -67,6 +77,7 @@ Polymer({ |
| var simLockStatus = this.networkProperties.Cellular.SIMLockStatus; |
| this.pukRequired_ = |
| !!simLockStatus && simLockStatus.LockType == CrOnc.LockType.PUK; |
| + this.lockEnabled_ = simLockStatus.LockEnabled; |
| }, |
| pukRequiredChanged_: function() { |
| @@ -112,8 +123,9 @@ Polymer({ |
| return; |
| this.sendSimLockEnabled_ = event.target.checked; |
| this.error_ = ErrorType.NONE; |
| - this.$.enterPinDialog.showModal(); |
| this.$.enterPin.value = ''; |
| + this.$.enterPinDialog.showModal(); |
| + this.$.enterPin.focus(); |
|
dpapad
2017/04/17 17:57:17
Can we use the |autofocus| attribute instead? See
stevenjb
2017/04/17 18:08:34
Ah, yes, indeed we can. Done.
|
| }, |
| /** |
| @@ -124,9 +136,10 @@ Polymer({ |
| sendEnterPin_: function(event) { |
| var guid = (this.networkProperties && this.networkProperties.GUID) || ''; |
| var pin = this.$.enterPin.value; |
| - if (!this.validatePin_(pin)) |
| + if (!this.validatePin_(pin)) { |
| + this.onEnterPinDialogCancel_(); |
| return; |
| - |
| + } |
| var simState = /** @type {!CrOnc.CellularSimState} */ ({ |
| currentPin: pin, |
| requirePin: this.sendSimLockEnabled_, |
| @@ -152,10 +165,11 @@ Polymer({ |
| return; |
| event.preventDefault(); |
| this.error_ = ErrorType.NONE; |
| - this.$.changePinDialog.showModal(); |
| this.$.changePinOld.value = ''; |
| this.$.changePinNew1.value = ''; |
| this.$.changePinNew2.value = ''; |
| + this.$.changePinDialog.showModal(); |
| + this.$.changePinOld.focus(); |
| }, |
| /** |
| @@ -193,8 +207,9 @@ Polymer({ |
| onUnlockPinTap_: function(event) { |
| event.preventDefault(); |
| this.error_ = ErrorType.NONE; |
| - this.$.unlockPinDialog.showModal(); |
| this.$.unlockPin.value = ''; |
| + this.$.unlockPinDialog.showModal(); |
| + this.$.unlockPin.focus(); |
| }, |
| /** |
| @@ -226,6 +241,7 @@ Polymer({ |
| this.$.unlockPin1.value = ''; |
| this.$.unlockPin2.value = ''; |
| this.$.unlockPukDialog.showModal(); |
| + this.$.unlockPuk.focus(); |
| }, |
| /** |
| @@ -340,7 +356,13 @@ Polymer({ |
| }, |
| /** @private */ |
| - onEnterPinDialogClosed_: function() { |
| + onEnterPinDialogCancel_: function() { |
| + this.lockEnabled_ = |
| + this.networkProperties.Cellular.SIMLockStatus.LockEnabled; |
| + }, |
| + |
| + /** @private */ |
| + onEnterPinDialogClose_: function() { |
| this.$$('#simLockButton').focus(); |
| }, |