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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
197 | 197 |
198 /** @private */ | 198 /** @private */ |
199 onPinSubmit_: function() { | 199 onPinSubmit_: function() { |
200 if (!this.isConfirmStep_) { | 200 if (!this.isConfirmStep_) { |
201 if (this.isPinLongEnough_(this.pinKeyboardValue_)) { | 201 if (this.isPinLongEnough_(this.pinKeyboardValue_)) { |
202 this.initialPin_ = this.pinKeyboardValue_; | 202 this.initialPin_ = this.pinKeyboardValue_; |
203 this.pinKeyboardValue_ = ''; | 203 this.pinKeyboardValue_ = ''; |
204 this.isConfirmStep_ = true; | 204 this.isConfirmStep_ = true; |
205 this.onPinChange_(); | 205 this.onPinChange_(); |
206 this.$.pinKeyboard.focus(); | 206 this.$.pinKeyboard.focus(); |
207 chrome.send('metricsHandler:recordInHistogram', | |
208 [PinUnlockUmaHistogramName, PinUnlockSetupType.ENTER_PIN, | |
209 PinUnlockSetupType.MAX_BUCKET]); | |
207 } | 210 } |
208 } else { | 211 } else { |
209 // onPinSubmit_ gets called if the user hits enter on the PIN keyboard. | 212 // onPinSubmit_ gets called if the user hits enter on the PIN keyboard. |
210 // The PIN is not guaranteed to be valid in that case. | 213 // The PIN is not guaranteed to be valid in that case. |
211 if (!this.canSubmit_()) | 214 if (!this.canSubmit_()) |
212 return; | 215 return; |
213 | 216 |
214 function onSetModesCompleted(didSet) { | 217 function onSetModesCompleted(didSet) { |
215 if (!didSet) { | 218 if (!didSet) { |
216 console.error('Failed to update pin'); | 219 console.error('Failed to update pin'); |
217 return; | 220 return; |
218 } | 221 } |
219 | 222 |
220 this.resetState_(); | 223 this.resetState_(); |
221 this.fire('done'); | 224 this.fire('done'); |
222 } | 225 } |
223 | 226 |
224 this.setModes.call( | 227 this.setModes.call( |
225 null, | 228 null, |
226 [chrome.quickUnlockPrivate.QuickUnlockMode.PIN], | 229 [chrome.quickUnlockPrivate.QuickUnlockMode.PIN], |
227 [this.pinKeyboardValue_], | 230 [this.pinKeyboardValue_], |
228 onSetModesCompleted.bind(this)); | 231 onSetModesCompleted.bind(this)); |
232 chrome.send('metricsHandler:recordInHistogram', | |
jdufault
2016/09/13 18:36:05
fix indentation
sammiequon
2016/09/13 19:21:40
Done.
| |
233 [PinUnlockUmaHistogramName, PinUnlockSetupType.CONFIRM_PIN, | |
234 PinUnlockSetupType.MAX_BUCKET]); | |
229 } | 235 } |
230 }, | 236 }, |
231 | 237 |
232 /** | 238 /** |
233 * @private | 239 * @private |
234 * @param {string} problemMessage | 240 * @param {string} problemMessage |
235 * @return {boolean} | 241 * @return {boolean} |
236 */ | 242 */ |
237 hasProblem_: function(problemMessage) { | 243 hasProblem_: function(problemMessage) { |
238 return !!problemMessage; | 244 return !!problemMessage; |
(...skipping 13 matching lines...) Expand all Loading... | |
252 * @private | 258 * @private |
253 * @param {boolean} isConfirmStep | 259 * @param {boolean} isConfirmStep |
254 * @return {string} | 260 * @return {string} |
255 */ | 261 */ |
256 getContinueMessage_: function(isConfirmStep) { | 262 getContinueMessage_: function(isConfirmStep) { |
257 return this.i18n(isConfirmStep ? 'confirm' : 'configurePinContinueButton'); | 263 return this.i18n(isConfirmStep ? 'confirm' : 'configurePinContinueButton'); |
258 }, | 264 }, |
259 }); | 265 }); |
260 | 266 |
261 })(); | 267 })(); |
OLD | NEW |