| OLD | NEW |
| 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-setup-pin-dialog' is the settings page for choosing a PIN. | 7 * 'settings-setup-pin-dialog' is the settings page for choosing a PIN. |
| 8 * | 8 * |
| 9 * Example: | 9 * Example: |
| 10 * | 10 * |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 */ | 54 */ |
| 55 problemClass_: String, | 55 problemClass_: String, |
| 56 | 56 |
| 57 /** | 57 /** |
| 58 * Should the step-specific submit button be displayed? | 58 * Should the step-specific submit button be displayed? |
| 59 * @private | 59 * @private |
| 60 */ | 60 */ |
| 61 enableSubmit_: Boolean, | 61 enableSubmit_: Boolean, |
| 62 | 62 |
| 63 /** | 63 /** |
| 64 * writeUma_ is a function that handles writing uma stats. It may be |
| 65 * overridden for tests. |
| 66 * |
| 67 * @type {Function} |
| 68 * @private |
| 69 */ |
| 70 writeUma_: { |
| 71 type: Object, |
| 72 value: function() { return settings.recordLockScreenProgress; } |
| 73 }, |
| 74 |
| 75 /** |
| 64 * The current step/subpage we are on. | 76 * The current step/subpage we are on. |
| 65 * @private | 77 * @private |
| 66 */ | 78 */ |
| 67 isConfirmStep_: { | 79 isConfirmStep_: { |
| 68 type: Boolean, | 80 type: Boolean, |
| 69 value: false | 81 value: false |
| 70 }, | 82 }, |
| 71 }, | 83 }, |
| 72 | 84 |
| 73 /** @override */ | 85 /** @override */ |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 | 215 |
| 204 /** @private */ | 216 /** @private */ |
| 205 onPinSubmit_: function() { | 217 onPinSubmit_: function() { |
| 206 if (!this.isConfirmStep_) { | 218 if (!this.isConfirmStep_) { |
| 207 if (this.isPinLongEnough_(this.pinKeyboardValue_)) { | 219 if (this.isPinLongEnough_(this.pinKeyboardValue_)) { |
| 208 this.initialPin_ = this.pinKeyboardValue_; | 220 this.initialPin_ = this.pinKeyboardValue_; |
| 209 this.pinKeyboardValue_ = ''; | 221 this.pinKeyboardValue_ = ''; |
| 210 this.isConfirmStep_ = true; | 222 this.isConfirmStep_ = true; |
| 211 this.onPinChange_(); | 223 this.onPinChange_(); |
| 212 this.$.pinKeyboard.focus(); | 224 this.$.pinKeyboard.focus(); |
| 225 this.writeUma_(LockScreenProgress.ENTER_PIN); |
| 213 } | 226 } |
| 214 } else { | 227 } else { |
| 215 // onPinSubmit_ gets called if the user hits enter on the PIN keyboard. | 228 // onPinSubmit_ gets called if the user hits enter on the PIN keyboard. |
| 216 // The PIN is not guaranteed to be valid in that case. | 229 // The PIN is not guaranteed to be valid in that case. |
| 217 if (!this.isPinConfirmed_()) { | 230 if (!this.isPinConfirmed_()) { |
| 218 this.showProblem_('configurePinMismatched', 'error'); | 231 this.showProblem_('configurePinMismatched', 'error'); |
| 219 return; | 232 return; |
| 220 } | 233 } |
| 221 | 234 |
| 222 function onSetModesCompleted(didSet) { | 235 function onSetModesCompleted(didSet) { |
| 223 if (!didSet) { | 236 if (!didSet) { |
| 224 console.error('Failed to update pin'); | 237 console.error('Failed to update pin'); |
| 225 return; | 238 return; |
| 226 } | 239 } |
| 227 | 240 |
| 228 this.resetState_(); | 241 this.resetState_(); |
| 229 this.fire('done'); | 242 this.fire('done'); |
| 230 } | 243 } |
| 231 | 244 |
| 232 this.setModes.call( | 245 this.setModes.call( |
| 233 null, | 246 null, |
| 234 [chrome.quickUnlockPrivate.QuickUnlockMode.PIN], | 247 [chrome.quickUnlockPrivate.QuickUnlockMode.PIN], |
| 235 [this.pinKeyboardValue_], | 248 [this.pinKeyboardValue_], |
| 236 onSetModesCompleted.bind(this)); | 249 onSetModesCompleted.bind(this)); |
| 250 this.writeUma_(LockScreenProgress.CONFIRM_PIN); |
| 237 } | 251 } |
| 238 }, | 252 }, |
| 239 | 253 |
| 240 /** | 254 /** |
| 241 * @private | 255 * @private |
| 242 * @param {string} problemMessage | 256 * @param {string} problemMessage |
| 243 * @return {boolean} | 257 * @return {boolean} |
| 244 */ | 258 */ |
| 245 hasProblem_: function(problemMessage) { | 259 hasProblem_: function(problemMessage) { |
| 246 return !!problemMessage; | 260 return !!problemMessage; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 260 * @private | 274 * @private |
| 261 * @param {boolean} isConfirmStep | 275 * @param {boolean} isConfirmStep |
| 262 * @return {string} | 276 * @return {string} |
| 263 */ | 277 */ |
| 264 getContinueMessage_: function(isConfirmStep) { | 278 getContinueMessage_: function(isConfirmStep) { |
| 265 return this.i18n(isConfirmStep ? 'confirm' : 'configurePinContinueButton'); | 279 return this.i18n(isConfirmStep ? 'confirm' : 'configurePinContinueButton'); |
| 266 }, | 280 }, |
| 267 }); | 281 }); |
| 268 | 282 |
| 269 })(); | 283 })(); |
| OLD | NEW |