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:
parent
d8f77e6b84
commit
1698991ae2
@ -270,6 +270,7 @@ function createWebpackConfig(
|
||||
"web-alt_text_manager": "web/alt_text_manager.js",
|
||||
"web-annotation_editor_params": "web/annotation_editor_params.js",
|
||||
"web-com": "",
|
||||
"web-download_manager": "",
|
||||
"web-l10n_utils": "web/stubs.js",
|
||||
"web-pdf_attachment_viewer": "web/pdf_attachment_viewer.js",
|
||||
"web-pdf_cursor_tools": "web/pdf_cursor_tools.js",
|
||||
@ -289,6 +290,7 @@ function createWebpackConfig(
|
||||
libraryAlias["display-network"] = "src/display/network.js";
|
||||
|
||||
viewerAlias["web-com"] = "web/chromecom.js";
|
||||
viewerAlias["web-download_manager"] = "web/download_manager.js";
|
||||
viewerAlias["web-print_service"] = "web/pdf_print_service.js";
|
||||
} else if (bundleDefines.GENERIC) {
|
||||
// Aliases defined here must also be replicated in the paths section of
|
||||
@ -300,6 +302,7 @@ function createWebpackConfig(
|
||||
libraryAlias["display-node_utils"] = "src/display/node_utils.js";
|
||||
|
||||
viewerAlias["web-com"] = "web/genericcom.js";
|
||||
viewerAlias["web-download_manager"] = "web/download_manager.js";
|
||||
viewerAlias["web-l10n_utils"] = "web/l10n_utils.js";
|
||||
viewerAlias["web-print_service"] = "web/pdf_print_service.js";
|
||||
} else if (bundleDefines.MOZCENTRAL) {
|
||||
@ -313,6 +316,7 @@ function createWebpackConfig(
|
||||
}
|
||||
}
|
||||
viewerAlias["web-com"] = "web/firefoxcom.js";
|
||||
viewerAlias["web-download_manager"] = "web/firefoxcom.js";
|
||||
viewerAlias["web-print_service"] = "web/firefox_print_service.js";
|
||||
}
|
||||
const alias = { ...basicAlias, ...libraryAlias, ...viewerAlias };
|
||||
|
@ -28,6 +28,7 @@
|
||||
"web-alt_text_manager": "../../web/alt_text_manager.js",
|
||||
"web-annotation_editor_params": "../../web/annotation_editor_params.js",
|
||||
"web-com": "../../web/genericcom.js",
|
||||
"web-download_manager": "../../web/download_manager.js",
|
||||
"web-l10n_utils": "../../web/l10n_utils.js",
|
||||
"web-pdf_attachment_viewer": "../../web/pdf_attachment_viewer.js",
|
||||
"web-pdf_cursor_tools": "../../web/pdf_cursor_tools.js",
|
||||
|
@ -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,
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -382,10 +382,6 @@ class FirefoxExternalServices extends DefaultExternalServices {
|
||||
FirefoxCom.request("reportTelemetry", JSON.stringify(data));
|
||||
}
|
||||
|
||||
static createDownloadManager() {
|
||||
return new DownloadManager();
|
||||
}
|
||||
|
||||
static createPreferences() {
|
||||
return new FirefoxPreferences();
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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",
|
||||
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user