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(); | |
109 }, | 104 }, |
110 | 105 |
111 close: function() { | 106 close: function() { |
112 if (this.$.dialog.open) | 107 if (this.$.dialog.open) |
113 this.$.dialog.close(); | 108 this.$.dialog.close(); |
114 | 109 |
115 this.resetState_(); | 110 this.resetState_(); |
116 }, | 111 }, |
117 | 112 |
118 /** | 113 /** |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 return; | 264 return; |
270 } | 265 } |
271 | 266 |
272 function onSetModesCompleted(didSet) { | 267 function onSetModesCompleted(didSet) { |
273 if (!didSet) { | 268 if (!didSet) { |
274 console.error('Failed to update pin'); | 269 console.error('Failed to update pin'); |
275 return; | 270 return; |
276 } | 271 } |
277 | 272 |
278 this.resetState_(); | 273 this.resetState_(); |
279 this.fire('done'); | 274 if (this.$.dialog.open) |
| 275 this.$.dialog.close(); |
280 } | 276 } |
281 | 277 |
282 this.setModes.call( | 278 this.setModes.call( |
283 null, | 279 null, |
284 [chrome.quickUnlockPrivate.QuickUnlockMode.PIN], | 280 [chrome.quickUnlockPrivate.QuickUnlockMode.PIN], |
285 [this.pinKeyboardValue_], | 281 [this.pinKeyboardValue_], |
286 onSetModesCompleted.bind(this)); | 282 onSetModesCompleted.bind(this)); |
287 this.writeUma_(LockScreenProgress.CONFIRM_PIN); | 283 this.writeUma_(LockScreenProgress.CONFIRM_PIN); |
288 }, | 284 }, |
289 | 285 |
(...skipping 21 matching lines...) Expand all Loading... |
311 * @private | 307 * @private |
312 * @param {boolean} isConfirmStep | 308 * @param {boolean} isConfirmStep |
313 * @return {string} | 309 * @return {string} |
314 */ | 310 */ |
315 getContinueMessage_: function(isConfirmStep) { | 311 getContinueMessage_: function(isConfirmStep) { |
316 return this.i18n(isConfirmStep ? 'confirm' : 'configurePinContinueButton'); | 312 return this.i18n(isConfirmStep ? 'confirm' : 'configurePinContinueButton'); |
317 }, | 313 }, |
318 }); | 314 }); |
319 | 315 |
320 })(); | 316 })(); |
OLD | NEW |