summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Varga <pvarga@inf.u-szeged.hu>2022-11-15 17:08:21 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-11-30 18:21:41 +0000
commit23ad38bfc0d76b6130271ba2c15c8b83c00a8f4a (patch)
tree9deead5385563542efb75e723de9ca15be9b0c71
parent9272fda9ebfe71164ad257d23e7f31342bad884f (diff)
Fix build with disabled webengine_extensions
PDF viewer depends on extensions. Guard these dependencies to make able to build with disabled webengine_extensions and enabled webengine_printing_and_pdf. The PDF Viewer is not expected to work with this configuration but the build should pass and loading a PDF should result a download. Change-Id: I4d75e356951c82333ec3dbcd7b6271b9305de3df Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit 20198450e392555b870e6448ca5544958924bb87) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/core/CMakeLists.txt4
-rw-r--r--src/core/browser_main_parts_qt.cpp2
-rw-r--r--src/core/content_browser_client_qt.cpp14
-rw-r--r--src/core/web_contents_adapter.cpp2
4 files changed, 11 insertions, 11 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 7b21fe459..61bf707c9 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -222,8 +222,6 @@ foreach(arch ${archs})
extend_gn_target(${buildGn} CONDITION QT_FEATURE_webengine_printing_and_pdf
SOURCES
printing/pdfium_document_wrapper_qt.cpp printing/pdfium_document_wrapper_qt.h
- printing/pdf_web_contents_helper_client_qt.cpp printing/pdf_web_contents_helper_client_qt.h
- printing/pdf_stream_delegate_qt.cpp printing/pdf_stream_delegate_qt.h
printing/print_view_manager_base_qt.cpp printing/print_view_manager_base_qt.h
printing/print_view_manager_qt.cpp printing/print_view_manager_qt.h
printing/printer_worker.cpp printing/printer_worker.h
@@ -265,6 +263,8 @@ foreach(arch ${archs})
extend_gn_target(${buildGn} CONDITION QT_FEATURE_webengine_extensions AND QT_FEATURE_webengine_printing_and_pdf
SOURCES
extensions/pdf_iframe_navigation_throttle_qt.cpp extensions/pdf_iframe_navigation_throttle_qt.h
+ printing/pdf_stream_delegate_qt.cpp printing/pdf_stream_delegate_qt.h
+ printing/pdf_web_contents_helper_client_qt.cpp printing/pdf_web_contents_helper_client_qt.h
)
extend_gn_target(${buildGn} CONDITION WIN32
diff --git a/src/core/browser_main_parts_qt.cpp b/src/core/browser_main_parts_qt.cpp
index 10fc29ebf..62ad4f635 100644
--- a/src/core/browser_main_parts_qt.cpp
+++ b/src/core/browser_main_parts_qt.cpp
@@ -262,12 +262,12 @@ int BrowserMainPartsQt::PreMainMessageLoopRun()
extensions::ExtensionsClient::Set(new extensions::ExtensionsClientQt());
extensions::ExtensionsBrowserClient::Set(new extensions::ExtensionsBrowserClientQt());
extensions::ExtensionSystemFactoryQt::GetInstance();
-#endif // BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_PLUGINS)
content::PluginService *plugin_service = content::PluginService::GetInstance();
plugin_service->SetFilter(extensions::PluginServiceFilterQt::GetInstance());
#endif // BUILDFLAG(ENABLE_PLUGINS)
+#endif // BUILDFLAG(ENABLE_EXTENSIONS)
if (base::FeatureList::IsEnabled(features::kWebUsb)) {
m_webUsbDetector.reset(new WebUsbDetectorQt());
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp
index 99a3aa3f4..f107b1a0f 100644
--- a/src/core/content_browser_client_qt.cpp
+++ b/src/core/content_browser_client_qt.cpp
@@ -846,12 +846,12 @@ std::vector<std::unique_ptr<content::NavigationThrottle>> ContentBrowserClientQt
base::BindRepeating(&navigationThrottleCallback),
navigation_interception::SynchronyMode::kSync));
-#if BUILDFLAG(ENABLE_PDF)
-#if BUILDFLAG(ENABLE_EXTENSIONS)
- MaybeAddThrottle(extensions::PDFIFrameNavigationThrottleQt::MaybeCreateThrottleFor(navigation_handle), &throttles);
-#endif // BUILDFLAG(ENABLE_EXTENSIONS)
+#if BUILDFLAG(ENABLE_PDF) && BUILDFLAG(ENABLE_EXTENSIONS)
+ MaybeAddThrottle(
+ extensions::PDFIFrameNavigationThrottleQt::MaybeCreateThrottleFor(navigation_handle),
+ &throttles);
MaybeAddThrottle(pdf::PdfNavigationThrottle::MaybeCreateThrottleFor(navigation_handle, std::make_unique<PdfStreamDelegateQt>()), &throttles);
-#endif // BUILDFLAG(ENABLE_PDF)
+#endif // BUILDFLAG(ENABLE_PDF) && BUIDLFLAG(ENABLE_EXTENSIONS)
return throttles;
}
@@ -1222,7 +1222,7 @@ ContentBrowserClientQt::WillCreateURLLoaderRequestInterceptors(content::Navigati
const scoped_refptr<network::SharedURLLoaderFactory>& network_loader_factory)
{
std::vector<std::unique_ptr<content::URLLoaderRequestInterceptor>> interceptors;
-#if BUILDFLAG(ENABLE_PDF)
+#if BUILDFLAG(ENABLE_PDF) && BUILDFLAG(ENABLE_EXTENSIONS)
{
std::unique_ptr<content::URLLoaderRequestInterceptor> pdf_interceptor =
pdf::PdfURLLoaderRequestInterceptor::MaybeCreateInterceptor(
@@ -1230,7 +1230,7 @@ ContentBrowserClientQt::WillCreateURLLoaderRequestInterceptors(content::Navigati
if (pdf_interceptor)
interceptors.push_back(std::move(pdf_interceptor));
}
-#endif
+#endif // BUILDFLAG(ENABLE_PDF) && BUIDLFLAG(ENABLE_EXTENSIONS)
return interceptors;
}
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index 7dc96967f..baf317d2a 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -489,7 +489,7 @@ void WebContentsAdapter::initialize(content::SiteInstance *site)
webContents(), AutofillClientQt::FromWebContents(webContents()),
/* app_locale = */ "", autofill::AutofillManager::DISABLE_AUTOFILL_DOWNLOAD_MANAGER);
-#if QT_CONFIG(webengine_printing_and_pdf)
+#if QT_CONFIG(webengine_printing_and_pdf) && QT_CONFIG(webengine_extensions)
pdf::PDFWebContentsHelper::CreateForWebContentsWithClient(
webContents(), std::make_unique<PDFWebContentsHelperClientQt>());
#endif