Chromium Code Reviews| Index: chrome/browser/resources/hotword/metrics.js |
| diff --git a/chrome/browser/resources/hotword/metrics.js b/chrome/browser/resources/hotword/metrics.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..573dce413329db8c5f603da3594a9e63760243b6 |
| --- /dev/null |
| +++ b/chrome/browser/resources/hotword/metrics.js |
| @@ -0,0 +1,28 @@ |
| +// Copyright 2014 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. |
| + |
| +cr.define('hotword.metrics', function() { |
| + 'use strict'; |
| + |
| + /** |
| + * Helper function to record enum values in UMA. |
| + * @param {!string} name |
| + * @param {!number} value |
| + * @param {!number} max_value |
| + */ |
| + function recordEnum(name, value, max_value) { |
|
Dan Beam
2014/10/21 01:57:29
maxValue
Anand Mistry (off Chromium)
2014/10/21 05:26:41
Done.
|
| + var metricDesc = { |
| + 'metricName': name, |
| + 'type': 'histogram-linear', |
| + 'min': 1, |
| + 'max': max_value, |
| + 'buckets': max_value + 1 |
| + }; |
| + chrome.metricsPrivate.recordValue(metricDesc, value); |
| + } |
| + |
| + return { |
| + recordEnum: recordEnum |
| + }; |
| +}); |