diff --git a/extensions/chromium/preferences_schema.json b/extensions/chromium/preferences_schema.json index 23b37fb7f58a22..eb23d18c0dfc08 100644 --- a/extensions/chromium/preferences_schema.json +++ b/extensions/chromium/preferences_schema.json @@ -55,6 +55,10 @@ "type": "boolean", "default": false }, + "enableGuessAltText": { + "type": "boolean", + "default": true + }, "altTextLearnMoreUrl": { "type": "string", "default": "" diff --git a/web/app.js b/web/app.js index 02436ff4a9d985..51da94668ac9e0 100644 --- a/web/app.js +++ b/web/app.js @@ -205,10 +205,10 @@ const PDFViewerApplication = { if (mode) { document.documentElement.classList.add(mode); } - } else { + } else if (AppOptions.get("enableAltText")) { // We want to load the image-to-text AI engine as soon as possible. this.mlManager = new MLManager({ - enableAltText: AppOptions.get("enableAltText"), + enableGuessAltText: AppOptions.get("enableGuessAltText"), altTextLearnMoreUrl: AppOptions.get("altTextLearnMoreUrl"), }); } diff --git a/web/app_options.js b/web/app_options.js index 001fa72ddb14cc..941b9a4499126d 100644 --- a/web/app_options.js +++ b/web/app_options.js @@ -179,6 +179,11 @@ const defaultOptions = { value: false, kind: OptionKind.VIEWER + OptionKind.PREFERENCE, }, + enableGuessAltText: { + /** @type {boolean} */ + value: true, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE, + }, enableHighlightEditor: { // We'll probably want to make some experiments before enabling this // in Firefox release, but it has to be temporary. diff --git a/web/firefoxcom.js b/web/firefoxcom.js index 8f84d6b9f5c048..869b69564ce06e 100644 --- a/web/firefoxcom.js +++ b/web/firefoxcom.js @@ -328,8 +328,8 @@ class MLManager { return FirefoxCom.requestAsync("mlGuess", data); } - enable({ altTextLearnMoreUrl, enableAltText, listenToProgress }) { - if (enableAltText) { + enable({ altTextLearnMoreUrl, enableGuessAltText, listenToProgress }) { + if (enableGuessAltText) { this.#loadAltTextEngine(listenToProgress); } // The `altTextLearnMoreUrl` is used to provide a link to the user to learn