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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 90 * @private | 90 * @private |
| 91 */ | 91 */ |
| 92 passwordActiveDurationMs_: { | 92 passwordActiveDurationMs_: { |
| 93 type: Number, | 93 type: Number, |
| 94 value: PASSWORD_ACTIVE_DURATION_MS, | 94 value: PASSWORD_ACTIVE_DURATION_MS, |
| 95 }, | 95 }, |
| 96 }, | 96 }, |
| 97 | 97 |
| 98 /** @override */ | 98 /** @override */ |
| 99 attached: function() { | 99 attached: function() { |
| 100 this.writeUma_(LockScreenProgress.START_SCREEN_LOCK); | |
| 101 this.$.dialog.showModal(); | |
| 100 this.async(function() { | 102 this.async(function() { |
| 101 this.$.passwordInput.focus(); | 103 this.$.passwordInput.focus(); |
|
dpapad
2017/06/01 17:48:44
I don't understand why this is needed at all.
- <
sammiequon
2017/06/01 20:21:10
I tried removing this but it does not give the exp
dpapad
2017/06/01 21:44:53
Thanks for trying. The logic for focusing an elem
sammiequon
2017/06/01 22:02:33
Actually, it's not that autofocus doesn't work, it
| |
| 102 }.bind(this)); | 104 }.bind(this)); |
| 103 }, | 105 }, |
| 104 | 106 |
| 105 /** | |
| 106 * Open up the dialog. This will wait until the dialog has loaded before | |
| 107 * opening it. | |
| 108 */ | |
| 109 open: function() { | |
| 110 // Wait until the dialog is attached to the DOM before trying to open it. | |
| 111 var dialog = /** @type {{isConnected: boolean}} */ (this.$.dialog); | |
| 112 if (!dialog.isConnected) { | |
| 113 setTimeout(this.open.bind(this)); | |
| 114 return; | |
| 115 } | |
| 116 | |
| 117 if (this.$.dialog.open) | |
| 118 return; | |
| 119 | |
| 120 this.writeUma_(LockScreenProgress.START_SCREEN_LOCK); | |
| 121 this.$.dialog.showModal(); | |
| 122 }, | |
| 123 | |
| 124 /** @private */ | 107 /** @private */ |
| 125 onCancelTap_: function() { | 108 onCancelTap_: function() { |
| 126 if (this.$.dialog.open) | 109 if (this.$.dialog.open) |
| 127 this.$.dialog.close(); | 110 this.$.dialog.close(); |
| 128 }, | 111 }, |
| 129 | 112 |
| 130 /** | 113 /** |
| 131 * Called whenever the dialog is closed. | 114 * Called whenever the dialog is closed. |
| 132 * @private | 115 * @private |
| 133 */ | 116 */ |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 207 this.quickUnlockPrivate_.getActiveModes(function(modes) { | 190 this.quickUnlockPrivate_.getActiveModes(function(modes) { |
| 208 var credentials = | 191 var credentials = |
| 209 /** @type {!Array<string>} */ (Array(modes.length).fill('')); | 192 /** @type {!Array<string>} */ (Array(modes.length).fill('')); |
| 210 this.quickUnlockPrivate_.setModes( | 193 this.quickUnlockPrivate_.setModes( |
| 211 this.password_, modes, credentials, onCheck); | 194 this.password_, modes, credentials, onCheck); |
| 212 }.bind(this)); | 195 }.bind(this)); |
| 213 } | 196 } |
| 214 }); | 197 }); |
| 215 | 198 |
| 216 })(); | 199 })(); |
| OLD | NEW |