diff options
author | Peter Varga <pvarga@inf.u-szeged.hu> | 2022-08-24 09:54:39 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-08-25 00:48:32 +0000 |
commit | 8df878880490b80328d728178d3bf75b2e400efc (patch) | |
tree | 7dba8c28e53facd5a1c113b53d4e2309387c235a | |
parent | 2b736bd5d5af22cc6a9f5b9866a60926ecc4cbdb (diff) |
Fix build with disabled webengine_printing_and_pdf
Now the extensions can be enabled when printing is disabled.
Change-Id: I6183c795298eedf9cdf5110e580e73ba88f45828
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit d3ceb65253b18cea470339ec5064778e253f5d58)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
m--------- | src/3rdparty | 0 | ||||
-rw-r--r-- | src/core/CMakeLists.txt | 6 | ||||
-rw-r--r-- | src/core/browser_main_parts_qt.cpp | 23 | ||||
-rw-r--r-- | src/core/content_browser_client_qt.cpp | 15 | ||||
-rw-r--r-- | src/core/extensions/extension_system_qt.cpp | 11 | ||||
-rw-r--r-- | src/core/extensions/extensions_api_client_qt.cpp | 13 |
6 files changed, 51 insertions, 17 deletions
diff --git a/src/3rdparty b/src/3rdparty -Subproject a7ecbb5ca5df05c10743ff50c5910b32c1f6606 +Subproject 82da2de9a7b0261bc5c765219147cd20621fccb diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 597513abd..2fa07d446 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -254,7 +254,6 @@ foreach(arch ${archs}) extensions/extensions_browser_client_qt.cpp extensions/extensions_browser_client_qt.h extensions/messaging_delegate_qt.cpp extensions/messaging_delegate_qt.h extensions/mime_handler_view_guest_delegate_qt.cpp extensions/mime_handler_view_guest_delegate_qt.h - extensions/pdf_iframe_navigation_throttle_qt.cpp extensions/pdf_iframe_navigation_throttle_qt.h extensions/plugin_service_filter_qt.cpp extensions/plugin_service_filter_qt.h net/plugin_response_interceptor_url_loader_throttle.cpp net/plugin_response_interceptor_url_loader_throttle.h renderer/extensions/extensions_dispatcher_delegate_qt.cpp renderer/extensions/extensions_dispatcher_delegate_qt.h @@ -263,6 +262,11 @@ foreach(arch ${archs}) renderer/extensions/resource_request_policy_qt.cpp renderer/extensions/resource_request_policy_qt.h ) + 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 + ) + extend_gn_target(${buildGn} CONDITION WIN32 SOURCES clipboard_util_win.cpp diff --git a/src/core/browser_main_parts_qt.cpp b/src/core/browser_main_parts_qt.cpp index f23fc7d31..10fc29ebf 100644 --- a/src/core/browser_main_parts_qt.cpp +++ b/src/core/browser_main_parts_qt.cpp @@ -27,19 +27,24 @@ #include "content/public/common/content_features.h" #include "content/public/common/result_codes.h" #include "extensions/buildflags/buildflags.h" +#include "ppapi/buildflags/buildflags.h" +#include "select_file_dialog_factory_qt.h" +#include "services/service_manager/public/cpp/connector.h" +#include "services/service_manager/public/cpp/service.h" +#include "ui/display/screen.h" + #if BUILDFLAG(ENABLE_EXTENSIONS) -#include "content/public/browser/plugin_service.h" #include "extensions/common/constants.h" #include "extensions/common/extensions_client.h" #include "extensions/extensions_browser_client_qt.h" #include "extensions/extension_system_factory_qt.h" -#include "extensions/plugin_service_filter_qt.h" #include "common/extensions/extensions_client_qt.h" -#endif //BUILDFLAG(ENABLE_EXTENSIONS) -#include "select_file_dialog_factory_qt.h" -#include "services/service_manager/public/cpp/connector.h" -#include "services/service_manager/public/cpp/service.h" -#include "ui/display/screen.h" +#endif // BUILDFLAG(ENABLE_EXTENSIONS) + +#if BUILDFLAG(ENABLE_PLUGINS) +#include "content/public/browser/plugin_service.h" +#include "extensions/plugin_service_filter_qt.h" +#endif // BUILDFLAG(ENABLE_PLUGINS) #include "web_engine_context.h" #include "web_usb_detector_qt.h" @@ -257,10 +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 //ENABLE_EXTENSIONS +#endif // BUILDFLAG(ENABLE_PLUGINS) 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 fdca05760..020ae916a 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -40,6 +40,7 @@ #include "net/ssl/client_cert_identity.h" #include "net/ssl/client_cert_store.h" #include "net/ssl/ssl_private_key.h" +#include "printing/buildflags/buildflags.h" #include "services/device/public/cpp/geolocation/geolocation_manager.h" #include "services/network/network_service.h" #include "services/network/public/cpp/web_sandbox_flags.h" @@ -128,7 +129,6 @@ #include "extensions/common/manifest_handlers/mime_types_handler.h" #include "extensions/extension_web_contents_observer_qt.h" #include "extensions/extensions_browser_client_qt.h" -#include "extensions/pdf_iframe_navigation_throttle_qt.h" #include "net/plugin_response_interceptor_url_loader_throttle.h" #endif @@ -138,17 +138,20 @@ #endif #if BUILDFLAG(ENABLE_PRINTING) && BUILDFLAG(ENABLE_PRINT_PREVIEW) +#include "printing/pdf_stream_delegate_qt.h" #include "printing/print_view_manager_qt.h" #endif #if BUILDFLAG(ENABLE_PDF) -#include "printing/pdf_stream_delegate_qt.h" - #include "components/pdf/browser/pdf_navigation_throttle.h" #include "components/pdf/browser/pdf_url_loader_request_interceptor.h" #include "components/pdf/browser/pdf_web_contents_helper.h" #endif +#if BUILDFLAG(ENABLE_PDF) && BUILDFLAG(ENABLE_EXTENSIONS) +#include "extensions/pdf_iframe_navigation_throttle_qt.h" +#endif + #include <QGuiApplication> #include <QStandardPaths> #include <qpa/qplatformnativeinterface.h> @@ -843,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 -#if BUILDFLAG(ENABLE_PDF) +#endif // BUILDFLAG(ENABLE_EXTENSIONS) MaybeAddThrottle(pdf::PdfNavigationThrottle::MaybeCreateThrottleFor(navigation_handle, std::make_unique<PdfStreamDelegateQt>()), &throttles); -#endif // BUILDFLAG(ENABLE_PDF) +#endif // BUILDFLAG(ENABLE_PDF) return throttles; } diff --git a/src/core/extensions/extension_system_qt.cpp b/src/core/extensions/extension_system_qt.cpp index b8468aab4..67750fa6a 100644 --- a/src/core/extensions/extension_system_qt.cpp +++ b/src/core/extensions/extension_system_qt.cpp @@ -33,7 +33,6 @@ #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" -#include "content/public/browser/plugin_service.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/url_data_source.h" #include "content/public/common/webplugininfo.h" @@ -56,9 +55,15 @@ #include "extensions/common/manifest_handlers/mime_types_handler.h" #include "extensions/common/manifest_url_handlers.h" #include "net/base/mime_util.h" +#include "pdf/buildflags.h" +#include "ppapi/buildflags/buildflags.h" #include "qtwebengine/grit/qt_webengine_resources.h" #include "ui/base/resource/resource_bundle.h" +#if BUILDFLAG(ENABLE_PLUGINS) +#include "content/public/browser/plugin_service.h" +#endif + using content::BrowserThread; namespace extensions { @@ -184,6 +189,7 @@ void ExtensionSystemQt::NotifyExtensionLoaded(const Extension *extension) // know about it. extension_registry_->TriggerOnLoaded(extension); +#if BUILDFLAG(ENABLE_PLUGINS) // Register plugins included with the extension. // Implementation based on PluginManager::OnExtensionLoaded. const MimeTypesHandler *handler = MimeTypesHandler::GetHandler(extension); @@ -209,6 +215,7 @@ void ExtensionSystemQt::NotifyExtensionLoaded(const Extension *extension) plugin_service->RefreshPlugins(); plugin_service->RegisterInternalPlugin(info, true); } +#endif // BUILDFLAG(ENABLE_PLUGINS) } bool ExtensionSystemQt::FinishDelayedInstallationIfReady(const std::string &extension_id, bool install_immediately) @@ -320,6 +327,7 @@ void ExtensionSystemQt::Init(bool extensions_enabled) // Inform the rest of the extensions system to start. ready_.Signal(); +#if BUILDFLAG(ENABLE_PDF) { std::string pdf_manifest = ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(IDR_PDF_MANIFEST); base::ReplaceFirstSubstringAfterOffset(&pdf_manifest, 0, "<NAME>", "chromium-pdf"); @@ -331,6 +339,7 @@ void ExtensionSystemQt::Init(bool extensions_enabled) std::string id = GenerateId(pdfManifestDict.get(), path); LoadExtension(id, std::move(pdfManifestDict), path); } +#endif // BUILDFLAG(ENABLE_PDF) #if BUILDFLAG(ENABLE_HANGOUT_SERVICES_EXTENSION) { diff --git a/src/core/extensions/extensions_api_client_qt.cpp b/src/core/extensions/extensions_api_client_qt.cpp index 9129ef3d6..3d86c65f7 100644 --- a/src/core/extensions/extensions_api_client_qt.cpp +++ b/src/core/extensions/extensions_api_client_qt.cpp @@ -10,12 +10,21 @@ #include "messaging_delegate_qt.h" #include <memory> -#include "components/pdf/browser/pdf_web_contents_helper.h" + #include "extension_web_contents_observer_qt.h" #include "extensions/browser/guest_view/extensions_guest_view_manager_delegate.h" #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest_delegate.h" #include "mime_handler_view_guest_delegate_qt.h" +#include "pdf/buildflags.h" +#include "printing/buildflags/buildflags.h" + +#if BUILDFLAG(ENABLE_PDF) +#include "components/pdf/browser/pdf_web_contents_helper.h" +#endif + +#if BUILDFLAG(ENABLE_PRINTING) && BUILDFLAG(ENABLE_PRINT_PREVIEW) #include "printing/print_view_manager_qt.h" +#endif namespace extensions { @@ -43,7 +52,9 @@ std::unique_ptr<MimeHandlerViewGuestDelegate> ExtensionsAPIClientQt::CreateMimeH void ExtensionsAPIClientQt::AttachWebContentsHelpers(content::WebContents *web_contents) const { // PrefsTabHelper::CreateForWebContents(web_contents); +#if BUILDFLAG(ENABLE_PRINTING) && BUILDFLAG(ENABLE_PRINT_PREVIEW) QtWebEngineCore::PrintViewManagerQt::CreateForWebContents(web_contents); +#endif ExtensionWebContentsObserverQt::CreateForWebContents(web_contents); } |