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

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

Issue 2208473007: Rework quick unlock settings to follow new specs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Initial upload Created 4 years, 4 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
(Empty)
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
3 // found in the LICENSE file.
4
5 /**
6 * @fileoverview
7 * 'settings-lock-screen' allows the user to change how they unlock their
8 * device.
9 *
10 * Example:
11 *
12 * <settings-lock-screen
13 * set-modes="[[quickUnlockSetModes]]"
tommycli 2016/08/05 17:46:19 Is this example usage still up to date? It doesn't
jdufault 2016/08/05 20:59:51 Done.
14 * prefs="{{prefs}}">
15 * </settings-lock-screen>
16 */
17
18 (function() {
tommycli 2016/08/05 17:46:19 Since there's no variables here you want to keep o
jdufault 2016/08/05 20:59:51 Done.
19 'use strict';
20
21 Polymer({
22 is: 'settings-lock-screen',
23
24 behaviors: [I18nBehavior, LockStateBehavior],
25
26 properties: {
27 /** @type {!settings.Route} */
tommycli 2016/08/05 17:46:19 Since this is new code, I recommend using the new
jdufault 2016/08/05 20:59:51 Done.
28 currentRoute: {
29 type: Object,
30 observer: 'onRouteChanged_',
31 },
32
33 /** Preferences state. */
34 prefs: {
35 type: Object
36 },
37
38 /**
39 * @type {Object|undefined}
40 * @private
41 */
42 setModes_: {
tommycli 2016/08/05 17:46:19 Since this setModes_ usage is subtle, it could use
jdufault 2016/08/05 20:59:51 Done.
43 type: Object,
44 observer: 'onSetModesChanged_'
45 },
46 },
47
48 // selectedUnlockType is defined in LockStateBehavior.
tommycli 2016/08/05 17:46:19 nit: Comment should probably be like: /** Foo */
jdufault 2016/08/05 20:59:51 Done.
49 observers: ['selectedUnlockTypeChanged_(selectedUnlockType)'],
50
51 /** @private */
52 onRouteChanged_: function(currentRoute) {
tommycli 2016/08/05 17:46:19 If you go with the settings.RouteObserverBehavior
jdufault 2016/08/05 20:59:51 Done.
53 if (this.currentRoute == settings.Route.LOCK_SCREEN && !this.setModes_) {
54 this.$.passwordPrompt.open();
55 } else {
56 // If the user navigated away from the lock screen settings page they will
57 // have to re-enter their password.
58 this.setModes_ = undefined;
59 }
60 },
61
62 /**
63 * Called when the unlock type has changed.
64 * @param {!string} selected The current unlock type.
65 * @private
66 */
67 selectedUnlockTypeChanged_: function(selected) {
68 if (selected == LockScreenUnlockType.VALUE_PENDING)
69 return;
70
71 if (selected != LockScreenUnlockType.PIN_PASSWORD && this.setModes_) {
72 this.setModes_.call(null, [], [], function(didSet) {
73 assert(didSet, 'Failed to clear quick unlock modes');
74 });
75 }
76 },
77
78 /** @private */
79 onSetModesChanged_: function() {
80 if (this.currentRoute == settings.Route.LOCK_SCREEN && !this.setModes_) {
81 this.$.setupPin.close();
82 this.$.passwordPrompt.open();
83 }
84 },
85
86 /** @private */
87 onPasswordClosed_: function() {
88 if (!this.setModes_)
89 settings.navigateTo(settings.Route.PEOPLE);
90 },
91
92 /** @private */
93 onPinSetupDone_: function() {
94 this.$.setupPin.close();
95 },
96
97 /**
98 * Retruns true if the setup pin section should be shown.
tommycli 2016/08/05 17:46:19 typo: Returns
jdufault 2016/08/05 20:59:51 Done.
99 * @param {!string} selectedUnlockType The current unlock type. Used to let
100 * polymer know about the dependency.
tommycli 2016/08/05 17:46:19 nit: indent four spaces, then Polymer
jdufault 2016/08/05 20:59:51 Done.
101 * @private
102 */
103 showSetupPin_: function(selectedUnlockType) {
tommycli 2016/08/05 17:46:18 nit: maybe rename: showConfigurePinButton_ ?
jdufault 2016/08/05 20:59:51 Done.
104 return selectedUnlockType === LockScreenUnlockType.PIN_PASSWORD;
105 },
106
107 /** @private */
108 getSetupPinText_: function() {
tommycli 2016/08/05 17:46:19 My interpretation of the mocks was that selecting
jdufault 2016/08/05 20:59:51 That part of the mocks is likely to change (UI rev
109 if (this.hasPin)
110 return this.i18n('lockScreenChangePinButton');
111 return this.i18n('lockScreenSetupPinButton');
112 },
113
114 /** @private */
115 onConfigurePin_: function() {
116 this.$.setupPin.open();
117 },
118 });
119
120 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698