Chromium Code Reviews| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 /** | 74 /** |
| 75 * PASSWORD_ACTIVE_DURATION_MS value. May be overridden by tests. | 75 * PASSWORD_ACTIVE_DURATION_MS value. May be overridden by tests. |
| 76 * @private | 76 * @private |
| 77 */ | 77 */ |
| 78 passwordActiveDurationMs_: { | 78 passwordActiveDurationMs_: { |
| 79 type: Number, | 79 type: Number, |
| 80 value: PASSWORD_ACTIVE_DURATION_MS | 80 value: PASSWORD_ACTIVE_DURATION_MS |
| 81 }, | 81 }, |
| 82 }, | 82 }, |
| 83 | 83 |
| 84 /** @override */ | |
| 85 ready: function() { | |
| 86 // The first time the dialog is shown, the password prompt does not | |
| 87 // auto-focus itself. However, if the dialog has been created already | |
| 88 // and is only being redisplayed, the password input will correctly | |
| 89 // capture focus by itself. | |
| 90 setTimeout(function() { | |
| 91 this.$.passwordInput.focus(); | |
|
Dan Beam
2016/10/26 22:52:09
don't start a focus storm
jdufault
2016/10/26 23:21:08
Strange, using autofocus works as expected now. I'
| |
| 92 }.bind(this)); | |
| 93 }, | |
| 94 | |
| 84 /** | 95 /** |
| 85 * Open up the dialog. This will wait until the dialog has loaded before | 96 * Open up the dialog. This will wait until the dialog has loaded before |
| 86 * opening it. | 97 * opening it. |
| 87 */ | 98 */ |
| 88 open: function() { | 99 open: function() { |
| 89 // Wait until the dialog is attached to the DOM before trying to open it. | 100 // Wait until the dialog is attached to the DOM before trying to open it. |
| 90 var dialog = /** @type {{isConnected: boolean}} */ (this.$.dialog); | 101 var dialog = /** @type {{isConnected: boolean}} */ (this.$.dialog); |
| 91 if (!dialog.isConnected) { | 102 if (!dialog.isConnected) { |
| 92 setTimeout(this.open.bind(this)); | 103 setTimeout(this.open.bind(this)); |
| 93 return; | 104 return; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 189 this.quickUnlockPrivate_.getActiveModes(function(modes) { | 200 this.quickUnlockPrivate_.getActiveModes(function(modes) { |
| 190 var credentials = | 201 var credentials = |
| 191 /** @type {!Array<string>} */ (Array(modes.length).fill('')); | 202 /** @type {!Array<string>} */ (Array(modes.length).fill('')); |
| 192 this.quickUnlockPrivate_.setModes( | 203 this.quickUnlockPrivate_.setModes( |
| 193 this.password_, modes, credentials, onCheck); | 204 this.password_, modes, credentials, onCheck); |
| 194 }.bind(this)); | 205 }.bind(this)); |
| 195 } | 206 } |
| 196 }); | 207 }); |
| 197 | 208 |
| 198 })(); | 209 })(); |
| OLD | NEW |