Merge pull request #16453 from calixteman/gv_telemetry

[GeckoView] Add some telemetry for the toolbar buttons (bug 1829216)
This commit is contained in:
calixteman 2023-05-22 17:08:43 +02:00 committed by GitHub
commit 094fb3c783
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

@ -601,7 +601,8 @@ const PDFViewerApplication = {
appConfig.toolbar,
eventBus,
this.l10n,
await this._nimbusDataPromise
await this._nimbusDataPromise,
this.externalServices
);
}
} else {

View File

@ -25,14 +25,18 @@ class Toolbar {
#eventBus;
#externalServices;
/**
* @param {ToolbarOptions} options
* @param {EventBus} eventBus
* @param {IL10n} _l10n - Localization service.
* @param {Object} nimbusData - Nimbus configuration.
* @param {Object} externalServices - Interface for external services.
*/
constructor(options, eventBus, _l10n, nimbusData) {
constructor(options, eventBus, _l10n, nimbusData, externalServices) {
this.#eventBus = eventBus;
this.#externalServices = externalServices;
const buttons = [
{
element: options.download,
@ -84,6 +88,10 @@ class Toolbar {
element.addEventListener("click", evt => {
if (eventName !== null) {
this.#eventBus.dispatch(eventName, { source: this, ...eventDetails });
this.#externalServices.reportTelemetry({
type: "gv-buttons",
data: { id: `${element.id}_tapped` },
});
}
});
}