Chromium Code Reviews| Index: chrome/browser/resources/settings/people_page/lock_screen_constants.js |
| diff --git a/chrome/browser/resources/settings/people_page/lock_screen_constants.js b/chrome/browser/resources/settings/people_page/lock_screen_constants.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..33d03c8012377573f25d619383867171f75e7a9e |
| --- /dev/null |
| +++ b/chrome/browser/resources/settings/people_page/lock_screen_constants.js |
| @@ -0,0 +1,43 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +/** |
| + * @fileoverview Constants used for logging the pin unlock setup uma. |
| + */ |
| + |
| +/** |
| + * Name of the pin unlock setup uma histogram. |
| + * @type {string} |
| + */ |
| +var PinUnlockUmaHistogramName = 'Settings.PinUnlockSetup'; |
| + |
| +/** |
| + * Stages the user can enter while setting up pin unlock. |
| + * @enum {number} |
| + */ |
| +var LockScreenProgress = { |
| + START_SCREEN_LOCK: 0, |
| + ENTER_PASSWORD_CORRECTLY: 1, |
| + CHOOSE_PIN_OR_PASSWORD: 2, |
| + ENTER_PIN: 3, |
| + CONFIRM_PIN: 4, |
| + MAX_BUCKET: 5 |
| +}; |
| + |
| +/** |
| + * Helper function to send the progress of the pin setup to be recorded in the |
| + * histogram. |
| + * @param {LockScreenProgress} currentProgress |
| + */ |
| +var recordLockScreenProgress = function(currentProgress) { |
|
Dan Beam
2016/12/16 08:31:01
maybe put this in a namespace? i.e. settings.reco
sammiequon
2016/12/17 18:17:13
Done.
|
| + if (currentProgress >= LockScreenProgress.MAX_BUCKET) { |
| + console.error('Expected a enumeration value of ' + |
| + LockScreenProgress.MAX_BUCKET + ' or lower: Received ' + |
| + currentProgress + '.'); |
| + return; |
| + } |
| + chrome.send('metricsHandler:recordInHistogram', |
| + [PinUnlockUmaHistogramName, currentProgress, |
| + LockScreenProgress.MAX_BUCKET]); |
| +}; |