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

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

Issue 2154213008: Settings Router Refactor: Clean up Quick Unlock (and a few misc fixes) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@0211-settings-router-impl-part-3-navigateTo
Patch Set: change test 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-setup-pin' is the settings page for choosing a PIN. 7 * 'settings-quick-unlock-setup-pin' is the settings page for choosing a PIN.
8 * 8 *
9 * Example: 9 * Example:
10 * 10 *
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 * @const 44 * @const
45 */ 45 */
46 var WEAK_PINS = [ 46 var WEAK_PINS = [
47 '1234', '1111', '0000', '1212', '7777', '1004', '2000', '4444', '2222', 47 '1234', '1111', '0000', '1212', '7777', '1004', '2000', '4444', '2222',
48 '6969' 48 '6969'
49 ]; 49 ];
50 50
51 Polymer({ 51 Polymer({
52 is: 'settings-quick-unlock-setup-pin', 52 is: 'settings-quick-unlock-setup-pin',
53 53
54 behaviors: [ 54 behaviors: [I18nBehavior, QuickUnlockPasswordDetectBehavior],
55 QuickUnlockPasswordDetectBehavior,
56 I18nBehavior
57 ],
58 55
59 properties: { 56 properties: {
57 /** @type {!settings.Route} */
58 currentRoute: {
59 type: Object,
60 observer: 'onRouteChanged_',
61 },
62
60 /** 63 /**
61 * The current PIN keyboard value. 64 * The current PIN keyboard value.
62 * @private 65 * @private
63 */ 66 */
64 pinKeyboardValue_: String, 67 pinKeyboardValue_: String,
65 68
66 /** 69 /**
67 * Stores the initial PIN value so it can be confirmed. 70 * Stores the initial PIN value so it can be confirmed.
68 * @private 71 * @private
69 */ 72 */
(...skipping 19 matching lines...) Expand all
89 /** 92 /**
90 * The current step/subpage we are on. 93 * The current step/subpage we are on.
91 * @private 94 * @private
92 */ 95 */
93 isConfirmStep_: { 96 isConfirmStep_: {
94 type: Boolean, 97 type: Boolean,
95 value: false 98 value: false
96 }, 99 },
97 }, 100 },
98 101
99 observers: [ 102 observers: ['onSetModesChanged_(setModes)'],
100 'onRouteChanged_(currentRoute)',
101 'onSetModesChanged_(setModes)'
102 ],
103 103
104 /** @override */ 104 /** @override */
105 attached: function() { 105 attached: function() {
106 this.resetState_(); 106 this.resetState_();
107 107
108 if (this.isScreenActive(QuickUnlockScreen.SETUP_PIN)) 108 if (this.currentRoute == settings.Route.QUICK_UNLOCK_SETUP_PIN)
109 this.askForPasswordIfUnset(); 109 this.askForPasswordIfUnset();
110 }, 110 },
111 111
112 /** 112 /**
113 * @param {!settings.Route} currentRoute 113 * @param {!settings.Route} currentRoute
114 * @private 114 * @private
115 */ 115 */
116 onRouteChanged_: function(currentRoute) { 116 onRouteChanged_: function(currentRoute) {
117 if (this.isScreenActive(QuickUnlockScreen.SETUP_PIN)) { 117 if (this.currentRoute == settings.Route.QUICK_UNLOCK_SETUP_PIN) {
118 this.askForPasswordIfUnset(); 118 this.askForPasswordIfUnset();
119 } else { 119 } else {
120 // If the user hits the back button, they can leave the element 120 // If the user hits the back button, they can leave the element
121 // half-completed; therefore, reset state if the element is not active. 121 // half-completed; therefore, reset state if the element is not active.
122 this.resetState_(); 122 this.resetState_();
123 } 123 }
124 }, 124 },
125 125
126 /** @private */ 126 /** @private */
127 onSetModesChanged_: function() { 127 onSetModesChanged_: function() {
128 if (this.isScreenActive(QuickUnlockScreen.SETUP_PIN)) 128 if (this.currentRoute == settings.Route.QUICK_UNLOCK_SETUP_PIN)
129 this.askForPasswordIfUnset(); 129 this.askForPasswordIfUnset();
130 }, 130 },
131 131
132 /** 132 /**
133 * Resets the element to the initial state. 133 * Resets the element to the initial state.
134 * @private 134 * @private
135 */ 135 */
136 resetState_: function() { 136 resetState_: function() {
137 this.initialPin_ = ''; 137 this.initialPin_ = '';
138 this.pinKeyboardValue_ = ''; 138 this.pinKeyboardValue_ = '';
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 * @return {string} 289 * @return {string}
290 */ 290 */
291 getContinueMessage_: function(isConfirmStep) { 291 getContinueMessage_: function(isConfirmStep) {
292 if (!isConfirmStep) 292 if (!isConfirmStep)
293 return this.i18n('quickUnlockConfigurePinContinueButton'); 293 return this.i18n('quickUnlockConfigurePinContinueButton');
294 return this.i18n('save'); 294 return this.i18n('save');
295 }, 295 },
296 }); 296 });
297 297
298 })(); 298 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698