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-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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 82 }, | 82 }, |
| 83 | 83 |
| 84 /** @private {?settings.FingerprintBrowserProxy} */ | 84 /** @private {?settings.FingerprintBrowserProxy} */ |
| 85 browserProxy_: null, | 85 browserProxy_: null, |
| 86 | 86 |
| 87 /** selectedUnlockType is defined in LockStateBehavior. */ | 87 /** selectedUnlockType is defined in LockStateBehavior. */ |
| 88 observers: ['selectedUnlockTypeChanged_(selectedUnlockType)'], | 88 observers: ['selectedUnlockTypeChanged_(selectedUnlockType)'], |
| 89 | 89 |
| 90 /** @override */ | 90 /** @override */ |
| 91 attached: function() { | 91 attached: function() { |
| 92 // currentRouteChanged is not called during the initial navigation. If the | 92 // Show lock screen if current route has been set to LOCK_SCREEN. |
| 93 // user navigates directly to the lockScreen page, we still want to show the | 93 this.showLockScreen_(); |
|
Dan Beam
2017/02/28 02:49:16
this probably ought to be like maybeShowLockScreen
xiaoyinh(OOO Sep 11-29)
2017/02/28 21:41:16
Thanks for the suggestion. I changed name to be "s
| |
| 94 // password prompt page. | |
| 95 this.currentRouteChanged(settings.Route.LOCK_SCREEN, | |
| 96 settings.Route.LOCK_SCREEN); | |
| 97 this.browserProxy_ = settings.FingerprintBrowserProxyImpl.getInstance(); | 94 this.browserProxy_ = settings.FingerprintBrowserProxyImpl.getInstance(); |
| 98 }, | 95 }, |
| 99 | 96 |
| 100 /** | 97 /** |
| 101 * Overridden from settings.RouteObserverBehavior. | 98 * Overridden from settings.RouteObserverBehavior. |
| 102 * @param {!settings.Route} newRoute | 99 * @param {!settings.Route} newRoute |
| 103 * @param {!settings.Route} oldRoute | 100 * @param {!settings.Route} oldRoute |
| 104 * @protected | 101 * @protected |
| 105 */ | 102 */ |
| 106 currentRouteChanged: function(newRoute, oldRoute) { | 103 currentRouteChanged: function(newRoute, oldRoute) { |
| 107 if (newRoute == settings.Route.LOCK_SCREEN && | 104 if (newRoute == settings.Route.LOCK_SCREEN && |
| 108 this.fingerprintUnlockEnabled_ && | 105 this.fingerprintUnlockEnabled_ && |
| 109 this.browserProxy_) { | 106 this.browserProxy_) { |
| 110 this.browserProxy_.getNumFingerprints().then( | 107 this.browserProxy_.getNumFingerprints().then( |
| 111 function(numFingerprints) { | 108 function(numFingerprints) { |
| 112 this.numFingerprints_ = numFingerprints; | 109 this.numFingerprints_ = numFingerprints; |
| 113 }.bind(this)); | 110 }.bind(this)); |
| 114 } | 111 } |
| 115 | 112 |
| 116 if (newRoute == settings.Route.LOCK_SCREEN && !this.setModes_) { | 113 if (newRoute == settings.Route.LOCK_SCREEN && !this.setModes_) { |
| 117 this.$.passwordPrompt.open(); | 114 this.$.passwordPrompt.open(); |
|
Dan Beam
2017/02/28 02:49:16
right, but you didn't update this part of the code
xiaoyinh(OOO Sep 11-29)
2017/02/28 21:41:16
Oh, thanks! I've updated it.
| |
| 118 } else if (newRoute != settings.Route.FINGERPRINT && | 115 } else if (newRoute != settings.Route.FINGERPRINT && |
| 119 oldRoute != settings.Route.FINGERPRINT) { | 116 oldRoute != settings.Route.FINGERPRINT) { |
| 120 // If the user navigated away from the lock screen settings page they will | 117 // If the user navigated away from the lock screen settings page they will |
| 121 // have to re-enter their password. An exception is if they are navigating | 118 // have to re-enter their password. An exception is if they are navigating |
| 122 // to or from the fingerprint subpage. | 119 // to or from the fingerprint subpage. |
| 123 this.setModes_ = undefined; | 120 this.setModes_ = undefined; |
| 124 } | 121 } |
| 125 }, | 122 }, |
| 126 | 123 |
| 127 /** | 124 /** |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 194 onConfigurePin_: function(e) { | 191 onConfigurePin_: function(e) { |
| 195 e.preventDefault(); | 192 e.preventDefault(); |
| 196 this.$.setupPin.open(); | 193 this.$.setupPin.open(); |
| 197 this.writeUma_(LockScreenProgress.CHOOSE_PIN_OR_PASSWORD); | 194 this.writeUma_(LockScreenProgress.CHOOSE_PIN_OR_PASSWORD); |
| 198 }, | 195 }, |
| 199 | 196 |
| 200 /** @private */ | 197 /** @private */ |
| 201 onEditFingerprints_: function() { | 198 onEditFingerprints_: function() { |
| 202 settings.navigateTo(settings.Route.FINGERPRINT); | 199 settings.navigateTo(settings.Route.FINGERPRINT); |
| 203 }, | 200 }, |
| 201 | |
| 202 /** @private */ | |
| 203 showLockScreen_: function() { | |
| 204 if (settings.getCurrentRoute() == settings.Route.LOCK_SCREEN && | |
| 205 !this.setModes_) { | |
| 206 this.$.passwordPrompt.open(); | |
| 207 } | |
| 208 }, | |
| 204 }); | 209 }); |
| OLD | NEW |