| Index: components/chrome_apps/webstore_widget/app/main.js
|
| diff --git a/components/chrome_apps/webstore_widget/app/main.js b/components/chrome_apps/webstore_widget/app/main.js
|
| index 1151da84a367588a199a5f6da0440fa529f86c89..8ada750b1506c200c131b721ac1eeb81651665ce 100644
|
| --- a/components/chrome_apps/webstore_widget/app/main.js
|
| +++ b/components/chrome_apps/webstore_widget/app/main.js
|
| @@ -68,20 +68,50 @@ function createPlatformDelegate(strings) {
|
|
|
| metricsImpl: {
|
| /**
|
| + * Map from interval name to interval start timestamp.
|
| + * @type {Object<string, Date>}
|
| + */
|
| + intervals: {},
|
| +
|
| + /**
|
| * @param {string} enumName
|
| * @param {number} value
|
| * @param {number} enumSize
|
| */
|
| - recordEnum: function(enumName, value, enumSize) {},
|
| + recordEnum: function(enumName, value, enumSize) {
|
| + var index = (value >= 0 && value < enumSize) ? value : enumSize - 1;
|
| + chrome.metricsPrivate.recordValue({
|
| + 'metricName': 'WebstoreWidgetApp.' + enumName,
|
| + 'type': 'histogram-linear',
|
| + 'min': 1,
|
| + 'max': enumSize,
|
| + 'buckets': enumSize
|
| + }, index);
|
| + },
|
|
|
| /** @param {string} actionName */
|
| - recordUserAction: function(actionName) {},
|
| + recordUserAction: function(actionName) {
|
| + chrome.metricsPrivate.recordUserAction(
|
| + 'WebstoreWidgetApp.' + actionName);
|
| + },
|
|
|
| /** @param {string} intervalName */
|
| - startInterval: function(intervalName) {},
|
| + startInterval: function(intervalName) {
|
| + this.intervals[intervalName] = Date.now();
|
| + },
|
|
|
| /** @param {string} intervalName */
|
| - recordInterval: function(intervalName) {}
|
| + recordInterval: function(intervalName) {
|
| + if (!intervalName in this.intervals) {
|
| + console.error('Interval \'' + intervalName + '\' not started');
|
| + return;
|
| + }
|
| +
|
| + chrome.metricsPrivate.recordTime(
|
| + 'WebstoreWidgetApp.' + intervalName,
|
| + Date.now() - this.intervals[intervalName]);
|
| + delete this.intervals[intervalName];
|
| + }
|
| },
|
|
|
| /**
|
|
|