diff options
Diffstat (limited to 'src/core/chromium_overrides.cpp')
-rw-r--r-- | src/core/chromium_overrides.cpp | 267 |
1 files changed, 148 insertions, 119 deletions
diff --git a/src/core/chromium_overrides.cpp b/src/core/chromium_overrides.cpp index 841dcf4c9..28917e6c5 100644 --- a/src/core/chromium_overrides.cpp +++ b/src/core/chromium_overrides.cpp @@ -1,96 +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$ -** -****************************************************************************/ - -#include "chromium_overrides.h" +// 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/renderer_host/pepper/pepper_truetype_font_list.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 "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" -#endif - -#if defined(USE_OPENSSL_CERTS) -#include "net/ssl/openssl_client_key_store.h" +#if !QT_CONFIG(webengine_webrtc) && QT_CONFIG(webengine_extensions) +#include "chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.h" #endif -namespace QtWebEngineCore { -void GetScreenInfoFromNativeWindow(QWindow* window, content::ScreenInfo* results) -{ - QScreen* screen = window->screen(); - if (!screen) - return; - content::ScreenInfo r; - r.device_scale_factor = screen->devicePixelRatio(); - r.depth_per_component = 8; - r.depth = screen->depth(); - r.is_monochrome = (r.depth == 1); +#if BUILDFLAG(ENABLE_VULKAN) +#include "compositor/vulkan_implementation_qt.h" - QRect screenGeometry = screen->geometry(); - r.rect = gfx::Rect(screenGeometry.x(), screenGeometry.y(), screenGeometry.width(), screenGeometry.height()); - QRect available = screen->availableGeometry(); - r.available_rect = gfx::Rect(available.x(), available.y(), available.width(), available.height()); - *results = r; -} +#include "gpu/vulkan/init/vulkan_factory.h" -} // namespace QtWebEngineCore +#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() { @@ -98,82 +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); } -// static -void WebContentsView::GetDefaultScreenInfo(content::ScreenInfo* results) +#if defined(Q_OS_DARWIN) +#if defined(QT_MAC_FRAMEWORK_BUILD) +base::FilePath getSandboxPath() { - QWindow dummy; - QtWebEngineCore::GetScreenInfoFromNativeWindow(&dummy, results); + return WebEngineLibraryInfo::getPath(QT_FRAMEWORK_BUNDLE); } - +#else +base::FilePath getSandboxPath() +{ + const QString prefix = QLibraryInfo::location(QLibraryInfo::PrefixPath); + 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 std::move(font_list); + return font_list; } -#if QT_CONFIG(webengine_pepper_plugins) -// content/browser/renderer_host/pepper/pepper_truetype_font_list.h -void GetFontFamilies_SlowBlocking(std::vector<std::string> *font_families) +} // namespace content +#endif // defined(USE_AURA) || defined(USE_OZONE) + +#if BUILDFLAG(ENABLE_VULKAN) +namespace gpu { +std::unique_ptr<VulkanImplementation> CreateVulkanImplementation(bool use_swiftshader, + bool allow_protected_memory) { - QFontDatabase database; - for (auto family : database.families()){ - font_families->push_back(family.toStdString()); - } +#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) + + // 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) -void GetFontsInFamily_SlowBlocking(const std::string &, std::vector<ppapi::proxy::SerializedTrueTypeFontDesc> *) +std::unique_ptr<ui::OSExchangeDataProvider> ui::OSExchangeDataProviderFactory::CreateProvider() { - QT_NOT_USED + return nullptr; } -#endif // QT_CONFIG(webengine_pepper_plugins) -} // namespace content +#if !QT_CONFIG(webengine_webrtc) && QT_CONFIG(webengine_extensions) +namespace extensions { +ExtensionFunction::ResponseAction WebrtcLoggingPrivateSetMetaDataFunction::Run() +{ + return RespondNow(NoArguments()); +} -namespace aura { -class Window; +ExtensionFunction::ResponseAction WebrtcLoggingPrivateStartFunction::Run() +{ + return RespondNow(NoArguments()); } -namespace wm { -class ActivationClient; +ExtensionFunction::ResponseAction WebrtcLoggingPrivateSetUploadOnRenderCloseFunction::Run() +{ + return RespondNow(NoArguments()); +} -ActivationClient *GetActivationClient(aura::Window *) +ExtensionFunction::ResponseAction WebrtcLoggingPrivateStopFunction::Run() { - return nullptr; + return RespondNow(NoArguments()); } -} // namespace wm -#endif // defined(USE_AURA) || defined(USE_OZONE) +ExtensionFunction::ResponseAction WebrtcLoggingPrivateStoreFunction::Run() +{ + return RespondNow(NoArguments()); +} -std::unique_ptr<ui::OSExchangeData::Provider> -ui::OSExchangeDataProviderFactory::CreateProvider() { - return nullptr; +ExtensionFunction::ResponseAction WebrtcLoggingPrivateUploadStoredFunction::Run() +{ + return RespondNow(NoArguments()); +} + +ExtensionFunction::ResponseAction WebrtcLoggingPrivateUploadFunction::Run() +{ + return RespondNow(NoArguments()); +} + +ExtensionFunction::ResponseAction WebrtcLoggingPrivateDiscardFunction::Run() +{ + return RespondNow(NoArguments()); +} + +ExtensionFunction::ResponseAction WebrtcLoggingPrivateStartRtpDumpFunction::Run() +{ + return RespondNow(NoArguments()); +} + +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) |