Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(312)

Side by Side Diff: chrome/browser/resources/print_preview/metrics.js

Issue 2863183004: Print Preview: Fix top level directory compile errors (Closed)
Patch Set: Address comments Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 cr.define('print_preview', function() { 5 cr.define('print_preview', function() {
6 'use strict'; 6 'use strict';
7 7
8 /** 8 /**
9 * Object used to measure usage statistics. 9 * Object used to measure usage statistics.
10 * @constructor 10 * @constructor
11 */ 11 */
12 function Metrics() {}; 12 function Metrics() {}
13 13
14 /** 14 /**
15 * Enumeration of buckets that a user can enter while using the destination 15 * Enumeration of buckets that a user can enter while using the destination
16 * search widget. 16 * search widget.
17 * @enum {number} 17 * @enum {number}
18 */ 18 */
19 Metrics.DestinationSearchBucket = { 19 Metrics.DestinationSearchBucket = {
20 // Used when the print destination search widget is shown. 20 // Used when the print destination search widget is shown.
21 DESTINATION_SHOWN: 0, 21 DESTINATION_SHOWN: 0,
22 // Used when the user selects a print destination. 22 // Used when the user selects a print destination.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 * @param {string} histogram The name of the histogram to be recorded in. 98 * @param {string} histogram The name of the histogram to be recorded in.
99 * @param {number} maxBucket The max value for the last histogram bucket. 99 * @param {number} maxBucket The max value for the last histogram bucket.
100 * @constructor 100 * @constructor
101 */ 101 */
102 function MetricsContext(histogram, maxBucket) { 102 function MetricsContext(histogram, maxBucket) {
103 /** @private {string} */ 103 /** @private {string} */
104 this.histogram_ = histogram; 104 this.histogram_ = histogram;
105 105
106 /** @private {number} */ 106 /** @private {number} */
107 this.maxBucket_ = maxBucket; 107 this.maxBucket_ = maxBucket;
108 }; 108 }
109 109
110 MetricsContext.prototype = { 110 MetricsContext.prototype = {
111 /** 111 /**
112 * Record a histogram value in UMA. If specified value is larger than the 112 * Record a histogram value in UMA. If specified value is larger than the
113 * max bucket value, record the value in the largest bucket 113 * max bucket value, record the value in the largest bucket
114 * @param {number} bucket Value to record. 114 * @param {number} bucket Value to record.
115 */ 115 */
116 record: function(bucket) { 116 record: function(bucket) {
117 chrome.send('metricsHandler:recordInHistogram', 117 chrome.send('metricsHandler:recordInHistogram',
118 [this.histogram_, 118 [this.histogram_,
119 ((bucket > this.maxBucket_) ? this.maxBucket_ : bucket), 119 ((bucket > this.maxBucket_) ? this.maxBucket_ : bucket),
120 this.maxBucket_]); 120 this.maxBucket_]);
121 } 121 }
122 }; 122 };
123 123
124 /** 124 /**
125 * Destination Search specific usage statistics context. 125 * Destination Search specific usage statistics context.
126 * @constructor 126 * @constructor
127 * @extends {print_preview.MetricsContext} 127 * @extends {print_preview.MetricsContext}
128 */ 128 */
129 function DestinationSearchMetricsContext() { 129 function DestinationSearchMetricsContext() {
130 MetricsContext.call( 130 MetricsContext.call(
131 this, 131 this,
132 'PrintPreview.DestinationAction', 132 'PrintPreview.DestinationAction',
133 Metrics.DestinationSearchBucket.DESTINATION_SEARCH_MAX_BUCKET); 133 Metrics.DestinationSearchBucket.DESTINATION_SEARCH_MAX_BUCKET);
134 }; 134 }
135 135
136 DestinationSearchMetricsContext.prototype = { 136 DestinationSearchMetricsContext.prototype = {
137 __proto__: MetricsContext.prototype 137 __proto__: MetricsContext.prototype
138 }; 138 };
139 139
140 /** 140 /**
141 * GCP promotion specific usage statistics context. 141 * GCP promotion specific usage statistics context.
142 * @constructor 142 * @constructor
143 * @extends {print_preview.MetricsContext} 143 * @extends {print_preview.MetricsContext}
144 */ 144 */
145 function GcpPromoMetricsContext() { 145 function GcpPromoMetricsContext() {
146 MetricsContext.call(this, 146 MetricsContext.call(this,
147 'PrintPreview.GcpPromo', 147 'PrintPreview.GcpPromo',
148 Metrics.GcpPromoBucket.GCP_PROMO_MAX_BUCKET); 148 Metrics.GcpPromoBucket.GCP_PROMO_MAX_BUCKET);
149 }; 149 }
150 150
151 GcpPromoMetricsContext.prototype = { 151 GcpPromoMetricsContext.prototype = {
152 __proto__: MetricsContext.prototype 152 __proto__: MetricsContext.prototype
153 }; 153 };
154 154
155 /** 155 /**
156 * Print settings UI specific usage statistics context. 156 * Print settings UI specific usage statistics context.
157 * @constructor 157 * @constructor
158 * @extends {print_preview.MetricsContext} 158 * @extends {print_preview.MetricsContext}
159 */ 159 */
160 function PrintSettingsUiMetricsContext() { 160 function PrintSettingsUiMetricsContext() {
161 MetricsContext.call( 161 MetricsContext.call(
162 this, 162 this,
163 'PrintPreview.PrintSettingsUi', 163 'PrintPreview.PrintSettingsUi',
164 Metrics.PrintSettingsUiBucket.PRINT_SETTINGS_UI_MAX_BUCKET); 164 Metrics.PrintSettingsUiBucket.PRINT_SETTINGS_UI_MAX_BUCKET);
165 }; 165 }
166 166
167 PrintSettingsUiMetricsContext.prototype = { 167 PrintSettingsUiMetricsContext.prototype = {
168 __proto__: MetricsContext.prototype 168 __proto__: MetricsContext.prototype
169 }; 169 };
170 170
171 // Export 171 // Export
172 return { 172 return {
173 Metrics: Metrics, 173 Metrics: Metrics,
174 MetricsContext: MetricsContext, 174 MetricsContext: MetricsContext,
175 DestinationSearchMetricsContext: DestinationSearchMetricsContext, 175 DestinationSearchMetricsContext: DestinationSearchMetricsContext,
176 GcpPromoMetricsContext: GcpPromoMetricsContext, 176 GcpPromoMetricsContext: GcpPromoMetricsContext,
177 PrintSettingsUiMetricsContext: PrintSettingsUiMetricsContext 177 PrintSettingsUiMetricsContext: PrintSettingsUiMetricsContext
178 }; 178 };
179 }); 179 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698