summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPeter Varga <pvarga@inf.u-szeged.hu>2022-11-15 17:08:21 +0100
committerPeter Varga <pvarga@inf.u-szeged.hu>2022-11-24 09:12:04 +0100
commit20198450e392555b870e6448ca5544958924bb87 (patch)
treeae5b16bfdd44fe53e2d2aa712ed4980b3a5dd65e /src
parenta68221ee023d05a5482b93f483b8030f8242e532 (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. Pick-to: 6.4 Change-Id: I4d75e356951c82333ec3dbcd7b6271b9305de3df Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src')
-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 644f1d558..ed14bbd31 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -230,8 +230,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
@@ -273,6 +271,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 a39a1ee3b..e58822c29 100644
--- a/src/core/browser_main_parts_qt.cpp
+++ b/src/core/browser_main_parts_qt.cpp
@@ -277,12 +277,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 2f214bbb7..6f9f94d6d 100644
--- a/src/core/content_browser_client_qt.cpp
+++ b/src/core/content_browser_client_qt.cpp
@@ -856,12 +856,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;
}
@@ -1238,7 +1238,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(
@@ -1246,7 +1246,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 9c0f85a2a..98128ee74 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -491,7 +491,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