chore: add OCR scaffolding to PDF Viewer (#38127)

This commit is contained in:
Shelley Vohr 2023-05-02 10:27:32 +02:00 committed by GitHub
parent c548f8f59e
commit d95f9d2c63
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 234 additions and 1 deletions

View file

@ -0,0 +1,39 @@
// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Use the <code>chrome.pdfViewerPrivate</code> API for specific browser
// functionality that the PDF Viewer needs from outside the PDF plugin. This API
// is exclusively for the PDF Viewer.
namespace pdfViewerPrivate {
callback IsAllowedLocalFileAccessCallback = void(boolean result);
callback IsPdfOcrAlwaysActiveCallback = void(boolean result);
callback OnPdfOcrPrefSetCallback = void(boolean result);
interface Functions {
// Determines if the given URL should be allowed to access local files from
// the PDF Viewer. |callback|: Called with true if URL should be allowed to
// access local files from the PDF Viewer, false otherwise.
[supportsPromises] static void isAllowedLocalFileAccess(
DOMString url,
IsAllowedLocalFileAccessCallback callback);
// Determines if the preference for PDF OCR is set to run PDF OCR always.
// |callback|: Called with true if PDF OCR is set to be always active;
// false otherwise.
[supportsPromises] static void isPdfOcrAlwaysActive(
IsPdfOcrAlwaysActiveCallback callback);
// Sets a pref value for PDF OCR.
// |value|: The new value of the pref.
// |callback|: The callback for whether the pref was set or not.
[supportsPromises] static void setPdfOcrPref(
boolean value, OnPdfOcrPrefSetCallback callback);
};
interface Events {
// Fired when a pref value for PDF OCR has changed.
// |value| The pref value that changed.
static void onPdfOcrPrefChanged(boolean value);
};
};