diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2023-02-16 17:57:29 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2023-07-06 11:40:10 +0200 |
commit | d488349ee0ecac8a2e5a87a18d249c7b5de39152 (patch) | |
tree | 95620d441c5be608127f976428f440636472d166 | |
parent | 09ab9ab74efcd0da0a310c992629bc650a5a80ec (diff) |
Adaptations for Chromium 110
Pick-to: 6.6
Change-Id: I56e1695ee4fc2b0e12da6580a5673df80bba8b6d
Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
36 files changed, 114 insertions, 149 deletions
diff --git a/cmake/Functions.cmake b/cmake/Functions.cmake index e79811346..b852a809b 100644 --- a/cmake/Functions.cmake +++ b/cmake/Functions.cmake @@ -855,7 +855,8 @@ macro(append_build_type_setup) forbid_non_component_debug_builds=false treat_warnings_as_errors=false use_allocator_shim=false - use_allocator="none" + use_partition_alloc=true + use_partition_alloc_as_malloc=false use_custom_libcxx=false ) if(${config} STREQUAL "Debug") @@ -878,7 +879,7 @@ macro(append_build_type_setup) if(FEATURE_developer_build OR (${config} STREQUAL "Debug") OR QT_FEATURE_webengine_sanitizer) list(APPEND gnArgArg is_official_build=false - from_here_uses_location_builtins=false + use_viz_debugger=false ) else() list(APPEND gnArgArg is_official_build=true) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 504dddd44..492731fa8 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -340,14 +340,14 @@ foreach(arch ${archs}) strip_absolute_paths_from_debug_symbols=false devtools_fast_bundle=false devtools_skip_typecheck=false - enable_jxl_decoder=false # temporarily because libjxl causes internal compiler error on armv7 + use_static_angle=true ) extend_gn_list(gnArgArg ARGS use_v8_context_snapshot v8_use_external_startup_data CONDITION QT_FEATURE_webengine_v8_context_snapshot ) extend_gn_list(gnArgArg - ARGS enable_basic_printing enable_print_preview enable_pdf + ARGS enable_printing enable_basic_printing enable_print_preview enable_pdf CONDITION QT_FEATURE_webengine_printing_and_pdf ) extend_gn_list(gnArgArg @@ -521,8 +521,6 @@ foreach(arch ${archs}) if(MACOS) list(APPEND gnArgArg use_external_popup_menu=false - angle_enable_vulkan=false - use_static_angle=true ) endif() diff --git a/src/core/autofill_client_qt.cpp b/src/core/autofill_client_qt.cpp index aaf775d60..4166cbedd 100644 --- a/src/core/autofill_client_qt.cpp +++ b/src/core/autofill_client_qt.cpp @@ -103,7 +103,7 @@ void AutofillClientQt::HideAutofillPopup(autofill::PopupHidingReason) adapterClient()->hideAutofillPopup(); } -bool AutofillClientQt::IsAutocompleteEnabled() +bool AutofillClientQt::IsAutocompleteEnabled() const { return autofill::prefs::IsAutocompleteEnabled(GetPrefs()); } diff --git a/src/core/autofill_client_qt.h b/src/core/autofill_client_qt.h index 95ae460f2..4830cac34 100644 --- a/src/core/autofill_client_qt.h +++ b/src/core/autofill_client_qt.h @@ -52,7 +52,7 @@ public: base::span<const autofill::Suggestion> GetPopupSuggestions() const override; void UpdatePopup(const std::vector<autofill::Suggestion> &, autofill::PopupType) override; void HideAutofillPopup(autofill::PopupHidingReason reason) override; - bool IsAutocompleteEnabled() override; + bool IsAutocompleteEnabled() const override; bool IsPasswordManagerEnabled() override; void PropagateAutofillPredictions(autofill::AutofillDriver *, const std::vector<autofill::FormStructure *> &) override; diff --git a/src/core/browser_accessibility_manager_qt.cpp b/src/core/browser_accessibility_manager_qt.cpp index 299eb7bb3..077856266 100644 --- a/src/core/browser_accessibility_manager_qt.cpp +++ b/src/core/browser_accessibility_manager_qt.cpp @@ -74,7 +74,7 @@ BrowserAccessibilityManagerQt::~BrowserAccessibilityManagerQt() QAccessibleInterface *BrowserAccessibilityManagerQt::rootParentAccessible() { - content::BrowserAccessibility *parent_node = GetParentNodeFromParentTree(); + content::BrowserAccessibility *parent_node = GetParentNodeFromParentTreeAsBrowserAccessibility(); if (!parent_node) { Q_ASSERT(m_webContentsAccessibility); return QAccessible::queryAccessibleInterface(m_webContentsAccessibility->accessibilityParentObject()); diff --git a/src/core/client_hints.cpp b/src/core/client_hints.cpp index 2a30bb51b..2fcecde58 100644 --- a/src/core/client_hints.cpp +++ b/src/core/client_hints.cpp @@ -151,7 +151,7 @@ bool ClientHints::IsJavaScriptAllowed(const GURL &url, content::RenderFrameHost return true; } -bool ClientHints::AreThirdPartyCookiesBlocked(const GURL &url) +bool ClientHints::AreThirdPartyCookiesBlocked(const GURL &url, content::RenderFrameHost *rfh) { return false; // we probably can not report anything more specific } diff --git a/src/core/client_hints.h b/src/core/client_hints.h index a80629fc9..193982d16 100644 --- a/src/core/client_hints.h +++ b/src/core/client_hints.h @@ -58,7 +58,7 @@ public: bool IsJavaScriptAllowed(const GURL &url, content::RenderFrameHost *parent_rfh) override; - bool AreThirdPartyCookiesBlocked(const GURL &url) override; + bool AreThirdPartyCookiesBlocked(const GURL &url, content::RenderFrameHost *rfh) override; blink::UserAgentMetadata GetUserAgentMetadata() override; diff --git a/src/core/compositor/display_software_output_surface.cpp b/src/core/compositor/display_software_output_surface.cpp index 9d6534c28..647c761c3 100644 --- a/src/core/compositor/display_software_output_surface.cpp +++ b/src/core/compositor/display_software_output_surface.cpp @@ -25,7 +25,7 @@ public: // Overridden from viz::SoftwareOutputDevice. void Resize(const gfx::Size &sizeInPixels, float devicePixelRatio) override; - void OnSwapBuffers(SwapBuffersCallback swap_ack_callback) override; + void OnSwapBuffers(SwapBuffersCallback swap_ack_callback, gl::FrameData data) override; // Overridden from Compositor. void swapFrame() override; @@ -60,7 +60,7 @@ void DisplaySoftwareOutputSurface::Device::Resize(const gfx::Size &sizeInPixels, surface_ = SkSurface::MakeRaster(SkImageInfo::MakeN32Premul(sizeInPixels.width(), sizeInPixels.height())); } -void DisplaySoftwareOutputSurface::Device::OnSwapBuffers(SwapBuffersCallback swap_ack_callback) +void DisplaySoftwareOutputSurface::Device::OnSwapBuffers(SwapBuffersCallback swap_ack_callback, gl::FrameData data) { { // MEMO don't hold a lock together with an 'observer', as the call from Qt's scene graph may come at the same time QMutexLocker locker(&m_mutex); diff --git a/src/core/compositor/native_skia_output_device.cpp b/src/core/compositor/native_skia_output_device.cpp index aa0be8c26..dfd2ee24b 100644 --- a/src/core/compositor/native_skia_output_device.cpp +++ b/src/core/compositor/native_skia_output_device.cpp @@ -145,7 +145,7 @@ public: DCHECK(!m_scopedSkiaWriteAccess); DCHECK(!m_scopedOverlayReadAccess); - m_scopedOverlayReadAccess = m_overlayRepresentation->BeginScopedReadAccess(true); + m_scopedOverlayReadAccess = m_overlayRepresentation->BeginScopedReadAccess(); DCHECK(m_scopedOverlayReadAccess); m_acquireFence = TakeGpuFence(m_scopedOverlayReadAccess->TakeAcquireFence()); } @@ -164,11 +164,13 @@ public: m_textureCleanup = nullptr; } } - gl::GLImage *glImage() +#ifdef Q_OS_MACOS + gfx::ScopedIOSurface ioSurface() const { DCHECK(m_presentCount); - return m_scopedOverlayReadAccess->gl_image(); + return m_scopedOverlayReadAccess->GetIOSurface(); } +#endif void createFence() { @@ -344,17 +346,11 @@ QSGTexture *NativeSkiaOutputDevice::texture(QQuickWindow *win, uint32_t textureO { if (!m_frontBuffer || !m_readyWithTexture) return nullptr; - gl::GLImageIOSurface *gl_image_iosurface = gl::GLImageIOSurface::FromGLImage(m_frontBuffer->glImage()); - QSGTexture *texture = nullptr; - if (gl_image_iosurface) { - texture = makeMetalTexture(win, gl_image_iosurface->io_surface().release(), /* plane */ 0, - m_shape.characterization.width(), m_shape.characterization.height(), - textureOptions); - } else { - qWarning() << "GLImage not an IOSURFACE"; - } + Q_ASSERT(QQuickWindow::graphicsApi() == QSGRendererInterface::Metal); - return texture; + return makeMetalTexture(win, m_frontBuffer->ioSurface().release(), /* plane */ 0, + m_shape.characterization.width(), m_shape.characterization.height(), + textureOptions); } #elif defined(Q_OS_WIN) QSGTexture *NativeSkiaOutputDevice::texture(QQuickWindow *win, uint32_t textureOptions) diff --git a/src/core/configure/BUILD.root.gn.in b/src/core/configure/BUILD.root.gn.in index 86369cbbb..45707ddca 100644 --- a/src/core/configure/BUILD.root.gn.in +++ b/src/core/configure/BUILD.root.gn.in @@ -386,7 +386,6 @@ source_set("qtwebengine_sources") { "//extensions/common:core_api_provider", "//extensions/browser", "//extensions/browser/api", - "//extensions/browser:core_api_provider", "//extensions/renderer", "//extensions:extensions_resources", "//extensions/strings", diff --git a/src/core/content_main_delegate_qt.cpp b/src/core/content_main_delegate_qt.cpp index 2033a296b..b5c8210cd 100644 --- a/src/core/content_main_delegate_qt.cpp +++ b/src/core/content_main_delegate_qt.cpp @@ -89,7 +89,7 @@ struct LazyDirectoryListerCacher webui::GetI18nTemplateHtml( ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(IDR_DIR_HEADER_HTML), std::move(dict)); - html_data = base::RefCountedString::TakeString(&html); + html_data = base::MakeRefCounted<base::RefCountedString>(std::move(html)); } scoped_refptr<base::RefCountedMemory> html_data; diff --git a/src/core/extensions/extension_system_qt.cpp b/src/core/extensions/extension_system_qt.cpp index 0f44b8db3..42dfd0d67 100644 --- a/src/core/extensions/extension_system_qt.cpp +++ b/src/core/extensions/extension_system_qt.cpp @@ -69,28 +69,28 @@ namespace extensions { namespace { -std::string GenerateId(const base::DictionaryValue *manifest, const base::FilePath &path) +std::string GenerateId(const base::Value::Dict &manifest, const base::FilePath &path) { - std::string raw_key; + const std::string *raw_key; std::string id_input; - CHECK(manifest->GetString(manifest_keys::kPublicKey, &raw_key)); - CHECK(Extension::ParsePEMKeyBytes(raw_key, &id_input)); + CHECK(raw_key = manifest.FindString(manifest_keys::kPublicKey)); + CHECK(Extension::ParsePEMKeyBytes(*raw_key, &id_input)); std::string id = crx_file::id_util::GenerateId(id_input); return id; } // Implementation based on ComponentLoader::ParseManifest. -std::unique_ptr<base::DictionaryValue> ParseManifest(const std::string &manifest_contents) +absl::optional<base::Value::Dict> ParseManifest(base::StringPiece manifest_contents) { JSONStringValueDeserializer deserializer(manifest_contents); - std::unique_ptr<base::Value> manifest(deserializer.Deserialize(NULL, NULL)); + std::unique_ptr<base::Value> manifest = deserializer.Deserialize(nullptr, nullptr); if (!manifest.get() || !manifest->is_dict()) { LOG(ERROR) << "Failed to parse extension manifest."; - return NULL; + return absl::nullopt; } - // Transfer ownership to the caller. - return base::DictionaryValue::From(std::move(manifest)); + + return std::move(*manifest).TakeDict(); } } // namespace @@ -129,14 +129,15 @@ public: void Shutdown() override {} }; -void ExtensionSystemQt::LoadExtension(std::string extension_id, std::unique_ptr<base::DictionaryValue> manifest, const base::FilePath &directory) +void ExtensionSystemQt::LoadExtension(std::string extension_id, const base::Value::Dict &manifest, const base::FilePath &directory) { int flags = Extension::REQUIRE_KEY; std::string error; + scoped_refptr<const Extension> extension = Extension::Create( directory, mojom::ManifestLocation::kComponent, - *manifest, + manifest, flags, &error); if (!extension.get()) @@ -191,8 +192,10 @@ void ExtensionSystemQt::NotifyExtensionLoaded(const Extension *extension) #if BUILDFLAG(ENABLE_PLUGINS) // Register plugins included with the extension. // Implementation based on PluginManager::OnExtensionLoaded. + bool plugins_changed = false; const MimeTypesHandler *handler = MimeTypesHandler::GetHandler(extension); if (handler && handler->HasPlugin()) { + plugins_changed = true; content::WebPluginInfo info; info.type = content::WebPluginInfo::PLUGIN_TYPE_BROWSER_PLUGIN; info.name = base::UTF8ToUTF16(extension->name()); @@ -214,6 +217,8 @@ void ExtensionSystemQt::NotifyExtensionLoaded(const Extension *extension) plugin_service->RefreshPlugins(); plugin_service->RegisterInternalPlugin(info, true); } + if (plugins_changed) + content::PluginService::GetInstance()->PurgePluginListCache(browser_context_, false); #endif // BUILDFLAG(ENABLE_PLUGINS) } @@ -331,24 +336,26 @@ void ExtensionSystemQt::Init(bool extensions_enabled) std::string pdf_manifest = ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(IDR_PDF_MANIFEST); base::ReplaceFirstSubstringAfterOffset(&pdf_manifest, 0, "<NAME>", "chromium-pdf"); - std::unique_ptr<base::DictionaryValue> pdfManifestDict = ParseManifest(pdf_manifest); + auto pdfManifestDict = ParseManifest(pdf_manifest); + CHECK(pdfManifestDict); base::FilePath path; base::PathService::Get(base::DIR_QT_LIBRARY_DATA, &path); path = path.Append(base::FilePath(FILE_PATH_LITERAL("pdf"))); - std::string id = GenerateId(pdfManifestDict.get(), path); - LoadExtension(id, std::move(pdfManifestDict), path); + std::string id = GenerateId(pdfManifestDict.value(), path); + LoadExtension(id, pdfManifestDict.value(), path); } #endif // BUILDFLAG(ENABLE_PDF) #if BUILDFLAG(ENABLE_HANGOUT_SERVICES_EXTENSION) { std::string hangout_manifest = ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(IDR_HANGOUT_SERVICES_MANIFEST); - std::unique_ptr<base::DictionaryValue> hangoutManifestDict = ParseManifest(hangout_manifest); + auto hangoutManifestDict = ParseManifest(hangout_manifest); + CHECK(hangoutManifestDict); base::FilePath path; base::PathService::Get(base::DIR_QT_LIBRARY_DATA, &path); path = path.Append(base::FilePath(FILE_PATH_LITERAL("hangout_services"))); - std::string id = GenerateId(hangoutManifestDict.get(), path); - LoadExtension(id, std::move(hangoutManifestDict), path); + std::string id = GenerateId(hangoutManifestDict.value(), path); + LoadExtension(id, hangoutManifestDict.value(), path); } #endif // BUILDFLAG(ENABLE_HANGOUT_SERVICES_EXTENSION) } diff --git a/src/core/extensions/extension_system_qt.h b/src/core/extensions/extension_system_qt.h index 02fbaee37..87e740820 100644 --- a/src/core/extensions/extension_system_qt.h +++ b/src/core/extensions/extension_system_qt.h @@ -83,7 +83,7 @@ private: void OnExtensionRegisteredWithRequestContexts(scoped_refptr<const extensions::Extension> extension); void NotifyExtensionLoaded(const Extension *extension); - void LoadExtension(std::string extension_id, std::unique_ptr<base::DictionaryValue> manifest, const base::FilePath &directory); + void LoadExtension(std::string extension_id, const base::Value::Dict &manifest, const base::FilePath &directory); // The services that are shared between normal and incognito profiles. // Data to be accessed on the IO thread. Must outlive process_manager_. diff --git a/src/core/extensions/extensions_browser_client_qt.cpp b/src/core/extensions/extensions_browser_client_qt.cpp index ab44c23eb..546105866 100644 --- a/src/core/extensions/extensions_browser_client_qt.cpp +++ b/src/core/extensions/extensions_browser_client_qt.cpp @@ -19,9 +19,9 @@ #include "chrome/browser/profiles/profile.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/render_frame_host.h" +#include "extensions/browser/api/core_extensions_browser_api_provider.h" #include "extensions/browser/api/extensions_api_client.h" #include "extensions/browser/api/runtime/runtime_api_delegate.h" -#include "extensions/browser/core_extensions_browser_api_provider.h" #include "extensions/browser/event_router.h" #include "extensions/browser/extension_host_delegate.h" #include "extensions/browser/extension_protocols.h" @@ -79,7 +79,7 @@ scoped_refptr<base::RefCountedMemory> GetResource(int resource_id, const std::st base::StringPiece input(reinterpret_cast<const char *>(bytes->front()), bytes->size()); std::string temp_str = ui::ReplaceTemplateExpressions(input, *replacements); DCHECK(!temp_str.empty()); - return base::RefCountedString::TakeString(&temp_str); + return base::MakeRefCounted<base::RefCountedString>(std::move(temp_str)); } return bytes; } diff --git a/src/core/extensions/pdf_iframe_navigation_throttle_qt.cpp b/src/core/extensions/pdf_iframe_navigation_throttle_qt.cpp index 5a93b4b84..15aa4a6c4 100644 --- a/src/core/extensions/pdf_iframe_navigation_throttle_qt.cpp +++ b/src/core/extensions/pdf_iframe_navigation_throttle_qt.cpp @@ -37,7 +37,6 @@ class PdfWebContentsLifetimeHelper : public content::WebContentsUserData<PdfWebC public: explicit PdfWebContentsLifetimeHelper(content::WebContents *web_contents) : content::WebContentsUserData<PdfWebContentsLifetimeHelper>(*web_contents) - , web_contents_(web_contents) {} base::WeakPtr<PdfWebContentsLifetimeHelper> GetWeakPtr() @@ -47,13 +46,12 @@ public: void NavigateIFrameToPlaceholder(const content::OpenURLParams &url_params) { - web_contents_->OpenURL(url_params); + GetWebContents().OpenURL(url_params); } private: friend class content::WebContentsUserData<PdfWebContentsLifetimeHelper>; - content::WebContents *const web_contents_; base::WeakPtrFactory<PdfWebContentsLifetimeHelper> weak_factory_{this}; WEB_CONTENTS_USER_DATA_KEY_DECL(); @@ -74,10 +72,11 @@ bool IsPDFPluginEnabled(content::NavigationHandle *navigation_handle, bool *is_s content::WebPluginInfo plugin_info; // Will check WebEngineSettings by PluginServiceFilterQt return content::PluginService::GetInstance()->GetPluginInfo( - process_id, routing_id, nullptr, navigation_handle->GetURL(), - kPDFMimeType, - false /* allow_wildcard */, is_stale, &plugin_info, - nullptr /* actual_mime_type */); + process_id, routing_id, + navigation_handle->GetWebContents()->GetBrowserContext(), + navigation_handle->GetURL(), + kPDFMimeType, false /* allow_wildcard */, + is_stale, &plugin_info, nullptr /* actual_mime_type */); } std::string GetPDFPlaceholderHTML(const GURL &pdf_url) diff --git a/src/core/favicon_service_factory_qt.cpp b/src/core/favicon_service_factory_qt.cpp index d76bfab11..1ed33d559 100644 --- a/src/core/favicon_service_factory_qt.cpp +++ b/src/core/favicon_service_factory_qt.cpp @@ -23,12 +23,17 @@ void HistoryClientQt::OnHistoryServiceCreated(history::HistoryService *history_s void HistoryClientQt::Shutdown() { } -bool HistoryClientQt::CanAddURL(const GURL &url) +static bool CanAddURL(const GURL &url) { Q_UNUSED(url); return true; } +history::CanAddURLCallback HistoryClientQt::GetThreadSafeCanAddURLCallback() const +{ + return base::BindRepeating(&CanAddURL); +} + void HistoryClientQt::NotifyProfileError(sql::InitStatus init_status, const std::string &diagnostics) { @@ -84,7 +89,7 @@ HistoryServiceFactoryQt::BuildServiceInstanceFor(content::BrowserContext *contex std::unique_ptr<history::HistoryService> historyService( new history::HistoryService(std::make_unique<HistoryClientQt>(), nullptr)); - if (!historyService->Init(history::HistoryDatabaseParamsForPath(context->GetPath()))) { + if (!historyService->Init(history::HistoryDatabaseParamsForPath(context->GetPath(), version_info::Channel::DEFAULT))) { return nullptr; } return historyService.release(); diff --git a/src/core/favicon_service_factory_qt.h b/src/core/favicon_service_factory_qt.h index 44a43211e..0c3bfd7b5 100644 --- a/src/core/favicon_service_factory_qt.h +++ b/src/core/favicon_service_factory_qt.h @@ -48,7 +48,7 @@ public: void OnHistoryServiceCreated(history::HistoryService *history_service) override; void Shutdown() override; - bool CanAddURL(const GURL &url) override; + history::CanAddURLCallback GetThreadSafeCanAddURLCallback() const override; void NotifyProfileError(sql::InitStatus init_status, const std::string &diagnostics) override; std::unique_ptr<history::HistoryBackendClient> CreateBackendClient() override; void UpdateBookmarkLastUsedTime(int64_t bookmark_node_id, base::Time time) override; 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 2fd710ad6..5628744ea 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 @@ -471,4 +471,8 @@ void FileSystemAccessPermissionContextQt::PermissionGrantDestroyed( grants.erase(grant_it); } +void FileSystemAccessPermissionContextQt::NotifyEntryMoved(const url::Origin &, const base::FilePath &, const base::FilePath &) +{ +} + } // namespace QtWebEngineCore 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 09e890038..06fbfae3f 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 @@ -52,6 +52,7 @@ public: 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 NavigatedAwayFromOrigin(const url::Origin &origin); content::BrowserContext *profile() const { return m_profile; } diff --git a/src/core/net/proxying_restricted_cookie_manager_qt.cpp b/src/core/net/proxying_restricted_cookie_manager_qt.cpp index 8608d35cd..d0c5b67de 100644 --- a/src/core/net/proxying_restricted_cookie_manager_qt.cpp +++ b/src/core/net/proxying_restricted_cookie_manager_qt.cpp @@ -68,14 +68,13 @@ void ProxyingRestrictedCookieManagerQt::GetAllForUrl(const GURL &url, const net::SiteForCookies &site_for_cookies, const url::Origin &top_frame_origin, network::mojom::CookieManagerGetOptionsPtr options, - bool partitioned_cookies_runtime_feature_enabled, GetAllForUrlCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); if (allowCookies(url, site_for_cookies)) { underlying_restricted_cookie_manager_->GetAllForUrl(url, site_for_cookies, top_frame_origin, std::move(options), - partitioned_cookies_runtime_feature_enabled, std::move(callback)); + std::move(callback)); } else { std::move(callback).Run(std::vector<net::CookieWithAccessResult>()); } @@ -111,14 +110,13 @@ void ProxyingRestrictedCookieManagerQt::SetCookieFromString(const GURL &url, const net::SiteForCookies &site_for_cookies, const url::Origin &top_frame_origin, const std::string &cookie, - bool partitioned_cookies_runtime_feature_enabled, SetCookieFromStringCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); if (allowCookies(url, site_for_cookies)) { underlying_restricted_cookie_manager_->SetCookieFromString(url, site_for_cookies, top_frame_origin, cookie, - partitioned_cookies_runtime_feature_enabled, std::move(callback)); + std::move(callback)); } else { std::move(callback).Run(false, false); // FIXME: is true, true in aw_proxying_restricted_cookie_manager.cc though.. } @@ -127,14 +125,13 @@ void ProxyingRestrictedCookieManagerQt::SetCookieFromString(const GURL &url, void ProxyingRestrictedCookieManagerQt::GetCookiesString(const GURL &url, const net::SiteForCookies &site_for_cookies, const url::Origin &top_frame_origin, - bool partitioned_cookies_runtime_feature_enabled, GetCookiesStringCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); if (allowCookies(url, site_for_cookies)) { underlying_restricted_cookie_manager_->GetCookiesString(url, site_for_cookies, top_frame_origin, - partitioned_cookies_runtime_feature_enabled, std::move(callback)); + std::move(callback)); } else { std::move(callback).Run(""); } @@ -149,11 +146,6 @@ void ProxyingRestrictedCookieManagerQt::CookiesEnabledFor(const GURL &url, std::move(callback).Run(allowCookies(url, site_for_cookies)); } -void ProxyingRestrictedCookieManagerQt::ConvertPartitionedCookiesToUnpartitioned(const GURL&) -{ - NOTIMPLEMENTED(); -} - bool ProxyingRestrictedCookieManagerQt::allowCookies(const GURL &url, const net::SiteForCookies &site_for_cookies) const { if (!m_profileIoData) diff --git a/src/core/net/proxying_restricted_cookie_manager_qt.h b/src/core/net/proxying_restricted_cookie_manager_qt.h index 95e193f76..70b8499c0 100644 --- a/src/core/net/proxying_restricted_cookie_manager_qt.h +++ b/src/core/net/proxying_restricted_cookie_manager_qt.h @@ -28,7 +28,6 @@ public: const net::SiteForCookies &site_for_cookies, const url::Origin &top_frame_origin, network::mojom::CookieManagerGetOptionsPtr options, - bool partitioned_cookies_runtime_feature_enabled, GetAllForUrlCallback callback) override; void SetCanonicalCookie(const net::CanonicalCookie& cookie, const GURL &url, @@ -45,18 +44,15 @@ public: const net::SiteForCookies &site_for_cookies, const url::Origin &top_frame_origin, const std::string &cookie, - bool partitioned_cookies_runtime_feature_enabled, SetCookieFromStringCallback callback) override; void GetCookiesString(const GURL &url, const net::SiteForCookies &site_for_cookies, const url::Origin &top_frame_origin, - bool partitioned_cookies_runtime_feature_enabled, GetCookiesStringCallback callback) override; void CookiesEnabledFor(const GURL &url, const net::SiteForCookies &site_for_cookies, const url::Origin &top_frame_origin, CookiesEnabledForCallback callback) override; - void ConvertPartitionedCookiesToUnpartitioned(const GURL&) override; // Internal: bool allowCookies(const GURL &url, const net::SiteForCookies &site_for_cookies) const; diff --git a/src/core/ozone/gl_ozone_glx_qt.cpp b/src/core/ozone/gl_ozone_glx_qt.cpp index e9946806a..661314085 100644 --- a/src/core/ozone/gl_ozone_glx_qt.cpp +++ b/src/core/ozone/gl_ozone_glx_qt.cpp @@ -14,6 +14,7 @@ #include "ui/gl/gl_context_glx.h" #include "ui/gl/gl_gl_api_implementation.h" #include "ui/gl/gl_glx_api_implementation.h" +#include "ui/gl/presenter.h" #include "ui/ozone/platform/x11/native_pixmap_glx_binding.h" #include <dlfcn.h> @@ -91,7 +92,7 @@ scoped_refptr<gl::GLSurface> GLOzoneGLXQt::CreateViewGLSurface( return nullptr; } -scoped_refptr<gl::GLSurface> GLOzoneGLXQt::CreateSurfacelessViewGLSurface( +scoped_refptr<gl::Presenter> GLOzoneGLXQt::CreateSurfacelessViewGLSurface( gl::GLDisplay* display, gfx::AcceleratedWidget window) { return nullptr; diff --git a/src/core/ozone/gl_ozone_glx_qt.h b/src/core/ozone/gl_ozone_glx_qt.h index cc0feb563..177d37ba1 100644 --- a/src/core/ozone/gl_ozone_glx_qt.h +++ b/src/core/ozone/gl_ozone_glx_qt.h @@ -39,7 +39,7 @@ public: gl::GLDisplay* display, gfx::AcceleratedWidget window) override; - scoped_refptr<gl::GLSurface> CreateSurfacelessViewGLSurface( + scoped_refptr<gl::Presenter> CreateSurfacelessViewGLSurface( gl::GLDisplay* display, gfx::AcceleratedWidget window) override; diff --git a/src/core/ozone/platform_window_qt.h b/src/core/ozone/platform_window_qt.h index 0d1743f68..c025102bb 100644 --- a/src/core/ozone/platform_window_qt.h +++ b/src/core/ozone/platform_window_qt.h @@ -33,7 +33,7 @@ public: void SetCapture() override { } void ReleaseCapture() override { } bool HasCapture() const override { return false; } - void ToggleFullscreen() override { } + void SetFullscreen(bool, int64_t) override { } void Maximize() override { } void Minimize() override { } void Restore() override { } diff --git a/src/core/permission_manager_qt.cpp b/src/core/permission_manager_qt.cpp index 28e1c981d..ca50b5af1 100644 --- a/src/core/permission_manager_qt.cpp +++ b/src/core/permission_manager_qt.cpp @@ -33,7 +33,7 @@ static ProfileAdapter::PermissionType toQt(blink::PermissionType type) return ProfileAdapter::NotificationPermission; case blink::PermissionType::ACCESSIBILITY_EVENTS: case blink::PermissionType::CAMERA_PAN_TILT_ZOOM: - case blink::PermissionType::WINDOW_PLACEMENT: + case blink::PermissionType::WINDOW_MANAGEMENT: return ProfileAdapter::UnsupportedPermission; case blink::PermissionType::MIDI_SYSEX: case blink::PermissionType::PROTECTED_MEDIA_IDENTIFIER: diff --git a/src/core/pref_service_adapter.cpp b/src/core/pref_service_adapter.cpp index b6cfc2714..9d18384a1 100644 --- a/src/core/pref_service_adapter.cpp +++ b/src/core/pref_service_adapter.cpp @@ -87,8 +87,6 @@ void PrefServiceAdapter::setup(const ProfileAdapter &profileAdapter) registry->RegisterIntegerPref(prefs::kNotificationNextPersistentId, 10000); registry->RegisterDictionaryPref(prefs::kPushMessagingAppIdentifierMap); registry->RegisterListPref(prefs::kAccountInfo); - registry->RegisterStringPref(prefs::kGoogleServicesLastAccountId, - std::string()); registry->RegisterStringPref(prefs::kGoogleServicesLastUsername, std::string()); registry->RegisterStringPref(prefs::kGoogleServicesAccountId, std::string()); diff --git a/src/core/printing/print_view_manager_base_qt.cpp b/src/core/printing/print_view_manager_base_qt.cpp index f071b59ad..2e9251200 100644 --- a/src/core/printing/print_view_manager_base_qt.cpp +++ b/src/core/printing/print_view_manager_base_qt.cpp @@ -145,9 +145,6 @@ PrintViewManagerBaseQt::PrintViewManagerBaseQt(content::WebContents *contents) , m_didPrintingSucceed(false) , m_printerQueriesQueue(WebEngineContext::current()->getPrintJobManager()->queue()) { - // FIXME: Check if this needs to be executed async: - // TODO: Add isEnabled to profile - PrintViewManagerBaseQt::UpdatePrintingEnabled(); } PrintViewManagerBaseQt::~PrintViewManagerBaseQt() @@ -181,18 +178,6 @@ void PrintViewManagerBaseQt::ScriptedPrintReply(ScriptedPrintCallback callback, std::move(callback).Run(std::move(params)); } -void PrintViewManagerBaseQt::UpdatePrintingEnabled() -{ - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - bool enabled = false; -#if QT_CONFIG(webengine_printing_and_pdf) - enabled = true; -#endif - web_contents()->ForEachRenderFrameHost([this, enabled](content::RenderFrameHost *rfh) { - SendPrintingEnabled(enabled, rfh); - }); -} - void PrintViewManagerBaseQt::NavigationStopped() { // Cancel the current job, wait for the worker to finish. @@ -284,6 +269,7 @@ void PrintViewManagerBaseQt::GetDefaultPrintSettings(GetDefaultPrintSettingsCall printer_query_ptr->GetDefaultSettings( base::BindOnce(&OnDidGetDefaultPrintSettings, m_printerQueriesQueue, std::move(printer_query), std::move(callback_wrapper)), + false, !render_process_host->IsPdf()); } @@ -298,6 +284,15 @@ void PrintViewManagerBaseQt::PrintingFailed(int32_t cookie, printing::mojom::Pri ReleasePrinterQuery(); } +void PrintViewManagerBaseQt::IsPrintingEnabled(IsPrintingEnabledCallback callback) +{ + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + bool enabled = false; +#if QT_CONFIG(webengine_printing_and_pdf) + enabled = true; +#endif + std::move(callback).Run(enabled); +} void PrintViewManagerBaseQt::ScriptedPrint(printing::mojom::ScriptedPrintParamsPtr params, printing::mojom::PrintManagerHost::ScriptedPrintCallback callback) @@ -328,11 +323,6 @@ void PrintViewManagerBaseQt::ShowInvalidPrinterSettingsError() { } -void PrintViewManagerBaseQt::DidStartLoading() -{ - UpdatePrintingEnabled(); -} - // Note: In PrintViewManagerQt we always initiate printing with // printing::mojom::PrintRenderFrame::InitiatePrintPreview() // so m_printingRFH is never set and used at the moment. @@ -536,11 +526,10 @@ bool PrintViewManagerBaseQt::RunInnerMessageLoop() m_quitInnerLoop = run_loop.QuitClosure(); - // Need to enable recursive task. - { - base::CurrentThread::ScopedNestableTaskAllower allow; - run_loop.Run(); - } + auto weak_this = weak_ptr_factory_.GetWeakPtr(); + run_loop.Run(); + if (!weak_this) + return false; bool success = !m_quitInnerLoop; m_quitInnerLoop.Reset(); @@ -610,12 +599,6 @@ void PrintViewManagerBaseQt::StopWorker(int documentCookie) printerQuery->StopWorker(); } -void PrintViewManagerBaseQt::SendPrintingEnabled(bool enabled, content::RenderFrameHost* rfh) -{ - if (rfh->IsRenderFrameLive()) - GetPrintRenderFrame(rfh)->SetPrintingEnabled(enabled); -} - void PrintViewManagerBaseQt::UpdatePrintSettings(int32_t cookie, base::Value::Dict job_settings, UpdatePrintSettingsCallback callback) { diff --git a/src/core/printing/print_view_manager_base_qt.h b/src/core/printing/print_view_manager_base_qt.h index 8201a4225..fbd847f81 100644 --- a/src/core/printing/print_view_manager_base_qt.h +++ b/src/core/printing/print_view_manager_base_qt.h @@ -36,9 +36,6 @@ class PrintViewManagerBaseQt : public printing::PrintManager public: ~PrintViewManagerBaseQt() override; - // Whether printing is enabled or not. - void UpdatePrintingEnabled(); - std::u16string RenderSourceName(); // mojom::PrintManagerHost: @@ -48,6 +45,7 @@ public: void GetDefaultPrintSettings(GetDefaultPrintSettingsCallback callback) override; void UpdatePrintSettings(int32_t cookie, base::Value::Dict job_settings, UpdatePrintSettingsCallback callback) override; + void IsPrintingEnabled(IsPrintingEnabledCallback callback) override; void ScriptedPrint(printing::mojom::ScriptedPrintParamsPtr, printing::mojom::PrintManagerHost::ScriptedPrintCallback) override; void ShowInvalidPrinterSettingsError() override; @@ -83,9 +81,6 @@ protected: void StopWorker(int documentCookie); private: - // content::WebContentsObserver implementation. - void DidStartLoading() override; - // Requests the RenderView to render all the missing pages for the print job. // No-op if no print job is pending. Returns true if at least one page has // been requested to the renderer. @@ -136,9 +131,6 @@ private: // Release the PrinterQuery associated with our |cookie_|. void ReleasePrinterQuery(); - // Helper method for UpdatePrintingEnabled(). - void SendPrintingEnabled(bool enabled, content::RenderFrameHost* rfh); - private: content::NotificationRegistrar m_registrar; scoped_refptr<printing::PrintJob> m_printJob; diff --git a/src/core/process_main.cpp b/src/core/process_main.cpp index ce92db083..6a7d26ffd 100644 --- a/src/core/process_main.cpp +++ b/src/core/process_main.cpp @@ -39,7 +39,6 @@ int processMain(int argc, const char **argv) CHECK(seatbelt.server->InitializeSandbox()); } #endif // IS_MAC - return content::ContentMain(std::move(params)); } diff --git a/src/core/renderer/content_renderer_client_qt.cpp b/src/core/renderer/content_renderer_client_qt.cpp index 80bbabf63..5ec4a1935 100644 --- a/src/core/renderer/content_renderer_client_qt.cpp +++ b/src/core/renderer/content_renderer_client_qt.cpp @@ -290,11 +290,12 @@ void ContentRendererClientQt::GetNavigationErrorStringsInternal(content::RenderF // TODO(elproxy): We could potentially get better diagnostics here by first calling // NetErrorHelper::GetErrorStringsForDnsProbe, but that one is harder to untangle. + base::Value::Dict error_page_params; error_page::LocalizedError::PageState errorPageState = 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); + RenderConfiguration::is_incognito_process(), false, false, false, locale, false, &error_page_params); resourceId = IDR_NET_ERROR_HTML; @@ -477,7 +478,7 @@ static const char kExternalClearKeyKeySystem[] = "org.chromium.externalclearkey" // External Clear Key (used for testing). static void AddExternalClearKey(const media::mojom::KeySystemCapabilityPtr &capability, - media::KeySystemInfoVector *key_systems) + media::KeySystemInfos* key_systems) { Q_UNUSED(capability); if (!base::FeatureList::IsEnabled(media::kExternalClearKeyForTesting)) { @@ -486,7 +487,7 @@ static void AddExternalClearKey(const media::mojom::KeySystemCapabilityPtr &capa } // TODO(xhwang): Actually use `capability` to determine capabilities. - key_systems->push_back(std::make_unique<cdm::ExternalClearKeyProperties>()); + key_systems->push_back(std::make_unique<cdm::ExternalClearKeyKeySystemInfo>()); } #if BUILDFLAG(ENABLE_WIDEVINE) @@ -603,7 +604,7 @@ static media::SupportedCodecs GetSupportedCodecs(const media::CdmCapability& cap } static void AddWidevine(const media::mojom::KeySystemCapabilityPtr &capability, - media::KeySystemInfoVector *key_systems) + media::KeySystemInfos *key_systems) { // Codecs and encryption schemes. media::SupportedCodecs codecs = media::EME_CODEC_NONE; @@ -658,11 +659,11 @@ static void AddWidevine(const media::mojom::KeySystemCapabilityPtr &capability, void OnKeySystemSupportUpdated(media::GetSupportedKeySystemsCB cb, content::KeySystemCapabilityPtrMap key_system_capabilities) { - media::KeySystemInfoVector key_systems; + media::KeySystemInfos key_systems; for (const auto &entry : key_system_capabilities) { +#if BUILDFLAG(ENABLE_LIBRARY_CDMS) const auto &key_system = entry.first; const auto &capability = entry.second; -#if BUILDFLAG(ENABLE_LIBRARY_CDMS) #if BUILDFLAG(ENABLE_WIDEVINE) if (key_system == kWidevineKeySystem) { AddWidevine(capability, &key_systems); @@ -674,9 +675,9 @@ void OnKeySystemSupportUpdated(media::GetSupportedKeySystemsCB cb, AddExternalClearKey(capability, &key_systems); continue; } -#endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) DLOG(ERROR) << "Unrecognized key system: " << key_system; +#endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) } cb.Run(std::move(key_systems)); diff --git a/src/core/renderer/web_channel_ipc_transport.cpp b/src/core/renderer/web_channel_ipc_transport.cpp index 04a4ce705..89b20c7d1 100644 --- a/src/core/renderer/web_channel_ipc_transport.cpp +++ b/src/core/renderer/web_channel_ipc_transport.cpp @@ -43,8 +43,6 @@ void WebChannelTransport::Install(blink::WebLocalFrame *frame, uint worldId) { v8::Isolate *isolate = blink::MainThreadIsolate(); v8::HandleScope handleScope(isolate); - v8::MicrotasksScope microtasks_scope( - isolate, v8::MicrotasksScope::kDoNotRunMicrotasks); v8::Local<v8::Context> context; if (worldId == 0) context = frame->MainWorldScriptContext(); @@ -59,15 +57,14 @@ void WebChannelTransport::Install(blink::WebLocalFrame *frame, uint worldId) return; v8::Local<v8::Object> global = context->Global(); - v8::Local<v8::Value> qtObjectValue; v8::Local<v8::Object> qtObject; - if (!global->Get(context, gin::StringToV8(isolate, "qt")).ToLocal(&qtObjectValue) || !qtObjectValue->IsObject()) { - qtObject = v8::Object::New(isolate); - global->Set(context, gin::StringToV8(isolate, "qt"), qtObject).Check(); - } else { - qtObject = v8::Local<v8::Object>::Cast(qtObjectValue); - } - qtObject->Set(context, gin::StringToV8(isolate, "webChannelTransport"), transport.ToV8()).Check(); + qtObject = v8::Object::New(isolate); + global->CreateDataProperty(context, + gin::StringToSymbol(isolate, "qt"), + qtObject).Check(); + qtObject->CreateDataProperty(context, + gin::StringToSymbol(isolate, "webChannelTransport"), + transport.ToV8()).Check(); } void WebChannelTransport::Uninstall(blink::WebLocalFrame *frame, uint worldId) diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index f1bdb07c0..6312103f5 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -979,9 +979,8 @@ void WebContentsAdapter::setZoomFactor(qreal factor) content::HostZoomMap *zoomMap = content::HostZoomMap::GetForWebContents(m_webContents.get()); if (zoomMap) { - int render_process_id = m_webContents->GetPrimaryMainFrame()->GetProcess()->GetID(); - int render_view_id = m_webContents->GetRenderViewHost()->GetRoutingID(); - zoomMap->SetTemporaryZoomLevel(render_process_id, render_view_id, zoomLevel); + const content::GlobalRenderFrameHostId global_id = m_webContents->GetPrimaryMainFrame()->GetGlobalId(); + zoomMap->SetTemporaryZoomLevel(global_id, zoomLevel); } } @@ -1546,7 +1545,7 @@ void WebContentsAdapter::startDragging(QObject *dragSource, const content::DropD } { - base::CurrentThread::ScopedNestableTaskAllower allow; + base::CurrentThread::ScopedAllowApplicationTasksInNativeNestedLoop allow; drag->exec(allowedActions); } diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index 7470e5cc2..a8020ae1c 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -641,12 +641,6 @@ void WebContentsDelegateQt::UpdateTargetURL(content::WebContents* source, const m_viewClient->didUpdateTargetURL(toQt(url)); } -void WebContentsDelegateQt::OnVisibilityChanged(content::Visibility visibility) -{ - if (visibility != content::Visibility::HIDDEN) - web_cache::WebCacheManager::GetInstance()->ObserveActivity(web_contents()->GetPrimaryMainFrame()->GetProcess()->GetID()); -} - void WebContentsDelegateQt::ActivateContents(content::WebContents* contents) { QWebEngineSettings *settings = m_viewClient->webEngineSettings(); diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h index 37c2c7341..7f25f29d8 100644 --- a/src/core/web_contents_delegate_qt.h +++ b/src/core/web_contents_delegate_qt.h @@ -124,7 +124,6 @@ public: void DidFailLoad(content::RenderFrameHost* render_frame_host, const GURL& validated_url, int error_code) override; void DidFinishLoad(content::RenderFrameHost *render_frame_host, const GURL &validated_url) override; void BeforeUnloadFired(bool proceed, const base::TimeTicks& proceed_time) override; - void OnVisibilityChanged(content::Visibility visibility) override; void ActivateContents(content::WebContents* contents) override; void ResourceLoadComplete(content::RenderFrameHost* render_frame_host, const content::GlobalRequestID& request_id, diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index d0da744d7..f2b90ad9d 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -710,7 +710,6 @@ WebEngineContext::WebEngineContext() disableFeatures.push_back(features::kWebOTP.name); disableFeatures.push_back(features::kWebPayments.name); disableFeatures.push_back(features::kWebUsb.name); - disableFeatures.push_back(media::kPictureInPicture.name); if (useEmbeddedSwitches) { // embedded switches are based on the switches for Android, see content/browser/android/content_startup_flags.cc diff --git a/src/pdf/CMakeLists.txt b/src/pdf/CMakeLists.txt index 1a008011f..e3566145e 100644 --- a/src/pdf/CMakeLists.txt +++ b/src/pdf/CMakeLists.txt @@ -119,6 +119,11 @@ foreach(arch ${archs}) qt_libjpeg_config="${buildDir}/${config}/${arch}:qt_libjpeg_config" qt_harfbuzz_config="${buildDir}/${config}/${arch}:qt_harfbuzz_config" qt_freetype_config="${buildDir}/${config}/${arch}:qt_freetype_config" + enable_swiftshader=false + enable_swiftshader_vulkan=false + angle_enable_swiftshader=false + dawn_use_swiftshader=false + use_dawn=false enable_ipc_fuzzer=false enable_remoting=false enable_resource_allowlist_generation=false |