Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(445)

Side by Side Diff: chrome/browser/resources/settings/people_page/lock_screen.js

Issue 2728563003: Revert of fix quick unlock config in options (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 if (this.shouldAskForPassword_(settings.getCurrentRoute())) 92 // currentRouteChanged is not called during the initial navigation. If the
93 this.$.passwordPrompt.open(); 93 // user navigates directly to the lockScreen page, we still want to show the
94 // password prompt page.
95 this.currentRouteChanged(settings.Route.LOCK_SCREEN,
96 settings.Route.LOCK_SCREEN);
94 this.browserProxy_ = settings.FingerprintBrowserProxyImpl.getInstance(); 97 this.browserProxy_ = settings.FingerprintBrowserProxyImpl.getInstance();
95 }, 98 },
96 99
97 /** 100 /**
98 * Overridden from settings.RouteObserverBehavior. 101 * Overridden from settings.RouteObserverBehavior.
99 * @param {!settings.Route} newRoute 102 * @param {!settings.Route} newRoute
100 * @param {!settings.Route} oldRoute 103 * @param {!settings.Route} oldRoute
101 * @protected 104 * @protected
102 */ 105 */
103 currentRouteChanged: function(newRoute, oldRoute) { 106 currentRouteChanged: function(newRoute, oldRoute) {
104 if (newRoute == settings.Route.LOCK_SCREEN && 107 if (newRoute == settings.Route.LOCK_SCREEN &&
105 this.fingerprintUnlockEnabled_ && 108 this.fingerprintUnlockEnabled_ &&
106 this.browserProxy_) { 109 this.browserProxy_) {
107 this.browserProxy_.getNumFingerprints().then( 110 this.browserProxy_.getNumFingerprints().then(
108 function(numFingerprints) { 111 function(numFingerprints) {
109 this.numFingerprints_ = numFingerprints; 112 this.numFingerprints_ = numFingerprints;
110 }.bind(this)); 113 }.bind(this));
111 } 114 }
112 115
113 if (this.shouldAskForPassword_(newRoute)) { 116 if (newRoute == settings.Route.LOCK_SCREEN && !this.setModes_) {
114 this.$.passwordPrompt.open(); 117 this.$.passwordPrompt.open();
115 } else if (newRoute != settings.Route.FINGERPRINT && 118 } else if (newRoute != settings.Route.FINGERPRINT &&
116 oldRoute != settings.Route.FINGERPRINT) { 119 oldRoute != settings.Route.FINGERPRINT) {
117 // If the user navigated away from the lock screen settings page they will 120 // If the user navigated away from the lock screen settings page they will
118 // have to re-enter their password. An exception is if they are navigating 121 // have to re-enter their password. An exception is if they are navigating
119 // to or from the fingerprint subpage. 122 // to or from the fingerprint subpage.
120 this.setModes_ = undefined; 123 this.setModes_ = undefined;
121 } 124 }
122 }, 125 },
123 126
124 /** 127 /**
125 * Called when the unlock type has changed. 128 * Called when the unlock type has changed.
126 * @param {!string} selected The current unlock type. 129 * @param {!string} selected The current unlock type.
127 * @private 130 * @private
128 */ 131 */
129 selectedUnlockTypeChanged_: function(selected) { 132 selectedUnlockTypeChanged_: function(selected) {
130 if (selected == LockScreenUnlockType.VALUE_PENDING) 133 if (selected == LockScreenUnlockType.VALUE_PENDING)
131 return; 134 return;
132 135
133 if (selected != LockScreenUnlockType.PIN_PASSWORD && this.setModes_) { 136 if (selected != LockScreenUnlockType.PIN_PASSWORD && this.setModes_) {
134 this.setModes_.call(null, [], [], function(didSet) { 137 this.setModes_.call(null, [], [], function(didSet) {
135 assert(didSet, 'Failed to clear quick unlock modes'); 138 assert(didSet, 'Failed to clear quick unlock modes');
136 }); 139 });
137 } 140 }
138 }, 141 },
139 142
140 /** @private */ 143 /** @private */
141 onSetModesChanged_: function() { 144 onSetModesChanged_: function() {
142 if (this.shouldAskForPassword_(settings.getCurrentRoute())) { 145 if (settings.getCurrentRoute() == settings.Route.LOCK_SCREEN &&
146 !this.setModes_) {
143 this.$.setupPin.close(); 147 this.$.setupPin.close();
144 this.$.passwordPrompt.open(); 148 this.$.passwordPrompt.open();
145 } 149 }
146 }, 150 },
147 151
148 /** @private */ 152 /** @private */
149 onPasswordClosed_: function() { 153 onPasswordClosed_: function() {
150 if (!this.setModes_) 154 if (!this.setModes_)
151 settings.navigateTo(settings.Route.PEOPLE); 155 settings.navigateTo(settings.Route.PEOPLE);
152 }, 156 },
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 onConfigurePin_: function(e) { 194 onConfigurePin_: function(e) {
191 e.preventDefault(); 195 e.preventDefault();
192 this.$.setupPin.open(); 196 this.$.setupPin.open();
193 this.writeUma_(LockScreenProgress.CHOOSE_PIN_OR_PASSWORD); 197 this.writeUma_(LockScreenProgress.CHOOSE_PIN_OR_PASSWORD);
194 }, 198 },
195 199
196 /** @private */ 200 /** @private */
197 onEditFingerprints_: function() { 201 onEditFingerprints_: function() {
198 settings.navigateTo(settings.Route.FINGERPRINT); 202 settings.navigateTo(settings.Route.FINGERPRINT);
199 }, 203 },
200
201 /**
202 * @param {!settings.Route} route
203 * @return {boolean} Whether the password dialog should be shown.
204 * @private
205 */
206 shouldAskForPassword_: function(route) {
207 return route == settings.Route.LOCK_SCREEN && !this.setModes_;
208 },
209 }); 204 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/options_resources.grd ('k') | chrome/browser/ui/webui/options/browser_options_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698