OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 cr.define('print_preview', function() { |
| 6 'use strict'; |
| 7 |
| 8 /** |
| 9 * Object used to measure usage statistics. |
| 10 * @constructor |
| 11 */ |
| 12 function Metrics() {}; |
| 13 |
| 14 /** |
| 15 * Enumeration of metrics buckets to record. |
| 16 * @enum {number} |
| 17 */ |
| 18 Metrics.Bucket = { |
| 19 // Used when the print destination search widget is shown. |
| 20 DESTINATION_SEARCH_SHOWN: 0, |
| 21 // Used when the user selects a print destination. |
| 22 DESTINATION_SELECTED: 1, |
| 23 // Used when the print destination search widget is closed without selecting |
| 24 // a print destination. |
| 25 DESTINATION_SELECTION_CANCELED: 2, |
| 26 // Used when the Google Cloud Print promotions is shown to the user. |
| 27 CLOUDPRINT_PROMO_SHOWN: 3, |
| 28 // Used when the user chooses to sign-in to their Google account. |
| 29 SIGNIN_TRIGGERED: 4 |
| 30 }; |
| 31 |
| 32 Metrics.prototype = { |
| 33 /** |
| 34 * Increments the counter for a given bucket. |
| 35 * @param {!print_preview.Metrics.Bucket} bucket Bucket to increment. |
| 36 */ |
| 37 increment: function(bucket) { |
| 38 chrome.send('reportDestinationEvent', bucket); |
| 39 } |
| 40 }; |
| 41 |
| 42 // Export |
| 43 return { |
| 44 Metrics: Metrics |
| 45 }; |
| 46 }); |
OLD | NEW |