Index: chrome/browser/resources/print_preview/metrics.js |
diff --git a/chrome/browser/resources/print_preview/metrics.js b/chrome/browser/resources/print_preview/metrics.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..bdeaf141efbb8ccad2760a4bd521f041b76a711f |
--- /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 |
+ }; |
+}); |