From eef8bbdbff100242602bc4cde91014484ef2cd1b Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 5 Mar 2025 11:41:26 +0100 Subject: [PATCH 1/2] Adaptations for Chromium 132 Pick-to: 6.10 Change-Id: Id2d09604201b2c007c76328f92bb4e0c0d802cae Reviewed-by: Michal Klocek --- cmake/QtToolchainHelpers.cmake | 3 ++ src/core/CMakeLists.txt | 1 + ...thenticator_request_client_delegate_qt.cpp | 21 +++------ ...authenticator_request_client_delegate_qt.h | 5 +-- ...uthenticator_request_dialog_controller.cpp | 29 +++++++++--- .../authenticator_request_dialog_controller.h | 6 ++- ...uthenticator_request_dialog_controller_p.h | 8 +++- src/core/autofill_client_qt.cpp | 5 +++ src/core/autofill_client_qt.h | 2 + src/core/chromium_overrides.cpp | 4 +- src/core/client_hints.cpp | 5 --- src/core/client_hints.h | 2 - .../compositor/native_skia_output_device.cpp | 1 - .../native_skia_output_device_opengl.cpp | 2 +- .../native_skia_output_device_vulkan.cpp | 2 +- src/core/configure/BUILD.root.gn.in | 7 +-- src/core/content_browser_client_qt.cpp | 10 +++-- src/core/content_browser_client_qt.h | 5 ++- .../extensions_browser_client_qt.cpp | 6 +-- .../extensions/extensions_browser_client_qt.h | 6 +-- src/core/file_picker_controller.cpp | 20 +++++++-- src/core/file_picker_controller.h | 3 +- ...le_system_access_permission_context_qt.cpp | 44 ++++++++++--------- ...file_system_access_permission_context_qt.h | 18 ++++---- ...file_system_access_permission_grant_qt.cpp | 6 +-- .../file_system_access_permission_grant_qt.h | 10 +++-- ...tem_access_permission_request_controller.h | 3 ++ ...ess_permission_request_controller_impl.cpp | 3 +- ...m_access_permission_request_manager_qt.cpp | 9 +++- ...tem_access_permission_request_manager_qt.h | 2 +- src/core/permission_manager_qt.cpp | 1 - .../pdf_document_helper_client_qt.cpp | 3 ++ .../printing/pdf_document_helper_client_qt.h | 1 + src/core/printing/print_view_manager_qt.cpp | 21 ++------- src/core/render_widget_host_view_qt.cpp | 9 ++-- .../renderer/content_renderer_client_qt.cpp | 2 +- .../renderer/web_engine_page_render_frame.cpp | 6 ++- .../touch_selection_controller_client_qt.cpp | 12 ++--- src/core/web_contents_delegate_qt.cpp | 19 +++++++- src/core/web_contents_view_qt.h | 1 + src/core/web_engine_context.cpp | 4 +- src/pdf/CMakeLists.txt | 2 +- .../api/qquickwebenginedialogrequests.cpp | 3 +- src/webenginewidgets/api/qwebengineview.cpp | 2 + 44 files changed, 200 insertions(+), 134 deletions(-) diff --git a/cmake/QtToolchainHelpers.cmake b/cmake/QtToolchainHelpers.cmake index 839650b7a1f..a2ed89c7e49 100644 --- a/cmake/QtToolchainHelpers.cmake +++ b/cmake/QtToolchainHelpers.cmake @@ -256,8 +256,11 @@ macro(append_build_type_setup) use_partition_alloc=true use_partition_alloc_as_malloc=false use_custom_libcxx=false + use_custom_libcxx_for_host=false enable_rust=false # We do not yet support rust enable_chromium_prelude=false + enable_rust_png=false + pdf_enable_fontations=false assert_cpp20=false ) if(${config} STREQUAL "Debug") diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index dedd1dbe777..043555ed9ad 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -337,6 +337,7 @@ foreach(arch ${archs}) qtwebengine_target="${buildDir}/${config}/${arch}:QtWebEngineCore" build_dawn_tests=false build_with_tflite_lib=false + webnn_use_tflite=false is_qtwebengine=true is_qtpdf=false chrome_pgo_phase=0 diff --git a/src/core/authenticator_request_client_delegate_qt.cpp b/src/core/authenticator_request_client_delegate_qt.cpp index 5d01df536e1..086ee510590 100644 --- a/src/core/authenticator_request_client_delegate_qt.cpp +++ b/src/core/authenticator_request_client_delegate_qt.cpp @@ -47,7 +47,7 @@ void AuthenticatorRequestClientDelegateQt::SetRelyingPartyId(const std::string & bool AuthenticatorRequestClientDelegateQt::DoesBlockRequestOnFailure( InterestingFailureReason reason) { - if (!IsWebAuthnUIEnabled()) + if (m_isUiDisabled) return false; switch (reason) { @@ -132,7 +132,7 @@ void AuthenticatorRequestClientDelegateQt::SelectAccount( return; } - if (m_isConditionalRequest) { + if (m_dialogController->uiPresentation() == UIPresentation::kAutofill) { return; } @@ -154,19 +154,10 @@ void AuthenticatorRequestClientDelegateQt::SelectAccount( m_dialogController->selectAccount(userList); } -void AuthenticatorRequestClientDelegateQt::DisableUI() +void AuthenticatorRequestClientDelegateQt::SetUIPresentation(UIPresentation ui_presentation) { - m_isUiDisabled = true; -} - -bool AuthenticatorRequestClientDelegateQt::IsWebAuthnUIEnabled() -{ - return !m_isUiDisabled; -} - -void AuthenticatorRequestClientDelegateQt::SetConditionalRequest(bool is_conditional) -{ - m_isConditionalRequest = is_conditional; + m_isUiDisabled = (ui_presentation == UIPresentation::kDisabled); + m_dialogController->setUiPresentation(ui_presentation); } // This method will not be invoked until the observer is set. @@ -182,7 +173,7 @@ void AuthenticatorRequestClientDelegateQt::OnTransportAvailabilityEnumerated( // Start WebAuth UX // we may need to pass data as well. for SelectAccount and SupportPin it is not required, // skipping that for the timebeing. - m_dialogController->startRequest(m_isConditionalRequest); + m_dialogController->startRequest(); } bool AuthenticatorRequestClientDelegateQt::SupportsPIN() const diff --git a/src/core/authenticator_request_client_delegate_qt.h b/src/core/authenticator_request_client_delegate_qt.h index 8c8089f04d3..1b6c292db1e 100644 --- a/src/core/authenticator_request_client_delegate_qt.h +++ b/src/core/authenticator_request_client_delegate_qt.h @@ -46,9 +46,7 @@ class AuthenticatorRequestClientDelegateQt : public content::AuthenticatorReques void SelectAccount( std::vector responses, base::OnceCallback callback) override; - void DisableUI() override; - bool IsWebAuthnUIEnabled() override; - void SetConditionalRequest(bool is_conditional) override; + void SetUIPresentation(UIPresentation ui_presentation) override; // device::FidoRequestHandlerBase::Observer overrides: // This method will not be invoked until the observer is set. @@ -69,7 +67,6 @@ class AuthenticatorRequestClientDelegateQt : public content::AuthenticatorReques private: content::RenderFrameHost *m_renderFrameHost; bool m_isUiDisabled = false; - bool m_isConditionalRequest = false; base::OnceClosure m_cancelCallback; base::RepeatingClosure m_startOverCallback; diff --git a/src/core/authenticator_request_dialog_controller.cpp b/src/core/authenticator_request_dialog_controller.cpp index 73fb4e7f374..e0ae5d9fa9f 100644 --- a/src/core/authenticator_request_dialog_controller.cpp +++ b/src/core/authenticator_request_dialog_controller.cpp @@ -112,7 +112,7 @@ void AuthenticatorRequestDialogControllerPrivate::setCurrentState( m_currentState = uxState; - if (m_isConditionalRequest) + if (m_uiPresentation == content::AuthenticatorRequestClientDelegate::UIPresentation ::kAutofill) return; if (!m_isDialogCreated) { @@ -159,12 +159,31 @@ AuthenticatorRequestDialogControllerPrivate::state() const return m_currentState; } -void AuthenticatorRequestDialogControllerPrivate::startRequest(bool isConditionalRequest) +void AuthenticatorRequestDialogController::setUiPresentation(content::AuthenticatorRequestClientDelegate::UIPresentation modality) +{ + d_ptr->setUiPresentation(modality); +} + +content::AuthenticatorRequestClientDelegate::UIPresentation AuthenticatorRequestDialogController::uiPresentation() const +{ + return d_ptr->uiPresentation(); +} + +void AuthenticatorRequestDialogControllerPrivate::setUiPresentation(content::AuthenticatorRequestClientDelegate::UIPresentation modality) +{ + m_uiPresentation = modality; +} + +content::AuthenticatorRequestClientDelegate::UIPresentation AuthenticatorRequestDialogControllerPrivate::uiPresentation() const +{ + return m_uiPresentation; +} + +void AuthenticatorRequestDialogControllerPrivate::startRequest() { DCHECK(!m_isStarted); m_isStarted = true; - m_isConditionalRequest = isConditionalRequest; if (m_pendingState) { setCurrentState(*m_pendingState); @@ -263,9 +282,9 @@ QWebEngineWebAuthUxRequest::WebAuthUxState AuthenticatorRequestDialogController: return d_ptr->state(); } -void AuthenticatorRequestDialogController::startRequest(bool bIsConditionalRequest) +void AuthenticatorRequestDialogController::startRequest() { - d_ptr->startRequest(bIsConditionalRequest); + d_ptr->startRequest(); } void AuthenticatorRequestDialogController::setRelyingPartyId(const std::string &rpId) diff --git a/src/core/authenticator_request_dialog_controller.h b/src/core/authenticator_request_dialog_controller.h index 98e8dcf901e..031f6454fdb 100644 --- a/src/core/authenticator_request_dialog_controller.h +++ b/src/core/authenticator_request_dialog_controller.h @@ -7,6 +7,7 @@ #include #include #include "qwebenginewebauthuxrequest.h" +#include "content/public/browser/authenticator_request_client_delegate.h" namespace content { class WebContents; @@ -33,6 +34,9 @@ class Q_WEBENGINECORE_EXPORT AuthenticatorRequestDialogController : public QObje void retryRequest(); QWebEngineWebAuthUxRequest::RequestFailureReason requestFailureReason() const; + content::AuthenticatorRequestClientDelegate::UIPresentation uiPresentation() const; + void setUiPresentation(content::AuthenticatorRequestClientDelegate::UIPresentation modality); + Q_SIGNALS: void stateChanged(QWebEngineWebAuthUxRequest::WebAuthUxState state); @@ -40,7 +44,7 @@ class Q_WEBENGINECORE_EXPORT AuthenticatorRequestDialogController : public QObje void selectAccount(const QStringList &userList); void collectPin(QWebEngineWebAuthPinRequest pinRequest); void finishCollectToken(); - void startRequest(bool bIsConditionalRequest); + void startRequest(); void finishRequest(); void setRelyingPartyId(const std::string &rpId); void handleRequestFailure(QWebEngineWebAuthUxRequest::RequestFailureReason reason); diff --git a/src/core/authenticator_request_dialog_controller_p.h b/src/core/authenticator_request_dialog_controller_p.h index 46dfc76e249..175d13901b9 100644 --- a/src/core/authenticator_request_dialog_controller_p.h +++ b/src/core/authenticator_request_dialog_controller_p.h @@ -34,6 +34,9 @@ class AuthenticatorRequestDialogControllerPrivate void setCurrentState(QWebEngineWebAuthUxRequest::WebAuthUxState uxState); void setRelyingPartyId(const QString &rpId); + content::AuthenticatorRequestClientDelegate::UIPresentation uiPresentation() const; + void setUiPresentation(content::AuthenticatorRequestClientDelegate::UIPresentation modality); + // Support pin functionality void collectPin(QWebEngineWebAuthPinRequest pinRequestInfo); void finishCollectToken(); @@ -46,7 +49,7 @@ class AuthenticatorRequestDialogControllerPrivate // cancel request void cancelRequest(); void retryRequest(); - void startRequest(bool isConditionalRequest); + void startRequest(); AuthenticatorRequestDialogController *q_ptr; @@ -57,7 +60,8 @@ class AuthenticatorRequestDialogControllerPrivate QString m_relyingPartyId; bool m_isStarted = false; - bool m_isConditionalRequest = false; + content::AuthenticatorRequestClientDelegate::UIPresentation m_uiPresentation = + content::AuthenticatorRequestClientDelegate::UIPresentation::kModal; QWebEngineWebAuthUxRequest::WebAuthUxState m_currentState = QWebEngineWebAuthUxRequest::WebAuthUxState::NotStarted; base::WeakPtr m_authenticatorRequestDelegate; diff --git a/src/core/autofill_client_qt.cpp b/src/core/autofill_client_qt.cpp index b0e846844ef..19d3ac24e1f 100644 --- a/src/core/autofill_client_qt.cpp +++ b/src/core/autofill_client_qt.cpp @@ -131,4 +131,9 @@ WebContentsAdapterClient *AutofillClientQt::adapterClient() ->client(); } +base::WeakPtr AutofillClientQt::GetWeakPtr() +{ + return weak_ptr_factory_.GetWeakPtr(); +} + } // namespace QtWebEngineCore diff --git a/src/core/autofill_client_qt.h b/src/core/autofill_client_qt.h index 2f97e005ba5..b42e4f67eb5 100644 --- a/src/core/autofill_client_qt.h +++ b/src/core/autofill_client_qt.h @@ -58,6 +58,7 @@ class AutofillClientQt : public autofill::ContentAutofillClient, bool IsOffTheRecord() const override; scoped_refptr GetURLLoaderFactory() override; std::unique_ptr CreateManager(base::PassKey, autofill::ContentAutofillDriver&) override; + base::WeakPtr GetWeakPtr() override; private: explicit AutofillClientQt(content::WebContents *webContents); @@ -65,6 +66,7 @@ class AutofillClientQt : public autofill::ContentAutofillClient, WebContentsAdapterClient *adapterClient(); QScopedPointer m_popupController; + base::WeakPtrFactory weak_ptr_factory_{this}; }; } // namespace QtWebEngineCore diff --git a/src/core/chromium_overrides.cpp b/src/core/chromium_overrides.cpp index 68b54674944..44803b5bcc0 100644 --- a/src/core/chromium_overrides.cpp +++ b/src/core/chromium_overrides.cpp @@ -77,7 +77,7 @@ base::FilePath getSandboxPath() #endif } // namespace content -#if defined(USE_AURA) || BUILDFLAG(IS_OZONE) +#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_OZONE) namespace content { // content/common/font_list.h @@ -96,7 +96,7 @@ base::Value::List GetFontList_SlowBlocking() } } // namespace content -#endif // defined(USE_AURA) || BUILDFLAG(IS_OZONE) +#endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_OZONE) #if BUILDFLAG(ENABLE_VULKAN) namespace gpu { diff --git a/src/core/client_hints.cpp b/src/core/client_hints.cpp index 9fa7531da18..af485767f03 100644 --- a/src/core/client_hints.cpp +++ b/src/core/client_hints.cpp @@ -155,11 +155,6 @@ bool ClientHints::IsJavaScriptAllowed(const GURL &url, content::RenderFrameHost return true; } -bool ClientHints::AreThirdPartyCookiesBlocked(const GURL &url, content::RenderFrameHost *rfh) -{ - return false; // we probably can not report anything more specific -} - blink::UserAgentMetadata ClientHints::GetUserAgentMetadata() { return static_cast(context_)->userAgentMetadata(); diff --git a/src/core/client_hints.h b/src/core/client_hints.h index 193982d1600..c3bcf7556ab 100644 --- a/src/core/client_hints.h +++ b/src/core/client_hints.h @@ -58,8 +58,6 @@ class ClientHints : public KeyedService, public content::ClientHintsControllerDe bool IsJavaScriptAllowed(const GURL &url, content::RenderFrameHost *parent_rfh) override; - bool AreThirdPartyCookiesBlocked(const GURL &url, content::RenderFrameHost *rfh) override; - blink::UserAgentMetadata GetUserAgentMetadata() override; void PersistClientHints(const url::Origin &primary_origin, diff --git a/src/core/compositor/native_skia_output_device.cpp b/src/core/compositor/native_skia_output_device.cpp index bf8fd575ab5..1bad6c5b34a 100644 --- a/src/core/compositor/native_skia_output_device.cpp +++ b/src/core/compositor/native_skia_output_device.cpp @@ -13,7 +13,6 @@ #include "gpu/command_buffer/service/shared_image/shared_image_factory.h" #include "gpu/command_buffer/service/shared_image/shared_image_representation.h" #include "gpu/command_buffer/service/skia_utils.h" -#include "third_party/skia/include/gpu/GrDirectContext.h" #include "third_party/skia/include/core/SkSurfaceProps.h" #include "ui/gfx/native_pixmap.h" #include "ui/gfx/gpu_fence.h" diff --git a/src/core/compositor/native_skia_output_device_opengl.cpp b/src/core/compositor/native_skia_output_device_opengl.cpp index 7421ea93312..46e4cef8ecc 100644 --- a/src/core/compositor/native_skia_output_device_opengl.cpp +++ b/src/core/compositor/native_skia_output_device_opengl.cpp @@ -39,7 +39,7 @@ #include "components/viz/common/gpu/vulkan_context_provider.h" #include "gpu/vulkan/vulkan_device_queue.h" -#include "third_party/skia/include/gpu/vk/GrVkTypes.h" +#include "third_party/skia/include/gpu/ganesh/vk/GrVkTypes.h" #include "third_party/skia/include/gpu/ganesh/vk/GrVkBackendSurface.h" #endif // BUILDFLAG(ENABLE_VULKAN) #endif // BUILDFLAG(IS_OZONE) diff --git a/src/core/compositor/native_skia_output_device_vulkan.cpp b/src/core/compositor/native_skia_output_device_vulkan.cpp index 5f410621bf5..e820825d2bd 100644 --- a/src/core/compositor/native_skia_output_device_vulkan.cpp +++ b/src/core/compositor/native_skia_output_device_vulkan.cpp @@ -21,7 +21,7 @@ #include "gpu/vulkan/vulkan_function_pointers.h" #include "components/viz/common/gpu/vulkan_context_provider.h" #include "gpu/vulkan/vulkan_device_queue.h" -#include "third_party/skia/include/gpu/vk/GrVkTypes.h" +#include "third_party/skia/include/gpu/ganesh/vk/GrVkTypes.h" #include "third_party/skia/include/gpu/ganesh/vk/GrVkBackendSurface.h" #endif // BUILDFLAG(IS_OZONE) diff --git a/src/core/configure/BUILD.root.gn.in b/src/core/configure/BUILD.root.gn.in index 81fd8368f75..910d68ad311 100644 --- a/src/core/configure/BUILD.root.gn.in +++ b/src/core/configure/BUILD.root.gn.in @@ -285,7 +285,6 @@ source_set("qtwebengine_sources") { ":devtools_sources", "//build:branding_buildflags", "//build/config/chromebox_for_meetings:buildflags", - "//chrome/browser:dev_ui_browser_resources_grit", "//chrome/browser/resources/accessibility:resources", "//chrome/browser/resources/net_internals:resources", "//chrome/browser/signin:identity_manager_provider", @@ -606,7 +605,6 @@ repack("qtwebengine_repack_resources") { "$root_gen_dir/qtwebengine/qt_webengine_resources.pak", "$root_gen_dir/chrome/accessibility_resources.pak", "$root_gen_dir/chrome/common_resources.pak", - "$root_gen_dir/chrome/dev_ui_browser_resources.pak", "$root_gen_dir/chrome/device_log_resources.pak", "$root_gen_dir/chrome/net_internals_resources.pak", "$root_gen_dir/components/components_resources.pak", @@ -626,7 +624,7 @@ repack("qtwebengine_repack_resources") { "$root_gen_dir/mojo/public/js/mojo_bindings_resources.pak", "$root_gen_dir/net/net_resources.pak", "$root_gen_dir/third_party/blink/public/resources/blink_resources.pak", - "$root_gen_dir/ui/resources/webui_resources.pak", + "$root_gen_dir/ui/webui/resources/webui_resources.pak", ] if (!is_debug) { output = "$root_out_dir/qtwebengine_resources.pak" @@ -636,7 +634,6 @@ repack("qtwebengine_repack_resources") { deps = [ "//qtwebengine/browser:qt_webengine_resources", - "//chrome/browser:dev_ui_browser_resources_grit", "//chrome/browser/resources/accessibility:resources", "//chrome/browser/resources/net_internals:resources", "//chrome/common:resources_grit", @@ -658,7 +655,7 @@ repack("qtwebengine_repack_resources") { "//mojo/public/js:resources", "//net:net_resources_grit", "//third_party/blink/public:resources_grit", - "//ui/resources:webui_resources_grd", + "//ui/webui/resources", ] if (enable_extensions) { sources += [ diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index 9a1de70af32..e85143d51d5 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -12,6 +12,7 @@ #include "components/error_page/common/localized_error.h" #include "components/navigation_interception/intercept_navigation_throttle.h" #include "components/network_hints/browser/simple_network_hints_handler_impl.h" +#include "components/performance_manager/embedder/binders.h" #include "components/performance_manager/embedder/performance_manager_lifetime.h" #include "components/performance_manager/embedder/performance_manager_registry.h" #include "components/performance_manager/public/performance_manager.h" @@ -480,8 +481,10 @@ void ContentBrowserClientQt::ExposeInterfacesToRenderer(service_manager::BinderR blink::AssociatedInterfaceRegistry *associated_registry, content::RenderProcessHost *render_process_host) { - if (auto *manager = performance_manager::PerformanceManagerRegistry::GetInstance()) - manager->CreateProcessNodeAndExposeInterfacesToRendererProcess(registry, render_process_host); + if (auto *manager = performance_manager::PerformanceManagerRegistry::GetInstance()) { + manager->CreateProcessNode(render_process_host); + manager->GetBinders().ExposeInterfacesToRendererProcess(registry, render_process_host); + } #if BUILDFLAG(ENABLE_EXTENSIONS) associated_registry->AddInterface(base::BindRepeating( &extensions::EventRouter::BindForRenderer, render_process_host->GetID())); @@ -733,6 +736,7 @@ bool ContentBrowserClientQt::HandleExternalProtocol( network::mojom::WebSandboxFlags sandbox_flags, ui::PageTransition page_transition, bool has_user_gesture, const std::optional &initiating_origin, content::RenderFrameHost *initiator_document, + const net::IsolationInfo &isolation_info, mojo::PendingRemote *out_factory) { Q_UNUSED(frame_tree_node_id); @@ -921,7 +925,7 @@ bool ContentBrowserClientQt::HasErrorPage(int httpStatusCode, content::WebConten std::unique_ptr ContentBrowserClientQt::CreateLoginDelegate( const net::AuthChallengeInfo &authInfo, content::WebContents *web_contents, content::BrowserContext *browser_context, const content::GlobalRequestID & /*request_id*/, - bool /*is_main_frame*/, const GURL &url, + bool /*is_main_frame*/, bool /*is_request_for_navigation*/, const GURL &url, scoped_refptr /*response_headers*/, bool first_auth_attempt, LoginAuthRequiredCallback auth_required_callback) { diff --git a/src/core/content_browser_client_qt.h b/src/core/content_browser_client_qt.h index 08ee2d1ab90..93358d545b3 100644 --- a/src/core/content_browser_client_qt.h +++ b/src/core/content_browser_client_qt.h @@ -154,7 +154,9 @@ class ContentBrowserClientQt : public content::ContentBrowserClient std::unique_ptr CreateLoginDelegate(const net::AuthChallengeInfo &auth_info, content::WebContents *web_contents, content::BrowserContext *browser_context, - const content::GlobalRequestID &request_id, bool is_request_for_main_frame, + const content::GlobalRequestID &request_id, + bool is_request_for_main_frame, + bool is_request_for_navigation, const GURL &url, scoped_refptr response_headers, bool first_auth_attempt, LoginAuthRequiredCallback auth_required_callback) override; @@ -166,6 +168,7 @@ class ContentBrowserClientQt : public content::ContentBrowserClient network::mojom::WebSandboxFlags sandbox_flags, ui::PageTransition page_transition, bool has_user_gesture, const std::optional &initiating_origin, content::RenderFrameHost *initiator_document, + const net::IsolationInfo &isolation_info, mojo::PendingRemote *out_factory) override; std::vector> diff --git a/src/core/extensions/extensions_browser_client_qt.cpp b/src/core/extensions/extensions_browser_client_qt.cpp index de943b2d3d2..099843c527c 100644 --- a/src/core/extensions/extensions_browser_client_qt.cpp +++ b/src/core/extensions/extensions_browser_client_qt.cpp @@ -292,19 +292,19 @@ BrowserContext *ExtensionsBrowserClientQt::GetOriginalContext(BrowserContext *co return context; } -content::BrowserContext* ExtensionsBrowserClientQt::GetContextRedirectedToOriginal(content::BrowserContext *context, bool) +content::BrowserContext* ExtensionsBrowserClientQt::GetContextRedirectedToOriginal(content::BrowserContext *context) { // like in ShellExtensionsBrowserClient: return context; } -content::BrowserContext* ExtensionsBrowserClientQt::GetContextOwnInstance(content::BrowserContext *context, bool) +content::BrowserContext* ExtensionsBrowserClientQt::GetContextOwnInstance(content::BrowserContext *context) { // like in ShellExtensionsBrowserClient: return context; } -content::BrowserContext* ExtensionsBrowserClientQt::GetContextForOriginalOnly(content::BrowserContext *context, bool) +content::BrowserContext* ExtensionsBrowserClientQt::GetContextForOriginalOnly(content::BrowserContext *context) { // like in ShellExtensionsBrowserClient: return context; diff --git a/src/core/extensions/extensions_browser_client_qt.h b/src/core/extensions/extensions_browser_client_qt.h index d0ffb4b9760..9aaf56d0c2f 100644 --- a/src/core/extensions/extensions_browser_client_qt.h +++ b/src/core/extensions/extensions_browser_client_qt.h @@ -35,9 +35,9 @@ class ExtensionsBrowserClientQt : public ExtensionsBrowserClient bool HasOffTheRecordContext(content::BrowserContext *context) override; content::BrowserContext *GetOffTheRecordContext(content::BrowserContext *context) override; content::BrowserContext *GetOriginalContext(content::BrowserContext *context) override; - content::BrowserContext *GetContextRedirectedToOriginal(content::BrowserContext*, bool) override; - content::BrowserContext *GetContextOwnInstance(content::BrowserContext*, bool) override; - content::BrowserContext *GetContextForOriginalOnly(content::BrowserContext*, bool) override; + content::BrowserContext *GetContextRedirectedToOriginal(content::BrowserContext*) override; + content::BrowserContext *GetContextOwnInstance(content::BrowserContext*) override; + content::BrowserContext *GetContextForOriginalOnly(content::BrowserContext*) override; bool IsGuestSession(content::BrowserContext *context) const override; bool IsExtensionIncognitoEnabled(const std::string &extension_id, content::BrowserContext *context) const override; bool CanExtensionCrossIncognito(const Extension *extension, content::BrowserContext *context) const override; diff --git a/src/core/file_picker_controller.cpp b/src/core/file_picker_controller.cpp index 550ae0da026..dd941f963a0 100644 --- a/src/core/file_picker_controller.cpp +++ b/src/core/file_picker_controller.cpp @@ -182,7 +182,21 @@ static QStringList listRecursively(const QDir &dir) ASSERT_ENUMS_MATCH(FilePickerController::Open, blink::mojom::FileChooserParams_Mode::kOpen) ASSERT_ENUMS_MATCH(FilePickerController::OpenMultiple, blink::mojom::FileChooserParams_Mode::kOpenMultiple) ASSERT_ENUMS_MATCH(FilePickerController::UploadFolder, blink::mojom::FileChooserParams_Mode::kUploadFolder) -ASSERT_ENUMS_MATCH(FilePickerController::Save, blink::mojom::FileChooserParams_Mode::kSave) + +blink::mojom::FileChooserParams_Mode toFileChooserParams(FilePickerController::FileChooserMode mode) +{ + switch (mode) { + case FilePickerController::Open: + case FilePickerController::OpenMultiple: + case FilePickerController::UploadFolder: + break; + case FilePickerController::OpenDirectory: + return blink::mojom::FileChooserParams_Mode::kOpenDirectory; + case FilePickerController::Save: + return blink::mojom::FileChooserParams_Mode::kSave; + } + return static_cast(mode); +} void FilePickerController::filesSelectedInChooser(const QStringList &filesList) { @@ -203,7 +217,7 @@ void FilePickerController::filesSelectedInChooser(const QStringList &filesList) std::vector chooser_files; for (const auto &file : std::as_const(files)) { chooser_files.push_back(blink::mojom::FileChooserFileInfo::NewNativeFile( - blink::mojom::NativeFileInfo::New(toFilePath(file), std::u16string()))); + blink::mojom::NativeFileInfo::New(toFilePath(file), std::u16string(), std::vector{}))); } if (files.isEmpty()) @@ -211,7 +225,7 @@ void FilePickerController::filesSelectedInChooser(const QStringList &filesList) else d_ptr->fileDialogListener->FileSelected( std::move(chooser_files), baseDir, - static_cast(d_ptr->mode)); + toFileChooserParams(d_ptr->mode)); // release the fileSelectListener manually because it blocks fullscreen requests in chromium // see QTBUG-106975 diff --git a/src/core/file_picker_controller.h b/src/core/file_picker_controller.h index 42ffd6a2dc6..be5bcfe35b3 100644 --- a/src/core/file_picker_controller.h +++ b/src/core/file_picker_controller.h @@ -29,7 +29,8 @@ class Q_WEBENGINECORE_EXPORT FilePickerController : public QObject { Open, OpenMultiple, UploadFolder, - Save + Save, + OpenDirectory, }; FilePickerController(FilePickerControllerPrivate *priv, QObject *parent = nullptr); diff --git a/src/core/file_system_access/file_system_access_permission_context_qt.cpp b/src/core/file_system_access/file_system_access_permission_context_qt.cpp index 207a3e2d962..d6412416566 100644 --- a/src/core/file_system_access/file_system_access_permission_context_qt.cpp +++ b/src/core/file_system_access/file_system_access_permission_context_qt.cpp @@ -200,12 +200,12 @@ FileSystemAccessPermissionContextQt::~FileSystemAccessPermissionContextQt() = de scoped_refptr FileSystemAccessPermissionContextQt::GetReadPermissionGrant(const url::Origin &origin, - const base::FilePath &path, + const content::PathInfo &path_info, HandleType handle_type, UserAction user_action) { auto &origin_state = m_origins[origin]; - auto *&existing_grant = origin_state.read_grants[path]; + auto *&existing_grant = origin_state.read_grants[path_info.path]; scoped_refptr new_grant; if (existing_grant && existing_grant->handleType() != handle_type) { @@ -218,12 +218,12 @@ FileSystemAccessPermissionContextQt::GetReadPermissionGrant(const url::Origin &o if (!existing_grant) { new_grant = base::MakeRefCounted( - m_weakFactory.GetWeakPtr(), origin, path, handle_type, GrantType::kRead); + m_weakFactory.GetWeakPtr(), origin, path_info, handle_type, GrantType::kRead); existing_grant = new_grant.get(); } // If a parent directory is already readable this new grant should also be readable. - if (new_grant && AncestorHasActivePermission(origin, path, GrantType::kRead)) { + if (new_grant && AncestorHasActivePermission(origin, path_info.path, GrantType::kRead)) { existing_grant->SetStatus(blink::mojom::PermissionStatus::GRANTED); return existing_grant; } @@ -250,12 +250,12 @@ FileSystemAccessPermissionContextQt::GetReadPermissionGrant(const url::Origin &o scoped_refptr FileSystemAccessPermissionContextQt::GetWritePermissionGrant(const url::Origin &origin, - const base::FilePath &path, + const content::PathInfo &path_info, HandleType handle_type, UserAction user_action) { auto &origin_state = m_origins[origin]; - auto *&existing_grant = origin_state.write_grants[path]; + auto *&existing_grant = origin_state.write_grants[path_info.path]; scoped_refptr new_grant; if (existing_grant && existing_grant->handleType() != handle_type) { @@ -268,12 +268,12 @@ FileSystemAccessPermissionContextQt::GetWritePermissionGrant(const url::Origin & if (!existing_grant) { new_grant = base::MakeRefCounted( - m_weakFactory.GetWeakPtr(), origin, path, handle_type, GrantType::kWrite); + m_weakFactory.GetWeakPtr(), origin, path_info, handle_type, GrantType::kWrite); existing_grant = new_grant.get(); } // If a parent directory is already writable this new grant should also be writable. - if (new_grant && AncestorHasActivePermission(origin, path, GrantType::kWrite)) { + if (new_grant && AncestorHasActivePermission(origin, path_info.path, GrantType::kWrite)) { existing_grant->SetStatus(blink::mojom::PermissionStatus::GRANTED); return existing_grant; } @@ -295,21 +295,21 @@ FileSystemAccessPermissionContextQt::GetWritePermissionGrant(const url::Origin & } void FileSystemAccessPermissionContextQt::ConfirmSensitiveEntryAccess( - const url::Origin &origin, PathType path_type, const base::FilePath &path, + const url::Origin &origin, const content::PathInfo &info, HandleType handle_type, UserAction user_action, content::GlobalRenderFrameHostId frame_id, base::OnceCallback callback) { - if (path_type == PathType::kExternal) { + if (info.type == content::PathType::kExternal) { std::move(callback).Run(SensitiveEntryResult::kAllowed); return; } base::ThreadPool::PostTaskAndReplyWithResult( FROM_HERE, { base::MayBlock(), base::TaskPriority::USER_VISIBLE }, - base::BindOnce(&ShouldBlockAccessToPath, path, handle_type), + base::BindOnce(&ShouldBlockAccessToPath, info.path, handle_type), base::BindOnce(&FileSystemAccessPermissionContextQt::DidConfirmSensitiveDirectoryAccess, - m_weakFactory.GetWeakPtr(), origin, path, handle_type, user_action, frame_id, + m_weakFactory.GetWeakPtr(), origin, info.path, handle_type, user_action, frame_id, std::move(callback))); } @@ -337,18 +337,14 @@ bool FileSystemAccessPermissionContextQt::CanObtainWritePermission(const url::Or void FileSystemAccessPermissionContextQt::SetLastPickedDirectory(const url::Origin &origin, const std::string &id, - const base::FilePath &path, - const PathType type) + const content::PathInfo &info) { Q_UNUSED(origin); - FileSystemAccessPermissionContextQt::PathInfo info; - info.path = path; - info.type = type; m_lastPickedDirectories.insert({ id, info }); } -FileSystemAccessPermissionContextQt::PathInfo +content::PathInfo FileSystemAccessPermissionContextQt::GetLastPickedDirectory(const url::Origin &origin, const std::string &id) { @@ -356,7 +352,7 @@ FileSystemAccessPermissionContextQt::GetLastPickedDirectory(const url::Origin &o return m_lastPickedDirectories.find(id) != m_lastPickedDirectories.end() ? m_lastPickedDirectories[id] - : FileSystemAccessPermissionContextQt::PathInfo(); + : content::PathInfo(); } base::FilePath FileSystemAccessPermissionContextQt::GetWellKnownDirectoryPath( @@ -472,12 +468,18 @@ void FileSystemAccessPermissionContextQt::PermissionGrantDestroyed( grants.erase(grant_it); } -void FileSystemAccessPermissionContextQt::NotifyEntryMoved(const url::Origin &, const base::FilePath &, const base::FilePath &) +void FileSystemAccessPermissionContextQt::NotifyEntryMoved(const url::Origin &, const content::PathInfo &, const content::PathInfo &) { } +base::expected FileSystemAccessPermissionContextQt::CanShowFilePicker(content::RenderFrameHost*) +{ + // Matching AwFileSystemAccessPermissionContext::CanShowFilePicker() + return base::ok(); +} + void FileSystemAccessPermissionContextQt::CheckPathsAgainstEnterprisePolicy( - std::vector entries, content::GlobalRenderFrameHostId, + std::vector entries, content::GlobalRenderFrameHostId, EntriesAllowedByEnterprisePolicyCallback callback) { std::move(callback).Run(std::move(entries)); diff --git a/src/core/file_system_access/file_system_access_permission_context_qt.h b/src/core/file_system_access/file_system_access_permission_context_qt.h index 8d34da1f13d..8f84333561f 100644 --- a/src/core/file_system_access/file_system_access_permission_context_qt.h +++ b/src/core/file_system_access/file_system_access_permission_context_qt.h @@ -31,13 +31,13 @@ class FileSystemAccessPermissionContextQt : public content::FileSystemAccessPerm // content::FileSystemAccessPermissionContext: scoped_refptr - GetReadPermissionGrant(const url::Origin &origin, const base::FilePath &path, + GetReadPermissionGrant(const url::Origin &origin, const content::PathInfo &path_info, HandleType handle_type, UserAction user_action) override; scoped_refptr - GetWritePermissionGrant(const url::Origin &origin, const base::FilePath &path, + GetWritePermissionGrant(const url::Origin &origin, const content::PathInfo &path_info, HandleType handle_type, UserAction user_action) override; void ConfirmSensitiveEntryAccess( - const url::Origin &origin, PathType path_type, const base::FilePath &path, + const url::Origin &origin, const content::PathInfo &path_info, HandleType handle_type, UserAction user_action, content::GlobalRenderFrameHostId frame_id, base::OnceCallback callback) override; @@ -47,17 +47,19 @@ class FileSystemAccessPermissionContextQt : public content::FileSystemAccessPerm bool CanObtainReadPermission(const url::Origin &origin) override; bool CanObtainWritePermission(const url::Origin &origin) override; void SetLastPickedDirectory(const url::Origin &origin, const std::string &id, - const base::FilePath &path, const PathType type) override; - FileSystemAccessPermissionContextQt::PathInfo + const content::PathInfo &path_info) override; + content::PathInfo GetLastPickedDirectory(const url::Origin &origin, const std::string &id) override; base::FilePath GetWellKnownDirectoryPath(blink::mojom::WellKnownDirectory directory, const url::Origin &origin) override; std::u16string GetPickerTitle(const blink::mojom::FilePickerOptionsPtr &) override; - void NotifyEntryMoved(const url::Origin &, const base::FilePath &, const base::FilePath &) override; + void NotifyEntryMoved(const url::Origin &, const content::PathInfo &, const content::PathInfo &) override; void OnFileCreatedFromShowSaveFilePicker(const GURL &file_picker_binding_context, const storage::FileSystemURL &url) override {}; - void CheckPathsAgainstEnterprisePolicy(std::vector, content::GlobalRenderFrameHostId, + void CheckPathsAgainstEnterprisePolicy(std::vector, content::GlobalRenderFrameHostId, EntriesAllowedByEnterprisePolicyCallback) override; + base::expected CanShowFilePicker(content::RenderFrameHost*) override; + void NavigatedAwayFromOrigin(const url::Origin &origin); content::BrowserContext *profile() const { return m_profile; } @@ -80,7 +82,7 @@ class FileSystemAccessPermissionContextQt : public content::FileSystemAccessPerm struct OriginState; std::map m_origins; - std::map m_lastPickedDirectories; + std::map m_lastPickedDirectories; base::WeakPtrFactory m_weakFactory { this }; }; diff --git a/src/core/file_system_access/file_system_access_permission_grant_qt.cpp b/src/core/file_system_access/file_system_access_permission_grant_qt.cpp index dc26a415ee8..66e1f9dfc95 100644 --- a/src/core/file_system_access/file_system_access_permission_grant_qt.cpp +++ b/src/core/file_system_access/file_system_access_permission_grant_qt.cpp @@ -23,8 +23,8 @@ namespace QtWebEngineCore { FileSystemAccessPermissionGrantQt::FileSystemAccessPermissionGrantQt( base::WeakPtr context, const url::Origin &origin, - const base::FilePath &path, HandleType handle_type, GrantType type) - : m_context(context), m_origin(origin), m_path(path), m_handleType(handle_type), m_type(type) + const content::PathInfo &pathInfo, HandleType handle_type, GrantType type) + : m_context(context), m_origin(origin), m_pathInfo(pathInfo), m_handleType(handle_type), m_type(type) { } FileSystemAccessPermissionGrantQt::~FileSystemAccessPermissionGrantQt() @@ -111,7 +111,7 @@ void FileSystemAccessPermissionGrantQt::RequestPermission( // code does not have to have any way to request Access::kReadWrite. request_manager->AddRequest( - { m_origin, m_path, m_handleType, access }, + { m_origin, m_pathInfo, m_handleType, access }, base::BindOnce(&FileSystemAccessPermissionGrantQt::OnPermissionRequestResult, this, std::move(callback)), std::move(fullscreen_block)); diff --git a/src/core/file_system_access/file_system_access_permission_grant_qt.h b/src/core/file_system_access/file_system_access_permission_grant_qt.h index 829d2b88912..4b3b0ea0379 100644 --- a/src/core/file_system_access/file_system_access_permission_grant_qt.h +++ b/src/core/file_system_access/file_system_access_permission_grant_qt.h @@ -19,19 +19,21 @@ class FileSystemAccessPermissionGrantQt : public content::FileSystemAccessPermis { public: FileSystemAccessPermissionGrantQt(base::WeakPtr context, - const url::Origin &origin, const base::FilePath &path, + const url::Origin &origin, + const content::PathInfo &path_info, HandleType handle_type, GrantType type); // content::FileSystemAccessPermissionGrant: blink::mojom::PermissionStatus GetStatus() override { return m_status; } - base::FilePath GetPath() override { return m_path; } + base::FilePath GetPath() override { return m_pathInfo.path; } + std::string GetDisplayName() override { return m_pathInfo.display_name; } void RequestPermission(content::GlobalRenderFrameHostId frame_id, UserActivationState user_activation_state, base::OnceCallback callback) override; const url::Origin &origin() const { return m_origin; } HandleType handleType() const { return m_handleType; } - const base::FilePath &path() const { return m_path; } + const base::FilePath &path() const { return m_pathInfo.path; } GrantType type() const { return m_type; } void SetStatus(blink::mojom::PermissionStatus status); @@ -45,7 +47,7 @@ class FileSystemAccessPermissionGrantQt : public content::FileSystemAccessPermis base::WeakPtr const m_context; const url::Origin m_origin; - const base::FilePath m_path; + const content::PathInfo m_pathInfo; const HandleType m_handleType; const GrantType m_type; diff --git a/src/core/file_system_access/file_system_access_permission_request_controller.h b/src/core/file_system_access/file_system_access_permission_request_controller.h index e659f81a770..282f41f4253 100644 --- a/src/core/file_system_access/file_system_access_permission_request_controller.h +++ b/src/core/file_system_access/file_system_access_permission_request_controller.h @@ -16,6 +16,7 @@ class FileSystemAccessPermissionRequestController : public RequestController { public: FileSystemAccessPermissionRequestController(const QUrl &origin, const QUrl &filePath, + const QString &displayName, HandleType handleType, AccessFlags accessType) : RequestController(origin) , m_filePath(filePath) @@ -25,11 +26,13 @@ class FileSystemAccessPermissionRequestController : public RequestController } QUrl filePath() const { return m_filePath; } + QString displayName() const { return m_displayName; } HandleType handleType() const { return m_handleType; } AccessFlags accessFlags() const { return m_accessType; } private: QUrl m_filePath; + QString m_displayName; HandleType m_handleType; AccessFlags m_accessType; }; diff --git a/src/core/file_system_access/file_system_access_permission_request_controller_impl.cpp b/src/core/file_system_access/file_system_access_permission_request_controller_impl.cpp index f77c974d0b6..67447928b7f 100644 --- a/src/core/file_system_access/file_system_access_permission_request_controller_impl.cpp +++ b/src/core/file_system_access/file_system_access_permission_request_controller_impl.cpp @@ -23,7 +23,8 @@ FileSystemAccessPermissionRequestControllerImpl::FileSystemAccessPermissionReque const FileSystemAccessPermissionRequestManagerQt::RequestData &request, base::OnceCallback callback) : FileSystemAccessPermissionRequestController( - toQt(request.origin.GetURL()), QUrl::fromLocalFile(toQt(request.path.value())), + toQt(request.origin.GetURL()), QUrl::fromLocalFile(toQt(request.pathInfo.path.value())), + QString::fromStdString(request.pathInfo.display_name), (HandleType)request.handle_type, AccessFlags((int)request.access)) , m_callback(std::move(callback)) { diff --git a/src/core/file_system_access/file_system_access_permission_request_manager_qt.cpp b/src/core/file_system_access/file_system_access_permission_request_manager_qt.cpp index c384dc7b3ea..a3f5b2ed2a6 100644 --- a/src/core/file_system_access/file_system_access_permission_request_manager_qt.cpp +++ b/src/core/file_system_access/file_system_access_permission_request_manager_qt.cpp @@ -17,17 +17,22 @@ namespace QtWebEngineCore { +// Based on chrome/browser/file_system_access/file_system_access_permission_request_manager.cc +// Copyright 2019 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + bool RequestsAreIdentical(const FileSystemAccessPermissionRequestManagerQt::RequestData &a, const FileSystemAccessPermissionRequestManagerQt::RequestData &b) { - return a.origin == b.origin && a.path == b.path && a.handle_type == b.handle_type + return a.origin == b.origin && a.pathInfo.path == b.pathInfo.path && a.handle_type == b.handle_type && a.access == b.access; } bool RequestsAreForSamePath(const FileSystemAccessPermissionRequestManagerQt::RequestData &a, const FileSystemAccessPermissionRequestManagerQt::RequestData &b) { - return a.origin == b.origin && a.path == b.path && a.handle_type == b.handle_type; + return a.origin == b.origin && a.pathInfo.path == b.pathInfo.path && a.handle_type == b.handle_type; } struct FileSystemAccessPermissionRequestManagerQt::Request diff --git a/src/core/file_system_access/file_system_access_permission_request_manager_qt.h b/src/core/file_system_access/file_system_access_permission_request_manager_qt.h index 84085491153..aba5ceebef1 100644 --- a/src/core/file_system_access/file_system_access_permission_request_manager_qt.h +++ b/src/core/file_system_access/file_system_access_permission_request_manager_qt.h @@ -38,7 +38,7 @@ class FileSystemAccessPermissionRequestManagerQt struct RequestData { url::Origin origin; - base::FilePath path; + content::PathInfo pathInfo; content::FileSystemAccessPermissionContext::HandleType handle_type; Access access; }; diff --git a/src/core/permission_manager_qt.cpp b/src/core/permission_manager_qt.cpp index e57e12e3d0e..5258f15cf8d 100644 --- a/src/core/permission_manager_qt.cpp +++ b/src/core/permission_manager_qt.cpp @@ -52,7 +52,6 @@ static QWebEnginePermission::PermissionType toQt(blink::PermissionType type) return QWebEnginePermission::PermissionType::LocalFontsAccess; case blink::PermissionType::POINTER_LOCK: return QWebEnginePermission::PermissionType::MouseLock; - case blink::PermissionType::ACCESSIBILITY_EVENTS: case blink::PermissionType::CAMERA_PAN_TILT_ZOOM: case blink::PermissionType::WINDOW_MANAGEMENT: case blink::PermissionType::BACKGROUND_SYNC: diff --git a/src/core/printing/pdf_document_helper_client_qt.cpp b/src/core/printing/pdf_document_helper_client_qt.cpp index 275f6701316..66252d212a5 100644 --- a/src/core/printing/pdf_document_helper_client_qt.cpp +++ b/src/core/printing/pdf_document_helper_client_qt.cpp @@ -20,3 +20,6 @@ void PDFDocumentHelperClientQt::SetPluginCanSave(content::RenderFrameHost *rende void PDFDocumentHelperClientQt::UpdateContentRestrictions(content::RenderFrameHost *, int) { } +void PDFDocumentHelperClientQt::OnSearchifyStateChange(bool, content::WebContents *) +{ +} diff --git a/src/core/printing/pdf_document_helper_client_qt.h b/src/core/printing/pdf_document_helper_client_qt.h index 4bdc3d6b371..43a4726d36a 100644 --- a/src/core/printing/pdf_document_helper_client_qt.h +++ b/src/core/printing/pdf_document_helper_client_qt.h @@ -21,6 +21,7 @@ class PDFDocumentHelperClientQt : public pdf::PDFDocumentHelperClient // FIXME: void OnSaveURL(content::WebContents *contents) override {} void SetPluginCanSave(content::RenderFrameHost *render_frame_host, bool can_save) override; void UpdateContentRestrictions(content::RenderFrameHost *, int) override; + void OnSearchifyStateChange(bool, content::WebContents *) override; }; #endif // PDF_DOCUMENT_HELPER_CLIENT_QT_H diff --git a/src/core/printing/print_view_manager_qt.cpp b/src/core/printing/print_view_manager_qt.cpp index b0f1788fdd3..364253887b6 100644 --- a/src/core/printing/print_view_manager_qt.cpp +++ b/src/core/printing/print_view_manager_qt.cpp @@ -52,27 +52,15 @@ static QSharedPointer GetStdVectorFromHandle(const base::ReadOnlySha return QSharedPointer(new QByteArray(data, map.size())); } -static scoped_refptr -GetBytesFromHandle(const base::ReadOnlySharedMemoryRegion &handle) -{ - base::ReadOnlySharedMemoryMapping map = handle.Map(); - if (!map.IsValid()) - return nullptr; - - const unsigned char* data = static_cast(map.memory()); - std::vector dataVector(data, data + map.size()); - return base::RefCountedBytes::TakeVector(&dataVector); -} - // Write the PDF file to disk. -static void SavePdfFile(scoped_refptr data, +static void SavePdfFile(scoped_refptr data, const base::FilePath &path, QtWebEngineCore::PrintViewManagerQt::PrintToPDFFileCallback saveCallback) { DCHECK_GT(data->size(), 0U); printing::MetafileSkia metafile; - metafile.InitFromData(base::as_bytes(base::make_span(data->front(), data->size()))); + metafile.InitFromData(*data); base::File file(path, base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE); @@ -100,7 +88,6 @@ static base::Value::Dict createPrintSettings() printSettings.Set(printing::kSettingCopies, 1); printSettings.Set(printing::kSettingPagesPerSheet, 1); printSettings.Set(printing::kSettingCollate, false); -// printSettings->SetBoolean(printing::kSettingGenerateDraftData, false); printSettings.Set(printing::kSettingPreviewModifiable, false); printSettings.Set(printing::kSettingShouldPrintSelectionOnly, base::Value(false)); @@ -432,9 +419,9 @@ void PrintViewManagerQt::MetafileReadyForPrinting(printing::mojom::DidPreviewDoc content::GetUIThreadTaskRunner({})->PostTask(FROM_HERE, base::BindOnce(std::move(pdf_print_callback), data_array)); } else { - scoped_refptr data_bytes = GetBytesFromHandle(params->content->metafile_data_region); + auto data_bytes = base::RefCountedSharedMemoryMapping::CreateFromWholeRegion(params->content->metafile_data_region); base::ThreadPool::PostTask(FROM_HERE, { base::MayBlock() }, - base::BindOnce(&SavePdfFile, data_bytes, pdfOutputPath, std::move(pdf_save_callback))); + base::BindOnce(&SavePdfFile, std::move(data_bytes), pdfOutputPath, std::move(pdf_save_callback))); } } diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index 0d3d9777514..978f00675ed 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -13,7 +13,9 @@ #include "web_event_factory.h" #include "components/input/cursor_manager.h" +#include "components/input/events_helper.h" #include "components/input/render_widget_host_input_event_router.h" +#include "components/input/switches.h" #include "components/viz/common/features.h" #include "components/viz/common/frame_sinks/begin_frame_source.h" #include "components/viz/common/surfaces/frame_sink_id_allocator.h" @@ -27,7 +29,6 @@ #include "content/browser/renderer_host/render_view_host_impl.h" #include "content/common/content_switches_internal.h" #include "content/common/cursors/webcursor.h" -#include "content/common/input/events_helper.h" #include "content/common/input/synthetic_gesture_target.h" #include "content/public/browser/web_contents.h" #include "third_party/skia/include/core/SkColor.h" @@ -646,7 +647,7 @@ bool RenderWidgetHostViewQt::TransformPointToCoordSpaceForView(const gfx::PointF return true; } - return target_view->TransformPointToLocalCoordSpace(point, GetCurrentSurfaceId(), transformed_point); + return target_view->TransformPointToLocalCoordSpace(point, GetFrameSinkId(), transformed_point); } void RenderWidgetHostViewQt::Destroy() @@ -766,7 +767,7 @@ void RenderWidgetHostViewQt::OnGestureEvent(const ui::GestureEventData& gesture) if ((gesture.type() == ui::EventType::kGesturePinchBegin || gesture.type() == ui::EventType::kGesturePinchUpdate || gesture.type() == ui::EventType::kGesturePinchEnd) - && !content::IsPinchToZoomEnabled()) { + && !input::switches::IsPinchToZoomEnabled()) { return; } @@ -848,7 +849,7 @@ void RenderWidgetHostViewQt::notifyHidden() void RenderWidgetHostViewQt::ProcessAckedTouchEvent(const input::TouchEventWithLatencyInfo &touch, blink::mojom::InputEventResultState ack_result) { const bool eventConsumed = (ack_result == blink::mojom::InputEventResultState::kConsumed); - const bool isSetBlocking = content::InputEventResultStateIsSetBlocking(ack_result); + const bool isSetBlocking = input::InputEventResultStateIsSetBlocking(ack_result); m_gestureProvider.OnTouchEventAck(touch.event.unique_touch_event_id, eventConsumed, isSetBlocking); } diff --git a/src/core/renderer/content_renderer_client_qt.cpp b/src/core/renderer/content_renderer_client_qt.cpp index b04696fe5e6..0368ba3d813 100644 --- a/src/core/renderer/content_renderer_client_qt.cpp +++ b/src/core/renderer/content_renderer_client_qt.cpp @@ -204,7 +204,7 @@ void ContentRendererClientQt::RenderFrameCreated(content::RenderFrame *render_fr #endif auto password_autofill_agent = - std::make_unique(render_frame, associated_interfaces, autofill::PasswordAutofillAgent::EnableHeavyFormDataScraping(false)); + std::make_unique(render_frame, associated_interfaces); auto password_generation_agent = std::make_unique(render_frame, password_autofill_agent.get(), associated_interfaces); diff --git a/src/core/renderer/web_engine_page_render_frame.cpp b/src/core/renderer/web_engine_page_render_frame.cpp index 31477564fd0..fbdef74b29e 100644 --- a/src/core/renderer/web_engine_page_render_frame.cpp +++ b/src/core/renderer/web_engine_page_render_frame.cpp @@ -2,16 +2,20 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "renderer/web_engine_page_render_frame.h" + #include "content/public/renderer/render_frame.h" #include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h" - #include "third_party/blink/public/common/metrics/document_update_reason.h" #include "third_party/blink/public/platform/web_string.h" #include "third_party/blink/public/web/web_frame_content_dumper.h" #include "third_party/blink/public/web/web_local_frame.h" #include "third_party/blink/public/web/web_view.h" + +// Pretend we are part of blink to access non public blink headers: +#define INSIDE_BLINK 1 #include "third_party/blink/renderer/core/frame/web_local_frame_impl.h" #include "third_party/blink/renderer/platform/heap/thread_state.h" +#undef INSIDE_BLINK namespace { // Forces layouting of document and it's subtree. diff --git a/src/core/touch_selection_controller_client_qt.cpp b/src/core/touch_selection_controller_client_qt.cpp index befee6aaf4f..804e943350e 100644 --- a/src/core/touch_selection_controller_client_qt.cpp +++ b/src/core/touch_selection_controller_client_qt.cpp @@ -37,17 +37,17 @@ TouchSelectionControllerClientQt::~TouchSelectionControllerClientQt() bool TouchSelectionControllerClientQt::handleContextMenu(const content::ContextMenuParams& params) { - if ((params.source_type == ui::MENU_SOURCE_LONG_PRESS || - params.source_type == ui::MENU_SOURCE_LONG_TAP) && + if ((params.source_type == ui::mojom::MenuSourceType::kLongPress || + params.source_type == ui::mojom::MenuSourceType::kLongTap) && params.is_editable && params.selection_text.empty()) { m_menuRequested = true; updateMenu(); return true; } - const bool from_touch = params.source_type == ui::MENU_SOURCE_LONG_PRESS || - params.source_type == ui::MENU_SOURCE_LONG_TAP || - params.source_type == ui::MENU_SOURCE_TOUCH; + const bool from_touch = params.source_type == ui::mojom::MenuSourceType::kLongPress || + params.source_type == ui::mojom::MenuSourceType::kLongTap || + params.source_type == ui::mojom::MenuSourceType::kTouch; if (from_touch && !params.selection_text.empty()) return true; @@ -132,7 +132,7 @@ void TouchSelectionControllerClientQt::RunContextMenu() content::RenderWidgetHostImpl *host = m_rwhv->host(); host->ShowContextMenuAtPoint(gfx::ToRoundedPoint(anchorPoint), - ui::MENU_SOURCE_TOUCH_EDIT_MENU); + ui::mojom::MenuSourceType::kTouchEditMenu); // Hide selection handles after getting rect-between-bounds from touch // selection controller; otherwise, rect would be empty and the above diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index e518b5ae172..3f209c7e0c5 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -606,10 +606,25 @@ bool WebContentsDelegateQt::IsFullscreenForTabOrPending(const content::WebConten ASSERT_ENUMS_MATCH(FilePickerController::Open, blink::mojom::FileChooserParams::Mode::kOpen) ASSERT_ENUMS_MATCH(FilePickerController::OpenMultiple, blink::mojom::FileChooserParams::Mode::kOpenMultiple) ASSERT_ENUMS_MATCH(FilePickerController::UploadFolder, blink::mojom::FileChooserParams::Mode::kUploadFolder) -ASSERT_ENUMS_MATCH(FilePickerController::Save, blink::mojom::FileChooserParams::Mode::kSave) +// ASSERT_ENUMS_MATCH(FilePickerController::Save, blink::mojom::FileChooserParams::Mode::kSave) extern FilePickerController *createFilePickerController(FilePickerController::FileChooserMode mode, scoped_refptr listener, const QString &defaultFileName, const QStringList &acceptedMimeTypes, QObject *parent = nullptr); +FilePickerController::FileChooserMode toFileChooserMode(blink::mojom::FileChooserParams_Mode mode) +{ + switch (mode) { + case blink::mojom::FileChooserParams_Mode::kOpen: + case blink::mojom::FileChooserParams_Mode::kOpenMultiple: + case blink::mojom::FileChooserParams_Mode::kUploadFolder: + break; + case blink::mojom::FileChooserParams_Mode::kOpenDirectory: + return FilePickerController::OpenDirectory; + case blink::mojom::FileChooserParams_Mode::kSave: + return FilePickerController::Save; + } + return static_cast(mode); +} + void WebContentsDelegateQt::RunFileChooser(content::RenderFrameHost * /*frameHost*/, scoped_refptr listener, const blink::mojom::FileChooserParams& params) @@ -619,7 +634,7 @@ void WebContentsDelegateQt::RunFileChooser(content::RenderFrameHost * /*frameHos for (std::vector::const_iterator it = params.accept_types.begin(); it < params.accept_types.end(); ++it) acceptedMimeTypes.append(toQt(*it)); - m_filePickerController.reset(createFilePickerController(static_cast(params.mode), + m_filePickerController.reset(createFilePickerController(toFileChooserMode(params.mode), listener, toQt(params.default_file_name.value()), acceptedMimeTypes)); // Defer the call to not block base::MessageLoop::RunTask with modal dialogs. diff --git a/src/core/web_contents_view_qt.h b/src/core/web_contents_view_qt.h index d04a4924f47..6f789ebe836 100644 --- a/src/core/web_contents_view_qt.h +++ b/src/core/web_contents_view_qt.h @@ -96,6 +96,7 @@ class WebContentsViewQt void GotFocus(content::RenderWidgetHostImpl *render_widget_host) override; void LostFocus(content::RenderWidgetHostImpl *render_widget_host) override; void TakeFocus(bool reverse) override; + void DestroyBackForwardTransitionAnimationManager() override {} private: static void update(QWebEngineContextMenuRequest *request, diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index d04016845a3..939fc647c97 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -918,12 +918,12 @@ WebEngineContext::WebEngineContext() enableFeatures.push_back(features::kOverlayScrollbar.name); parsedCommandLine.AppendSwitch(switches::kEnableViewport); parsedCommandLine.AppendSwitch(input::switches::kValidateInputEventStream); - parsedCommandLine.AppendSwitch(cc::switches::kDisableCompositedAntialiasing); + parsedCommandLine.AppendSwitch(switches::kDisableCompositedAntialiasing); } #if BUILDFLAG(IS_OZONE) if (!isGbmSupported()) { - disableFeatures.push_back(media::kVaapiVideoDecodeLinux.name); + disableFeatures.push_back(media::kAcceleratedVideoDecodeLinux.name); parsedCommandLine.AppendSwitch(switches::kDisableGpuMemoryBufferVideoFrames); } #endif diff --git a/src/pdf/CMakeLists.txt b/src/pdf/CMakeLists.txt index 9f7ef7d0e99..423d9883d97 100644 --- a/src/pdf/CMakeLists.txt +++ b/src/pdf/CMakeLists.txt @@ -126,7 +126,6 @@ foreach(arch ${archs}) enable_swiftshader_vulkan=false angle_enable_swiftshader=false dawn_use_swiftshader=false - pdf_enable_fontations=false use_cups=false use_dawn=false build_dawn_tests=false @@ -141,6 +140,7 @@ foreach(arch ${archs}) v8_enable_webassembly=false use_v8_context_snapshot=false v8_use_external_startup_data=false + webnn_use_tflite=false ) if(LINUX OR ANDROID) diff --git a/src/webenginequick/api/qquickwebenginedialogrequests.cpp b/src/webenginequick/api/qquickwebenginedialogrequests.cpp index 9d6b5ed7000..9f08e1781f3 100644 --- a/src/webenginequick/api/qquickwebenginedialogrequests.cpp +++ b/src/webenginequick/api/qquickwebenginedialogrequests.cpp @@ -622,7 +622,8 @@ QString QQuickWebEngineFileDialogRequest::defaultFileName() const QQuickWebEngineFileDialogRequest::FileMode QQuickWebEngineFileDialogRequest::mode() const { - return m_mode; + // map opendirectory to openmultiple + return m_mode > FileMode::FileModeSave ? FileMode::FileModeOpenMultiple : m_mode; } /*! diff --git a/src/webenginewidgets/api/qwebengineview.cpp b/src/webenginewidgets/api/qwebengineview.cpp index ed768d8500b..888ed88655c 100644 --- a/src/webenginewidgets/api/qwebengineview.cpp +++ b/src/webenginewidgets/api/qwebengineview.cpp @@ -507,6 +507,8 @@ QStringList QWebEngineViewPrivate::chooseFiles(QWebEnginePage::FileSelectionMode QStringList ret; QString str; switch (static_cast(mode)) { + case QtWebEngineCore::FilePickerController::OpenDirectory: + Q_FALLTHROUGH(); case QtWebEngineCore::FilePickerController::OpenMultiple: ret = QFileDialog::getOpenFileNames(q, QString(), QString(), filter.join(QStringLiteral(";;")), nullptr, From daab0b4ed7c49627045a12500df197b16128fa19 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 14 Apr 2025 11:07:35 +0200 Subject: [PATCH 2/2] Adaptations for Chromium 134 Pick-to: 6.10 Change-Id: I9615f0a095843fdf295e454a93476cf349f7fc76 Reviewed-by: Michal Klocek --- CHROMIUM_VERSION | 5 +- configure.cmake | 2 +- src/3rdparty | 2 +- src/core/api/CMakeLists.txt | 1 + ...authenticator_request_client_delegate_qt.h | 1 + src/core/autofill_client_qt.cpp | 39 +++++++++------ src/core/autofill_client_qt.h | 13 +++-- src/core/autofill_popup_controller.cpp | 2 +- src/core/autofill_popup_controller_p.h | 2 +- src/core/client_cert_select_controller.cpp | 4 +- src/core/client_hints.cpp | 4 +- src/core/client_hints.h | 2 +- src/core/clipboard_qt.cpp | 2 + src/core/clipboard_qt.h | 1 + src/core/clipboard_util_win.cpp | 18 +++---- .../native_skia_output_device_direct3d11.cpp | 4 +- .../native_skia_output_device_opengl.cpp | 4 +- .../native_skia_output_device_vulkan.cpp | 4 +- src/core/configure/BUILD.root.gn.in | 7 ++- src/core/content_browser_client_qt.cpp | 32 ++++++++----- src/core/content_browser_client_qt.h | 6 ++- .../protocol_handler_registry_factory.cpp | 7 ++- .../protocol_handler_registry_factory.h | 2 +- .../extensions/extension_host_delegate_qt.cpp | 5 -- .../extensions/extension_host_delegate_qt.h | 1 - src/core/extensions/extension_loader.h | 25 ++++++---- .../extension_system_factory_qt.cpp | 4 +- .../extensions/extension_system_factory_qt.h | 2 +- .../extension_web_contents_observer_qt.cpp | 2 +- .../extensions_browser_client_qt.cpp | 7 --- .../extensions/extensions_browser_client_qt.h | 3 -- .../pdf_iframe_navigation_throttle_qt.cpp | 2 +- .../extensions/webui/extensions_ui_qt.cpp | 5 +- src/core/favicon_service_factory_qt.cpp | 11 ++--- src/core/favicon_service_factory_qt.h | 4 +- ...m_access_permission_context_factory_qt.cpp | 6 +-- ...tem_access_permission_context_factory_qt.h | 2 +- ...le_system_access_permission_context_qt.cpp | 6 +++ ...file_system_access_permission_context_qt.h | 1 + src/core/media_capture_devices_dispatcher.cpp | 4 +- src/core/net/client_cert_store_data.cpp | 5 +- src/core/net/custom_url_loader_factory.cpp | 2 - ...sponse_interceptor_url_loader_throttle.cpp | 2 +- .../proxying_restricted_cookie_manager_qt.cpp | 15 ++++-- .../proxying_restricted_cookie_manager_qt.h | 5 ++ .../net/proxying_url_loader_factory_qt.cpp | 16 +------ src/core/net/resource_request_body_qt.cpp | 2 +- src/core/ozone/ozone_platform_qt.cpp | 3 +- .../pdf_document_helper_client_qt.cpp | 2 +- .../printing/pdf_document_helper_client_qt.h | 3 +- .../printing/print_view_manager_base_qt.cpp | 4 +- src/core/profile_io_data_qt.cpp | 3 +- src/core/profile_qt.cpp | 30 ++++-------- src/core/render_widget_host_view_qt.cpp | 33 ++----------- src/core/render_widget_host_view_qt.h | 4 +- ...nder_widget_host_view_qt_delegate_item.cpp | 2 + .../renderer/content_renderer_client_qt.cpp | 43 ++++++----------- .../web_channel_ipc_transport_host.cpp | 2 +- src/core/touch_handle_drawable_qt.cpp | 26 +++++----- src/core/touch_handle_drawable_qt.h | 4 +- .../touch_selection_controller_client_qt.cpp | 11 ++++- src/core/web_contents_adapter.cpp | 16 ++++--- src/core/web_contents_delegate_qt.cpp | 2 + src/core/web_engine_context.cpp | 3 +- src/core/web_engine_settings.cpp | 10 ++-- src/pdf/CMakeLists.txt | 3 +- src/webenginewidgets/api/qwebengineview.cpp | 1 - .../tst_qquickwebengineview.cpp | 13 ----- .../qwebenginepage/tst_qwebenginepage.cpp | 48 ------------------- .../qwebengineview/tst_qwebengineview.cpp | 13 ----- tests/manual/widgets/webrtc/index.html | 31 ------------ tests/manual/widgets/webrtc/main.cpp | 4 +- tools/scripts/version_resolver.py | 4 +- 73 files changed, 252 insertions(+), 367 deletions(-) diff --git a/CHROMIUM_VERSION b/CHROMIUM_VERSION index 4855e4bfd0b..08826803a58 100644 --- a/CHROMIUM_VERSION +++ b/CHROMIUM_VERSION @@ -1,3 +1,2 @@ - -Based on Chromium version: 130.0.6723.192 -Patched with security patches up to Chromium version: 137.0.7151.68 +Based on Chromium version: 134.0.6998.208 +Patched with security patches up to Chromium version: 134.0.6998.208 diff --git a/configure.cmake b/configure.cmake index 6b3b5f7705e..f37910d7cf3 100644 --- a/configure.cmake +++ b/configure.cmake @@ -17,7 +17,7 @@ qt_webengine_set_version(glib 2.32.0) qt_webengine_set_version(glibc 2.16) qt_webengine_set_version(harfbuzz 4.3.0) qt_webengine_set_version(libpng 1.6.0) -qt_webengine_set_version(libtiff 4.2.0) +qt_webengine_set_version(libtiff 4.5.0) qt_webengine_set_version(re2 11.0.0) qt_webengine_set_version(icu 70) qt_webengine_set_version(opus 1.3.1) diff --git a/src/3rdparty b/src/3rdparty index d55e428cf65..40948d1690e 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit d55e428cf65c2fffceef1e1eb95803d3395415f8 +Subproject commit 40948d1690e3a124e45ac562c58d3e6887a3f4fe diff --git a/src/core/api/CMakeLists.txt b/src/core/api/CMakeLists.txt index b13aa026026..970c071fd61 100644 --- a/src/core/api/CMakeLists.txt +++ b/src/core/api/CMakeLists.txt @@ -53,6 +53,7 @@ qt_internal_add_module(WebEngineCore ../ ../../3rdparty/chromium ../../3rdparty/chromium/third_party/abseil-cpp + ../../3rdparty/chromium/third_party/icu/source/common ../../3rdparty/chromium/third_party/perfetto/include ../../3rdparty/chromium/third_party/boringssl/src/include ../../3rdparty/chromium/base/allocator/partition_allocator/src diff --git a/src/core/authenticator_request_client_delegate_qt.h b/src/core/authenticator_request_client_delegate_qt.h index 1b6c292db1e..1c04351e86e 100644 --- a/src/core/authenticator_request_client_delegate_qt.h +++ b/src/core/authenticator_request_client_delegate_qt.h @@ -6,6 +6,7 @@ #include "qtwebenginecoreglobal_p.h" #include "content/public/browser/authenticator_request_client_delegate.h" +#include "content/public/browser/web_authentication_delegate.h" #include #include diff --git a/src/core/autofill_client_qt.cpp b/src/core/autofill_client_qt.cpp index 19d3ac24e1f..27834498001 100644 --- a/src/core/autofill_client_qt.cpp +++ b/src/core/autofill_client_qt.cpp @@ -12,7 +12,7 @@ #include "chrome/browser/profiles/profile.h" #include "components/autofill/content/browser/content_autofill_driver.h" -#include "components/autofill/core/browser/browser_autofill_manager.h" +#include "components/autofill/core/browser/foundations/browser_autofill_manager.h" #include "components/autofill/core/common/autofill_prefs.h" #include "content/browser/web_contents/web_contents_impl.h" #include "services/network/public/cpp/shared_url_loader_factory.h" @@ -35,11 +35,6 @@ AutofillClientQt::AutofillClientQt(content::WebContents *webContents) AutofillClientQt::~AutofillClientQt() { } -autofill::PersonalDataManager *AutofillClientQt::GetPersonalDataManager() -{ - return nullptr; -} - autofill::AutocompleteHistoryManager *AutofillClientQt::GetAutocompleteHistoryManager() { return nullptr; @@ -47,7 +42,7 @@ autofill::AutocompleteHistoryManager *AutofillClientQt::GetAutocompleteHistoryMa std::unique_ptr AutofillClientQt::CreateManager(base::PassKey, autofill::ContentAutofillDriver &driver) { - return base::WrapUnique(new autofill::BrowserAutofillManager(&driver, std::string())); + return base::WrapUnique(new autofill::BrowserAutofillManager(&driver)); } PrefService *AutofillClientQt::GetPrefs() @@ -85,12 +80,6 @@ void AutofillClientQt::UpdateAutofillDataListValues( HideAutofillSuggestions(autofill::SuggestionHidingReason::kNoSuggestions); } -void AutofillClientQt::PinAutofillSuggestions() -{ - // Called by password_manager component only. - NOTIMPLEMENTED(); -} - base::span AutofillClientQt::GetAutofillSuggestions() const { @@ -104,16 +93,38 @@ void AutofillClientQt::HideAutofillSuggestions(autofill::SuggestionHidingReason) adapterClient()->hideAutofillPopup(); } +bool AutofillClientQt::IsAutofillEnabled() const +{ + // Returns false, this is not required to be enabled for . + return IsAutofillProfileEnabled() || IsAutofillPaymentMethodsEnabled(); +} + +bool AutofillClientQt::IsAutofillProfileEnabled() const +{ + return autofill::prefs::IsAutofillProfileEnabled(GetPrefs()); +} + +bool AutofillClientQt::IsAutofillPaymentMethodsEnabled() const +{ + return autofill::prefs::IsAutofillPaymentMethodsEnabled(GetPrefs()); +} + bool AutofillClientQt::IsAutocompleteEnabled() const { return autofill::prefs::IsAutocompleteEnabled(GetPrefs()); } -bool AutofillClientQt::IsPasswordManagerEnabled() +bool AutofillClientQt::IsPasswordManagerEnabled() const { return false; } +const std::string& AutofillClientQt::GetAppLocale() const +{ + static const std::string empty; + return empty; +} + bool AutofillClientQt::IsOffTheRecord() const { return web_contents()->GetBrowserContext()->IsOffTheRecord(); diff --git a/src/core/autofill_client_qt.h b/src/core/autofill_client_qt.h index b42e4f67eb5..f701f0b12f7 100644 --- a/src/core/autofill_client_qt.h +++ b/src/core/autofill_client_qt.h @@ -21,7 +21,7 @@ #include "base/memory/weak_ptr.h" #include "base/containers/span.h" #include "components/autofill/content/browser/content_autofill_client.h" -#include "components/autofill/core/browser/autofill_manager.h" +#include "components/autofill/core/browser/foundations/autofill_manager.h" #include "content/public/browser/web_contents_observer.h" #include @@ -40,7 +40,6 @@ class AutofillClientQt : public autofill::ContentAutofillClient, static void CreateForWebContents(content::WebContents *contents); // autofill::AutofillClient overrides: - autofill::PersonalDataManager *GetPersonalDataManager() override; autofill::AutocompleteHistoryManager *GetAutocompleteHistoryManager() override; PrefService *GetPrefs() override; const PrefService *GetPrefs() const override; @@ -50,16 +49,22 @@ class AutofillClientQt : public autofill::ContentAutofillClient, base::WeakPtr delegate) override; void UpdateAutofillDataListValues( base::span datalist) override; - void PinAutofillSuggestions() override; base::span GetAutofillSuggestions() const override; void HideAutofillSuggestions(autofill::SuggestionHidingReason reason) override; + + bool IsAutofillEnabled() const override; + bool IsAutofillProfileEnabled() const override; + bool IsAutofillPaymentMethodsEnabled() const override; bool IsAutocompleteEnabled() const override; - bool IsPasswordManagerEnabled() override; + bool IsPasswordManagerEnabled() const override; + bool IsOffTheRecord() const override; scoped_refptr GetURLLoaderFactory() override; std::unique_ptr CreateManager(base::PassKey, autofill::ContentAutofillDriver&) override; base::WeakPtr GetWeakPtr() override; + const std::string& GetAppLocale() const override; + private: explicit AutofillClientQt(content::WebContents *webContents); diff --git a/src/core/autofill_popup_controller.cpp b/src/core/autofill_popup_controller.cpp index 99eb09f379c..94ea39f5de0 100644 --- a/src/core/autofill_popup_controller.cpp +++ b/src/core/autofill_popup_controller.cpp @@ -5,7 +5,7 @@ #include "autofill_popup_controller_p.h" #include "components/autofill/core/browser/ui/autofill_suggestion_delegate.h" -#include "components/autofill/core/browser/ui/suggestion.h" +#include "components/autofill/core/browser/suggestions/suggestion.h" namespace QtWebEngineCore { diff --git a/src/core/autofill_popup_controller_p.h b/src/core/autofill_popup_controller_p.h index 6c51d26bfc0..30de88de23c 100644 --- a/src/core/autofill_popup_controller_p.h +++ b/src/core/autofill_popup_controller_p.h @@ -18,7 +18,7 @@ #include #include "base/memory/weak_ptr.h" -#include "components/autofill/core/browser/ui/suggestion.h" +#include "components/autofill/core/browser/suggestions/suggestion.h" namespace autofill { class AutofillSuggestionDelegate; diff --git a/src/core/client_cert_select_controller.cpp b/src/core/client_cert_select_controller.cpp index e898da618ae..45f69b80d7d 100644 --- a/src/core/client_cert_select_controller.cpp +++ b/src/core/client_cert_select_controller.cpp @@ -77,8 +77,8 @@ void ClientCertSelectController::select(const QSslCertificate &certificate) } const QByteArray derCertificate = certificate.toDer(); scoped_refptr selectedCert = - net::X509Certificate::CreateFromBytes(base::make_span((const unsigned char *)derCertificate.constData(), - (long unsigned)derCertificate.length())); + net::X509Certificate::CreateFromBytes(base::span((const unsigned char *)derCertificate.constData(), + (long unsigned)derCertificate.length())); for (auto &certInfo : m_clientCerts) { scoped_refptr cert = certInfo->certificate(); if (cert->EqualsExcludingChain(selectedCert.get())) { diff --git a/src/core/client_hints.cpp b/src/core/client_hints.cpp index af485767f03..4c41b626ae1 100644 --- a/src/core/client_hints.cpp +++ b/src/core/client_hints.cpp @@ -44,9 +44,9 @@ ClientHintsFactory::ClientHintsFactory() ClientHintsFactory::~ClientHintsFactory() = default; -KeyedService *ClientHintsFactory::BuildServiceInstanceFor(content::BrowserContext *context) const +std::unique_ptr ClientHintsFactory::BuildServiceInstanceForBrowserContext(content::BrowserContext *profile) const { - return new ClientHints(context); + return std::make_unique(profile); } content::BrowserContext *ClientHintsFactory::GetBrowserContextToUse(content::BrowserContext *context) const diff --git a/src/core/client_hints.h b/src/core/client_hints.h index c3bcf7556ab..ceb07a1d683 100644 --- a/src/core/client_hints.h +++ b/src/core/client_hints.h @@ -37,7 +37,7 @@ class ClientHintsFactory : public BrowserContextKeyedServiceFactory ~ClientHintsFactory() override; // BrowserContextKeyedServiceFactory methods: - KeyedService *BuildServiceInstanceFor(content::BrowserContext *profile) const override; + std::unique_ptr BuildServiceInstanceForBrowserContext(content::BrowserContext *profile) const override; content::BrowserContext *GetBrowserContextToUse(content::BrowserContext *context) const override; }; diff --git a/src/core/clipboard_qt.cpp b/src/core/clipboard_qt.cpp index 1560d581594..91d0d8637ed 100644 --- a/src/core/clipboard_qt.cpp +++ b/src/core/clipboard_qt.cpp @@ -97,6 +97,7 @@ extern void CFHtmlExtractMetadata(const std::string &cf_html, std::string *base_ void ClipboardQt::WritePortableAndPlatformRepresentations(ui::ClipboardBuffer type, const ObjectMap &objects, + const std::vector &raw_objects, std::vector platform_representations, std::unique_ptr data_src, uint32_t val) { @@ -120,6 +121,7 @@ void ClipboardQt::WritePortableAndPlatformRepresentations(ui::ClipboardBuffer ty // Copy text and SourceTag to the selection clipboard. WritePortableAndPlatformRepresentations(ui::ClipboardBuffer::kSelection, ObjectMap(text_iter, ++text_iter), + raw_objects, {}, nullptr, val); } diff --git a/src/core/clipboard_qt.h b/src/core/clipboard_qt.h index 077251fc7d1..a51ba6ff08e 100644 --- a/src/core/clipboard_qt.h +++ b/src/core/clipboard_qt.h @@ -46,6 +46,7 @@ class ClipboardQt : public ui::Clipboard protected: void WritePortableAndPlatformRepresentations(ui::ClipboardBuffer buffer, const ObjectMap &objects, + const std::vector &raw_objects, std::vector platform_representations, std::unique_ptr data_src, uint32_t) override; diff --git a/src/core/clipboard_util_win.cpp b/src/core/clipboard_util_win.cpp index f3ae7e730b8..263ecd9594d 100644 --- a/src/core/clipboard_util_win.cpp +++ b/src/core/clipboard_util_win.cpp @@ -26,15 +26,15 @@ std::string HtmlToCFHtml(const std::string &html, const std::string &base_url) #define MAKE_NUMBER_FORMAT_2(digits) "%0" #digits "u" #define NUMBER_FORMAT MAKE_NUMBER_FORMAT_1(MAX_DIGITS) - static const char *header = "Version:0.9\r\n" - "StartHTML:" NUMBER_FORMAT "\r\n" - "EndHTML:" NUMBER_FORMAT "\r\n" - "StartFragment:" NUMBER_FORMAT "\r\n" - "EndFragment:" NUMBER_FORMAT "\r\n"; - static const char *source_url_prefix = "SourceURL:"; + static constexpr char header[] = "Version:0.9\r\n" + "StartHTML:" NUMBER_FORMAT "\r\n" + "EndHTML:" NUMBER_FORMAT "\r\n" + "StartFragment:" NUMBER_FORMAT "\r\n" + "EndFragment:" NUMBER_FORMAT "\r\n"; + static constexpr char source_url_prefix[] = "SourceURL:"; - static const char *start_markup = "\r\n\r\n"; - static const char *end_markup = "\r\n\r\n"; + static constexpr char start_markup[] = "\r\n\r\n"; + static constexpr char end_markup[] = "\r\n\r\n"; // Calculate offsets size_t start_html_offset = strlen(header) - strlen(NUMBER_FORMAT) * 4 + MAX_DIGITS * 4; @@ -45,7 +45,7 @@ std::string HtmlToCFHtml(const std::string &html, const std::string &base_url) size_t end_fragment_offset = start_fragment_offset + html.length(); size_t end_html_offset = end_fragment_offset + strlen(end_markup); - std::string result = base::StringPrintfNonConstexpr(header, start_html_offset, end_html_offset, + std::string result = base::StringPrintf(header, start_html_offset, end_html_offset, start_fragment_offset, end_fragment_offset); if (!base_url.empty()) { result += source_url_prefix; diff --git a/src/core/compositor/native_skia_output_device_direct3d11.cpp b/src/core/compositor/native_skia_output_device_direct3d11.cpp index 12ddecdbe7e..4454e500446 100644 --- a/src/core/compositor/native_skia_output_device_direct3d11.cpp +++ b/src/core/compositor/native_skia_output_device_direct3d11.cpp @@ -45,8 +45,8 @@ QSGTexture *NativeSkiaOutputDeviceDirect3D11::texture(QQuickWindow *win, uint32_ qCDebug(lcWebEngineCompositor, "D3D: Importing DXGI Resource into D3D11 Texture."); - Q_ASSERT(overlayImage->type() == gl::DCLayerOverlayType::kNV12Texture); - Microsoft::WRL::ComPtr chromeTexture = overlayImage->nv12_texture(); + Q_ASSERT(overlayImage->type() == gl::DCLayerOverlayType::kD3D11Texture); + Microsoft::WRL::ComPtr chromeTexture = overlayImage->d3d11_video_texture(); if (!chromeTexture) { qWarning("D3D: No D3D texture."); return nullptr; diff --git a/src/core/compositor/native_skia_output_device_opengl.cpp b/src/core/compositor/native_skia_output_device_opengl.cpp index 46e4cef8ecc..7e1511c16a0 100644 --- a/src/core/compositor/native_skia_output_device_opengl.cpp +++ b/src/core/compositor/native_skia_output_device_opengl.cpp @@ -344,8 +344,8 @@ QSGTexture *NativeSkiaOutputDeviceOpenGL::texture(QQuickWindow *win, uint32_t te qCDebug(lcWebEngineCompositor, "WGL: Importing DXGI Resource into GL Texture."); Q_ASSERT(m_contextState->gr_context_type() == gpu::GrContextType::kGL); - Q_ASSERT(overlayImage->type() == gl::DCLayerOverlayType::kNV12Texture); - Microsoft::WRL::ComPtr chromeTexture = overlayImage->nv12_texture(); + Q_ASSERT(overlayImage->type() == gl::DCLayerOverlayType::kD3D11Texture); + Microsoft::WRL::ComPtr chromeTexture = overlayImage->d3d11_video_texture(); if (!chromeTexture) { qWarning("WGL: No D3D texture."); return nullptr; diff --git a/src/core/compositor/native_skia_output_device_vulkan.cpp b/src/core/compositor/native_skia_output_device_vulkan.cpp index e820825d2bd..123be531b25 100644 --- a/src/core/compositor/native_skia_output_device_vulkan.cpp +++ b/src/core/compositor/native_skia_output_device_vulkan.cpp @@ -186,8 +186,8 @@ QSGTexture *NativeSkiaOutputDeviceVulkan::texture(QQuickWindow *win, uint32_t te qCDebug(lcWebEngineCompositor, "VULKAN: Importing DXGI Resource into VkImage."); externalMemoryImageCreateInfo.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT; - Q_ASSERT(overlayImage->type() == gl::DCLayerOverlayType::kNV12Texture); - Microsoft::WRL::ComPtr chromeTexture = overlayImage->nv12_texture(); + Q_ASSERT(overlayImage->type() == gl::DCLayerOverlayType::kD3D11Texture); + Microsoft::WRL::ComPtr chromeTexture = overlayImage->d3d11_video_texture(); if (!chromeTexture) { qWarning("VULKAN: No D3D texture."); return nullptr; diff --git a/src/core/configure/BUILD.root.gn.in b/src/core/configure/BUILD.root.gn.in index 910d68ad311..0a4a6bfea29 100644 --- a/src/core/configure/BUILD.root.gn.in +++ b/src/core/configure/BUILD.root.gn.in @@ -162,6 +162,7 @@ shared_library("QtWebEngineCore") { "//third_party/blink/public:blink", "//ui/accessibility", "//ui/gl", + "//ui/touch_selection/vector_icons", "//qtwebengine/browser:interfaces", "//qtwebengine/userscript", "//qtwebengine/common:mojo_bindings", @@ -380,8 +381,6 @@ source_set("qtwebengine_sources") { "//chrome/browser/ui/webui/user_actions/user_actions_ui.h", "//chrome/browser/ui/webui/user_actions/user_actions_ui_handler.cc", "//chrome/browser/ui/webui/user_actions/user_actions_ui_handler.h", - "//chrome/browser/ui/webui/webui_util.cc", - "//chrome/browser/ui/webui/webui_util.h", "//chrome/common/chrome_switches.cc", "//chrome/common/chrome_switches.h", "//chrome/common/pref_names.h", @@ -390,6 +389,8 @@ source_set("qtwebengine_sources") { "//chrome/common/webui_url_constants.h", "//components/embedder_support/user_agent_utils.cc", "//components/embedder_support/user_agent_utils.h", + "//ui/webui/webui_util.cc", + "//ui/webui/webui_util.h", ] if (use_ozone) { deps += [ @@ -625,6 +626,7 @@ repack("qtwebengine_repack_resources") { "$root_gen_dir/net/net_resources.pak", "$root_gen_dir/third_party/blink/public/resources/blink_resources.pak", "$root_gen_dir/ui/webui/resources/webui_resources.pak", + "$root_gen_dir/components/user_actions_ui_resources.pak", ] if (!is_debug) { output = "$root_out_dir/qtwebengine_resources.pak" @@ -641,6 +643,7 @@ repack("qtwebengine_repack_resources") { "//components/resources:components_resources_grit", "//components/resources:dev_ui_components_resources_grit", "//components/ukm/debug:resources", + "//components/webui/user_actions/resources", "//content/browser/resources/attribution_reporting:resources", "//content/browser/resources/gpu:resources", "//content/browser/resources/histograms:resources_grit", diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index e85143d51d5..8486f903817 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -224,7 +224,7 @@ std::unique_ptr ContentBrowserClientQt::CreateBrowser void ContentBrowserClientQt::RenderProcessWillLaunch(content::RenderProcessHost *host) { - const int id = host->GetID(); + const int id = host->GetDeprecatedID(); Profile *profile = Profile::FromBrowserContext(host->GetBrowserContext()); #if QT_CONFIG(webengine_spellchecker) @@ -256,8 +256,11 @@ content::MediaObserver *ContentBrowserClientQt::GetMediaObserver() return MediaCaptureDevicesDispatcher::GetInstance(); } -void ContentBrowserClientQt::OverrideWebkitPrefs(content::WebContents *webContents, blink::web_pref::WebPreferences *web_prefs) +void ContentBrowserClientQt::OverrideWebPreferences(content::WebContents *webContents, + content::SiteInstance &mainFrameSite, + blink::web_pref::WebPreferences *webPrefs) { + Q_UNUSED(mainFrameSite); #if BUILDFLAG(ENABLE_EXTENSIONS) if (guest_view::GuestViewBase::IsGuest(webContents)) return; @@ -268,7 +271,7 @@ void ContentBrowserClientQt::OverrideWebkitPrefs(content::WebContents *webConten #endif // BUILDFLAG(ENABLE_EXTENSIONS) WebContentsDelegateQt* delegate = static_cast(webContents->GetDelegate()); if (delegate) - delegate->overrideWebPreferences(webContents, web_prefs); + delegate->overrideWebPreferences(webContents, webPrefs); } void ContentBrowserClientQt::AllowCertificateError(content::WebContents *webContents, @@ -391,7 +394,7 @@ void ContentBrowserClientQt::BindHostReceiverForRenderer(content::RenderProcessH { #if QT_CONFIG(webengine_spellchecker) if (auto host_receiver = receiver.As()) { - SpellCheckInitializationHostImpl::Create(render_process_host->GetID(), + SpellCheckInitializationHostImpl::Create(render_process_host->GetDeprecatedID(), std::move(host_receiver)); return; } @@ -449,7 +452,7 @@ void ContentBrowserClientQt::RegisterBrowserInterfaceBindersForFrame( map->Add(base::BindRepeating( [](content::RenderFrameHost *frame_host, mojo::PendingReceiver receiver) { - SpellCheckHostChromeImpl::Create(frame_host->GetProcess()->GetID(), + SpellCheckHostChromeImpl::Create(frame_host->GetProcess()->GetDeprecatedID(), std::move(receiver)); })); #endif @@ -487,7 +490,7 @@ void ContentBrowserClientQt::ExposeInterfacesToRenderer(service_manager::BinderR } #if BUILDFLAG(ENABLE_EXTENSIONS) associated_registry->AddInterface(base::BindRepeating( - &extensions::EventRouter::BindForRenderer, render_process_host->GetID())); + &extensions::EventRouter::BindForRenderer, render_process_host->GetDeprecatedID())); #else Q_UNUSED(associated_registry); #endif @@ -840,22 +843,25 @@ WebContentsAdapterClient::NavigationType pageTransitionToNavigationType(ui::Page } } -static bool navigationThrottleCallback(content::NavigationHandle *handle) +static void navigationThrottleCallback(content::NavigationHandle *handle, + bool should_run_async, + navigation_interception::InterceptNavigationThrottle::ResultCallback result_callback) { + Q_ASSERT(!should_run_async); // We call navigationRequested later in launchExternalUrl for external protocols. // The is_external_protocol parameter here is not fully accurate though, // and doesn't know about profile specific custom URL schemes. content::WebContents *source = handle->GetWebContents(); ProfileQt *profile = static_cast(source->GetBrowserContext()); if (handle->IsExternalProtocol() && !profile->profileAdapter()->urlSchemeHandler(toQByteArray(handle->GetURL().scheme()))) - return false; + return std::move(result_callback).Run(false); bool navigationAccepted = true; WebContentsAdapterClient *client = WebContentsViewQt::from(static_cast(source)->GetView())->client(); if (!client) - return false; + return std::move(result_callback).Run(false); // Redirects might not be reflected in transition_type at this point (see also chrome/.../web_navigation_api_helpers.cc) auto transition_type = handle->GetPageTransition(); @@ -867,7 +873,7 @@ static bool navigationThrottleCallback(content::NavigationHandle *handle) navigationAccepted, handle->IsInPrimaryMainFrame(), handle->IsFormSubmission()); - return !navigationAccepted; + std::move(result_callback).Run(!navigationAccepted); } std::vector> ContentBrowserClientQt::CreateThrottlesForNavigation( @@ -877,7 +883,8 @@ std::vector> ContentBrowserClientQt throttles.push_back(std::make_unique( navigation_handle, base::BindRepeating(&navigationThrottleCallback), - navigation_interception::SynchronyMode::kSync)); + navigation_interception::SynchronyMode::kSync, + std::nullopt /* async callback */)); #if BUILDFLAG(ENABLE_PDF) && BUILDFLAG(ENABLE_EXTENSIONS) MaybeAddThrottle( @@ -927,6 +934,7 @@ std::unique_ptr ContentBrowserClientQt::CreateLoginDeleg content::BrowserContext *browser_context, const content::GlobalRequestID & /*request_id*/, bool /*is_main_frame*/, bool /*is_request_for_navigation*/, const GURL &url, scoped_refptr /*response_headers*/, bool first_auth_attempt, + content::GuestPageHolder * /*guest_page_holder*/, LoginAuthRequiredCallback auth_required_callback) { auto loginDelegate = std::make_unique(authInfo, web_contents, url, first_auth_attempt, std::move(auth_required_callback)); @@ -1381,7 +1389,7 @@ void ContentBrowserClientQt::SiteInstanceGotProcessAndSite(content::SiteInstance return; extensions::ProcessMap *processMap = extensions::ProcessMap::Get(context); - processMap->Insert(extension->id(), site_instance->GetProcess()->GetID()); + processMap->Insert(extension->id(), site_instance->GetProcess()->GetDeprecatedID()); #endif } diff --git a/src/core/content_browser_client_qt.h b/src/core/content_browser_client_qt.h index 93358d545b3..a6d0649cda1 100644 --- a/src/core/content_browser_client_qt.h +++ b/src/core/content_browser_client_qt.h @@ -34,8 +34,9 @@ class ContentBrowserClientQt : public content::ContentBrowserClient std::unique_ptr CreateBrowserMainParts(bool is_integration_test) override; void RenderProcessWillLaunch(content::RenderProcessHost *host) override; content::MediaObserver* GetMediaObserver() override; - void OverrideWebkitPrefs(content::WebContents *web_contents, - blink::web_pref::WebPreferences *prefs) override; + void OverrideWebPreferences(content::WebContents *, + content::SiteInstance &, + blink::web_pref::WebPreferences *) override; void AllowCertificateError(content::WebContents *web_contents, int cert_error, const net::SSLInfo &ssl_info, @@ -159,6 +160,7 @@ class ContentBrowserClientQt : public content::ContentBrowserClient bool is_request_for_navigation, const GURL &url, scoped_refptr response_headers, bool first_auth_attempt, + content::GuestPageHolder *guest_page_holder, LoginAuthRequiredCallback auth_required_callback) override; bool HandleExternalProtocol( diff --git a/src/core/custom_handlers/protocol_handler_registry_factory.cpp b/src/core/custom_handlers/protocol_handler_registry_factory.cpp index 50b17006ba8..efd5cb40663 100644 --- a/src/core/custom_handlers/protocol_handler_registry_factory.cpp +++ b/src/core/custom_handlers/protocol_handler_registry_factory.cpp @@ -60,11 +60,10 @@ bool ProtocolHandlerRegistryFactory::ServiceIsNULLWhileTesting() const return true; } -KeyedService *ProtocolHandlerRegistryFactory::BuildServiceInstanceFor(content::BrowserContext *context) const +std::unique_ptr ProtocolHandlerRegistryFactory::BuildServiceInstanceForBrowserContext(content::BrowserContext *profile) const { - custom_handlers::ProtocolHandlerRegistry *registry = - new custom_handlers::ProtocolHandlerRegistry(/*prefs*/ nullptr, - std::make_unique()); + auto registry = std::make_unique(/*prefs*/ nullptr, + std::make_unique()); // Must be called as a part of the creation process. registry->InitProtocolSettings(); diff --git a/src/core/custom_handlers/protocol_handler_registry_factory.h b/src/core/custom_handlers/protocol_handler_registry_factory.h index 6559addc064..aa9bea3a610 100644 --- a/src/core/custom_handlers/protocol_handler_registry_factory.h +++ b/src/core/custom_handlers/protocol_handler_registry_factory.h @@ -49,7 +49,7 @@ class ProtocolHandlerRegistryFactory : public BrowserContextKeyedServiceFactory ~ProtocolHandlerRegistryFactory() override; // BrowserContextKeyedServiceFactory implementation. - KeyedService *BuildServiceInstanceFor(content::BrowserContext *profile) const override; + std::unique_ptr BuildServiceInstanceForBrowserContext(content::BrowserContext *profile) const override; }; } // namespace QtWebEngineCore diff --git a/src/core/extensions/extension_host_delegate_qt.cpp b/src/core/extensions/extension_host_delegate_qt.cpp index b460cd6ce91..9ffe5f766bd 100644 --- a/src/core/extensions/extension_host_delegate_qt.cpp +++ b/src/core/extensions/extension_host_delegate_qt.cpp @@ -34,11 +34,6 @@ void ExtensionHostDelegateQt::OnMainFrameCreatedForBackgroundPage(ExtensionHost Q_UNUSED(host); } -content::JavaScriptDialogManager *ExtensionHostDelegateQt::GetJavaScriptDialogManager() -{ - Q_UNREACHABLE_RETURN(nullptr); -} - void ExtensionHostDelegateQt::CreateTab(std::unique_ptr web_contents, const std::string &extension_id, WindowOpenDisposition disposition, diff --git a/src/core/extensions/extension_host_delegate_qt.h b/src/core/extensions/extension_host_delegate_qt.h index 38b5d4a2fd1..d209dd0789f 100644 --- a/src/core/extensions/extension_host_delegate_qt.h +++ b/src/core/extensions/extension_host_delegate_qt.h @@ -16,7 +16,6 @@ class ExtensionHostDelegateQt : public ExtensionHostDelegate // EtensionHostDelegate implementation. void OnExtensionHostCreated(content::WebContents *web_contents) override; void OnMainFrameCreatedForBackgroundPage(ExtensionHost *host) override; - content::JavaScriptDialogManager *GetJavaScriptDialogManager() override; void CreateTab(std::unique_ptr web_contents, const std::string &extension_id, WindowOpenDisposition disposition, diff --git a/src/core/extensions/extension_loader.h b/src/core/extensions/extension_loader.h index 32de4f9aa83..e1207dd3b47 100644 --- a/src/core/extensions/extension_loader.h +++ b/src/core/extensions/extension_loader.h @@ -59,15 +59,22 @@ class ExtensionLoader : public extensions::ExtensionRegistrar::Delegate // ExtensionRegistrar::Delegate: void PreAddExtension(const extensions::Extension *extension, - const extensions::Extension *old_extension) override { }; - void PostActivateExtension(scoped_refptr extension) override { }; - void PostDeactivateExtension(scoped_refptr extension) override { }; - void LoadExtensionForReload( - const extensions::ExtensionId &extension_id, const base::FilePath &path, - extensions::ExtensionRegistrar::LoadErrorBehavior load_error_behavior) override { }; - bool CanEnableExtension(const extensions::Extension *extension) override { return true; }; - bool CanDisableExtension(const extensions::Extension *extension) override { return true; }; - bool ShouldBlockExtension(const extensions::Extension *extension) override { return false; }; + const extensions::Extension *old_extension) override { } + void PostActivateExtension(scoped_refptr extension) override { } + void PostDeactivateExtension(scoped_refptr extension) override { } + void PreUninstallExtension(scoped_refptr extension) override { } + void PostUninstallExtension(scoped_refptr extension, base::OnceClosure done_callback) override + { std::move(done_callback).Run(); } + void PostNotifyUninstallExtension(scoped_refptr extension) override { } + void LoadExtensionForReload(const extensions::ExtensionId &extension_id, + const base::FilePath &path, + extensions::ExtensionRegistrar::LoadErrorBehavior load_error_behavior) override { } + void ShowExtensionDisabledError(const extensions::Extension *extension, bool is_remote_install) override { } + void FinishDelayedInstallationsIfAny() override { } + bool CanAddExtension(const extensions::Extension *extension) override { return true; } + bool CanEnableExtension(const extensions::Extension *extension) override { return true; } + bool CanDisableExtension(const extensions::Extension *extension) override { return true; } + bool ShouldBlockExtension(const extensions::Extension *extension) override { return false; } raw_ptr m_browserContext; extensions::ExtensionRegistrar m_extensionRegistrar; diff --git a/src/core/extensions/extension_system_factory_qt.cpp b/src/core/extensions/extension_system_factory_qt.cpp index fe6d1df6ceb..2db892e9ea1 100644 --- a/src/core/extensions/extension_system_factory_qt.cpp +++ b/src/core/extensions/extension_system_factory_qt.cpp @@ -43,9 +43,9 @@ ExtensionSystemFactoryQt::~ExtensionSystemFactoryQt() { } -KeyedService *ExtensionSystemFactoryQt::BuildServiceInstanceFor(content::BrowserContext *context) const +std::unique_ptr ExtensionSystemFactoryQt::BuildServiceInstanceForBrowserContext(content::BrowserContext *context) const { - return new ExtensionSystemQt(context); + return std::make_unique(context); } content::BrowserContext *ExtensionSystemFactoryQt::GetBrowserContextToUse(content::BrowserContext *context) const diff --git a/src/core/extensions/extension_system_factory_qt.h b/src/core/extensions/extension_system_factory_qt.h index b6f6acc5dde..ddd5d6c4f21 100644 --- a/src/core/extensions/extension_system_factory_qt.h +++ b/src/core/extensions/extension_system_factory_qt.h @@ -33,7 +33,7 @@ class ExtensionSystemFactoryQt : public ExtensionSystemProvider ~ExtensionSystemFactoryQt() override; // BrowserContextKeyedServiceFactory implementation: - KeyedService *BuildServiceInstanceFor(content::BrowserContext *context) const override; + std::unique_ptr BuildServiceInstanceForBrowserContext(content::BrowserContext *context) const override; content::BrowserContext *GetBrowserContextToUse(content::BrowserContext *context) const override; bool ServiceIsCreatedWithBrowserContext() const override; }; diff --git a/src/core/extensions/extension_web_contents_observer_qt.cpp b/src/core/extensions/extension_web_contents_observer_qt.cpp index a33954a20dc..2fd75d91e31 100644 --- a/src/core/extensions/extension_web_contents_observer_qt.cpp +++ b/src/core/extensions/extension_web_contents_observer_qt.cpp @@ -48,7 +48,7 @@ void ExtensionWebContentsObserverQt::RenderFrameCreated(content::RenderFrameHost if (!extension) return; - int process_id = render_frame_host->GetProcess()->GetID(); + const int process_id = render_frame_host->GetProcess()->GetDeprecatedID(); auto *policy = content::ChildProcessSecurityPolicy::GetInstance(); if (extension->is_extension() && Manifest::IsComponentLocation(extension->location())) diff --git a/src/core/extensions/extensions_browser_client_qt.cpp b/src/core/extensions/extensions_browser_client_qt.cpp index 099843c527c..8653a7700a5 100644 --- a/src/core/extensions/extensions_browser_client_qt.cpp +++ b/src/core/extensions/extensions_browser_client_qt.cpp @@ -114,8 +114,6 @@ class ResourceBundleFileLoader : public network::mojom::URLLoader // Current implementation reads all resource data at start of resource // load, so priority, and pausing is not currently implemented. void SetPriority(net::RequestPriority priority, int32_t intra_priority_value) override {} - void PauseReadingBodyFromNet() override {} - void ResumeReadingBodyFromNet() override {} private: ResourceBundleFileLoader(scoped_refptr headers) @@ -496,11 +494,6 @@ bool ExtensionsBrowserClientQt::IsMinBrowserVersionSupported(const std::string & return true; } -bool ExtensionsBrowserClientQt::IsLockScreenContext(content::BrowserContext *context) -{ - return false; -} - // Returns the locale used by the application. std::string ExtensionsBrowserClientQt::GetApplicationLocale() { diff --git a/src/core/extensions/extensions_browser_client_qt.h b/src/core/extensions/extensions_browser_client_qt.h index 9aaf56d0c2f..456a502a2f5 100644 --- a/src/core/extensions/extensions_browser_client_qt.h +++ b/src/core/extensions/extensions_browser_client_qt.h @@ -77,9 +77,6 @@ class ExtensionsBrowserClientQt : public ExtensionsBrowserClient ExtensionWebContentsObserver *GetExtensionWebContentsObserver(content::WebContents *web_contents) override; KioskDelegate *GetKioskDelegate() override; - // Whether the browser context is associated with Chrome OS lock screen. - bool IsLockScreenContext(content::BrowserContext *context) override; - bool IsAppModeForcedForApp(const ExtensionId &id) override; bool IsInDemoMode() override; diff --git a/src/core/extensions/pdf_iframe_navigation_throttle_qt.cpp b/src/core/extensions/pdf_iframe_navigation_throttle_qt.cpp index 7fe4324ccbd..be05cbed1f5 100644 --- a/src/core/extensions/pdf_iframe_navigation_throttle_qt.cpp +++ b/src/core/extensions/pdf_iframe_navigation_throttle_qt.cpp @@ -68,7 +68,7 @@ bool IsPDFPluginEnabled(content::NavigationHandle *navigation_handle, bool *is_s if (web_contents->IsInnerWebContentsForGuest()) web_contents = web_contents->GetOuterWebContents(); - int process_id = web_contents->GetPrimaryMainFrame()->GetProcess()->GetID(); + int process_id = web_contents->GetPrimaryMainFrame()->GetProcess()->GetDeprecatedID(); int routing_id = web_contents->GetPrimaryMainFrame()->GetRoutingID(); content::WebPluginInfo plugin_info; // Will check WebEngineSettings by PluginServiceFilterQt diff --git a/src/core/extensions/webui/extensions_ui_qt.cpp b/src/core/extensions/webui/extensions_ui_qt.cpp index d72be5164bf..c323f71690e 100644 --- a/src/core/extensions/webui/extensions_ui_qt.cpp +++ b/src/core/extensions/webui/extensions_ui_qt.cpp @@ -3,13 +3,14 @@ #include "extensions_ui_qt.h" +#include "base/containers/span.h" #include "chrome/common/url_constants.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_ui_data_source.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/ui/webui/webui_util.h" #include "qtwebengine/browser/extensions/resources/grit/extensions_ui_qt_resources.h" #include "qtwebengine/browser/extensions/resources/grit/extensions_ui_qt_resources_map.h" +#include "ui/webui/webui_util.h" #include "extensions_ui_page_handler_qt.h" @@ -19,7 +20,7 @@ ExtensionsUIQt::ExtensionsUIQt(content::WebUI *web_ui) : ui::MojoWebUIController web_ui->GetWebContents()->GetBrowserContext(), chrome::kChromeUIExtensionsHost); webui::SetupWebUIDataSource( - source, base::make_span(kExtensionsUiQtResources, kExtensionsUiQtResourcesSize), + source, base::span(kExtensionsUiQtResources, kExtensionsUiQtResourcesSize), IDR_EXTENSIONS_UI_QT_EXTENSIONS_UI_QT_HTML); source->OverrideContentSecurityPolicy(network::mojom::CSPDirectiveName::TrustedTypes, diff --git a/src/core/favicon_service_factory_qt.cpp b/src/core/favicon_service_factory_qt.cpp index c60ed885fb8..e94f6cf4aa6 100644 --- a/src/core/favicon_service_factory_qt.cpp +++ b/src/core/favicon_service_factory_qt.cpp @@ -88,8 +88,7 @@ HistoryServiceFactoryQt::GetBrowserContextToUse(content::BrowserContext *context return context; } -KeyedService * -HistoryServiceFactoryQt::BuildServiceInstanceFor(content::BrowserContext *context) const +std::unique_ptr HistoryServiceFactoryQt::BuildServiceInstanceForBrowserContext(content::BrowserContext *context) const { Q_ASSERT(!context->IsOffTheRecord()); @@ -98,7 +97,7 @@ HistoryServiceFactoryQt::BuildServiceInstanceFor(content::BrowserContext *contex if (!historyService->Init(history::HistoryDatabaseParamsForPath(context->GetPath(), version_info::Channel::DEFAULT))) { return nullptr; } - return historyService.release(); + return historyService; } bool FaviconClientQt::IsNativeApplicationURL(const GURL &url) @@ -164,12 +163,12 @@ FaviconServiceFactoryQt::GetBrowserContextToUse(content::BrowserContext *context return context; } -KeyedService * -FaviconServiceFactoryQt::BuildServiceInstanceFor(content::BrowserContext *context) const +std::unique_ptr +FaviconServiceFactoryQt::BuildServiceInstanceForBrowserContext(content::BrowserContext *context) const { history::HistoryService *historyService = static_cast( HistoryServiceFactoryQt::GetInstance()->GetForBrowserContext(context)); - return new favicon::FaviconServiceImpl(std::make_unique(), historyService); + return std::make_unique(std::make_unique(), historyService); } } // namespace QtWebEngineCore diff --git a/src/core/favicon_service_factory_qt.h b/src/core/favicon_service_factory_qt.h index b9667018c46..8ff54d6f4ef 100644 --- a/src/core/favicon_service_factory_qt.h +++ b/src/core/favicon_service_factory_qt.h @@ -70,7 +70,7 @@ class HistoryServiceFactoryQt : public BrowserContextKeyedServiceFactory // BrowserContextKeyedServiceFactory: content::BrowserContext * GetBrowserContextToUse(content::BrowserContext *context) const override; - KeyedService *BuildServiceInstanceFor(content::BrowserContext *context) const override; + std::unique_ptr BuildServiceInstanceForBrowserContext(content::BrowserContext *context) const override; }; class FaviconClientQt : public favicon::FaviconClient @@ -105,7 +105,7 @@ class FaviconServiceFactoryQt : public BrowserContextKeyedServiceFactory // BrowserContextKeyedServiceFactory: content::BrowserContext * GetBrowserContextToUse(content::BrowserContext *context) const override; - KeyedService *BuildServiceInstanceFor(content::BrowserContext *context) const override; + std::unique_ptr BuildServiceInstanceForBrowserContext(content::BrowserContext *context) const override; }; } // namespace QtWebEngineCore diff --git a/src/core/file_system_access/file_system_access_permission_context_factory_qt.cpp b/src/core/file_system_access/file_system_access_permission_context_factory_qt.cpp index 6d1e8084afc..a4b0a472e32 100644 --- a/src/core/file_system_access/file_system_access_permission_context_factory_qt.cpp +++ b/src/core/file_system_access/file_system_access_permission_context_factory_qt.cpp @@ -5,6 +5,7 @@ #include "components/keyed_service/content/browser_context_dependency_manager.h" +#include #include namespace QtWebEngineCore { @@ -46,10 +47,9 @@ content::BrowserContext *FileSystemAccessPermissionContextFactoryQt::GetBrowserC return context; } -KeyedService *FileSystemAccessPermissionContextFactoryQt::BuildServiceInstanceFor( - content::BrowserContext *context) const +std::unique_ptr FileSystemAccessPermissionContextFactoryQt::BuildServiceInstanceForBrowserContext(content::BrowserContext *context) const { - return new FileSystemAccessPermissionContextQt(context); + return std::make_unique(context); } } // namespace QtWebEngineCore diff --git a/src/core/file_system_access/file_system_access_permission_context_factory_qt.h b/src/core/file_system_access/file_system_access_permission_context_factory_qt.h index 8589a37132d..0d3585a8e7a 100644 --- a/src/core/file_system_access/file_system_access_permission_context_factory_qt.h +++ b/src/core/file_system_access/file_system_access_permission_context_factory_qt.h @@ -28,7 +28,7 @@ class FileSystemAccessPermissionContextFactoryQt : public BrowserContextKeyedSer // BrowserContextKeyedServiceFactory content::BrowserContext * GetBrowserContextToUse(content::BrowserContext *context) const override; - KeyedService *BuildServiceInstanceFor(content::BrowserContext *profile) const override; + std::unique_ptr BuildServiceInstanceForBrowserContext(content::BrowserContext *context) const override; }; } // namespace QtWebEngineCore diff --git a/src/core/file_system_access/file_system_access_permission_context_qt.cpp b/src/core/file_system_access/file_system_access_permission_context_qt.cpp index d6412416566..f6b160e79fa 100644 --- a/src/core/file_system_access/file_system_access_permission_context_qt.cpp +++ b/src/core/file_system_access/file_system_access_permission_context_qt.cpp @@ -478,6 +478,12 @@ base::expected FileSystemAccessPermissionContextQt::CanShowFi return base::ok(); } +bool FileSystemAccessPermissionContextQt::IsFileTypeDangerous(const base::FilePath &path, const url::Origin &origin) +{ + // Matching AwFileSystemAccessPermissionContext::IsFileTypeDangerous() + return false; +} + void FileSystemAccessPermissionContextQt::CheckPathsAgainstEnterprisePolicy( std::vector entries, content::GlobalRenderFrameHostId, EntriesAllowedByEnterprisePolicyCallback callback) diff --git a/src/core/file_system_access/file_system_access_permission_context_qt.h b/src/core/file_system_access/file_system_access_permission_context_qt.h index 8f84333561f..57f99fef93f 100644 --- a/src/core/file_system_access/file_system_access_permission_context_qt.h +++ b/src/core/file_system_access/file_system_access_permission_context_qt.h @@ -59,6 +59,7 @@ class FileSystemAccessPermissionContextQt : public content::FileSystemAccessPerm EntriesAllowedByEnterprisePolicyCallback) override; base::expected CanShowFilePicker(content::RenderFrameHost*) override; + bool IsFileTypeDangerous(const base::FilePath &path, const url::Origin &origin) override; void NavigatedAwayFromOrigin(const url::Origin &origin); content::BrowserContext *profile() const { return m_profile; } diff --git a/src/core/media_capture_devices_dispatcher.cpp b/src/core/media_capture_devices_dispatcher.cpp index 56df02412bd..848a929863f 100644 --- a/src/core/media_capture_devices_dispatcher.cpp +++ b/src/core/media_capture_devices_dispatcher.cpp @@ -187,7 +187,7 @@ std::string DeviceNamePrefix(content::WebContents *web_contents, // dialog for DISPLAY_VIDEO_CAPTURE_THIS_TAB could still return something // other than the current tab - be it a screen, window, or another tab. if (media_id.type == content::DesktopMediaID::TYPE_WEB_CONTENTS && - web_contents->GetPrimaryMainFrame()->GetProcess()->GetID() == + web_contents->GetPrimaryMainFrame()->GetProcess()->GetDeprecatedID() == media_id.web_contents_id.render_process_id && web_contents->GetPrimaryMainFrame()->GetRoutingID() == media_id.web_contents_id.main_render_frame_id) { @@ -509,7 +509,7 @@ void MediaCaptureDevicesDispatcher::processDesktopCaptureAccessRequest(content:: if (main_frame) { // Resolve DesktopMediaID for the specified device id. mediaId = content::DesktopStreamsRegistry::GetInstance()->RequestMediaForStreamId( - request.requested_video_device_ids.front(), main_frame->GetProcess()->GetID(), + request.requested_video_device_ids.front(), main_frame->GetProcess()->GetDeprecatedID(), main_frame->GetRoutingID(), url::Origin::Create(request.security_origin), content::kRegistryStreamTypeDesktop); } diff --git a/src/core/net/client_cert_store_data.cpp b/src/core/net/client_cert_store_data.cpp index 5f9c8243af9..357d7bacf2e 100644 --- a/src/core/net/client_cert_store_data.cpp +++ b/src/core/net/client_cert_store_data.cpp @@ -4,6 +4,7 @@ #include "net/client_cert_store_data.h" #if QT_CONFIG(ssl) +#include "base/containers/span.h" #include "net/base/net_errors.h" #include "net/cert/x509_certificate.h" #include "net/ssl/ssl_platform_key_util.h" @@ -97,8 +98,8 @@ void ClientCertificateStoreData::add(const QSslCertificate &certificate, const Q Entry *data = new Entry; data->keyPtr = wrapOpenSSLPrivateKey(sslKeyInBytes); - data->certPtr = net::X509Certificate::CreateFromBytes(base::make_span((const unsigned char *)certInBytes.data(), - (unsigned long)certInBytes.length())); + data->certPtr = net::X509Certificate::CreateFromBytes(base::span((const unsigned char *)certInBytes.data(), + (unsigned long)certInBytes.length())); data->key = privateKey; data->certificate = certificate; extraCerts.append(data); diff --git a/src/core/net/custom_url_loader_factory.cpp b/src/core/net/custom_url_loader_factory.cpp index eec3c5f7e1b..4b444480148 100644 --- a/src/core/net/custom_url_loader_factory.cpp +++ b/src/core/net/custom_url_loader_factory.cpp @@ -84,8 +84,6 @@ class CustomURLLoader : public network::mojom::URLLoader Start(); } void SetPriority(net::RequestPriority priority, int32_t intra_priority_value) override { } - void PauseReadingBodyFromNet() override { } - void ResumeReadingBodyFromNet() override { } private: CustomURLLoader(const network::ResourceRequest &request, diff --git a/src/core/net/plugin_response_interceptor_url_loader_throttle.cpp b/src/core/net/plugin_response_interceptor_url_loader_throttle.cpp index bd2714dcb5b..acf4872d048 100644 --- a/src/core/net/plugin_response_interceptor_url_loader_throttle.cpp +++ b/src/core/net/plugin_response_interceptor_url_loader_throttle.cpp @@ -150,7 +150,7 @@ void PluginResponseInterceptorURLLoaderThrottle::WillProcessResponse(const GURL size_t len = payload.size(); CHECK_EQ(MOJO_RESULT_OK, producer_handle->WriteData( - base::make_span(reinterpret_cast(payload.data()), len), + base::span(reinterpret_cast(payload.data()), len), MOJO_WRITE_DATA_FLAG_ALL_OR_NONE, len)); network::URLLoaderCompletionStatus status(net::OK); diff --git a/src/core/net/proxying_restricted_cookie_manager_qt.cpp b/src/core/net/proxying_restricted_cookie_manager_qt.cpp index b07e239f2f1..c4530614cce 100644 --- a/src/core/net/proxying_restricted_cookie_manager_qt.cpp +++ b/src/core/net/proxying_restricted_cookie_manager_qt.cpp @@ -69,6 +69,7 @@ void ProxyingRestrictedCookieManagerQt::GetAllForUrl(const GURL &url, net::StorageAccessApiStatus storage_access_api_status, network::mojom::CookieManagerGetOptionsPtr options, bool is_ad_tagged, + bool apply_devtools_overrides, bool force_disable_third_party_cookies, GetAllForUrlCallback callback) { @@ -76,7 +77,8 @@ void ProxyingRestrictedCookieManagerQt::GetAllForUrl(const GURL &url, if (allowCookies(url, site_for_cookies)) { underlying_restricted_cookie_manager_->GetAllForUrl(url, site_for_cookies, top_frame_origin, storage_access_api_status, - std::move(options), is_ad_tagged, force_disable_third_party_cookies, std::move(callback)); + std::move(options), is_ad_tagged, apply_devtools_overrides, + force_disable_third_party_cookies, std::move(callback)); } else { std::move(callback).Run(std::vector()); } @@ -88,13 +90,15 @@ void ProxyingRestrictedCookieManagerQt::SetCanonicalCookie(const net::CanonicalC const url::Origin &top_frame_origin, net::StorageAccessApiStatus storage_access_api_status, net::CookieInclusionStatus status, + bool apply_devtools_overrides, SetCanonicalCookieCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); if (allowCookies(url, site_for_cookies)) { underlying_restricted_cookie_manager_->SetCanonicalCookie(cookie, url, site_for_cookies, top_frame_origin, - storage_access_api_status, status, std::move(callback)); + storage_access_api_status, status, + apply_devtools_overrides, std::move(callback)); } else { std::move(callback).Run(false); } @@ -116,6 +120,7 @@ void ProxyingRestrictedCookieManagerQt::SetCookieFromString(const GURL &url, const net::SiteForCookies &site_for_cookies, const url::Origin &top_frame_origin, net::StorageAccessApiStatus storage_access_api_status, + bool apply_devtools_overrides, const std::string &cookie, SetCookieFromStringCallback callback) { @@ -123,7 +128,7 @@ void ProxyingRestrictedCookieManagerQt::SetCookieFromString(const GURL &url, if (allowCookies(url, site_for_cookies)) { underlying_restricted_cookie_manager_->SetCookieFromString(url, site_for_cookies, top_frame_origin, storage_access_api_status, - cookie, std::move(callback)); + apply_devtools_overrides, cookie, std::move(callback)); } else { std::move(callback).Run(); } @@ -135,6 +140,7 @@ void ProxyingRestrictedCookieManagerQt::GetCookiesString(const GURL &url, net::StorageAccessApiStatus storage_access_api_status, bool get_version_shared_memory, bool is_ad_tagged, + bool apply_devtools_overrides, bool force_disable_third_party_cookies, GetCookiesStringCallback callback) { @@ -143,7 +149,7 @@ void ProxyingRestrictedCookieManagerQt::GetCookiesString(const GURL &url, if (allowCookies(url, site_for_cookies)) { underlying_restricted_cookie_manager_->GetCookiesString(url, site_for_cookies, top_frame_origin, storage_access_api_status, get_version_shared_memory, - is_ad_tagged, force_disable_third_party_cookies, + is_ad_tagged, apply_devtools_overrides, force_disable_third_party_cookies, std::move(callback)); } else { std::move(callback).Run(network::mojom::kInvalidCookieVersion, base::ReadOnlySharedMemoryRegion(), ""); @@ -154,6 +160,7 @@ void ProxyingRestrictedCookieManagerQt::CookiesEnabledFor(const GURL &url, const net::SiteForCookies &site_for_cookies, const url::Origin & /*top_frame_origin*/, net::StorageAccessApiStatus /*storage_access_api_status*/, + bool apply_devtools_overrides, CookiesEnabledForCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); diff --git a/src/core/net/proxying_restricted_cookie_manager_qt.h b/src/core/net/proxying_restricted_cookie_manager_qt.h index 658a09d5d6d..214822d1265 100644 --- a/src/core/net/proxying_restricted_cookie_manager_qt.h +++ b/src/core/net/proxying_restricted_cookie_manager_qt.h @@ -30,6 +30,7 @@ class ProxyingRestrictedCookieManagerQt : public network::mojom::RestrictedCooki net::StorageAccessApiStatus storage_access_api_status, network::mojom::CookieManagerGetOptionsPtr options, bool is_ad_tagged, + bool apply_devtools_overrides, bool force_disable_third_party_cookies, GetAllForUrlCallback callback) override; @@ -39,6 +40,7 @@ class ProxyingRestrictedCookieManagerQt : public network::mojom::RestrictedCooki const url::Origin &top_frame_origin, net::StorageAccessApiStatus storage_access_api_status, net::CookieInclusionStatus status, + bool apply_devtools_overrides, SetCanonicalCookieCallback callback) override; void AddChangeListener(const GURL &url, const net::SiteForCookies &site_for_cookies, @@ -50,6 +52,7 @@ class ProxyingRestrictedCookieManagerQt : public network::mojom::RestrictedCooki const net::SiteForCookies &site_for_cookies, const url::Origin &top_frame_origin, net::StorageAccessApiStatus storage_access_api_status, + bool apply_devtools_overrides, const std::string &cookie, SetCookieFromStringCallback callback) override; void GetCookiesString(const GURL &url, @@ -58,12 +61,14 @@ class ProxyingRestrictedCookieManagerQt : public network::mojom::RestrictedCooki net::StorageAccessApiStatus storage_access_api_status, bool get_version_shared_memory, bool is_ad_tagged, + bool apply_devtools_overrides, bool force_disable_third_party_cookies, GetCookiesStringCallback callback) override; void CookiesEnabledFor(const GURL &url, const net::SiteForCookies &site_for_cookies, const url::Origin &top_frame_origin, net::StorageAccessApiStatus storage_access_api_status, + bool apply_devtools_overrides, CookiesEnabledForCallback callback) override; // Internal: diff --git a/src/core/net/proxying_url_loader_factory_qt.cpp b/src/core/net/proxying_url_loader_factory_qt.cpp index 67b40f7dbcc..6b78b71f764 100644 --- a/src/core/net/proxying_url_loader_factory_qt.cpp +++ b/src/core/net/proxying_url_loader_factory_qt.cpp @@ -126,8 +126,6 @@ class InterceptedRequest : public network::mojom::URLLoader const net::HttpRequestHeaders &modified_cors_exempt_headers, const std::optional &new_url) override; void SetPriority(net::RequestPriority priority, int32_t intra_priority_value) override; - void PauseReadingBodyFromNet() override; - void ResumeReadingBodyFromNet() override; private: void InterceptOnUIThread(); @@ -298,7 +296,7 @@ void InterceptedRequest::Restart() if (!allow_local_ && local_access_) { // Check for specifically granted file access: if (auto *frame_tree = content::FrameTreeNode::GloballyFindByID(frame_tree_node_id_)) { - const int renderer_id = frame_tree->current_frame_host()->GetProcess()->GetID(); + const int renderer_id = frame_tree->current_frame_host()->GetProcess()->GetDeprecatedID(); base::FilePath file_path; if (net::FileURLToFilePath(request_.url, &file_path)) { if (content::ChildProcessSecurityPolicy::GetInstance()->CanReadFile(renderer_id, file_path)) @@ -482,18 +480,6 @@ void InterceptedRequest::SetPriority(net::RequestPriority priority, int32_t intr target_loader_->SetPriority(priority, intra_priority_value); } -void InterceptedRequest::PauseReadingBodyFromNet() -{ - if (target_loader_) - target_loader_->PauseReadingBodyFromNet(); -} - -void InterceptedRequest::ResumeReadingBodyFromNet() -{ - if (target_loader_) - target_loader_->ResumeReadingBodyFromNet(); -} - void InterceptedRequest::OnURLLoaderClientError() { // We set |wait_for_loader_error| to true because if the loader did have a diff --git a/src/core/net/resource_request_body_qt.cpp b/src/core/net/resource_request_body_qt.cpp index a82d01aae85..bc2e93ca6ee 100644 --- a/src/core/net/resource_request_body_qt.cpp +++ b/src/core/net/resource_request_body_qt.cpp @@ -157,7 +157,7 @@ void ResourceRequestBody::readDataElementPipe( MojoResult result; do { size_t bytesToRead = 1; - base::span buffer = base::make_span(reinterpret_cast(*data), reinterpret_cast(*data) + maxSize); + base::span buffer(reinterpret_cast(*data), static_cast(maxSize)); result = consumerHandle->ReadData(MOJO_READ_DATA_FLAG_NONE, buffer, bytesToRead); if (result == MOJO_RESULT_OK) { diff --git a/src/core/ozone/ozone_platform_qt.cpp b/src/core/ozone/ozone_platform_qt.cpp index 417254f42d5..acea40c16ad 100644 --- a/src/core/ozone/ozone_platform_qt.cpp +++ b/src/core/ozone/ozone_platform_qt.cpp @@ -20,6 +20,7 @@ #include "ui/ozone/public/input_controller.h" #include "ui/ozone/public/ozone_platform.h" #include "ui/ozone/public/platform_screen.h" +#include "ui/ozone/public/stub_input_controller.h" #include "ui/ozone/public/system_input_injector.h" #include "ui/ozone/platform/wayland/gpu/wayland_gl_egl_utility.h" #include "ui/platform_window/platform_window_delegate.h" @@ -225,7 +226,7 @@ bool OzonePlatformQt::InitializeUI(const ui::OzonePlatform::InitParams &) KeyboardLayoutEngineManager::SetKeyboardLayoutEngine(m_keyboardLayoutEngine.get()); overlay_manager_.reset(new StubOverlayManager()); - input_controller_ = CreateStubInputController(); + input_controller_.reset(new StubInputController()); cursor_factory_.reset(new BitmapCursorFactory()); gpu_platform_support_host_.reset(ui::CreateStubGpuPlatformSupportHost()); m_supportsNativePixmaps = QtWebEngineCore::SurfaceFactoryQt::SupportsNativePixmaps(); diff --git a/src/core/printing/pdf_document_helper_client_qt.cpp b/src/core/printing/pdf_document_helper_client_qt.cpp index 66252d212a5..acf2ef7e055 100644 --- a/src/core/printing/pdf_document_helper_client_qt.cpp +++ b/src/core/printing/pdf_document_helper_client_qt.cpp @@ -20,6 +20,6 @@ void PDFDocumentHelperClientQt::SetPluginCanSave(content::RenderFrameHost *rende void PDFDocumentHelperClientQt::UpdateContentRestrictions(content::RenderFrameHost *, int) { } -void PDFDocumentHelperClientQt::OnSearchifyStateChange(bool, content::WebContents *) +void PDFDocumentHelperClientQt::OnSearchifyStarted(content::WebContents *) { } diff --git a/src/core/printing/pdf_document_helper_client_qt.h b/src/core/printing/pdf_document_helper_client_qt.h index 43a4726d36a..3c848dfe300 100644 --- a/src/core/printing/pdf_document_helper_client_qt.h +++ b/src/core/printing/pdf_document_helper_client_qt.h @@ -17,11 +17,10 @@ class PDFDocumentHelperClientQt : public pdf::PDFDocumentHelperClient // FIXME: private: // pdf::PDFDocumentHelperClient: - void OnPDFHasUnsupportedFeature(content::WebContents *contents) override {} void OnSaveURL(content::WebContents *contents) override {} void SetPluginCanSave(content::RenderFrameHost *render_frame_host, bool can_save) override; void UpdateContentRestrictions(content::RenderFrameHost *, int) override; - void OnSearchifyStateChange(bool, content::WebContents *) override; + void OnSearchifyStarted(content::WebContents *) override; }; #endif // PDF_DOCUMENT_HELPER_CLIENT_QT_H diff --git a/src/core/printing/print_view_manager_base_qt.cpp b/src/core/printing/print_view_manager_base_qt.cpp index 742862a53ef..f36767aac26 100644 --- a/src/core/printing/print_view_manager_base_qt.cpp +++ b/src/core/printing/print_view_manager_base_qt.cpp @@ -281,7 +281,7 @@ void PrintViewManagerBaseQt::ScriptedPrint(printing::mojom::ScriptedPrintParamsP auto callback_wrapper = base::BindOnce( &PrintViewManagerBaseQt::ScriptedPrintReply, weak_ptr_factory_.GetWeakPtr(), - std::move(callback), render_process_host->GetID()); + std::move(callback), render_process_host->GetDeprecatedID()); std::unique_ptr printer_query = m_printerQueriesQueue->PopPrinterQuery(params->cookie); @@ -585,7 +585,7 @@ void PrintViewManagerBaseQt::UpdatePrintSettings(base::Value::Dict job_settings, std::move(job_settings), base::BindOnce(&OnDidUpdatePrintSettings, m_printerQueriesQueue, std::move(printer_query), std::move(callback), - render_frame_host->GetProcess()->GetID(), render_frame_host->GetRoutingID())); + render_frame_host->GetProcess()->GetDeprecatedID(), render_frame_host->GetRoutingID())); } } // namespace QtWebEngineCore diff --git a/src/core/profile_io_data_qt.cpp b/src/core/profile_io_data_qt.cpp index 30568a716fb..567403a7cf5 100644 --- a/src/core/profile_io_data_qt.cpp +++ b/src/core/profile_io_data_qt.cpp @@ -206,8 +206,7 @@ void ProfileIODataQt::ConfigureNetworkContextParams(bool in_memory, network_context_params->enable_referrers = true; // Encrypted cookies requires os_crypt, which currently has issues for us on Linux. network_context_params->enable_encrypted_cookies = false; - network_context_params->enable_zstd = - base::FeatureList::IsEnabled(net::features::kZstdContentEncoding); + network_context_params->enable_zstd = true; network_context_params->http_cache_enabled = m_httpCacheType != ProfileAdapter::NoCache; network_context_params->http_cache_max_size = m_httpCacheMaxSize; diff --git a/src/core/profile_qt.cpp b/src/core/profile_qt.cpp index b0069aac7ed..cbc2e86e67b 100644 --- a/src/core/profile_qt.cpp +++ b/src/core/profile_qt.cpp @@ -305,30 +305,16 @@ const PrefServiceAdapter &ProfileQt::prefServiceAdapter() const void ProfileQt::initUserAgentMetadata() { m_userAgentMetadata = embedder_support::GetUserAgentMetadata(); - m_userAgentMetadata.brand_version_list.clear(); - m_userAgentMetadata.brand_full_version_list.clear(); - - // Chromium version - m_userAgentMetadata.brand_version_list.emplace_back( - blink::UserAgentBrandVersion("Chromium", version_info::GetMajorVersionNumber())); - m_userAgentMetadata.brand_full_version_list.emplace_back(blink::UserAgentBrandVersion( - "Chromium", std::string(version_info::GetVersionNumber()))); - // We keep the brand lists identical throughout the lifetime of each major version of Chromium. int seed = version_info::GetMajorVersionNumberAsInt(); - // Generate a greasey version - const std::vector> orders{ { 0, 1, 2 }, { 0, 2, 1 }, { 1, 0, 2 }, - { 1, 2, 0 }, { 2, 0, 1 }, { 2, 1, 0 } }; - const std::vector order = orders[seed % 6]; - m_userAgentMetadata.brand_version_list.emplace_back( - embedder_support::GetGreasedUserAgentBrandVersion( - order, seed, std::nullopt, std::nullopt, true, - blink::UserAgentBrandVersionType::kMajorVersion)); - - m_userAgentMetadata.brand_full_version_list.emplace_back( - embedder_support::GetGreasedUserAgentBrandVersion( - order, seed, std::nullopt, std::nullopt, true, - blink::UserAgentBrandVersionType::kFullVersion)); + std::string version = version_info::GetMajorVersionNumber(); + m_userAgentMetadata.brand_version_list = + embedder_support::GenerateBrandVersionList(seed, {}, version, + blink::UserAgentBrandVersionType::kMajorVersion); + version = version_info::GetVersionNumber(); + m_userAgentMetadata.brand_full_version_list = + embedder_support::GenerateBrandVersionList(seed, {}, version, + blink::UserAgentBrandVersionType::kFullVersion); } const blink::UserAgentMetadata &ProfileQt::userAgentMetadata() diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index 978f00675ed..3b7ba67dd4f 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -228,7 +228,8 @@ void RenderWidgetHostViewQt::setAdapterClient(WebContentsAdapterClient *adapterC m_adapterClient = nullptr; }); } -void RenderWidgetHostViewQt::OnInputEventAck(blink::mojom::InputEventResultSource, +void RenderWidgetHostViewQt::OnInputEventAck(const content::RenderWidgetHost &, + blink::mojom::InputEventResultSource, blink::mojom::InputEventResultState state, const blink::WebInputEvent &event) { @@ -386,8 +387,6 @@ void RenderWidgetHostViewQt::UpdateBackgroundColor() m_delegate->setClearColor(toQt(color)); - bool opaque = SkColorGetA(color) == SK_AlphaOPAQUE; - m_rootLayer->SetFillsBoundsOpaquely(opaque); m_rootLayer->SetColor(color); m_uiCompositor->SetBackgroundColor(color); @@ -439,32 +438,8 @@ bool RenderWidgetHostViewQt::updateCursorFromResource(ui::mojom::CursorType type hotX = hotspot.x(); hotY = hotspot.y(); #elif defined(Q_OS_MACOS) - // See chromium/content/common/cursors/webcursor_mac.mm - switch (type) { - case ui::mojom::CursorType::kVerticalText: - // TODO: [NSCursor IBeamCursorForVerticalLayout] - return false; - case ui::mojom::CursorType::kCell: - resourceId = IDR_CELL_CURSOR; - hotX = 7; - hotY = 7; - break; - case ui::mojom::CursorType::kContextMenu: - // TODO: [NSCursor contextualMenuCursor] - return false; - case ui::mojom::CursorType::kZoomIn: - resourceId = IDR_ZOOMIN_CURSOR; - hotX = 7; - hotY = 7; - break; - case ui::mojom::CursorType::kZoomOut: - resourceId = IDR_ZOOMOUT_CURSOR; - hotX = 7; - hotY = 7; - break; - default: - Q_UNREACHABLE_RETURN(false); - } + // FIXME: find a way to reimplement + return false; #else Q_UNREACHABLE_RETURN(false); #endif diff --git a/src/core/render_widget_host_view_qt.h b/src/core/render_widget_host_view_qt.h index 64c19acdbb2..4a47b5c3415 100644 --- a/src/core/render_widget_host_view_qt.h +++ b/src/core/render_widget_host_view_qt.h @@ -153,8 +153,8 @@ class RenderWidgetHostViewQt void OnLocalSurfaceIdChanged(const cc::RenderFrameMetadata &) override {} // Overridden from content::RenderWidgetHost::InputEventObserver - void OnInputEvent(const blink::WebInputEvent &) override { } - void OnInputEventAck(blink::mojom::InputEventResultSource, + void OnInputEventAck(const content::RenderWidgetHost &, + blink::mojom::InputEventResultSource, blink::mojom::InputEventResultState state, const blink::WebInputEvent &event) override; diff --git a/src/core/render_widget_host_view_qt_delegate_item.cpp b/src/core/render_widget_host_view_qt_delegate_item.cpp index e82dabb5fff..77adb843ceb 100644 --- a/src/core/render_widget_host_view_qt_delegate_item.cpp +++ b/src/core/render_widget_host_view_qt_delegate_item.cpp @@ -355,6 +355,8 @@ void RenderWidgetHostViewQtDelegateItem::itemChange(ItemChange change, const Ite if (value.boolValue) { m_client->notifyShown(); } else { + if (!m_widgetDelegate) + return; m_client->notifyHidden(); if (!m_isPopup) onHide(); diff --git a/src/core/renderer/content_renderer_client_qt.cpp b/src/core/renderer/content_renderer_client_qt.cpp index 0368ba3d813..2052ba8d709 100644 --- a/src/core/renderer/content_renderer_client_qt.cpp +++ b/src/core/renderer/content_renderer_client_qt.cpp @@ -45,8 +45,8 @@ #if QT_CONFIG(webengine_printing_and_pdf) #include "renderer/print_web_view_helper_delegate_qt.h" +#include "chrome/common/webui_url_constants.h" #include "components/pdf/renderer/internal_plugin_renderer_helpers.h" -#include "components/pdf/renderer/pdf_internal_plugin_delegate.h" #include "components/printing/renderer/print_render_frame_helper.h" #endif @@ -210,11 +210,6 @@ void ContentRendererClientQt::RenderFrameCreated(content::RenderFrame *render_fr new autofill::AutofillAgent( render_frame, - { - autofill::AutofillAgent::ExtractAllDatalists(false), autofill::AutofillAgent::FocusRequiresScroll(true), - autofill::AutofillAgent::QueryPasswordSuggestions(false), autofill::AutofillAgent::SecureContextRequired(false), - autofill::AutofillAgent::UserGestureRequired(true), autofill::AutofillAgent::UsesKeyboardAccessoryForSuggestions(false) - }, std::move(password_autofill_agent), std::move(password_generation_agent), associated_interfaces); } @@ -307,7 +302,11 @@ void ContentRendererClientQt::GetNavigationErrorStringsInternal(content::RenderF error_page::LocalizedError::GetPageState( error.reason(), error.domain(), error.url(), isPost, false, error.stale_copy_in_cache(), false, - RenderConfiguration::is_incognito_process(), false, false, false, locale, false, &error_page_params); + RenderConfiguration::is_incognito_process(), + false, false, + locale, + false, + &error_page_params); resourceId = IDR_NET_ERROR_HTML; @@ -348,15 +347,15 @@ bool IsPdfExtensionOrigin(const url::Origin &origin) #if BUILDFLAG(ENABLE_PLUGINS) void AppendParams(const std::vector &additional_params, - blink::WebVector *existing_names, - blink::WebVector *existing_values) + std::vector *existing_names, + std::vector *existing_values) { DCHECK(existing_names->size() == existing_values->size()); size_t existing_size = existing_names->size(); size_t total_size = existing_size + additional_params.size(); - blink::WebVector names(total_size); - blink::WebVector values(total_size); + std::vector names(total_size); + std::vector values(total_size); for (size_t i = 0; i < existing_size; ++i) { names[i] = (*existing_names)[i]; @@ -374,23 +373,9 @@ void AppendParams(const std::vector &addition #endif // BUILDFLAG(ENABLE_PLUGINS) #if QT_CONFIG(webengine_printing_and_pdf) -// based on chrome/renderer/pdf/chrome_pdf_internal_plugin_delegate.cc: -class PdfInternalPluginDelegateQt final - : public pdf::PdfInternalPluginDelegate +std::vector GetAdditionalPdfInternalPluginAllowedOrigins() { -public: - PdfInternalPluginDelegateQt() = default; - PdfInternalPluginDelegateQt(const PdfInternalPluginDelegateQt &) = delete; - PdfInternalPluginDelegateQt& operator=(const PdfInternalPluginDelegateQt &) = delete; - ~PdfInternalPluginDelegateQt() override = default; - - // `pdf::PdfInternalPluginDelegate`: - bool IsAllowedOrigin(const url::Origin &origin) const override; -}; - -bool PdfInternalPluginDelegateQt::IsAllowedOrigin(const url::Origin &origin) const -{ - return IsPdfExtensionOrigin(origin); + return {url::Origin::Create(GURL(chrome::kChromeUIPrintURL))}; } #endif } // namespace @@ -442,6 +427,7 @@ bool ContentRendererClientQt::OverrideCreatePlugin(content::RenderFrame *render_ *plugin = LoadablePluginPlaceholderQt::CreateLoadableMissingPlugin(render_frame, params)->plugin(); return true; } +#if QT_CONFIG(webengine_printing_and_pdf) if (info.name == u"Chromium PDF Viewer") { blink::WebPluginParams new_params(params); for (const auto& mime_type : info.mime_types) { @@ -452,9 +438,10 @@ bool ContentRendererClientQt::OverrideCreatePlugin(content::RenderFrame *render_ } } - *plugin = pdf::CreateInternalPlugin(std::move(new_params), render_frame, std::make_unique()); + *plugin = pdf::CreateInternalPlugin(std::move(new_params), render_frame, GetAdditionalPdfInternalPluginAllowedOrigins()); return true; } +#endif *plugin = render_frame->CreatePlugin(info, params); #endif // BUILDFLAG(ENABLE_PLUGINS) return true; diff --git a/src/core/renderer_host/web_channel_ipc_transport_host.cpp b/src/core/renderer_host/web_channel_ipc_transport_host.cpp index 0cc24014fa5..d69d543de3e 100644 --- a/src/core/renderer_host/web_channel_ipc_transport_host.cpp +++ b/src/core/renderer_host/web_channel_ipc_transport_host.cpp @@ -22,7 +22,7 @@ Q_WEBENGINE_LOGGING_CATEGORY(log, "qt.webengine.webchanneltransport") inline QDebug operator<<(QDebug stream, content::RenderFrameHost *frame) { - return stream << "frame " << frame->GetRoutingID() << " in process " << frame->GetProcess()->GetID(); + return stream << "frame " << frame->GetRoutingID() << " in process " << frame->GetProcess()->GetDeprecatedID(); } WebChannelIPCTransportHost::WebChannelIPCTransportHost(content::WebContents *contents, uint worldId, QObject *parent) diff --git a/src/core/touch_handle_drawable_qt.cpp b/src/core/touch_handle_drawable_qt.cpp index 1e979fa03d7..9dded431b83 100644 --- a/src/core/touch_handle_drawable_qt.cpp +++ b/src/core/touch_handle_drawable_qt.cpp @@ -13,8 +13,10 @@ #include "type_conversion.h" #include "web_contents_adapter_client.h" +#include "ui/base/models/image_model.h" #include "ui/base/resource/resource_bundle.h" #include "ui/resources/grit/ui_resources.h" +#include "ui/touch_selection/vector_icons/vector_icons.h" namespace QtWebEngineCore { @@ -89,11 +91,12 @@ void TouchHandleDrawableQt::SetOrientation(ui::TouchHandleOrientation orientatio if (m_orientation == orientation) return; m_orientation = orientation; - gfx::Image* image = GetHandleImage(orientation); + + ui::ImageModel imageModel = GetHandleVectorIcon(orientation); m_delegate->setImage(static_cast(orientation)); // Calculate the relative bounds. - gfx::Size image_size = image->Size(); + gfx::Size image_size = imageModel.Size(); int window_width = image_size.width() + 2 * kSelectionHandlePadding; int window_height = image_size.height() + 2 * kSelectionHandlePadding; m_relativeBounds = @@ -142,25 +145,24 @@ float TouchHandleDrawableQt::GetDrawableHorizontalPaddingRatio() const return 0.0; } -// Returns the appropriate handle image based on the handle orientation. -gfx::Image *TouchHandleDrawableQt::GetHandleImage(ui::TouchHandleOrientation orientation) -{ - int resource_id = 0; +// [static] Returns the appropriate handle vector icon based on the handle orientation. +ui::ImageModel TouchHandleDrawableQt::GetHandleVectorIcon(ui::TouchHandleOrientation orientation) { + const gfx::VectorIcon* icon = nullptr; switch (orientation) { case ui::TouchHandleOrientation::LEFT: - resource_id = IDR_TEXT_SELECTION_HANDLE_LEFT; + icon = &ui::kTextSelectionHandleLeftIcon; break; case ui::TouchHandleOrientation::CENTER: - resource_id = IDR_TEXT_SELECTION_HANDLE_CENTER; + icon = &ui::kTextSelectionHandleCenterIcon; break; case ui::TouchHandleOrientation::RIGHT: - resource_id = IDR_TEXT_SELECTION_HANDLE_RIGHT; + icon = &ui::kTextSelectionHandleRightIcon; break; case ui::TouchHandleOrientation::UNDEFINED: NOTREACHED() << "Invalid touch handle bound type."; - return nullptr; - }; - return &ui::ResourceBundle::GetSharedInstance().GetImageNamed(resource_id); + } + return ui::ImageModel::FromVectorIcon(*icon, + /*color_id=*/ui::kColorSysPrimary); } } // namespace QtWebEngineCore diff --git a/src/core/touch_handle_drawable_qt.h b/src/core/touch_handle_drawable_qt.h index 1738e68e980..f8ae4661bb7 100644 --- a/src/core/touch_handle_drawable_qt.h +++ b/src/core/touch_handle_drawable_qt.h @@ -6,7 +6,7 @@ #include "ui/touch_selection/touch_handle.h" #include "ui/touch_selection/touch_handle_orientation.h" -#include "ui/gfx/image/image.h" +#include "ui/base/models/image_model.h" #include @@ -19,7 +19,7 @@ class TouchHandleDrawableQt : public ui::TouchHandleDrawable public: explicit TouchHandleDrawableQt(TouchHandleDrawableDelegate *delegate); ~TouchHandleDrawableQt() override; - static gfx::Image *GetHandleImage(ui::TouchHandleOrientation orientation); + static ui::ImageModel GetHandleVectorIcon(ui::TouchHandleOrientation orientation); private: void UpdateBounds(); diff --git a/src/core/touch_selection_controller_client_qt.cpp b/src/core/touch_selection_controller_client_qt.cpp index 804e943350e..3c365b98f36 100644 --- a/src/core/touch_selection_controller_client_qt.cpp +++ b/src/core/touch_selection_controller_client_qt.cpp @@ -13,6 +13,9 @@ #include "content/browser/renderer_host/render_frame_host_impl.h" #include "content/browser/renderer_host/render_widget_host_impl.h" #include "ui/gfx/geometry/size_conversions.h" +#include "ui/color/color_provider.h" +#include "ui/color/color_provider_manager.h" +#include "ui/native_theme/native_theme.h" #include #include @@ -260,12 +263,16 @@ std::unique_ptr TouchSelectionControllerClientQt::Creat { Q_ASSERT(m_rwhv); Q_ASSERT(m_rwhv->adapterClient()); + + auto color_provider = ui::ColorProviderManager::Get().GetColorProviderFor( + ui::NativeTheme::GetInstanceForNativeUi()->GetColorProviderKey(nullptr)); QMap images; for (int orientation = 0; orientation < static_cast(ui::TouchHandleOrientation::UNDEFINED); ++orientation) { - gfx::Image *image = TouchHandleDrawableQt::GetHandleImage( + ui::ImageModel imageModel = TouchHandleDrawableQt::GetHandleVectorIcon( static_cast(orientation)); - images.insert(orientation, toQImage(image->AsBitmap())); + gfx::ImageSkia image = imageModel.Rasterize(color_provider); + images.insert(orientation, toQImage(*image.bitmap())); } auto delegate = m_rwhv->adapterClient()->createTouchHandleDelegate(images); return std::unique_ptr(new TouchHandleDrawableQt(delegate)); diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 67f9362d1a9..8c4d01e58e3 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -33,7 +33,7 @@ #include "base/task/sequence_manager/thread_controller_with_message_pump_impl.h" #include "base/values.h" #include "chrome/browser/tab_contents/form_interaction_tab_helper.h" -#include "components/autofill/core/browser/autofill_manager.h" +#include "components/autofill/core/browser/foundations/autofill_manager.h" #include "components/autofill/content/browser/content_autofill_driver_factory.h" #include "components/embedder_support/user_agent_utils.h" #include "components/favicon/core/favicon_service.h" @@ -535,13 +535,13 @@ void WebContentsAdapter::initializeRenderPrefs() base::CommandLine* commandLine = base::CommandLine::ForCurrentProcess(); if (commandLine->HasSwitch(switches::kForceWebRtcIPHandlingPolicy)) rendererPrefs->webrtc_ip_handling_policy = - commandLine->GetSwitchValueASCII(switches::kForceWebRtcIPHandlingPolicy); + blink::ToWebRTCIPHandlingPolicy(commandLine->GetSwitchValueASCII(switches::kForceWebRtcIPHandlingPolicy)); else rendererPrefs->webrtc_ip_handling_policy = m_adapterClient->webEngineSettings()->testAttribute( QWebEngineSettings::WebRTCPublicInterfacesOnly) - ? blink::kWebRTCIPHandlingDefaultPublicInterfaceOnly - : blink::kWebRTCIPHandlingDefault; + ? blink::mojom::WebRtcIpHandlingPolicy::kDefaultPublicInterfaceOnly + : blink::mojom::WebRtcIpHandlingPolicy::kDefault; #endif rendererPrefs->can_accept_load_drops = m_adapterClient->webEngineSettings()->testAttribute(QWebEngineSettings::NavigateOnDropEnabled); @@ -693,9 +693,11 @@ void WebContentsAdapter::load(const QWebEngineHttpRequest &request) net::ERR_DISALLOWED_URL_SCHEME)); return; } - params.post_data = network::ResourceRequestBody::CreateFromBytes( - (const char*)request.postData().constData(), - request.postData().length()); + { + std::vector data(request.postData().length()); + memcpy(data.data(), request.postData().constData(), data.size()); + params.post_data = network::ResourceRequestBody::CreateFromBytes(std::move(data)); + } break; } diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index 3f209c7e0c5..4100daa9d52 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -89,6 +89,8 @@ WebContentsDelegateQt::~WebContentsDelegateQt() // The destruction of this object should take place before // WebContents destruction since WebContentsAdapterClient // might be already deleted. + + GetJavaScriptDialogManager(web_contents())->CancelDialogs(web_contents(), false); } content::WebContents *WebContentsDelegateQt::OpenURLFromTab(content::WebContents *source, const content::OpenURLParams ¶ms, diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 939fc647c97..72fd4c3a885 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -1045,7 +1045,6 @@ WebEngineContext::WebEngineContext() } m_mainDelegate->PostEarlyInitialization({}); content::StartBrowserThreadPool(); - content::BrowserTaskExecutor::PostFeatureListSetup(); tracing::InitTracingPostThreadPoolStartAndFeatureList(false); base::PowerMonitor::GetInstance()->Initialize(MakePowerMonitorDeviceSource()); content::ProcessVisibilityTracker::GetInstance(); @@ -1243,7 +1242,7 @@ const char *qWebEngineChromiumVersion() noexcept const char *qWebEngineChromiumSecurityPatchVersion() noexcept { - return "137.0.7151.68"; // FIXME: Remember to update + return "134.0.6998.208"; // FIXME: Remember to update } QT_END_NAMESPACE diff --git a/src/core/web_engine_settings.cpp b/src/core/web_engine_settings.cpp index 4f5de0cc440..8d789c5bd3a 100644 --- a/src/core/web_engine_settings.cpp +++ b/src/core/web_engine_settings.cpp @@ -465,12 +465,14 @@ void WebEngineSettings::applySettingsToWebPreferences(blink::web_pref::WebPrefer bool WebEngineSettings::applySettingsToRendererPreferences(blink::RendererPreferences *prefs) { bool changed = false; + prefs->uses_platform_autofill = false; #if QT_CONFIG(webengine_webrtc) if (!base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kForceWebRtcIPHandlingPolicy)) { - std::string webrtc_ip_handling_policy = - testAttribute(QWebEngineSettings::WebRTCPublicInterfacesOnly) - ? blink::kWebRTCIPHandlingDefaultPublicInterfaceOnly - : blink::kWebRTCIPHandlingDefault; + auto webrtc_ip_handling_policy = + blink::ToWebRTCIPHandlingPolicy( + testAttribute(QWebEngineSettings::WebRTCPublicInterfacesOnly) + ? blink::kWebRTCIPHandlingDefaultPublicInterfaceOnly + : blink::kWebRTCIPHandlingDefault); if (prefs->webrtc_ip_handling_policy != webrtc_ip_handling_policy) { prefs->webrtc_ip_handling_policy = webrtc_ip_handling_policy; changed = true; diff --git a/src/pdf/CMakeLists.txt b/src/pdf/CMakeLists.txt index 423d9883d97..a318051eaed 100644 --- a/src/pdf/CMakeLists.txt +++ b/src/pdf/CMakeLists.txt @@ -140,8 +140,9 @@ foreach(arch ${archs}) v8_enable_webassembly=false use_v8_context_snapshot=false v8_use_external_startup_data=false + build_with_tflite_lib=false webnn_use_tflite=false - ) + ) if(LINUX OR ANDROID) list(APPEND gnArgArg diff --git a/src/webenginewidgets/api/qwebengineview.cpp b/src/webenginewidgets/api/qwebengineview.cpp index 888ed88655c..53fcc46285a 100644 --- a/src/webenginewidgets/api/qwebengineview.cpp +++ b/src/webenginewidgets/api/qwebengineview.cpp @@ -1705,7 +1705,6 @@ void QWebEngineViewPrivate::hideTouchSelectionMenu() void QWebEngineViewPrivate::showTouchSelectionMenu( QtWebEngineCore::TouchSelectionMenuController *controller, const QRect &selectionBounds) { - Q_ASSERT(m_touchSelectionMenu == nullptr); Q_Q(QWebEngineView); // Do not show outside of view diff --git a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp index 07058898363..f3f36520285 100644 --- a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp +++ b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp @@ -1048,19 +1048,6 @@ void tst_QQuickWebEngineView::changeLocale() QTRY_VERIFY(!evaluateJavaScriptSync(viewEN.data(), "document.body.innerText").isNull()); errorLines = evaluateJavaScriptSync(viewEN.data(), "document.body.innerText").toString().split(QRegularExpression("[\r\n]"), Qt::SkipEmptyParts); QCOMPARE(errorLines.first().toUtf8(), QByteArrayLiteral("This site can\xE2\x80\x99t be reached")); - - // Reset error page - viewDE->setUrl(QUrl("about:blank")); - QVERIFY(waitForLoadSucceeded(viewDE.data())); - - // Check whether an existing QWebEngineView keeps the language settings after changing the default locale - viewDE->setUrl(url); - QVERIFY(waitForLoadFailed(viewDE.data())); - - QTRY_VERIFY(!evaluateJavaScriptSync(viewDE.data(), "document.body").isNull()); - QTRY_VERIFY(!evaluateJavaScriptSync(viewDE.data(), "document.body.innerText").isNull()); - errorLines = evaluateJavaScriptSync(viewDE.data(), "document.body.innerText").toString().split(QRegularExpression("[\r\n]"), Qt::SkipEmptyParts); - QCOMPARE(errorLines.first().toUtf8(), QByteArrayLiteral("Die Website ist nicht erreichbar")); } void tst_QQuickWebEngineView::userScripts() diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index c9354a9bef5..b12a29f2bc7 100644 --- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp +++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp @@ -286,7 +286,6 @@ private Q_SLOTS: void openLinkInNewPageWithWebWindowType_data(); void openLinkInNewPageWithWebWindowType(); void keepInterceptorAfterNewWindowRequested(); - void chooseDesktopMedia(); void backForwardCache(); private: @@ -5802,53 +5801,6 @@ void tst_QWebEnginePage::keepInterceptorAfterNewWindowRequested() QVERIFY(interceptor.ran); } -void tst_QWebEnginePage::chooseDesktopMedia() -{ -#if QT_CONFIG(webengine_extensions) && QT_CONFIG(webengine_webrtc) - HttpServer server; - server.setHostDomain("localhost"); - connect(&server, &HttpServer::newRequest, &server, [&] (HttpReqRep *r) { - if (r->requestMethod() == "GET") - r->setResponseBody(""); - }); - QVERIFY(server.start()); - - QWebEnginePage page; - QSignalSpy loadFinishedSpy(&page, SIGNAL(loadFinished(bool))); - page.settings()->setAttribute(QWebEngineSettings::ScreenCaptureEnabled, true); - page.profile()->setPersistentPermissionsPolicy(QWebEngineProfile::PersistentPermissionsPolicy::AskEveryTime); - - bool desktopMediaRequested = false; - bool emptyDesktopMediaRequested = false; - bool permissionRequested = false; - - connect(&page, &QWebEnginePage::desktopMediaRequested, - [&](const QWebEngineDesktopMediaRequest &request) { - desktopMediaRequested = true; - emptyDesktopMediaRequested = request.screensModel()->rowCount() == 0; - }); - - connect(&page, &QWebEnginePage::permissionRequested, - [&](QWebEnginePermission permission) { - permissionRequested = true; - // Handle permission to 'complete' the media request - permission.grant(); - }); - - page.load(QUrl(server.url())); - QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.size(), 1, 20000); - - const QString extensionId("nkeimhogjdpnpccoofpliimaahmaaome"); - page.runJavaScript(QString("(() => {" - " let port = chrome.runtime.connect(\"%1\", {name: \"chooseDesktopMedia\"});" - " port.postMessage({method: \"chooseDesktopMedia\"});" - "})()").arg(extensionId)); - - QTRY_VERIFY(desktopMediaRequested); - QTRY_VERIFY(permissionRequested || emptyDesktopMediaRequested); -#endif // QT_CONFIG(webengine_extensions) && QT_CONFIG(webengine_webrtc) -} - void tst_QWebEnginePage::backForwardCache() { QWebEngineView view; diff --git a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp index 042bdbb3bc8..651bdf829cd 100644 --- a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp +++ b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp @@ -1370,19 +1370,6 @@ void tst_QWebEngineView::changeLocale() QTRY_VERIFY(!toPlainTextSync(viewEN.page()).isEmpty()); errorLines = toPlainTextSync(viewEN.page()).split(QRegularExpression("[\r\n]"), Qt::SkipEmptyParts); QCOMPARE(errorLines.first().toUtf8(), QByteArrayLiteral("This site can\xE2\x80\x99t be reached")); - - // Reset error page - viewDE.load(QUrl("about:blank")); - QVERIFY(loadFinishedSpyDE.wait()); - loadFinishedSpyDE.clear(); - - // Check whether an existing QWebEngineView keeps the language settings after changing the default locale - viewDE.load(url); - QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpyDE.size(), 1, 20000); - - QTRY_VERIFY(!toPlainTextSync(viewDE.page()).isEmpty()); - errorLines = toPlainTextSync(viewDE.page()).split(QRegularExpression("[\r\n]"), Qt::SkipEmptyParts); - QCOMPARE(errorLines.first().toUtf8(), QByteArrayLiteral("Die Website ist nicht erreichbar")); } void tst_QWebEngineView::mixLangLocale_data() diff --git a/tests/manual/widgets/webrtc/index.html b/tests/manual/widgets/webrtc/index.html index 433d643c3ce..ee813d306c1 100644 --- a/tests/manual/widgets/webrtc/index.html +++ b/tests/manual/widgets/webrtc/index.html @@ -17,13 +17,11 @@
-