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-quick-unlock-authenticate' shows a password input prompt to the | 8 * 'settings-quick-unlock-authenticate' shows a password input prompt to the |
9 * user. It validates the password is correct. Once the user has entered their | 9 * user. It validates the password is correct. Once the user has entered their |
10 * account password, the page navigates to the quick unlock setup methods page. | 10 * account password, the page navigates to the quick unlock setup methods page. |
(...skipping 28 matching lines...) Expand all Loading... |
39 chrome.quickUnlockPrivate.getActiveModes(function(modes) { | 39 chrome.quickUnlockPrivate.getActiveModes(function(modes) { |
40 var credentials = | 40 var credentials = |
41 /** @type {!Array<string>} */ (Array(modes.length).fill('')); | 41 /** @type {!Array<string>} */ (Array(modes.length).fill('')); |
42 chrome.quickUnlockPrivate.setModes(password, modes, credentials, onCheck); | 42 chrome.quickUnlockPrivate.setModes(password, modes, credentials, onCheck); |
43 }); | 43 }); |
44 } | 44 } |
45 | 45 |
46 Polymer({ | 46 Polymer({ |
47 is: 'settings-quick-unlock-authenticate', | 47 is: 'settings-quick-unlock-authenticate', |
48 | 48 |
49 behaviors: [ | 49 properties: { |
50 QuickUnlockRoutingBehavior, | 50 /** @type {!settings.Route} */ |
51 ], | 51 currentRoute: { |
| 52 type: Object, |
| 53 observer: 'onRouteChanged_', |
| 54 }, |
52 | 55 |
53 properties: { | |
54 /** | 56 /** |
55 * A wrapper around chrome.quickUnlockPrivate.setModes with the account | 57 * A wrapper around chrome.quickUnlockPrivate.setModes with the account |
56 * password already supplied. If this is null, the authentication screen | 58 * password already supplied. If this is null, the authentication screen |
57 * needs to be redisplayed. This property will be cleared after | 59 * needs to be redisplayed. This property will be cleared after |
58 * PASSWORD_ACTIVE_DURATION_MS milliseconds. | 60 * PASSWORD_ACTIVE_DURATION_MS milliseconds. |
59 */ | 61 */ |
60 setModes: { | 62 setModes: { |
61 type: Object, | 63 type: Object, |
62 notify: true | 64 notify: true |
63 }, | 65 }, |
(...skipping 12 matching lines...) Expand all Loading... |
76 */ | 78 */ |
77 password_: String, | 79 password_: String, |
78 | 80 |
79 /** | 81 /** |
80 * Helper property which marks password as valid/invalid. | 82 * Helper property which marks password as valid/invalid. |
81 * @private | 83 * @private |
82 */ | 84 */ |
83 passwordInvalid_: Boolean | 85 passwordInvalid_: Boolean |
84 }, | 86 }, |
85 | 87 |
86 observers: [ | |
87 'onRouteChanged_(currentRoute)' | |
88 ], | |
89 | |
90 /** @private */ | 88 /** @private */ |
91 onRouteChanged_: function(currentRoute) { | 89 onRouteChanged_: function(currentRoute) { |
92 // Clear local state if this screen is not active so if this screen shows | 90 // Clear local state if this screen is not active so if this screen shows |
93 // up again the user will get a fresh UI. | 91 // up again the user will get a fresh UI. |
94 if (!this.isScreenActive(QuickUnlockScreen.AUTHENTICATE)) { | 92 if (this.currentRoute != settings.Route.QUICK_UNLOCK_AUTHENTICATE) { |
95 this.password_ = ''; | 93 this.password_ = ''; |
96 this.passwordInvalid_ = false; | 94 this.passwordInvalid_ = false; |
97 } | 95 } |
98 }, | 96 }, |
99 | 97 |
100 /** | 98 /** |
101 * Start or restart a timer to check the account password and move past the | 99 * Start or restart a timer to check the account password and move past the |
102 * authentication screen. | 100 * authentication screen. |
103 * @private | 101 * @private |
104 */ | 102 */ |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 | 150 |
153 settings.navigateTo(settings.Route.QUICK_UNLOCK_CHOOSE_METHOD); | 151 settings.navigateTo(settings.Route.QUICK_UNLOCK_CHOOSE_METHOD); |
154 } | 152 } |
155 } | 153 } |
156 | 154 |
157 checkAccountPassword_(this.password_, onPasswordChecked.bind(this)); | 155 checkAccountPassword_(this.password_, onPasswordChecked.bind(this)); |
158 } | 156 } |
159 }); | 157 }); |
160 | 158 |
161 })(); | 159 })(); |
OLD | NEW |