| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 | 6 * @fileoverview |
| 7 * | 7 * |
| 8 * 'settings-password-prompt-dialog' shows a dialog which asks for the user to | 8 * 'settings-password-prompt-dialog' shows a dialog which asks for the user to |
| 9 * enter their password. It validates the password is correct. Once the user has | 9 * enter their password. It validates the password is correct. Once the user has |
| 10 * entered their account password, the page fires an 'authenticated' event and | 10 * entered their account password, the page fires an 'authenticated' event and |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 // Wait until the dialog is attached to the DOM before trying to open it. | 86 // Wait until the dialog is attached to the DOM before trying to open it. |
| 87 var dialog = /** @type {{isConnected: boolean}} */ (this.$.dialog); | 87 var dialog = /** @type {{isConnected: boolean}} */ (this.$.dialog); |
| 88 if (!dialog.isConnected) { | 88 if (!dialog.isConnected) { |
| 89 setTimeout(this.open.bind(this)); | 89 setTimeout(this.open.bind(this)); |
| 90 return; | 90 return; |
| 91 } | 91 } |
| 92 | 92 |
| 93 if (this.$.dialog.open) | 93 if (this.$.dialog.open) |
| 94 return; | 94 return; |
| 95 | 95 |
| 96 recordLockScreenProgress(LockScreenProgress.START_SCREEN_LOCK); |
| 96 this.$.dialog.showModal(); | 97 this.$.dialog.showModal(); |
| 97 }, | 98 }, |
| 98 | 99 |
| 99 /** @private */ | 100 /** @private */ |
| 100 onCancelTap_: function() { | 101 onCancelTap_: function() { |
| 101 if (this.$.dialog.open) | 102 if (this.$.dialog.open) |
| 102 this.$.dialog.close(); | 103 this.$.dialog.close(); |
| 103 }, | 104 }, |
| 104 | 105 |
| 105 /** | 106 /** |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 // Reset the password so that any cached references to this.setModes | 151 // Reset the password so that any cached references to this.setModes |
| 151 // will fail. | 152 // will fail. |
| 152 password = ''; | 153 password = ''; |
| 153 this.setModes = null; | 154 this.setModes = null; |
| 154 } | 155 } |
| 155 | 156 |
| 156 this.clearAccountPasswordTimeout_ = setTimeout( | 157 this.clearAccountPasswordTimeout_ = setTimeout( |
| 157 clearSetModes.bind(this), PASSWORD_ACTIVE_DURATION_MS); | 158 clearSetModes.bind(this), PASSWORD_ACTIVE_DURATION_MS); |
| 158 // Closing the dialog will clear this.password_. | 159 // Closing the dialog will clear this.password_. |
| 159 this.$.dialog.close(); | 160 this.$.dialog.close(); |
| 161 recordLockScreenProgress(LockScreenProgress.ENTER_PASSWORD_CORRECTLY); |
| 160 } | 162 } |
| 161 } | 163 } |
| 162 | 164 |
| 163 checkAccountPassword_(this.password_, onPasswordChecked.bind(this)); | 165 checkAccountPassword_(this.password_, onPasswordChecked.bind(this)); |
| 164 }, | 166 }, |
| 165 | 167 |
| 166 /** @private */ | 168 /** @private */ |
| 167 onPasswordChanged_: function() { | 169 onPasswordChanged_: function() { |
| 168 this.passwordInvalid_ = false; | 170 this.passwordInvalid_ = false; |
| 169 }, | 171 }, |
| 170 | 172 |
| 171 /** @private */ | 173 /** @private */ |
| 172 enableConfirm_: function() { | 174 enableConfirm_: function() { |
| 173 return !!this.password_ && !this.passwordInvalid_; | 175 return !!this.password_ && !this.passwordInvalid_; |
| 174 } | 176 } |
| 175 }); | 177 }); |
| 176 | 178 |
| 177 })(); | 179 })(); |
| OLD | NEW |