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 * 'settings-setup-pin-dialog' is the settings page for choosing a PIN. | 7 * 'settings-setup-pin-dialog' is the settings page for choosing a PIN. |
| 8 * | 8 * |
| 9 * Example: | 9 * Example: |
| 10 * | 10 * * <settings-setup-pin-dialog set-modes="[[quickUnlockSetModes]]"> |
| 11 * <settings-setup-pin-dialog set-modes="[[quickUnlockSetModes]]"> | |
| 12 * </settings-setup-pin-dialog> | 11 * </settings-setup-pin-dialog> |
| 13 */ | 12 */ |
| 14 | 13 |
| 15 (function() { | 14 (function() { |
| 16 'use strict'; | 15 'use strict'; |
| 17 | 16 |
| 18 /** | 17 /** |
| 19 * Keep in sync with the string keys provided by settings. | 18 * Keep in sync with the string keys provided by settings. |
| 20 * @enum {string} | 19 * @enum {string} |
| 21 */ | 20 */ |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 94 */ | 93 */ |
| 95 quickUnlockPrivate_: { | 94 quickUnlockPrivate_: { |
| 96 type: Object, | 95 type: Object, |
| 97 value: chrome.quickUnlockPrivate | 96 value: chrome.quickUnlockPrivate |
| 98 }, | 97 }, |
| 99 }, | 98 }, |
| 100 | 99 |
| 101 /** @override */ | 100 /** @override */ |
| 102 attached: function() { | 101 attached: function() { |
| 103 this.resetState_(); | 102 this.resetState_(); |
| 104 }, | |
| 105 | |
| 106 open: function() { | |
| 107 this.$.dialog.showModal(); | 103 this.$.dialog.showModal(); |
| 108 this.$.pinKeyboard.focus(); | 104 this.$.pinKeyboard.focus(); |
|
dpapad
2017/06/01 17:48:44
Similar question about |autofocus| here. Can we ad
sammiequon
2017/06/01 20:21:10
Done.
| |
| 109 }, | 105 }, |
| 110 | 106 |
| 111 close: function() { | 107 close: function() { |
| 112 if (this.$.dialog.open) | 108 if (this.$.dialog.open) |
| 113 this.$.dialog.close(); | 109 this.$.dialog.close(); |
| 114 | 110 |
| 115 this.resetState_(); | 111 this.resetState_(); |
| 116 }, | 112 }, |
| 117 | 113 |
| 118 /** | 114 /** |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 269 return; | 265 return; |
| 270 } | 266 } |
| 271 | 267 |
| 272 function onSetModesCompleted(didSet) { | 268 function onSetModesCompleted(didSet) { |
| 273 if (!didSet) { | 269 if (!didSet) { |
| 274 console.error('Failed to update pin'); | 270 console.error('Failed to update pin'); |
| 275 return; | 271 return; |
| 276 } | 272 } |
| 277 | 273 |
| 278 this.resetState_(); | 274 this.resetState_(); |
| 279 this.fire('done'); | 275 if (this.$.dialog.open) |
| 276 this.$.dialog.close(); | |
| 280 } | 277 } |
| 281 | 278 |
| 282 this.setModes.call( | 279 this.setModes.call( |
| 283 null, | 280 null, |
| 284 [chrome.quickUnlockPrivate.QuickUnlockMode.PIN], | 281 [chrome.quickUnlockPrivate.QuickUnlockMode.PIN], |
| 285 [this.pinKeyboardValue_], | 282 [this.pinKeyboardValue_], |
| 286 onSetModesCompleted.bind(this)); | 283 onSetModesCompleted.bind(this)); |
| 287 this.writeUma_(LockScreenProgress.CONFIRM_PIN); | 284 this.writeUma_(LockScreenProgress.CONFIRM_PIN); |
| 288 }, | 285 }, |
| 289 | 286 |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 311 * @private | 308 * @private |
| 312 * @param {boolean} isConfirmStep | 309 * @param {boolean} isConfirmStep |
| 313 * @return {string} | 310 * @return {string} |
| 314 */ | 311 */ |
| 315 getContinueMessage_: function(isConfirmStep) { | 312 getContinueMessage_: function(isConfirmStep) { |
| 316 return this.i18n(isConfirmStep ? 'confirm' : 'configurePinContinueButton'); | 313 return this.i18n(isConfirmStep ? 'confirm' : 'configurePinContinueButton'); |
| 317 }, | 314 }, |
| 318 }); | 315 }); |
| 319 | 316 |
| 320 })(); | 317 })(); |
| OLD | NEW |