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

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

Issue 2210933004: Settings Router Refactor: Kill settings-router. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge yet again because this conflicts with everything 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
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-quick-unlock-choose-method' allows the user to change how they 7 * 'settings-quick-unlock-choose-method' allows the user to change how they
8 * unlock their device. Note that setting up the unlock method is delegated 8 * unlock their device. Note that setting up the unlock method is delegated
9 * to other elements. 9 * to other elements.
10 * 10 *
11 * Example: 11 * Example:
12 * 12 *
13 * <settings-quick-unlock-choose-method 13 * <settings-quick-unlock-choose-method
14 * set-modes="[[quickUnlockSetModes]]" 14 * set-modes="[[quickUnlockSetModes]]"
15 * current-route="{{currentRoute}}"
16 * prefs="{{prefs}}"> 15 * prefs="{{prefs}}">
17 * </settings-quick-unlock-choose-method> 16 * </settings-quick-unlock-choose-method>
18 */ 17 */
19 18
20 (function() { 19 (function() {
21 'use strict'; 20 'use strict';
22 21
23 /** @const */ var ENABLE_LOCK_SCREEN_PREF = 'settings.enable_screen_lock'; 22 /** @const */ var ENABLE_LOCK_SCREEN_PREF = 'settings.enable_screen_lock';
24 23
25 /** @enum {string} */ 24 /** @enum {string} */
26 var QuickUnlockUnlockType = { 25 var QuickUnlockUnlockType = {
27 VALUE_PENDING: 'value_pending', 26 VALUE_PENDING: 'value_pending',
28 NONE: 'none', 27 NONE: 'none',
29 PASSWORD: 'password', 28 PASSWORD: 'password',
30 PIN_PASSWORD: 'pin+password' 29 PIN_PASSWORD: 'pin+password'
31 }; 30 };
32 31
33 Polymer({ 32 Polymer({
34 is: 'settings-quick-unlock-choose-method', 33 is: 'settings-quick-unlock-choose-method',
35 34
36 behaviors: [PrefsBehavior, QuickUnlockPasswordDetectBehavior], 35 behaviors: [PrefsBehavior, QuickUnlockPasswordDetectBehavior],
37 36
38 properties: { 37 properties: {
39 /** @type {!settings.Route} */
40 currentRoute: {
41 type: Object,
42 observer: 'onRouteChanged_',
43 },
44
45 /** Preferences state. */ 38 /** Preferences state. */
46 prefs: { 39 prefs: {
47 type: Object, 40 type: Object,
48 notify: true, 41 notify: true,
49 }, 42 },
50 43
51 /** 44 /**
52 * The currently selected unlock type. 45 * The currently selected unlock type.
53 * @type {!QuickUnlockUnlockType} 46 * @type {!QuickUnlockUnlockType}
54 * @private 47 * @private
(...skipping 18 matching lines...) Expand all
73 this.updateUnlockType_(); 66 this.updateUnlockType_();
74 } 67 }
75 }.bind(this); 68 }.bind(this);
76 this.boundOnActiveModesChanged_ = this.updateUnlockType_.bind(this); 69 this.boundOnActiveModesChanged_ = this.updateUnlockType_.bind(this);
77 70
78 chrome.settingsPrivate.onPrefsChanged.addListener( 71 chrome.settingsPrivate.onPrefsChanged.addListener(
79 this.boundOnPrefsChanged_); 72 this.boundOnPrefsChanged_);
80 chrome.quickUnlockPrivate.onActiveModesChanged.addListener( 73 chrome.quickUnlockPrivate.onActiveModesChanged.addListener(
81 this.boundOnActiveModesChanged_); 74 this.boundOnActiveModesChanged_);
82 75
83 if (this.currentRoute == settings.Route.QUICK_UNLOCK_CHOOSE_METHOD) 76 if (settings.getCurrentRoute() == settings.Route.QUICK_UNLOCK_CHOOSE_METHOD)
Dan Beam 2016/08/05 18:25:19 indent off
tommycli 2016/08/05 18:54:06 Done.
84 this.askForPasswordIfUnset(); 77 this.askForPasswordIfUnset();
85 }, 78 },
86 79
87 /** @override */ 80 /** @override */
88 detached: function() { 81 detached: function() {
89 chrome.settingsPrivate.onPrefsChanged.removeListener( 82 chrome.settingsPrivate.onPrefsChanged.removeListener(
90 this.boundOnPrefsChanged_); 83 this.boundOnPrefsChanged_);
91 chrome.quickUnlockPrivate.onActiveModesChanged.removeListener( 84 chrome.quickUnlockPrivate.onActiveModesChanged.removeListener(
92 this.boundOnActiveModesChanged_); 85 this.boundOnActiveModesChanged_);
93 }, 86 },
94 87
95 /** @private */ 88 /** @protected */
96 onRouteChanged_: function() { 89 currentRouteChanged: function() {
97 if (this.currentRoute == settings.Route.QUICK_UNLOCK_CHOOSE_METHOD) 90 if (settings.getCurrentRoute() == settings.Route.QUICK_UNLOCK_CHOOSE_METHOD)
98 this.askForPasswordIfUnset(); 91 this.askForPasswordIfUnset();
99 }, 92 },
100 93
101 /** @private */ 94 /** @private */
102 onSetModesChanged_: function() { 95 onSetModesChanged_: function() {
103 if (this.currentRoute == settings.Route.QUICK_UNLOCK_CHOOSE_METHOD) 96 if (settings.getCurrentRoute() == settings.Route.QUICK_UNLOCK_CHOOSE_METHOD)
104 this.askForPasswordIfUnset(); 97 this.askForPasswordIfUnset();
105 }, 98 },
106 99
107 /** 100 /**
108 * Updates the selected unlock type radio group. This function will get called 101 * Updates the selected unlock type radio group. This function will get called
109 * after preferences are initialized, after the quick unlock mode has been 102 * after preferences are initialized, after the quick unlock mode has been
110 * changed, and after the lockscreen preference has changed. 103 * changed, and after the lockscreen preference has changed.
111 * 104 *
112 * @private 105 * @private
113 */ 106 */
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 return selectedUnlockType === QuickUnlockUnlockType.PIN_PASSWORD; 165 return selectedUnlockType === QuickUnlockUnlockType.PIN_PASSWORD;
173 }, 166 },
174 167
175 /** @private */ 168 /** @private */
176 onConfigurePin_: function() { 169 onConfigurePin_: function() {
177 settings.navigateTo(settings.Route.QUICK_UNLOCK_SETUP_PIN); 170 settings.navigateTo(settings.Route.QUICK_UNLOCK_SETUP_PIN);
178 }, 171 },
179 }); 172 });
180 173
181 })(); 174 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698