1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

Remove the createDownloadManager method from DefaultExternalServices

Given the simplicity of the `createDownloadManager` method, we can leverage import maps to directly initialize the correct `DownloadManager`-instance depending on the build.
This commit is contained in:
Jonas Jenwald 2024-01-26 11:50:25 +01:00
parent d8f77e6b84
commit 1698991ae2
8 changed files with 9 additions and 20 deletions

View file

@ -56,6 +56,7 @@ import { AutomationEventBus, EventBus } from "./event_utils.js";
import { LinkTarget, PDFLinkService } from "./pdf_link_service.js";
import { AltTextManager } from "web-alt_text_manager";
import { AnnotationEditorParams } from "web-annotation_editor_params";
import { DownloadManager } from "web-download_manager";
import { OverlayManager } from "./overlay_manager.js";
import { PasswordPrompt } from "./password_prompt.js";
import { PDFAttachmentViewer } from "web-pdf_attachment_viewer";
@ -98,10 +99,6 @@ class DefaultExternalServices {
static reportTelemetry(data) {}
static createDownloadManager() {
throw new Error("Not implemented: createDownloadManager");
}
static createPreferences() {
throw new Error("Not implemented: createPreferences");
}
@ -390,8 +387,7 @@ const PDFViewerApplication = {
});
this.pdfLinkService = pdfLinkService;
const downloadManager = externalServices.createDownloadManager();
this.downloadManager = downloadManager;
const downloadManager = (this.downloadManager = new DownloadManager());
const findController = new PDFFindController({
linkService: pdfLinkService,

View file

@ -17,7 +17,6 @@
import { DefaultExternalServices, PDFViewerApplication } from "./app.js";
import { AppOptions } from "./app_options.js";
import { BasePreferences } from "./preferences.js";
import { DownloadManager } from "./download_manager.js";
import { GenericL10n } from "./genericl10n.js";
import { GenericScripting } from "./generic_scripting.js";
@ -427,10 +426,6 @@ class ChromeExternalServices extends DefaultExternalServices {
);
}
static createDownloadManager() {
return new DownloadManager();
}
static createPreferences() {
return new ChromePreferences();
}

View file

@ -382,10 +382,6 @@ class FirefoxExternalServices extends DefaultExternalServices {
FirefoxCom.request("reportTelemetry", JSON.stringify(data));
}
static createDownloadManager() {
return new DownloadManager();
}
static createPreferences() {
return new FirefoxPreferences();
}

View file

@ -16,7 +16,6 @@
import { DefaultExternalServices, PDFViewerApplication } from "./app.js";
import { AppOptions } from "./app_options.js";
import { BasePreferences } from "./preferences.js";
import { DownloadManager } from "./download_manager.js";
import { GenericL10n } from "./genericl10n.js";
import { GenericScripting } from "./generic_scripting.js";
@ -39,10 +38,6 @@ class GenericPreferences extends BasePreferences {
}
class GenericExternalServices extends DefaultExternalServices {
static createDownloadManager() {
return new DownloadManager();
}
static createPreferences() {
return new GenericPreferences();
}

View file

@ -61,6 +61,7 @@ See https://github.com/adobe-type-tools/cmap-resources
"web-alt_text_manager": "./stubs-geckoview.js",
"web-annotation_editor_params": "./stubs-geckoview.js",
"web-com": "./genericcom.js",
"web-download_manager": "./download_manager.js",
"web-l10n_utils": "./l10n_utils.js",
"web-pdf_attachment_viewer": "./stubs-geckoview.js",
"web-pdf_cursor_tools": "./stubs-geckoview.js",

View file

@ -70,6 +70,7 @@ See https://github.com/adobe-type-tools/cmap-resources
"web-alt_text_manager": "./alt_text_manager.js",
"web-annotation_editor_params": "./annotation_editor_params.js",
"web-com": "./genericcom.js",
"web-download_manager": "./download_manager.js",
"web-l10n_utils": "./l10n_utils.js",
"web-pdf_attachment_viewer": "./pdf_attachment_viewer.js",
"web-pdf_cursor_tools": "./pdf_cursor_tools.js",