michael@0: /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ michael@0: /* Copyright 2013 Mozilla Foundation michael@0: * michael@0: * Licensed under the Apache License, Version 2.0 (the "License"); michael@0: * you may not use this file except in compliance with the License. michael@0: * You may obtain a copy of the License at michael@0: * michael@0: * http://www.apache.org/licenses/LICENSE-2.0 michael@0: * michael@0: * Unless required by applicable law or agreed to in writing, software michael@0: * distributed under the License is distributed on an "AS IS" BASIS, michael@0: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. michael@0: * See the License for the specific language governing permissions and michael@0: * limitations under the License. michael@0: */ michael@0: /* jshint esnext:true */ michael@0: michael@0: 'use strict'; michael@0: michael@0: this.EXPORTED_SYMBOLS = ['PdfJsTelemetry']; michael@0: michael@0: const Cu = Components.utils; michael@0: Cu.import('resource://gre/modules/Services.jsm'); michael@0: michael@0: this.PdfJsTelemetry = { michael@0: onViewerIsUsed: function () { michael@0: let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_USED"); michael@0: histogram.add(true); michael@0: }, michael@0: onFallback: function () { michael@0: let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_FALLBACK_SHOWN"); michael@0: histogram.add(true); michael@0: }, michael@0: onDocumentSize: function (size) { michael@0: let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_DOCUMENT_SIZE_KB"); michael@0: histogram.add(size / 1024); michael@0: }, michael@0: onDocumentVersion: function (versionId) { michael@0: let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_DOCUMENT_VERSION"); michael@0: histogram.add(versionId); michael@0: }, michael@0: onDocumentGenerator: function (generatorId) { michael@0: let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_DOCUMENT_GENERATOR"); michael@0: histogram.add(generatorId); michael@0: }, michael@0: onForm: function (isAcroform) { michael@0: let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_FORM"); michael@0: histogram.add(isAcroform); michael@0: }, michael@0: onStreamType: function (streamTypeId) { michael@0: let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_STREAM_TYPES"); michael@0: histogram.add(streamTypeId); michael@0: }, michael@0: onTimeToView: function (ms) { michael@0: let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_TIME_TO_VIEW_MS"); michael@0: histogram.add(ms); michael@0: } michael@0: };