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

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

Issue 2893053002: md-settings: wrap lock screen dialogs in dom-if. (Closed)
Patch Set: Fixed patch set 1 errors. Created 3 years, 6 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 loadTimeData.getBoolean('easyUnlockProximityDetectionAllowed'); 116 loadTimeData.getBoolean('easyUnlockProximityDetectionAllowed');
117 }, 117 },
118 readOnly: true, 118 readOnly: true,
119 }, 119 },
120 120
121 /** @private */ 121 /** @private */
122 showEasyUnlockTurnOffDialog_: { 122 showEasyUnlockTurnOffDialog_: {
123 type: Boolean, 123 type: Boolean,
124 value: false, 124 value: false,
125 }, 125 },
126
127 /** @private */
128 showPasswordPromptDialog_: Boolean,
129
130 /** @private */
131 showSetupPinDialog_: Boolean,
126 }, 132 },
127 133
128 /** @private {?settings.EasyUnlockBrowserProxy} */ 134 /** @private {?settings.EasyUnlockBrowserProxy} */
129 easyUnlockBrowserProxy_: null, 135 easyUnlockBrowserProxy_: null,
130 136
131 /** @private {?settings.FingerprintBrowserProxy} */ 137 /** @private {?settings.FingerprintBrowserProxy} */
132 fingerprintBrowserProxy_: null, 138 fingerprintBrowserProxy_: null,
133 139
134 /** selectedUnlockType is defined in LockStateBehavior. */ 140 /** selectedUnlockType is defined in LockStateBehavior. */
135 observers: ['selectedUnlockTypeChanged_(selectedUnlockType)'], 141 observers: ['selectedUnlockTypeChanged_(selectedUnlockType)'],
136 142
137 /** @override */ 143 /** @override */
138 attached: function() { 144 attached: function() {
139 if (this.shouldAskForPassword_(settings.getCurrentRoute())) 145 if (this.shouldAskForPassword_(settings.getCurrentRoute()))
140 this.$.passwordPrompt.open(); 146 this.openPasswordPromptDialog_();
141 147
142 this.easyUnlockBrowserProxy_ = 148 this.easyUnlockBrowserProxy_ =
143 settings.EasyUnlockBrowserProxyImpl.getInstance(); 149 settings.EasyUnlockBrowserProxyImpl.getInstance();
144 this.fingerprintBrowserProxy_ = 150 this.fingerprintBrowserProxy_ =
145 settings.FingerprintBrowserProxyImpl.getInstance(); 151 settings.FingerprintBrowserProxyImpl.getInstance();
146 152
147 if (this.easyUnlockAllowed_) { 153 if (this.easyUnlockAllowed_) {
148 this.addWebUIListener( 154 this.addWebUIListener(
149 'easy-unlock-enabled-status', 155 'easy-unlock-enabled-status',
150 this.handleEasyUnlockEnabledStatusChanged_.bind(this)); 156 this.handleEasyUnlockEnabledStatusChanged_.bind(this));
(...skipping 11 matching lines...) Expand all
162 currentRouteChanged: function(newRoute, oldRoute) { 168 currentRouteChanged: function(newRoute, oldRoute) {
163 if (newRoute == settings.Route.LOCK_SCREEN && 169 if (newRoute == settings.Route.LOCK_SCREEN &&
164 this.fingerprintUnlockEnabled_ && this.fingerprintBrowserProxy_) { 170 this.fingerprintUnlockEnabled_ && this.fingerprintBrowserProxy_) {
165 this.fingerprintBrowserProxy_.getNumFingerprints().then( 171 this.fingerprintBrowserProxy_.getNumFingerprints().then(
166 function(numFingerprints) { 172 function(numFingerprints) {
167 this.numFingerprints_ = numFingerprints; 173 this.numFingerprints_ = numFingerprints;
168 }.bind(this)); 174 }.bind(this));
169 } 175 }
170 176
171 if (this.shouldAskForPassword_(newRoute)) { 177 if (this.shouldAskForPassword_(newRoute)) {
172 this.$.passwordPrompt.open(); 178 this.openPasswordPromptDialog_();
173 } else if (newRoute != settings.Route.FINGERPRINT && 179 } else if (newRoute != settings.Route.FINGERPRINT &&
174 oldRoute != settings.Route.FINGERPRINT) { 180 oldRoute != settings.Route.FINGERPRINT) {
175 // If the user navigated away from the lock screen settings page they will 181 // If the user navigated away from the lock screen settings page they will
176 // have to re-enter their password. An exception is if they are navigating 182 // have to re-enter their password. An exception is if they are navigating
177 // to or from the fingerprint subpage. 183 // to or from the fingerprint subpage.
178 this.setModes_ = undefined; 184 this.setModes_ = undefined;
179 } 185 }
180 }, 186 },
181 187
182 /** 188 /**
183 * Called when the unlock type has changed. 189 * Called when the unlock type has changed.
184 * @param {!string} selected The current unlock type. 190 * @param {!string} selected The current unlock type.
185 * @private 191 * @private
186 */ 192 */
187 selectedUnlockTypeChanged_: function(selected) { 193 selectedUnlockTypeChanged_: function(selected) {
188 if (selected == LockScreenUnlockType.VALUE_PENDING) 194 if (selected == LockScreenUnlockType.VALUE_PENDING)
189 return; 195 return;
190 196
191 if (selected != LockScreenUnlockType.PIN_PASSWORD && this.setModes_) { 197 if (selected != LockScreenUnlockType.PIN_PASSWORD && this.setModes_) {
192 this.setModes_.call(null, [], [], function(didSet) { 198 this.setModes_.call(null, [], [], function(didSet) {
193 assert(didSet, 'Failed to clear quick unlock modes'); 199 assert(didSet, 'Failed to clear quick unlock modes');
194 }); 200 });
195 } 201 }
196 }, 202 },
197 203
198 /** @private */ 204 /** @private */
199 onSetModesChanged_: function() { 205 onSetModesChanged_: function() {
200 if (this.shouldAskForPassword_(settings.getCurrentRoute())) { 206 if (this.shouldAskForPassword_(settings.getCurrentRoute())) {
201 this.$.setupPin.close(); 207 this.$.setupPin.close();
202 this.$.passwordPrompt.open(); 208 this.openPasswordPromptDialog_();
203 } 209 }
204 }, 210 },
205 211
206 /** @private */ 212 /** @private */
207 onPasswordClosed_: function() { 213 openPasswordPromptDialog_: function() {
214 this.showPasswordPromptDialog_ = true;
215 },
216
217 /** @private */
218 onPasswordPromptDialogClose_: function() {
219 this.showPasswordPromptDialog_ = false;
208 if (!this.setModes_) 220 if (!this.setModes_)
209 settings.navigateTo(settings.Route.PEOPLE); 221 settings.navigateToPreviousRoute();
210 else 222 else
211 cr.ui.focusWithoutInk(assert(this.$$('#unlockType'))); 223 cr.ui.focusWithoutInk(assert(this.$$('#unlockType')));
212 }, 224 },
213 225
214 /** @private */ 226 /**
215 onPinSetupDone_: function() { 227 * @param {!Event} e
216 this.$.setupPin.close(); 228 * @private
229 */
230 onConfigurePin_: function(e) {
231 e.preventDefault();
232 this.writeUma_(LockScreenProgress.CHOOSE_PIN_OR_PASSWORD);
233 this.showSetupPinDialog_ = true;
217 }, 234 },
218 235
219 /** @private */ 236 /** @private */
220 onSetupPinClosed_: function() { 237 onSetupPinDialogClose_: function() {
238 this.showSetupPinDialog_ = false;
221 cr.ui.focusWithoutInk(assert(this.$$('#setupPinButton'))); 239 cr.ui.focusWithoutInk(assert(this.$$('#setupPinButton')));
222 }, 240 },
223 241
224 /** 242 /**
225 * Returns true if the setup pin section should be shown. 243 * Returns true if the setup pin section should be shown.
226 * @param {!string} selectedUnlockType The current unlock type. Used to let 244 * @param {!string} selectedUnlockType The current unlock type. Used to let
227 * Polymer know about the dependency. 245 * Polymer know about the dependency.
228 * @private 246 * @private
229 */ 247 */
230 showConfigurePinButton_: function(selectedUnlockType) { 248 showConfigurePinButton_: function(selectedUnlockType) {
(...skipping 13 matching lines...) Expand all
244 /** @private */ 262 /** @private */
245 getDescriptionText_: function() { 263 getDescriptionText_: function() {
246 if (this.numFingerprints_ > 0) { 264 if (this.numFingerprints_ > 0) {
247 return this.i18n('lockScreenNumberFingerprints', 265 return this.i18n('lockScreenNumberFingerprints',
248 this.numFingerprints_.toString()); 266 this.numFingerprints_.toString());
249 } 267 }
250 268
251 return this.i18n('lockScreenEditFingerprintsDescription'); 269 return this.i18n('lockScreenEditFingerprintsDescription');
252 }, 270 },
253 271
254 /**
255 * @param {!Event} e
256 * @private
257 */
258 onConfigurePin_: function(e) {
259 e.preventDefault();
260 this.$.setupPin.open();
261 this.writeUma_(LockScreenProgress.CHOOSE_PIN_OR_PASSWORD);
262 },
263
264 /** @private */ 272 /** @private */
265 onEditFingerprints_: function() { 273 onEditFingerprints_: function() {
266 settings.navigateTo(settings.Route.FINGERPRINT); 274 settings.navigateTo(settings.Route.FINGERPRINT);
267 }, 275 },
268 276
269 /** 277 /**
270 * @param {!settings.Route} route 278 * @param {!settings.Route} route
271 * @return {boolean} Whether the password dialog should be shown. 279 * @return {boolean} Whether the password dialog should be shown.
272 * @private 280 * @private
273 */ 281 */
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 /** 331 /**
324 * @param {boolean} easyUnlockEnabled 332 * @param {boolean} easyUnlockEnabled
325 * @param {boolean} proximityDetectionAllowed 333 * @param {boolean} proximityDetectionAllowed
326 * @private 334 * @private
327 */ 335 */
328 getShowEasyUnlockToggle_: function( 336 getShowEasyUnlockToggle_: function(
329 easyUnlockEnabled, proximityDetectionAllowed) { 337 easyUnlockEnabled, proximityDetectionAllowed) {
330 return easyUnlockEnabled && proximityDetectionAllowed; 338 return easyUnlockEnabled && proximityDetectionAllowed;
331 }, 339 },
332 }); 340 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698