diff options
Diffstat (limited to 'src/core/printing/pdf_document_helper_client_qt.cpp')
-rw-r--r-- | src/core/printing/pdf_document_helper_client_qt.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/core/printing/pdf_document_helper_client_qt.cpp b/src/core/printing/pdf_document_helper_client_qt.cpp new file mode 100644 index 000000000..be1cc2e4c --- /dev/null +++ b/src/core/printing/pdf_document_helper_client_qt.cpp @@ -0,0 +1,33 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +// based on chrome/browser/ui/pdf/chrome_pdf_document_helper_client.cc: + +#include "pdf_document_helper_client_qt.h" + +#include "content/public/browser/render_process_host.h" +#include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h" +#include "extensions/common/constants.h" + +#include "pdf_util_qt.h" + +PDFDocumentHelperClientQt::PDFDocumentHelperClientQt() = default; +PDFDocumentHelperClientQt::~PDFDocumentHelperClientQt() = default; + +content::RenderFrameHost *PDFDocumentHelperClientQt::FindPdfFrame(content::WebContents *contents) +{ + content::RenderFrameHost *main_frame = contents->GetPrimaryMainFrame(); + content::RenderFrameHost *pdf_frame = QtWebEngineCore::FindPdfChildFrame(main_frame); + return pdf_frame ? pdf_frame : main_frame; +} + +void PDFDocumentHelperClientQt::SetPluginCanSave(content::RenderFrameHost *render_frame_host, bool can_save) +{ + auto *guest_view = extensions::MimeHandlerViewGuest::FromRenderFrameHost(render_frame_host); + if (guest_view) + guest_view->SetPluginCanSave(can_save); +} + +void PDFDocumentHelperClientQt::UpdateContentRestrictions(content::RenderFrameHost *, int) +{ +} |