summaryrefslogtreecommitdiffstats
path: root/chrome/browser/resources/print_preview/metrics.js
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/resources/print_preview/metrics.js')
-rw-r--r--chrome/browser/resources/print_preview/metrics.js46
1 files changed, 46 insertions, 0 deletions
diff --git a/chrome/browser/resources/print_preview/metrics.js b/chrome/browser/resources/print_preview/metrics.js
new file mode 100644
index 0000000..bdeaf14
--- /dev/null
+++ b/chrome/browser/resources/print_preview/metrics.js
@@ -0,0 +1,46 @@
+// Copyright (c) 2012 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('print_preview', function() {
+ 'use strict';
+
+ /**
+ * Object used to measure usage statistics.
+ * @constructor
+ */
+ function Metrics() {};
+
+ /**
+ * Enumeration of metrics buckets to record.
+ * @enum {number}
+ */
+ Metrics.Bucket = {
+ // Used when the print destination search widget is shown.
+ DESTINATION_SEARCH_SHOWN: 0,
+ // Used when the user selects a print destination.
+ DESTINATION_SELECTED: 1,
+ // Used when the print destination search widget is closed without selecting
+ // a print destination.
+ DESTINATION_SELECTION_CANCELED: 2,
+ // Used when the Google Cloud Print promotions is shown to the user.
+ CLOUDPRINT_PROMO_SHOWN: 3,
+ // Used when the user chooses to sign-in to their Google account.
+ SIGNIN_TRIGGERED: 4
+ };
+
+ Metrics.prototype = {
+ /**
+ * Increments the counter for a given bucket.
+ * @param {!print_preview.Metrics.Bucket} bucket Bucket to increment.
+ */
+ increment: function(bucket) {
+ chrome.send('reportDestinationEvent', bucket);
+ }
+ };
+
+ // Export
+ return {
+ Metrics: Metrics
+ };
+});