Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ |
michael@0 | 3 | /* Copyright 2013 Mozilla Foundation |
michael@0 | 4 | * |
michael@0 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
michael@0 | 6 | * you may not use this file except in compliance with the License. |
michael@0 | 7 | * You may obtain a copy of the License at |
michael@0 | 8 | * |
michael@0 | 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
michael@0 | 10 | * |
michael@0 | 11 | * Unless required by applicable law or agreed to in writing, software |
michael@0 | 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
michael@0 | 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
michael@0 | 14 | * See the License for the specific language governing permissions and |
michael@0 | 15 | * limitations under the License. |
michael@0 | 16 | */ |
michael@0 | 17 | /* jshint esnext:true */ |
michael@0 | 18 | |
michael@0 | 19 | 'use strict'; |
michael@0 | 20 | |
michael@0 | 21 | this.EXPORTED_SYMBOLS = ['PdfJsTelemetry']; |
michael@0 | 22 | |
michael@0 | 23 | const Cu = Components.utils; |
michael@0 | 24 | Cu.import('resource://gre/modules/Services.jsm'); |
michael@0 | 25 | |
michael@0 | 26 | this.PdfJsTelemetry = { |
michael@0 | 27 | onViewerIsUsed: function () { |
michael@0 | 28 | let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_USED"); |
michael@0 | 29 | histogram.add(true); |
michael@0 | 30 | }, |
michael@0 | 31 | onFallback: function () { |
michael@0 | 32 | let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_FALLBACK_SHOWN"); |
michael@0 | 33 | histogram.add(true); |
michael@0 | 34 | }, |
michael@0 | 35 | onDocumentSize: function (size) { |
michael@0 | 36 | let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_DOCUMENT_SIZE_KB"); |
michael@0 | 37 | histogram.add(size / 1024); |
michael@0 | 38 | }, |
michael@0 | 39 | onDocumentVersion: function (versionId) { |
michael@0 | 40 | let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_DOCUMENT_VERSION"); |
michael@0 | 41 | histogram.add(versionId); |
michael@0 | 42 | }, |
michael@0 | 43 | onDocumentGenerator: function (generatorId) { |
michael@0 | 44 | let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_DOCUMENT_GENERATOR"); |
michael@0 | 45 | histogram.add(generatorId); |
michael@0 | 46 | }, |
michael@0 | 47 | onForm: function (isAcroform) { |
michael@0 | 48 | let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_FORM"); |
michael@0 | 49 | histogram.add(isAcroform); |
michael@0 | 50 | }, |
michael@0 | 51 | onStreamType: function (streamTypeId) { |
michael@0 | 52 | let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_STREAM_TYPES"); |
michael@0 | 53 | histogram.add(streamTypeId); |
michael@0 | 54 | }, |
michael@0 | 55 | onTimeToView: function (ms) { |
michael@0 | 56 | let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_TIME_TO_VIEW_MS"); |
michael@0 | 57 | histogram.add(ms); |
michael@0 | 58 | } |
michael@0 | 59 | }; |