#include "components/pdf/renderer/pdf_ocr_helper.h"
#include "base/metrics/histogram_functions.h"
#include "base/time/time.h"
#include "content/public/renderer/render_frame.h"
#include "pdf/pdf_accessibility_image_fetcher.h"
#include "third_party/blink/public/platform/browser_interface_broker_proxy.h"
#include "ui/accessibility/accessibility_features.h"
namespace pdf {
namespace {
constexpr base::TimeDelta kIdleDisconnectDelay = …;
}
PdfOcrRequest::PdfOcrRequest(const ui::AXNodeID& image_node_id,
const chrome_pdf::AccessibilityImageInfo& image,
const ui::AXNodeID& root_node_id,
const ui::AXNodeID& parent_node_id,
const ui::AXNodeID& page_node_id,
uint32_t page_index)
: … { … }
PdfOcrRequest::PdfOcrRequest(const PdfOcrRequest& other) = default;
PdfOcrHelper::PdfOcrHelper(
chrome_pdf::PdfAccessibilityImageFetcher* image_fetcher,
content::RenderFrame& render_frame,
ui::AXNodeID root_node_id,
uint32_t page_count,
OnOcrDataReceivedCallback callback)
: … { … }
PdfOcrHelper::~PdfOcrHelper() { … }
void PdfOcrHelper::Reset(ui::AXNodeID root_node_id, uint32_t page_count) { … }
uint32_t PdfOcrHelper::ComputePagesPerBatch(uint32_t page_count) { … }
void PdfOcrHelper::OcrPage(base::queue<PdfOcrRequest> page_requests) { … }
bool PdfOcrHelper::AreAllPagesOcred() const { … }
bool PdfOcrHelper::AreAllPagesInBatchOcred() const { … }
void PdfOcrHelper::SetScreenAIAnnotatorForTesting(
mojo::PendingRemote<screen_ai::mojom::ScreenAIAnnotator>
screen_ai_annotator) { … }
void PdfOcrHelper::ResetRemainingPageCountForTesting() { … }
void PdfOcrHelper::MaybeConnectToOcrService() { … }
void PdfOcrHelper::OcrNextImage() { … }
void PdfOcrHelper::ReceiveOcrResultsForImage(
PdfOcrRequest request,
const ui::AXTreeUpdate& tree_update) { … }
}