diff options
Diffstat (limited to 'src/core/chromium_overrides.cpp')
-rw-r--r-- | src/core/chromium_overrides.cpp | 255 |
1 files changed, 131 insertions, 124 deletions
diff --git a/src/core/chromium_overrides.cpp b/src/core/chromium_overrides.cpp index 01937d3e7..28917e6c5 100644 --- a/src/core/chromium_overrides.cpp +++ b/src/core/chromium_overrides.cpp @@ -1,76 +1,41 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +#include "type_conversion.h" #include "ozone/gl_context_qt.h" #include "qtwebenginecoreglobal_p.h" #include "web_contents_view_qt.h" +#include "web_engine_library_info.h" #include "base/values.h" -#include "content/browser/accessibility/accessibility_tree_formatter_blink.h" -#include "content/browser/accessibility/accessibility_tree_formatter_browser.h" -#include "content/browser/renderer_host/render_widget_host_view_base.h" #include "content/browser/web_contents/web_contents_impl.h" +#include "content/browser/web_contents/web_contents_view.h" #include "content/common/font_list.h" +#include "content/public/browser/web_contents_view_delegate.h" +#include "extensions/buildflags/buildflags.h" +#include "extensions/common/constants.h" +#include "gpu/vulkan/buildflags.h" #include "ui/base/dragdrop/os_exchange_data.h" #include "ui/base/dragdrop/os_exchange_data_provider_factory.h" -#include "ui/events/devices/device_data_manager.h" -#include "ui/events/platform/platform_event_source.h" -#include "ui/snapshot/snapshot.h" -#include "ppapi/buildflags/buildflags.h" #include <QGuiApplication> -#include <QScreen> -#include <QWindow> #include <QFontDatabase> -#include <QStringList> #include <QLibraryInfo> -#if defined(USE_AURA) && !defined(USE_OZONE) -#include "ui/base/dragdrop/os_exchange_data.h" -#include "ui/base/dragdrop/os_exchange_data_provider_aura.h" -#include "ui/gfx/render_text.h" -#include "ui/gfx/platform_font.h" +#if !QT_CONFIG(webengine_webrtc) && QT_CONFIG(webengine_extensions) +#include "chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.h" #endif -#if defined(USE_OPENSSL_CERTS) -#include "net/ssl/openssl_client_key_store.h" -#endif +#if BUILDFLAG(ENABLE_VULKAN) +#include "compositor/vulkan_implementation_qt.h" + +#include "gpu/vulkan/init/vulkan_factory.h" + +#if defined(USE_OZONE) +#include "ui/ozone/public/ozone_platform.h" +#include "ui/ozone/public/surface_factory_ozone.h" +#endif // defined(USE_OZONE) +#endif // defined(ENABLE_VULKAN) void *GetQtXDisplay() { @@ -78,124 +43,166 @@ void *GetQtXDisplay() } namespace content { -class WebContentsImpl; -class WebContentsView; -class WebContentsViewDelegate; class RenderViewHostDelegateView; -WebContentsView* CreateWebContentsView(WebContentsImpl *web_contents, - WebContentsViewDelegate *, - RenderViewHostDelegateView **render_view_host_delegate_view) +std::unique_ptr<WebContentsView> CreateWebContentsView( + WebContentsImpl *web_contents, + std::unique_ptr<WebContentsViewDelegate> delegate, + raw_ptr<RenderViewHostDelegateView>* render_view_host_delegate_view) { - QtWebEngineCore::WebContentsViewQt* rv = new QtWebEngineCore::WebContentsViewQt(web_contents); + QtWebEngineCore::WebContentsViewQt *rv = new QtWebEngineCore::WebContentsViewQt(web_contents); *render_view_host_delegate_view = rv; - return rv; + return std::unique_ptr<WebContentsView>(rv); } -#if defined(Q_OS_MACOS) -std::string getQtPrefix() +#if defined(Q_OS_DARWIN) +#if defined(QT_MAC_FRAMEWORK_BUILD) +base::FilePath getSandboxPath() +{ + return WebEngineLibraryInfo::getPath(QT_FRAMEWORK_BUNDLE); +} +#else +base::FilePath getSandboxPath() { const QString prefix = QLibraryInfo::location(QLibraryInfo::PrefixPath); - return prefix.toStdString(); + return QtWebEngineCore::toFilePath(prefix); } #endif - +#endif } // namespace content #if defined(USE_AURA) || defined(USE_OZONE) namespace content { // content/common/font_list.h -std::unique_ptr<base::ListValue> GetFontList_SlowBlocking() +base::Value::List GetFontList_SlowBlocking() { - std::unique_ptr<base::ListValue> font_list(new base::ListValue); + base::Value::List font_list; - QFontDatabase database; - for (auto family : database.families()){ - std::unique_ptr<base::ListValue> font_item(new base::ListValue()); - font_item->AppendString(family.toStdString()); - font_item->AppendString(family.toStdString()); // localized name. + for (auto family : QFontDatabase::families()){ + base::Value::List font_item; + font_item.Append(family.toStdString()); + font_item.Append(family.toStdString()); // localized name. // TODO(yusukes): Support localized family names. - font_list->Append(std::move(font_item)); + font_list.Append(std::move(font_item)); } return font_list; } } // namespace content +#endif // defined(USE_AURA) || defined(USE_OZONE) -namespace aura { -class Window; -} +#if BUILDFLAG(ENABLE_VULKAN) +namespace gpu { +std::unique_ptr<VulkanImplementation> CreateVulkanImplementation(bool use_swiftshader, + bool allow_protected_memory) +{ +#if QT_CONFIG(webengine_vulkan) +#if BUILDFLAG(IS_APPLE) + // TODO: Investigate if we can support MoltenVK. + NOTIMPLEMENTED(); + return nullptr; +#else +#if defined(USE_OZONE) + return ui::OzonePlatform::GetInstance()->GetSurfaceFactoryOzone()->CreateVulkanImplementation( + use_swiftshader, allow_protected_memory); +#endif + +#if !BUILDFLAG(IS_WIN) + // TODO(samans): Support Swiftshader on more platforms. + // https://crbug.com/963988 + DCHECK(!use_swiftshader) << "Vulkan Swiftshader is not supported on this platform."; +#endif // !BUILDFLAG(IS_WIN) -namespace wm { -class ActivationClient; + // Protected memory is supported only on Fuchsia, which uses Ozone, i.e. + // VulkanImplementation is initialized above. + DCHECK(!allow_protected_memory) << "Protected memory is not supported on this platform."; + + return std::make_unique<VulkanImplementationQt>(); +#endif // BUILDFLAG(IS_APPLE) +#else + NOTREACHED(); + return nullptr; +#endif // QT_CONFIG(webengine_vulkan) +} +} // namespace gpu +#endif // BUILDFLAG(ENABLE_VULKAN) -ActivationClient *GetActivationClient(aura::Window *) +std::unique_ptr<ui::OSExchangeDataProvider> ui::OSExchangeDataProviderFactory::CreateProvider() { return nullptr; } -} // namespace wm -#endif // defined(USE_AURA) || defined(USE_OZONE) +#if !QT_CONFIG(webengine_webrtc) && QT_CONFIG(webengine_extensions) +namespace extensions { +ExtensionFunction::ResponseAction WebrtcLoggingPrivateSetMetaDataFunction::Run() +{ + return RespondNow(NoArguments()); +} -namespace content { -std::vector<AccessibilityTreeFormatter::TestPass> AccessibilityTreeFormatter::GetTestPasses() +ExtensionFunction::ResponseAction WebrtcLoggingPrivateStartFunction::Run() { - return { - {"blink", &AccessibilityTreeFormatterBlink::CreateBlink, nullptr}, - {"native", &AccessibilityTreeFormatter::Create, nullptr}, - }; + return RespondNow(NoArguments()); } -} // namespace content -#if defined(USE_AURA) -namespace ui { +ExtensionFunction::ResponseAction WebrtcLoggingPrivateSetUploadOnRenderCloseFunction::Run() +{ + return RespondNow(NoArguments()); +} -bool GrabWindowSnapshot(gfx::NativeWindow window, - const gfx::Rect& snapshot_bounds, - gfx::Image* image) +ExtensionFunction::ResponseAction WebrtcLoggingPrivateStopFunction::Run() { - NOTIMPLEMENTED(); - return false; + return RespondNow(NoArguments()); } -bool GrabViewSnapshot(gfx::NativeView view, - const gfx::Rect& snapshot_bounds, - gfx::Image* image) +ExtensionFunction::ResponseAction WebrtcLoggingPrivateStoreFunction::Run() { - NOTIMPLEMENTED(); - return false; + return RespondNow(NoArguments()); } -void GrabWindowSnapshotAndScaleAsync(gfx::NativeWindow window, - const gfx::Rect& source_rect, - const gfx::Size& target_size, - GrabWindowSnapshotAsyncCallback callback) +ExtensionFunction::ResponseAction WebrtcLoggingPrivateUploadStoredFunction::Run() { - NOTIMPLEMENTED(); - std::move(callback).Run(gfx::Image()); + return RespondNow(NoArguments()); } -void GrabWindowSnapshotAsync(gfx::NativeWindow window, - const gfx::Rect& source_rect, - GrabWindowSnapshotAsyncCallback callback) +ExtensionFunction::ResponseAction WebrtcLoggingPrivateUploadFunction::Run() { - NOTIMPLEMENTED(); - std::move(callback).Run(gfx::Image()); + return RespondNow(NoArguments()); } -void GrabViewSnapshotAsync(gfx::NativeView view, - const gfx::Rect& source_rect, - GrabWindowSnapshotAsyncCallback callback) +ExtensionFunction::ResponseAction WebrtcLoggingPrivateDiscardFunction::Run() { - NOTIMPLEMENTED(); - std::move(callback).Run(gfx::Image()); + return RespondNow(NoArguments()); } -} // namespace ui -#endif // defined(USE_AURA) +ExtensionFunction::ResponseAction WebrtcLoggingPrivateStartRtpDumpFunction::Run() +{ + return RespondNow(NoArguments()); +} -std::unique_ptr<ui::OSExchangeData::Provider> -ui::OSExchangeDataProviderFactory::CreateProvider() { - return nullptr; +ExtensionFunction::ResponseAction WebrtcLoggingPrivateStopRtpDumpFunction::Run() +{ + return RespondNow(NoArguments()); +} + +ExtensionFunction::ResponseAction WebrtcLoggingPrivateStartAudioDebugRecordingsFunction::Run() +{ + return RespondNow(NoArguments()); +} + +ExtensionFunction::ResponseAction WebrtcLoggingPrivateStopAudioDebugRecordingsFunction::Run() +{ + return RespondNow(NoArguments()); +} + +ExtensionFunction::ResponseAction WebrtcLoggingPrivateStartEventLoggingFunction::Run() +{ + return RespondNow(NoArguments()); +} + +ExtensionFunction::ResponseAction WebrtcLoggingPrivateGetLogsDirectoryFunction::Run() +{ + return RespondNow(NoArguments()); } +} // namespace extensions +#endif // !QT_CONFIG(webengine_webrtc) && QT_CONFIG(webengine_extensions) |