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-lock-screen' allows the user to change how they unlock their | 7 * 'settings-lock-screen' allows the user to change how they unlock their |
8 * device. | 8 * device. |
9 * | 9 * |
10 * Example: | 10 * Example: |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 } | 159 } |
160 }, | 160 }, |
161 | 161 |
162 /** | 162 /** |
163 * Overridden from settings.RouteObserverBehavior. | 163 * Overridden from settings.RouteObserverBehavior. |
164 * @param {!settings.Route} newRoute | 164 * @param {!settings.Route} newRoute |
165 * @param {!settings.Route} oldRoute | 165 * @param {!settings.Route} oldRoute |
166 * @protected | 166 * @protected |
167 */ | 167 */ |
168 currentRouteChanged: function(newRoute, oldRoute) { | 168 currentRouteChanged: function(newRoute, oldRoute) { |
169 if (newRoute == settings.Route.LOCK_SCREEN && | 169 if (newRoute == settings.routes.LOCK_SCREEN && |
170 this.fingerprintUnlockEnabled_ && this.fingerprintBrowserProxy_) { | 170 this.fingerprintUnlockEnabled_ && this.fingerprintBrowserProxy_) { |
171 this.fingerprintBrowserProxy_.getNumFingerprints().then( | 171 this.fingerprintBrowserProxy_.getNumFingerprints().then( |
172 function(numFingerprints) { | 172 function(numFingerprints) { |
173 this.numFingerprints_ = numFingerprints; | 173 this.numFingerprints_ = numFingerprints; |
174 }.bind(this)); | 174 }.bind(this)); |
175 } | 175 } |
176 | 176 |
177 if (this.shouldAskForPassword_(newRoute)) { | 177 if (this.shouldAskForPassword_(newRoute)) { |
178 this.openPasswordPromptDialog_(); | 178 this.openPasswordPromptDialog_(); |
179 } else if ( | 179 } else if ( |
180 newRoute != settings.Route.FINGERPRINT && | 180 newRoute != settings.routes.FINGERPRINT && |
181 oldRoute != settings.Route.FINGERPRINT) { | 181 oldRoute != settings.routes.FINGERPRINT) { |
182 // If the user navigated away from the lock screen settings page they will | 182 // If the user navigated away from the lock screen settings page they will |
183 // have to re-enter their password. An exception is if they are navigating | 183 // have to re-enter their password. An exception is if they are navigating |
184 // to or from the fingerprint subpage. | 184 // to or from the fingerprint subpage. |
185 this.setModes_ = undefined; | 185 this.setModes_ = undefined; |
186 } | 186 } |
187 }, | 187 }, |
188 | 188 |
189 /** | 189 /** |
190 * Called when the unlock type has changed. | 190 * Called when the unlock type has changed. |
191 * @param {!string} selected The current unlock type. | 191 * @param {!string} selected The current unlock type. |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 if (this.numFingerprints_ > 0) { | 265 if (this.numFingerprints_ > 0) { |
266 return this.i18n( | 266 return this.i18n( |
267 'lockScreenNumberFingerprints', this.numFingerprints_.toString()); | 267 'lockScreenNumberFingerprints', this.numFingerprints_.toString()); |
268 } | 268 } |
269 | 269 |
270 return this.i18n('lockScreenEditFingerprintsDescription'); | 270 return this.i18n('lockScreenEditFingerprintsDescription'); |
271 }, | 271 }, |
272 | 272 |
273 /** @private */ | 273 /** @private */ |
274 onEditFingerprints_: function() { | 274 onEditFingerprints_: function() { |
275 settings.navigateTo(settings.Route.FINGERPRINT); | 275 settings.navigateTo(settings.routes.FINGERPRINT); |
276 }, | 276 }, |
277 | 277 |
278 /** | 278 /** |
279 * @param {!settings.Route} route | 279 * @param {!settings.Route} route |
280 * @return {boolean} Whether the password dialog should be shown. | 280 * @return {boolean} Whether the password dialog should be shown. |
281 * @private | 281 * @private |
282 */ | 282 */ |
283 shouldAskForPassword_: function(route) { | 283 shouldAskForPassword_: function(route) { |
284 return route == settings.Route.LOCK_SCREEN && !this.setModes_; | 284 return route == settings.routes.LOCK_SCREEN && !this.setModes_; |
285 }, | 285 }, |
286 | 286 |
287 /** | 287 /** |
288 * Handler for when the Easy Unlock enabled status has changed. | 288 * Handler for when the Easy Unlock enabled status has changed. |
289 * @private | 289 * @private |
290 */ | 290 */ |
291 handleEasyUnlockEnabledStatusChanged_: function(easyUnlockEnabled) { | 291 handleEasyUnlockEnabledStatusChanged_: function(easyUnlockEnabled) { |
292 this.easyUnlockEnabled_ = easyUnlockEnabled; | 292 this.easyUnlockEnabled_ = easyUnlockEnabled; |
293 this.showEasyUnlockTurnOffDialog_ = | 293 this.showEasyUnlockTurnOffDialog_ = |
294 easyUnlockEnabled && this.showEasyUnlockTurnOffDialog_; | 294 easyUnlockEnabled && this.showEasyUnlockTurnOffDialog_; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 /** | 332 /** |
333 * @param {boolean} easyUnlockEnabled | 333 * @param {boolean} easyUnlockEnabled |
334 * @param {boolean} proximityDetectionAllowed | 334 * @param {boolean} proximityDetectionAllowed |
335 * @private | 335 * @private |
336 */ | 336 */ |
337 getShowEasyUnlockToggle_: function( | 337 getShowEasyUnlockToggle_: function( |
338 easyUnlockEnabled, proximityDetectionAllowed) { | 338 easyUnlockEnabled, proximityDetectionAllowed) { |
339 return easyUnlockEnabled && proximityDetectionAllowed; | 339 return easyUnlockEnabled && proximityDetectionAllowed; |
340 }, | 340 }, |
341 }); | 341 }); |
OLD | NEW |