diff options
Diffstat (limited to 'src/core')
404 files changed, 5758 insertions, 15759 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 9e6370260..0ed47a676 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -4,7 +4,6 @@ find_package(Ninja 1.7.2 REQUIRED) find_package(Nodejs 12 REQUIRED) find_package(PkgConfig) if(PkgConfig_FOUND) - pkg_check_modules(XSCRNSAVER xscrnsaver) create_pkg_config_host_wrapper(${CMAKE_CURRENT_BINARY_DIR}) endif() @@ -77,6 +76,8 @@ foreach(arch ${archs}) accessibility_activation_observer.cpp accessibility_activation_observer.h accessibility_tree_formatter_qt.cpp authentication_dialog_controller.cpp authentication_dialog_controller.h authentication_dialog_controller_p.h + autofill_client_qt.cpp autofill_client_qt.h + autofill_popup_controller.cpp autofill_popup_controller.h autofill_popup_controller_p.h browser_accessibility_manager_qt.cpp browser_accessibility_manager_qt.h browser_accessibility_qt.cpp browser_accessibility_qt.h browser_main_parts_qt.cpp browser_main_parts_qt.h @@ -99,6 +100,10 @@ foreach(arch ${archs}) content_client_qt.cpp content_client_qt.h content_main_delegate_qt.cpp content_main_delegate_qt.h content_utility_client_qt.cpp content_utility_client_qt.h + custom_handlers/protocol_handler_registry_delegate_qt.h custom_handlers/protocol_handler_registry_delegate_qt.cpp + custom_handlers/protocol_handler_registry_factory.h custom_handlers/protocol_handler_registry_factory.cpp + custom_handlers/register_protocol_handler_request_controller.h + custom_handlers/register_protocol_handler_request_controller_impl.cpp custom_handlers/register_protocol_handler_request_controller_impl.h delegated_frame_host_client_qt.cpp delegated_frame_host_client_qt.h desktop_screen_qt.cpp desktop_screen_qt.h devtools_frontend_qt.cpp devtools_frontend_qt.h @@ -107,6 +112,12 @@ foreach(arch ${archs}) favicon_driver_qt.cpp favicon_driver_qt.h favicon_service_factory_qt.cpp favicon_service_factory_qt.h file_picker_controller.cpp file_picker_controller.h + file_system_access/file_system_access_permission_context_factory_qt.cpp file_system_access/file_system_access_permission_context_factory_qt.h + file_system_access/file_system_access_permission_context_qt.cpp file_system_access/file_system_access_permission_context_qt.h + file_system_access/file_system_access_permission_grant_qt.cpp file_system_access/file_system_access_permission_grant_qt.h + file_system_access/file_system_access_permission_request_controller.h + file_system_access/file_system_access_permission_request_controller_impl.cpp file_system_access/file_system_access_permission_request_controller_impl.h + file_system_access/file_system_access_permission_request_manager_qt.cpp file_system_access/file_system_access_permission_request_manager_qt.h find_text_helper.cpp find_text_helper.h global_descriptors_qt.h javascript_dialog_controller.cpp javascript_dialog_controller.h javascript_dialog_controller_p.h @@ -147,12 +158,11 @@ foreach(arch ${archs}) quota_permission_context_qt.cpp quota_permission_context_qt.h quota_request_controller.h quota_request_controller_impl.cpp quota_request_controller_impl.h - register_protocol_handler_request_controller.h - register_protocol_handler_request_controller_impl.cpp register_protocol_handler_request_controller_impl.h render_view_context_menu_qt.cpp render_view_context_menu_qt.h render_widget_host_view_qt.cpp render_widget_host_view_qt.h render_widget_host_view_qt_delegate.h render_widget_host_view_qt_delegate_client.cpp render_widget_host_view_qt_delegate_client.h + render_widget_host_view_qt_delegate_item.cpp render_widget_host_view_qt_delegate_item.h renderer/content_renderer_client_qt.cpp renderer/content_renderer_client_qt.h renderer/content_settings_observer_qt.cpp renderer/content_settings_observer_qt.h renderer/render_configuration.cpp renderer/render_configuration.h @@ -163,7 +173,6 @@ foreach(arch ${archs}) renderer_host/web_engine_page_host.cpp renderer_host/web_engine_page_host.h request_controller.h resource_bundle_qt.cpp - resource_context_qt.cpp resource_context_qt.h select_file_dialog_factory_qt.cpp select_file_dialog_factory_qt.h touch_handle_drawable_client.h touch_handle_drawable_qt.cpp touch_handle_drawable_qt.h @@ -208,13 +217,13 @@ foreach(arch ${archs}) SOURCES renderer/pepper/pepper_renderer_host_factory_qt.cpp renderer/pepper/pepper_renderer_host_factory_qt.h renderer/plugins/loadable_plugin_placeholder_qt.cpp renderer/plugins/loadable_plugin_placeholder_qt.h - renderer_host/pepper/pepper_host_factory_qt.cpp renderer_host/pepper/pepper_host_factory_qt.h - renderer_host/pepper/pepper_isolated_file_system_message_filter.cpp renderer_host/pepper/pepper_isolated_file_system_message_filter.h ) extend_gn_target(${buildGn} CONDITION QT_FEATURE_webengine_printing_and_pdf SOURCES printing/pdfium_document_wrapper_qt.cpp printing/pdfium_document_wrapper_qt.h + printing/pdf_web_contents_helper_client_qt.cpp printing/pdf_web_contents_helper_client_qt.h + printing/pdf_stream_delegate_qt.cpp printing/pdf_stream_delegate_qt.h printing/print_view_manager_base_qt.cpp printing/print_view_manager_base_qt.h printing/print_view_manager_qt.cpp printing/print_view_manager_qt.h printing/printer_worker.cpp printing/printer_worker.h @@ -245,7 +254,6 @@ foreach(arch ${archs}) extensions/extensions_browser_client_qt.cpp extensions/extensions_browser_client_qt.h extensions/messaging_delegate_qt.cpp extensions/messaging_delegate_qt.h extensions/mime_handler_view_guest_delegate_qt.cpp extensions/mime_handler_view_guest_delegate_qt.h - extensions/pdf_iframe_navigation_throttle_qt.cpp extensions/pdf_iframe_navigation_throttle_qt.h extensions/plugin_service_filter_qt.cpp extensions/plugin_service_filter_qt.h net/plugin_response_interceptor_url_loader_throttle.cpp net/plugin_response_interceptor_url_loader_throttle.h renderer/extensions/extensions_dispatcher_delegate_qt.cpp renderer/extensions/extensions_dispatcher_delegate_qt.h @@ -254,6 +262,11 @@ foreach(arch ${archs}) renderer/extensions/resource_request_policy_qt.cpp renderer/extensions/resource_request_policy_qt.h ) + extend_gn_target(${buildGn} CONDITION QT_FEATURE_webengine_extensions AND QT_FEATURE_webengine_printing_and_pdf + SOURCES + extensions/pdf_iframe_navigation_throttle_qt.cpp extensions/pdf_iframe_navigation_throttle_qt.h + ) + extend_gn_target(${buildGn} CONDITION WIN32 SOURCES clipboard_util_win.cpp @@ -283,6 +296,7 @@ foreach(arch ${archs}) enable_swiftshader=false enable_swiftshader_vulkan=false angle_enable_swiftshader=false + dawn_use_swiftshader=false enable_web_speech=false enable_widevine=true fatal_linker_warnings=false @@ -295,7 +309,9 @@ foreach(arch ${archs}) enable_js_type_check=false v8_use_external_startup_data=false strip_absolute_paths_from_debug_symbols=false - disable_ftp_support=true + enable_oop_printing=false + devtools_fast_bundle=false + devtools_skip_typecheck=false ) extend_gn_list(gnArgArg @@ -345,6 +361,10 @@ foreach(arch ${archs}) ARGS use_browser_spellchecker CONDITION QT_FEATURE_webengine_native_spellchecker ) + extend_gn_list(gnArgArg + ARGS use_embedded_config + CONDITION QT_FEATURE_webengine_embedded_build + ) if(LINUX) list(APPEND gnArgArg @@ -356,13 +376,14 @@ foreach(arch ${archs}) enable_session_service=false is_cfi=false use_ozone=true - use_x11=false ozone_auto_platforms=false ozone_platform_headless=false ozone_platform_external=true ozone_platform="qt" ozone_extra_path="${CMAKE_CURRENT_LIST_DIR}/ozone/ozone_extra.gni" use_glib=false + use_bluez=false + use_vaapi=false ) set(systemLibs libjpeg libpng freetype harfbuzz libevent libwebp libxml opus snappy libvpx icu ffmpeg re2 lcms2 @@ -413,10 +434,12 @@ foreach(arch ${archs}) ARGS rtc_use_x11 CONDITION QT_FEATURE_webengine_ozone_x11 AND QT_FEATURE_webengine_webrtc ) - extend_gn_list(gnArgArg - ARGS use_xscrnsaver - CONDITION QT_FEATURE_webengine_ozone_x11 AND XSCRNSAVER_FOUND - ) + + if(QT_FEATURE_webengine_kerberos) + list(APPEND gnArgArg + external_gssapi_include_dir="${GSSAPI_INCLUDE_DIRS}/gssapi" + ) + endif() if(QT_FEATURE_webengine_kerberos) list(APPEND gnArgArg diff --git a/src/core/accessibility_activation_observer.cpp b/src/core/accessibility_activation_observer.cpp index 833190844..53a5e87fd 100644 --- a/src/core/accessibility_activation_observer.cpp +++ b/src/core/accessibility_activation_observer.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 "accessibility_activation_observer.h" diff --git a/src/core/accessibility_activation_observer.h b/src/core/accessibility_activation_observer.h index 23fd2101e..20063c577 100644 --- a/src/core/accessibility_activation_observer.h +++ b/src/core/accessibility_activation_observer.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 #ifndef ACCESSIBILITY_ACTIVATION_OBSERVER_H #define ACCESSIBILITY_ACTIVATION_OBSERVER_H diff --git a/src/core/accessibility_tree_formatter_qt.cpp b/src/core/accessibility_tree_formatter_qt.cpp index cbbb032b7..6167bc73b 100644 --- a/src/core/accessibility_tree_formatter_qt.cpp +++ b/src/core/accessibility_tree_formatter_qt.cpp @@ -1,56 +1,16 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 "ui/accessibility/platform/inspect/ax_tree_formatter_base.h" #include <utility> -#include "base/logging.h" -#include "base/strings/string_number_conversions.h" -#include "base/strings/string_util.h" #include "base/strings/stringprintf.h" -#include "base/strings/utf_string_conversions.h" #include "base/values.h" -#include "content/browser/accessibility/accessibility_event_recorder.h" #include "content/browser/accessibility/accessibility_tree_formatter_blink.h" #include "content/browser/accessibility/browser_accessibility.h" #include "content/public/browser/ax_inspect_factory.h" +#include "ui/accessibility/platform/inspect/ax_event_recorder.h" #include "browser_accessibility_qt.h" @@ -65,10 +25,6 @@ public: ~AccessibilityTreeFormatterQt() override; base::Value BuildTree(ui::AXPlatformNodeDelegate *start) const override; - base::Value BuildTreeForWindow(gfx::AcceleratedWidget hwnd) const override - { - return base::Value{}; - } base::Value BuildTreeForSelector(const AXTreeSelector &selector) const override { return base::Value{}; @@ -194,9 +150,8 @@ std::string AccessibilityTreeFormatterQt::ProcessTreeForOutput(const base::Dicti const base::ListValue *states_value = nullptr; if (node.GetList("states", &states_value)) { for (const auto &state : states_value->GetList()) { - std::string state_value; - if (state.GetAsString(&state_value)) - WriteAttribute(false, state_value, &line); + if (auto *state_value = state.GetIfString()) + WriteAttribute(false, *state_value, &line); } } @@ -221,7 +176,7 @@ std::string AccessibilityTreeFormatterQt::ProcessTreeForOutput(const base::Dicti std::unique_ptr<ui::AXTreeFormatter> AXInspectFactory::CreatePlatformFormatter() { - return AXInspectFactory::CreateFormatter(kQt); + return AXInspectFactory::CreateFormatter(ui::AXApiType::kQt); } // static @@ -229,16 +184,16 @@ std::unique_ptr<ui::AXEventRecorder> AXInspectFactory::CreatePlatformRecorder(Br base::ProcessId pid, const ui::AXTreeSelector &selector) { - return AXInspectFactory::CreateRecorder(kQt, manager, pid, selector); + return AXInspectFactory::CreateRecorder(ui::AXApiType::kQt, manager, pid, selector); } // static -std::unique_ptr<ui::AXTreeFormatter> AXInspectFactory::CreateFormatter(AXInspectFactory::Type type) +std::unique_ptr<ui::AXTreeFormatter> AXInspectFactory::CreateFormatter(ui::AXApiType::Type type) { switch (type) { - case kBlink: + case ui::AXApiType::kBlink: return std::make_unique<AccessibilityTreeFormatterBlink>(); - case kQt: + case ui::AXApiType::kQt: #if QT_CONFIG(accessibility) return std::make_unique<AccessibilityTreeFormatterQt>(); #else @@ -251,14 +206,14 @@ std::unique_ptr<ui::AXTreeFormatter> AXInspectFactory::CreateFormatter(AXInspect } // static -std::unique_ptr<ui::AXEventRecorder> AXInspectFactory::CreateRecorder(AXInspectFactory::Type type, +std::unique_ptr<ui::AXEventRecorder> AXInspectFactory::CreateRecorder(ui::AXApiType::Type type, BrowserAccessibilityManager *manager, base::ProcessId pid, const ui::AXTreeSelector &selector) { switch (type) { - case kQt: - return std::make_unique<AccessibilityEventRecorder>(manager); + case ui::AXApiType::kQt: + return std::make_unique<ui::AXEventRecorder>(); default: NOTREACHED() << "Unsupported inspect type " << type; } diff --git a/src/core/api/CMakeLists.txt b/src/core/api/CMakeLists.txt index e46c95be3..2d493c04c 100644 --- a/src/core/api/CMakeLists.txt +++ b/src/core/api/CMakeLists.txt @@ -12,6 +12,7 @@ qt_internal_add_module(WebEngineCore qwebenginecontextmenurequest.cpp qwebenginecontextmenurequest.h qwebenginecontextmenurequest_p.h qwebenginecookiestore.cpp qwebenginecookiestore.h qwebenginecookiestore_p.h qwebenginedownloadrequest.cpp qwebenginedownloadrequest.h qwebenginedownloadrequest_p.h + qwebenginefilesystemaccessrequest.cpp qwebenginefilesystemaccessrequest.h qwebenginefindtextresult.cpp qwebenginefindtextresult.h qwebenginefullscreenrequest.cpp qwebenginefullscreenrequest.h qwebenginehistory.cpp qwebenginehistory.h qwebenginehistory_p.h diff --git a/src/core/api/configure.cmake b/src/core/api/configure.cmake index e2543cfac..d712f1c2a 100644 --- a/src/core/api/configure.cmake +++ b/src/core/api/configure.cmake @@ -1,7 +1,7 @@ #### Libraries if(NOT QT_CONFIGURE_RUNNING) - find_package(GLIB2 COMPONENTS gio) + find_package(GLIB2 COMPONENTS GIO) find_package(GSSAPI) find_package(PkgConfig) if(PkgConfig_FOUND) @@ -72,11 +72,6 @@ qt_feature("webengine-system-pulseaudio" PRIVATE AUTODETECT UNIX CONDITION PULSEAUDIO_FOUND ) -qt_feature("webengine-pepper-plugins" PRIVATE - LABEL "Pepper Plugins" - PURPOSE "Enables use of Pepper Flash plugins." - AUTODETECT NOT QT_FEATURE_webengine_embedded_build -) qt_feature("webengine-printing-and-pdf" PRIVATE LABEL "Printing and PDF" PURPOSE "Provides printing and output to PDF." @@ -84,6 +79,11 @@ qt_feature("webengine-printing-and-pdf" PRIVATE CONDITION TARGET Qt::PrintSupport AND QT_FEATURE_printer AND (CUPS_FOUND OR WIN32) ) +qt_feature("webengine-pepper-plugins" PRIVATE + LABEL "Pepper Plugins" + PURPOSE "Enables use of Pepper plugins." + AUTODETECT QT_FEATURE_webengine_printing_and_pdf +) qt_feature("webengine-webchannel" PUBLIC SECTION "WebEngine" LABEL "WebChannel support" @@ -118,7 +118,7 @@ qt_feature("webengine-extensions" PUBLIC LABEL "Extensions" PURPOSE "Enables Chromium extensions within certain limits. Currently used by the pdf viewer and hangout webrtc extension." AUTODETECT ON - CONDITION QT_FEATURE_webengine_printing_and_pdf OR QT_FEATURE_webengine_printing_and_pdf + CONDITION QT_FEATURE_webengine_printing_and_pdf OR QT_FEATURE_webengine_webrtc ) qt_feature("webengine-webrtc" PRIVATE LABEL "WebRTC" diff --git a/src/core/api/qtwebenginecoreglobal.cpp b/src/core/api/qtwebenginecoreglobal.cpp index 5215f7ce7..3c2eefdf5 100644 --- a/src/core/api/qtwebenginecoreglobal.cpp +++ b/src/core/api/qtwebenginecoreglobal.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 "qtwebenginecoreglobal_p.h" @@ -233,7 +197,10 @@ static void initialize() #if QT_CONFIG(opengl) if (QCoreApplication::instance()) { // On window/ANGLE, calling QtWebEngineQuick::initialize from DllMain will result in a crash. - if (!qt_gl_global_share_context()) { + if (!qt_gl_global_share_context() && + !(QCoreApplication::testAttribute(Qt::AA_ShareOpenGLContexts) && + QQuickWindow::graphicsApi() == QSGRendererInterface::OpenGLRhi) + ) { qWarning("Qt WebEngine seems to be initialized from a plugin. Please " "set Qt::AA_ShareOpenGLContexts using QCoreApplication::setAttribute and " "QSGRendererInterface::OpenGLRhi using QQuickWindow::setGraphicsApi " diff --git a/src/core/api/qtwebenginecoreglobal.h b/src/core/api/qtwebenginecoreglobal.h index 81039a1af..305040808 100644 --- a/src/core/api/qtwebenginecoreglobal.h +++ b/src/core/api/qtwebenginecoreglobal.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 #ifndef QTWEBENGINECOREGLOBAL_H #define QTWEBENGINECOREGLOBAL_H diff --git a/src/core/api/qtwebenginecoreglobal_p.h b/src/core/api/qtwebenginecoreglobal_p.h index a716f5827..6bd1c5a06 100644 --- a/src/core/api/qtwebenginecoreglobal_p.h +++ b/src/core/api/qtwebenginecoreglobal_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef QTWEBENGINECOREGLOBAL_P_H #define QTWEBENGINECOREGLOBAL_P_H diff --git a/src/core/api/qwebenginecertificateerror.cpp b/src/core/api/qwebenginecertificateerror.cpp index 9e487b71a..90d8a542d 100644 --- a/src/core/api/qwebenginecertificateerror.cpp +++ b/src/core/api/qwebenginecertificateerror.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 "qwebenginecertificateerror.h" @@ -98,7 +62,7 @@ QWebEngineCertificateError::~QWebEngineCertificateError() = default; \value CertificateKnownInterceptionBlocked The certificate is known to be used for interception by an entity other the device owner. (Added in 5.15) - \value SslObsoleteVersion The connection uses an obsolete version of SSL/TLS. (Added in Qt 6.2) + \value SslObsoleteVersion The connection uses an obsolete version of SSL/TLS. (Added in Qt 6.2, deprecated in Qt 6.4) \value CertificateSymantecLegacy The certificate is a legacy Symantec one that's no longer valid. (Added in Qt 6.2) */ @@ -194,3 +158,5 @@ QList<QSslCertificate> QWebEngineCertificateError::certificateChain() const } QT_END_NAMESPACE + +#include "moc_qwebenginecertificateerror.cpp" diff --git a/src/core/api/qwebenginecertificateerror.h b/src/core/api/qwebenginecertificateerror.h index 82ef5017a..c4a3585f4 100644 --- a/src/core/api/qwebenginecertificateerror.h +++ b/src/core/api/qwebenginecertificateerror.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 #ifndef QWEBENGINECERTIFICATEERROR_H #define QWEBENGINECERTIFICATEERROR_H diff --git a/src/core/api/qwebengineclientcertificateselection.cpp b/src/core/api/qwebengineclientcertificateselection.cpp index 7df5cb57a..d6402353c 100644 --- a/src/core/api/qwebengineclientcertificateselection.cpp +++ b/src/core/api/qwebengineclientcertificateselection.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 "qwebengineclientcertificateselection.h" #include "client_cert_select_controller.h" diff --git a/src/core/api/qwebengineclientcertificateselection.h b/src/core/api/qwebengineclientcertificateselection.h index 71c85f154..559d1753b 100644 --- a/src/core/api/qwebengineclientcertificateselection.h +++ b/src/core/api/qwebengineclientcertificateselection.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 #ifndef QWEBENGINECLIENTCERTSELECTION_H #define QWEBENGINECLIENTCERTSELECTION_H diff --git a/src/core/api/qwebengineclientcertificatestore.cpp b/src/core/api/qwebengineclientcertificatestore.cpp index 4d84bd165..e7837afce 100644 --- a/src/core/api/qwebengineclientcertificatestore.cpp +++ b/src/core/api/qwebengineclientcertificatestore.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 "qwebengineclientcertificatestore.h" diff --git a/src/core/api/qwebengineclientcertificatestore.h b/src/core/api/qwebengineclientcertificatestore.h index 12ac9c6be..fcebbe2b1 100644 --- a/src/core/api/qwebengineclientcertificatestore.h +++ b/src/core/api/qwebengineclientcertificatestore.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 #ifndef QWEBENGINECLIENTCERTIFICATESTORE_H #define QWEBENGINECLIENTCERTIFICATESTORE_H diff --git a/src/core/api/qwebenginecontextmenurequest.cpp b/src/core/api/qwebenginecontextmenurequest.cpp index 24ea3a073..25de1fe6b 100644 --- a/src/core/api/qwebenginecontextmenurequest.cpp +++ b/src/core/api/qwebenginecontextmenurequest.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 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) 2020 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 "qwebenginecontextmenurequest.h" #include "qwebenginecontextmenurequest_p.h" @@ -292,3 +256,5 @@ bool QWebEngineContextMenuRequest::hasImageContent() const } QT_END_NAMESPACE + +#include "moc_qwebenginecontextmenurequest.cpp" diff --git a/src/core/api/qwebenginecontextmenurequest.h b/src/core/api/qwebenginecontextmenurequest.h index a5911463a..6e6f6338c 100644 --- a/src/core/api/qwebenginecontextmenurequest.h +++ b/src/core/api/qwebenginecontextmenurequest.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 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) 2020 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 #ifndef QWEBENGINECONTEXTMENUREQUEST_H #define QWEBENGINECONTEXTMENUREQUEST_H diff --git a/src/core/api/qwebenginecontextmenurequest_p.h b/src/core/api/qwebenginecontextmenurequest_p.h index c7b98a871..0e774f534 100644 --- a/src/core/api/qwebenginecontextmenurequest_p.h +++ b/src/core/api/qwebenginecontextmenurequest_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 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) 2020 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 #ifndef QWEBENGINECONTEXTMENUREQUEST_P_H #define QWEBENGINECONTEXTMENUREQUEST_P_H diff --git a/src/core/api/qwebenginecookiestore.cpp b/src/core/api/qwebenginecookiestore.cpp index e8d552caf..c17fde475 100644 --- a/src/core/api/qwebenginecookiestore.cpp +++ b/src/core/api/qwebenginecookiestore.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 "qwebenginecookiestore.h" #include "qwebenginecookiestore_p.h" @@ -410,3 +374,5 @@ void QWebEngineCookieStore::setCookieFilter(std::function<bool(const FilterReque */ QT_END_NAMESPACE + +#include "moc_qwebenginecookiestore.cpp" diff --git a/src/core/api/qwebenginecookiestore.h b/src/core/api/qwebenginecookiestore.h index e73222bcd..347d0c45c 100644 --- a/src/core/api/qwebenginecookiestore.h +++ b/src/core/api/qwebenginecookiestore.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef QWEBENGINECOOKIESTORE_H #define QWEBENGINECOOKIESTORE_H diff --git a/src/core/api/qwebenginecookiestore_p.h b/src/core/api/qwebenginecookiestore_p.h index 9f26604a6..ac9395301 100644 --- a/src/core/api/qwebenginecookiestore_p.h +++ b/src/core/api/qwebenginecookiestore_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef QWEBENGINECOOKIESTORE_P_H #define QWEBENGINECOOKIESTORE_P_H diff --git a/src/core/api/qwebenginedownloadrequest.cpp b/src/core/api/qwebenginedownloadrequest.cpp index 222336239..97f6051b4 100644 --- a/src/core/api/qwebenginedownloadrequest.cpp +++ b/src/core/api/qwebenginedownloadrequest.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 "qwebenginedownloadrequest.h" #include "qwebenginedownloadrequest_p.h" @@ -674,3 +638,5 @@ QWebEngineDownloadRequest::~QWebEngineDownloadRequest() } QT_END_NAMESPACE + +#include "moc_qwebenginedownloadrequest.cpp" diff --git a/src/core/api/qwebenginedownloadrequest.h b/src/core/api/qwebenginedownloadrequest.h index 35ed4263b..36604188e 100644 --- a/src/core/api/qwebenginedownloadrequest.h +++ b/src/core/api/qwebenginedownloadrequest.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 #ifndef QWEBENGINEDOWNLOADREQUEST_H #define QWEBENGINEDOWNLOADREQUEST_H diff --git a/src/core/api/qwebenginedownloadrequest_p.h b/src/core/api/qwebenginedownloadrequest_p.h index e158d8edd..814af59cb 100644 --- a/src/core/api/qwebenginedownloadrequest_p.h +++ b/src/core/api/qwebenginedownloadrequest_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef QWEBENGINEDOWNLOADREQUEST_P_H #define QWEBENGINEDOWNLOADREQUEST_P_H diff --git a/src/core/api/qwebenginefilesystemaccessrequest.cpp b/src/core/api/qwebenginefilesystemaccessrequest.cpp new file mode 100644 index 000000000..6527e1766 --- /dev/null +++ b/src/core/api/qwebenginefilesystemaccessrequest.cpp @@ -0,0 +1,107 @@ +// Copyright (C) 2022 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 "qwebenginefilesystemaccessrequest.h" + +#include "file_system_access/file_system_access_permission_request_controller.h" + +QT_BEGIN_NAMESPACE + +/*! + \class QWebEngineFileSystemAccessRequest + \brief The QWebEngineFileSystemAccessRequest class enables accepting or rejecting + requests for local file system access from JavaScript applications. + + \since 6.4 + + \inmodule QtWebEngineCore + + To allow web applications to access local files of the computer, + applications must connect to QWebEnginePage::fileSystemAccessRequested, which takes a + QWebEngineFileSystemAccessRequest instance as an argument. + + If a web applications requests access to local files or directories, + QWebEnginePage::fileSystemAccessRequested will be emitted with an + QWebEngineFileSystemAccessRequest instance as an argument where accessFlags() indicates + the type of the requested access: read, write or both. The signal handler needs to then + either call accept() or reject(). +*/ + +QWebEngineFileSystemAccessRequest::QWebEngineFileSystemAccessRequest( + const QWebEngineFileSystemAccessRequest &other) = default; +QWebEngineFileSystemAccessRequest &QWebEngineFileSystemAccessRequest::operator=( + const QWebEngineFileSystemAccessRequest &other) = default; +QWebEngineFileSystemAccessRequest::~QWebEngineFileSystemAccessRequest() = default; + +/*! \fn bool QWebEngineFileSystemAccessRequest::operator==(const QWebEngineFileSystemAccessRequest &lhs, const QWebEngineFileSystemAccessRequest &rhs) + Returns \c true if \a lhs and \a rhs both point to the same request. +*/ + +/*! \fn bool QWebEngineFileSystemAccessRequest::operator!=(const QWebEngineFileSystemAccessRequest &lhs, const QWebEngineFileSystemAccessRequest &rhs) + Returns \c true if \a lhs and \a rhs point to different requests. +*/ + +/*! \internal */ +QWebEngineFileSystemAccessRequest::QWebEngineFileSystemAccessRequest( + std::shared_ptr<QtWebEngineCore::FileSystemAccessPermissionRequestController> controller) + : d_ptr(std::move(controller)) +{ +} + +/*! + Rejects a request to access local files. +*/ +void QWebEngineFileSystemAccessRequest::reject() +{ + d_ptr->reject(); +} + +/*! + Accepts the request to access local files. +*/ +void QWebEngineFileSystemAccessRequest::accept() +{ + d_ptr->accept(); +} + +/*! + \property QWebEngineFileSystemAccessRequest::origin + \brief The URL of the web page that issued the file system access request. +*/ + +QUrl QWebEngineFileSystemAccessRequest::origin() const +{ + return d_ptr->origin(); +} + +/*! + \property QWebEngineFileSystemAccessRequest::filePath + \brief Returns the file path this file system access request is referring to. +*/ + +QUrl QWebEngineFileSystemAccessRequest::filePath() const +{ + return d_ptr->filePath(); +} + +/*! + \property QWebEngineFileSystemAccessRequest::handleType + \brief Returns the type of the requested file system entry. (File or directory) + */ +HandleType QWebEngineFileSystemAccessRequest::handleType() const +{ + return d_ptr->handleType(); +} + +/*! + \property QWebEngineFileSystemAccessRequest::accessFlags + \brief Contains the requested file access rights. + */ +AccessFlags QWebEngineFileSystemAccessRequest::accessFlags() const +{ + return d_ptr->accessFlags(); +} + +QT_END_NAMESPACE + +#include "moc_qwebenginefilesystemaccessrequest.cpp" diff --git a/src/core/api/qwebenginefilesystemaccessrequest.h b/src/core/api/qwebenginefilesystemaccessrequest.h new file mode 100644 index 000000000..37b1e1861 --- /dev/null +++ b/src/core/api/qwebenginefilesystemaccessrequest.h @@ -0,0 +1,70 @@ +// Copyright (C) 2022 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 + +#ifndef QWEBENGINEFILESYSTEMACCESSREQUEST_H +#define QWEBENGINEFILESYSTEMACCESSREQUEST_H + +#include <QtWebEngineCore/qtwebenginecoreglobal.h> +#include <QtCore/qurl.h> +#include <memory> + +namespace QtWebEngineCore { +class FileSystemAccessPermissionRequestController; +class FileSystemAccessPermissionRequestManagerQt; +} + +QT_BEGIN_NAMESPACE + +class Q_WEBENGINECORE_EXPORT QWebEngineFileSystemAccessRequest +{ + Q_GADGET + Q_PROPERTY(QUrl origin READ origin CONSTANT FINAL) + Q_PROPERTY(QUrl filePath READ filePath CONSTANT FINAL) + Q_PROPERTY(HandleType handleType READ handleType CONSTANT FINAL) + Q_PROPERTY(AccessFlags accessFlags READ accessFlags CONSTANT FINAL) + +public: + QWebEngineFileSystemAccessRequest(const QWebEngineFileSystemAccessRequest &other); + QWebEngineFileSystemAccessRequest &operator=(const QWebEngineFileSystemAccessRequest &other); + QWebEngineFileSystemAccessRequest(QWebEngineFileSystemAccessRequest &&other) noexcept = default; + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QWebEngineFileSystemAccessRequest) + ~QWebEngineFileSystemAccessRequest(); + + void swap(QWebEngineFileSystemAccessRequest &other) noexcept { d_ptr.swap(other.d_ptr); } + + enum HandleType { File, Directory }; + Q_ENUM(HandleType) + + enum AccessFlag { Read = 0x1, Write = 0x2 }; + Q_DECLARE_FLAGS(AccessFlags, AccessFlag) + Q_FLAG(AccessFlags) + + Q_INVOKABLE void accept(); + Q_INVOKABLE void reject(); + QUrl origin() const; + QUrl filePath() const; + HandleType handleType() const; + AccessFlags accessFlags() const; + + inline friend bool operator==(const QWebEngineFileSystemAccessRequest &lhs, + const QWebEngineFileSystemAccessRequest &rhs) noexcept + { return lhs.d_ptr == rhs.d_ptr; } + inline friend bool operator!=(const QWebEngineFileSystemAccessRequest &lhs, + const QWebEngineFileSystemAccessRequest &rhs) noexcept + { return lhs.d_ptr != rhs.d_ptr; } + +private: + QWebEngineFileSystemAccessRequest( + std::shared_ptr<QtWebEngineCore::FileSystemAccessPermissionRequestController>); + friend QtWebEngineCore::FileSystemAccessPermissionRequestManagerQt; + + std::shared_ptr<QtWebEngineCore::FileSystemAccessPermissionRequestController> d_ptr; +}; + +Q_DECLARE_SHARED(QWebEngineFileSystemAccessRequest) + +Q_DECLARE_OPERATORS_FOR_FLAGS(QWebEngineFileSystemAccessRequest::AccessFlags) + +QT_END_NAMESPACE + +#endif // QWEBENGINEFILESYSTEMACCESSREQUEST_H diff --git a/src/core/api/qwebenginefindtextresult.cpp b/src/core/api/qwebenginefindtextresult.cpp index cba8f6b4c..ce953ddff 100644 --- a/src/core/api/qwebenginefindtextresult.cpp +++ b/src/core/api/qwebenginefindtextresult.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 "qwebenginefindtextresult.h" diff --git a/src/core/api/qwebenginefindtextresult.h b/src/core/api/qwebenginefindtextresult.h index 8576dbabb..d506a50f5 100644 --- a/src/core/api/qwebenginefindtextresult.h +++ b/src/core/api/qwebenginefindtextresult.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 #ifndef QWEBENGINEFINDTEXTRESULT_H #define QWEBENGINEFINDTEXTRESULT_H diff --git a/src/core/api/qwebenginefullscreenrequest.cpp b/src/core/api/qwebenginefullscreenrequest.cpp index cac1d56ba..938aad19c 100644 --- a/src/core/api/qwebenginefullscreenrequest.cpp +++ b/src/core/api/qwebenginefullscreenrequest.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 "qwebenginefullscreenrequest.h" @@ -145,3 +109,5 @@ QUrl QWebEngineFullScreenRequest::origin() const } QT_END_NAMESPACE + +#include "moc_qwebenginefullscreenrequest.cpp" diff --git a/src/core/api/qwebenginefullscreenrequest.h b/src/core/api/qwebenginefullscreenrequest.h index aa7a6a9d2..8e25286b6 100644 --- a/src/core/api/qwebenginefullscreenrequest.h +++ b/src/core/api/qwebenginefullscreenrequest.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 #ifndef QWEBENGINEFULLSCREENREQUEST_H #define QWEBENGINEFULLSCREENREQUEST_H diff --git a/src/core/api/qwebenginehistory.cpp b/src/core/api/qwebenginehistory.cpp index 2364aed6b..b70c0b73d 100644 --- a/src/core/api/qwebenginehistory.cpp +++ b/src/core/api/qwebenginehistory.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 "qwebenginehistory.h" #include "qwebenginehistory_p.h" @@ -428,3 +392,5 @@ void QWebEngineHistory::reset() } QT_END_NAMESPACE + +#include "moc_qwebenginehistory.cpp" diff --git a/src/core/api/qwebenginehistory.h b/src/core/api/qwebenginehistory.h index 2e5dfcd9a..fd54e62a5 100644 --- a/src/core/api/qwebenginehistory.h +++ b/src/core/api/qwebenginehistory.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 #ifndef QWEBENGINEHISTORY_H #define QWEBENGINEHISTORY_H diff --git a/src/core/api/qwebenginehistory_p.h b/src/core/api/qwebenginehistory_p.h index fb52f799c..99c42d7eb 100644 --- a/src/core/api/qwebenginehistory_p.h +++ b/src/core/api/qwebenginehistory_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef QWEBENGINEHISTORY_P_H #define QWEBENGINEHISTORY_P_H diff --git a/src/core/api/qwebenginehttprequest.cpp b/src/core/api/qwebenginehttprequest.cpp index d199bff1d..bb822d6e3 100644 --- a/src/core/api/qwebenginehttprequest.cpp +++ b/src/core/api/qwebenginehttprequest.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 "qplatformdefs.h" #include <QtCore/qshareddata.h> diff --git a/src/core/api/qwebenginehttprequest.h b/src/core/api/qwebenginehttprequest.h index 65b2e8f98..6c0298f86 100644 --- a/src/core/api/qwebenginehttprequest.h +++ b/src/core/api/qwebenginehttprequest.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef QWEBENGINEHTTPREQUEST_H #define QWEBENGINEHTTPREQUEST_H diff --git a/src/core/api/qwebengineloadinginfo.cpp b/src/core/api/qwebengineloadinginfo.cpp index ce6e57d5c..14ec26be4 100644 --- a/src/core/api/qwebengineloadinginfo.cpp +++ b/src/core/api/qwebengineloadinginfo.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 <qwebengineloadinginfo.h> @@ -53,6 +17,7 @@ Q_STATIC_ASSERT(static_cast<int>(WebEngineError::CertificateErrorDomain) == stat Q_STATIC_ASSERT(static_cast<int>(WebEngineError::HttpErrorDomain) == static_cast<int>(ErrorDomain::HttpErrorDomain)); Q_STATIC_ASSERT(static_cast<int>(WebEngineError::FtpErrorDomain) == static_cast<int>(ErrorDomain::FtpErrorDomain)); Q_STATIC_ASSERT(static_cast<int>(WebEngineError::DnsErrorDomain) == static_cast<int>(ErrorDomain::DnsErrorDomain)); +Q_STATIC_ASSERT(static_cast<int>(WebEngineError::HttpStatusCodeDomain) == static_cast<int>(ErrorDomain::HttpStatusCodeDomain)); class QWebEngineLoadingInfo::QWebEngineLoadingInfoPrivate : public QSharedData { public: @@ -169,6 +134,8 @@ QString QWebEngineLoadingInfo::errorString() const Error is related to the FTP connection. \value DnsErrorDomain Error is related to the DNS connection. + \value HttpStatusCodeDomain + Error is the HTTP response status code, even in case of success e.g. the server replied with status 200. */ /* \property QWebEngineLoadingInfo::errorDomain @@ -191,3 +158,5 @@ int QWebEngineLoadingInfo::errorCode() const } QT_END_NAMESPACE + +#include "moc_qwebengineloadinginfo.cpp" diff --git a/src/core/api/qwebengineloadinginfo.h b/src/core/api/qwebengineloadinginfo.h index a8b7233ac..a17588a57 100644 --- a/src/core/api/qwebengineloadinginfo.h +++ b/src/core/api/qwebengineloadinginfo.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 #ifndef QWEBENGINELOADINGINFO_H #define QWEBENGINELOADINGINFO_H @@ -79,7 +43,8 @@ public: CertificateErrorDomain, HttpErrorDomain, FtpErrorDomain, - DnsErrorDomain + DnsErrorDomain, + HttpStatusCodeDomain }; Q_ENUM(ErrorDomain) diff --git a/src/core/api/qwebenginemessagepumpscheduler.cpp b/src/core/api/qwebenginemessagepumpscheduler.cpp index 34cbc49bf..62244c787 100644 --- a/src/core/api/qwebenginemessagepumpscheduler.cpp +++ b/src/core/api/qwebenginemessagepumpscheduler.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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) 2019 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 "qwebenginemessagepumpscheduler_p.h" @@ -70,3 +34,5 @@ void QWebEngineMessagePumpScheduler::timerEvent(QTimerEvent *ev) m_timerId = 0; m_callback(); } + +#include "moc_qwebenginemessagepumpscheduler_p.cpp" diff --git a/src/core/api/qwebenginemessagepumpscheduler_p.h b/src/core/api/qwebenginemessagepumpscheduler_p.h index 46ed62f54..7e84b4190 100644 --- a/src/core/api/qwebenginemessagepumpscheduler_p.h +++ b/src/core/api/qwebenginemessagepumpscheduler_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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) 2019 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 #ifndef QWEBENGINEMESSAGEPUMPSCHEDULER_P_H #define QWEBENGINEMESSAGEPUMPSCHEDULER_P_H diff --git a/src/core/api/qwebenginenavigationrequest.cpp b/src/core/api/qwebenginenavigationrequest.cpp index 070770012..c14a7bf41 100644 --- a/src/core/api/qwebenginenavigationrequest.cpp +++ b/src/core/api/qwebenginenavigationrequest.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 "qwebenginenavigationrequest.h" @@ -214,3 +178,5 @@ bool QWebEngineNavigationRequest::isAccepted() const } QT_END_NAMESPACE + +#include "moc_qwebenginenavigationrequest.cpp" diff --git a/src/core/api/qwebenginenavigationrequest.h b/src/core/api/qwebenginenavigationrequest.h index ab098b6aa..12fc2b4a1 100644 --- a/src/core/api/qwebenginenavigationrequest.h +++ b/src/core/api/qwebenginenavigationrequest.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 #ifndef QWEBENGINENAVIGATIONREQUEST_H #define QWEBENGINENAVIGATIONREQUEST_H diff --git a/src/core/api/qwebenginenewwindowrequest.cpp b/src/core/api/qwebenginenewwindowrequest.cpp index 70fbd2bb4..951753136 100644 --- a/src/core/api/qwebenginenewwindowrequest.cpp +++ b/src/core/api/qwebenginenewwindowrequest.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 "qwebenginenewwindowrequest.h" #include "qwebenginenewwindowrequest_p.h" @@ -189,3 +153,5 @@ void QWebEngineNewWindowRequest::openIn(QWebEnginePage *page) } QT_END_NAMESPACE + +#include "moc_qwebenginenewwindowrequest.cpp" diff --git a/src/core/api/qwebenginenewwindowrequest.h b/src/core/api/qwebenginenewwindowrequest.h index 8fd35ad6f..86d182581 100644 --- a/src/core/api/qwebenginenewwindowrequest.h +++ b/src/core/api/qwebenginenewwindowrequest.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 #ifndef QWEBENGINENEWWINDOWREQUEST_H #define QWEBENGINENEWWINDOWREQUEST_H diff --git a/src/core/api/qwebenginenewwindowrequest_p.h b/src/core/api/qwebenginenewwindowrequest_p.h index ec69dc84c..979d3fe2d 100644 --- a/src/core/api/qwebenginenewwindowrequest_p.h +++ b/src/core/api/qwebenginenewwindowrequest_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 #ifndef QWEBENGINENEWWINDOWREQUEST_P_H #define QWEBENGINENEWWINDOWREQUEST_P_H diff --git a/src/core/api/qwebenginenotification.cpp b/src/core/api/qwebenginenotification.cpp index 60646d2c9..136047042 100644 --- a/src/core/api/qwebenginenotification.cpp +++ b/src/core/api/qwebenginenotification.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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) 2017 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 "qwebenginenotification.h" diff --git a/src/core/api/qwebenginenotification.h b/src/core/api/qwebenginenotification.h index 791f6bb1b..646413d39 100644 --- a/src/core/api/qwebenginenotification.h +++ b/src/core/api/qwebenginenotification.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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) 2017 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 #ifndef QWEBENGINENOTIFICATION_H #define QWEBENGINENOTIFICATION_H diff --git a/src/core/api/qwebenginepage.cpp b/src/core/api/qwebenginepage.cpp index e02864e08..3b83a0b97 100644 --- a/src/core/api/qwebenginepage.cpp +++ b/src/core/api/qwebenginepage.cpp @@ -1,50 +1,16 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 "qwebenginepage.h" #include "qwebenginepage_p.h" #include "qwebenginecertificateerror.h" +#include "qwebenginefilesystemaccessrequest.h" #include "qwebenginefindtextresult.h" #include "qwebenginefullscreenrequest.h" #include "qwebenginehistory.h" #include "qwebenginehistory_p.h" +#include "qwebenginehttprequest.h" #include "qwebengineloadinginfo.h" #include "qwebenginenavigationrequest.h" #include "qwebenginenewwindowrequest.h" @@ -58,6 +24,7 @@ #include "qwebenginesettings.h" #include "authentication_dialog_controller.h" +#include "autofill_popup_controller.h" #include "color_chooser_controller.h" #include "find_text_helper.h" #include "file_picker_controller.h" @@ -66,6 +33,7 @@ #include "render_view_context_menu_qt.h" #include "render_widget_host_view_qt_delegate.h" #include "render_widget_host_view_qt_delegate_client.h" +#include "render_widget_host_view_qt_delegate_item.h" #include "web_contents_adapter.h" #include <QAction> @@ -76,58 +44,15 @@ #include <QIcon> #include <QLoggingCategory> #include <QMimeData> +#include <QRect> #include <QTimer> #include <QUrl> +#include <QVariant> QT_BEGIN_NAMESPACE using namespace QtWebEngineCore; -// add temporary dummy code to cover the case when page is loading and there is no view -class DummyDelegate : public QObject, public QtWebEngineCore::RenderWidgetHostViewQtDelegate -{ -public: - DummyDelegate(RenderWidgetHostViewQtDelegateClient *client) : m_delegateClient(client) {}; - ~DummyDelegate() = default; - void initAsPopup(const QRect &) override { Q_UNREACHABLE(); } - QRectF viewGeometry() const override { return QRectF(m_pos, m_size); } - void setKeyboardFocus() override { } - bool hasKeyboardFocus() override { return false; } - void lockMouse() override { Q_UNREACHABLE(); } - void unlockMouse() override { Q_UNREACHABLE(); } - void show() override { m_delegateClient->notifyShown(); } - void hide() override { m_delegateClient->notifyHidden(); } - bool isVisible() const override { Q_UNREACHABLE(); } - QWindow *window() const override { return nullptr; } - void updateCursor(const QCursor &cursor) override - { - Q_UNUSED(cursor); - /*setCursor(cursor);*/ - } - void resize(int width, int height) override - { - m_size = QSize(width, height); - m_delegateClient->visualPropertiesChanged(); - } - void move(const QPoint &) override { Q_UNREACHABLE(); } - void inputMethodStateChanged(bool, bool) override { } - void setInputMethodHints(Qt::InputMethodHints) override { } - void setClearColor(const QColor &) override { } - void adapterClientChanged(WebContentsAdapterClient *) override { } - bool copySurface(const QRect &, const QSize &, QImage &) - { - Q_UNREACHABLE(); - return false; - } - QRect windowGeometry() const override { return QRect(m_pos, m_size); } - bool forwardEvent(QEvent *ev) { return m_delegateClient->forwardEvent(ev); } - -private: - RenderWidgetHostViewQtDelegateClient *m_delegateClient; - QPoint m_pos; - QSize m_size; -}; - static QWebEnginePage::WebWindowType toWindowType(WebContentsAdapterClient::WindowOpenDisposition disposition) { switch (disposition) { @@ -180,6 +105,7 @@ QWebEnginePagePrivate::QWebEnginePagePrivate(QWebEngineProfile *_profile) qRegisterMetaType<QWebEngineQuotaRequest>(); qRegisterMetaType<QWebEngineRegisterProtocolHandlerRequest>(); + qRegisterMetaType<QWebEngineFileSystemAccessRequest>(); qRegisterMetaType<QWebEngineFindTextResult>(); // See setVisible(). @@ -200,6 +126,14 @@ QWebEnginePagePrivate::~QWebEnginePagePrivate() RenderWidgetHostViewQtDelegate *QWebEnginePagePrivate::CreateRenderWidgetHostViewQtDelegate(RenderWidgetHostViewQtDelegateClient *client) { + if (view) + return view->CreateRenderWidgetHostViewQtDelegate(client); + delegateItem = new QtWebEngineCore::RenderWidgetHostViewQtDelegateItem(client, false); + return delegateItem; +} + +RenderWidgetHostViewQtDelegate *QWebEnginePagePrivate::CreateRenderWidgetHostViewQtDelegateForPopup(RenderWidgetHostViewQtDelegateClient *client) +{ // Set the QWebEngineView as the parent for a popup delegate, so that the new popup window // responds properly to clicks in case the QWebEngineView is inside a modal QDialog. Setting the // parent essentially notifies the OS that the popup window is part of the modal session, and @@ -207,7 +141,9 @@ RenderWidgetHostViewQtDelegate *QWebEnginePagePrivate::CreateRenderWidgetHostVie // The new delegate will not be deleted by the parent view though, because we unset the parent // when the parent is destroyed. The delegate will be destroyed by Chromium when the popup is // dismissed. - return view ? view->CreateRenderWidgetHostViewQtDelegate(client) : new DummyDelegate(client); + return view + ? view->CreateRenderWidgetHostViewQtDelegateForPopup(client) + : new QtWebEngineCore::RenderWidgetHostViewQtDelegateItem(client, true); } void QWebEnginePagePrivate::initializationFinished() @@ -512,7 +448,7 @@ void QWebEnginePagePrivate::releaseProfile() { qWarning("Release of profile requested but WebEnginePage still not deleted. Expect troubles !"); // this is not the way to go, but might avoid the crash if user code does not make any calls to page. - delete q_ptr->d_ptr.take(); + q_ptr->d_ptr.reset(); } void QWebEnginePagePrivate::showColorDialog(QSharedPointer<ColorChooserController> controller) @@ -578,6 +514,12 @@ void QWebEnginePagePrivate::runRegisterProtocolHandlerRequest(QWebEngineRegister Q_EMIT q->registerProtocolHandlerRequested(request); } +void QWebEnginePagePrivate::runFileSystemAccessRequest(QWebEngineFileSystemAccessRequest request) +{ + Q_Q(QWebEnginePage); + Q_EMIT q->fileSystemAccessRequested(request); +} + QObject *QWebEnginePagePrivate::accessibilityParentObject() { return view ? view->accessibilityParentObject() : nullptr; @@ -585,7 +527,7 @@ QObject *QWebEnginePagePrivate::accessibilityParentObject() void QWebEnginePagePrivate::updateAction(QWebEnginePage::WebAction action) const { -#ifdef QT_NO_ACTION +#if !QT_CONFIG(action) Q_UNUSED(action); #else QAction *a = actions[action]; @@ -628,7 +570,7 @@ void QWebEnginePagePrivate::updateAction(QWebEnginePage::WebAction action) const } a->setEnabled(enabled); -#endif // QT_NO_ACTION +#endif // QT_CONFIG(action) } void QWebEnginePagePrivate::updateNavigationActions() @@ -653,7 +595,7 @@ void QWebEnginePagePrivate::updateEditActions() updateAction(QWebEnginePage::Unselect); } -#ifndef QT_NO_ACTION +#if QT_CONFIG(action) void QWebEnginePagePrivate::_q_webActionTriggered(bool checked) { Q_Q(QWebEnginePage); @@ -663,7 +605,7 @@ void QWebEnginePagePrivate::_q_webActionTriggered(bool checked) QWebEnginePage::WebAction action = static_cast<QWebEnginePage::WebAction>(a->data().toInt()); q->triggerAction(action, checked); } -#endif // QT_NO_ACTION +#endif // QT_CONFIG(action) void QWebEnginePagePrivate::recreateFromSerializedHistory(QDataStream &input) { @@ -718,6 +660,19 @@ void QWebEnginePagePrivate::findTextFinished(const QWebEngineFindTextResult &res Q_EMIT q->findTextFinished(result); } +void QWebEnginePagePrivate::showAutofillPopup(QtWebEngineCore::AutofillPopupController *controller, + const QRect &bounds, bool autoselectFirstSuggestion) +{ + if (view) + view->showAutofillPopup(controller, bounds, autoselectFirstSuggestion); +} + +void QWebEnginePagePrivate::hideAutofillPopup() +{ + if (view) + view->hideAutofillPopup(); +} + void QWebEnginePagePrivate::ensureInitialized() const { if (!adapter->isInitialized()) @@ -1083,12 +1038,12 @@ QString QWebEnginePage::selectedText() const return d->adapter->selectedText(); } -#ifndef QT_NO_ACTION +#if QT_CONFIG(action) QAction *QWebEnginePage::action(WebAction action) const { Q_D(const QWebEnginePage); if (action == QWebEnginePage::NoWebAction) - return 0; + return nullptr; if (d->actions[action]) return d->actions[action]; @@ -1245,7 +1200,7 @@ QAction *QWebEnginePage::action(WebAction action) const d->updateAction(action); return a; } -#endif // QT_NO_ACTION +#endif // QT_CONFIG(action) void QWebEnginePage::triggerAction(WebAction action, bool) { diff --git a/src/core/api/qwebenginepage.h b/src/core/api/qwebenginepage.h index 45829f603..f4cca0582 100644 --- a/src/core/api/qwebenginepage.h +++ b/src/core/api/qwebenginepage.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 #ifndef QWEBENGINEPAGE_H #define QWEBENGINEPAGE_H @@ -43,27 +7,29 @@ #include <QtWebEngineCore/qtwebenginecoreglobal.h> #include <QtWebEngineCore/qwebengineclientcertificateselection.h> #include <QtWebEngineCore/qwebenginedownloadrequest.h> -#include <QtWebEngineCore/qwebenginehttprequest.h> #include <QtCore/qobject.h> #include <QtCore/qurl.h> -#include <QtCore/qvariant.h> -#include <QtGui/qaction.h> #include <QtGui/qpagelayout.h> #include <QtGui/qpageranges.h> +#include <QtGui/qtgui-config.h> #include <functional> QT_BEGIN_NAMESPACE +class QAction; class QAuthenticator; class QContextMenuBuilder; +class QRect; +class QVariant; class QWebChannel; class QWebEngineCertificateError; -class QWebEngineClientCertificateSelection; +class QWebEngineFileSystemAccessRequest; class QWebEngineFindTextResult; class QWebEngineFullScreenRequest; class QWebEngineHistory; +class QWebEngineHttpRequest; class QWebEngineLoadingInfo; class QWebEngineNavigationRequest; class QWebEngineNewWindowRequest; @@ -250,7 +216,7 @@ public: QWebEngineProfile *profile() const; -#ifndef QT_NO_ACTION +#if QT_CONFIG(action) QAction *action(WebAction action) const; #endif virtual void triggerAction(WebAction action, bool checked = false); @@ -345,6 +311,7 @@ Q_SIGNALS: void fullScreenRequested(QWebEngineFullScreenRequest fullScreenRequest); void quotaRequested(QWebEngineQuotaRequest quotaRequest); void registerProtocolHandlerRequested(QWebEngineRegisterProtocolHandlerRequest request); + void fileSystemAccessRequested(QWebEngineFileSystemAccessRequest request); void selectClientCertificate(QWebEngineClientCertificateSelection clientCertSelection); void authenticationRequired(const QUrl &requestUrl, QAuthenticator *authenticator); void proxyAuthenticationRequired(const QUrl &requestUrl, QAuthenticator *authenticator, const QString &proxyHost); @@ -396,16 +363,16 @@ private: Q_DISABLE_COPY(QWebEnginePage) Q_DECLARE_PRIVATE(QWebEnginePage) QScopedPointer<QWebEnginePagePrivate> d_ptr; -#ifndef QT_NO_ACTION +#if QT_CONFIG(action) Q_PRIVATE_SLOT(d_func(), void _q_webActionTriggered(bool checked)) #endif friend class QContextMenuBuilder; friend class QWebEngineView; friend class QWebEngineViewPrivate; -#ifndef QT_NO_ACCESSIBILITY +#if QT_CONFIG(accessibility) friend class QWebEngineViewAccessible; -#endif // QT_NO_ACCESSIBILITY +#endif // QT_CONFIG(accessibility) }; Q_DECLARE_OPERATORS_FOR_FLAGS(QWebEnginePage::FindFlags) diff --git a/src/core/api/qwebenginepage_p.h b/src/core/api/qwebenginepage_p.h index 55b94f86b..8bdf6de5c 100644 --- a/src/core/api/qwebenginepage_p.h +++ b/src/core/api/qwebenginepage_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef QWEBENGINEPAGE_P_H #define QWEBENGINEPAGE_P_H @@ -59,12 +23,14 @@ #include <QtCore/qcompilerdetection.h> #include <QtCore/QPointer> #include <QtCore/QTimer> +#include <QtGui/QColor> namespace QtWebEngineCore { +class AutofillPopupController; class RenderWidgetHostViewQtDelegate; -class RenderWidgetHostViewQtDelegateWidget; class RenderWidgetHostViewQtDelegateClient; -class TouchHandleDrawableClient; +class RenderWidgetHostViewQtDelegateItem; +class TouchHandleDrawableDelegate; class TouchSelectionMenuController; class WebContentsAdapter; } @@ -94,6 +60,8 @@ public: virtual void setToolTip(const QString &toolTipText) = 0; virtual QtWebEngineCore::RenderWidgetHostViewQtDelegate *CreateRenderWidgetHostViewQtDelegate( QtWebEngineCore::RenderWidgetHostViewQtDelegateClient *client) = 0; + virtual QtWebEngineCore::RenderWidgetHostViewQtDelegate *CreateRenderWidgetHostViewQtDelegateForPopup( + QtWebEngineCore::RenderWidgetHostViewQtDelegateClient *client) = 0; virtual QWebEngineContextMenuRequest *lastContextMenuRequest() const = 0; virtual QWebEnginePage *createPageForWindow(QWebEnginePage::WebWindowType type) = 0; virtual bool isEnabled() const = 0; @@ -106,6 +74,9 @@ public: virtual void didPrintPage(QPrinter *&printer, QSharedPointer<QByteArray> result) = 0; virtual void didPrintPageToPdf(const QString &filePath, bool success) = 0; virtual void printRequested() = 0; + virtual void showAutofillPopup(QtWebEngineCore::AutofillPopupController *controller, + const QRect &bounds, bool autoselectFirstSuggestion) = 0; + virtual void hideAutofillPopup() = 0; }; class Q_WEBENGINECORE_PRIVATE_EXPORT QWebEnginePagePrivate : public QtWebEngineCore::WebContentsAdapterClient @@ -118,7 +89,7 @@ public: ~QWebEnginePagePrivate(); QtWebEngineCore::RenderWidgetHostViewQtDelegate* CreateRenderWidgetHostViewQtDelegate(QtWebEngineCore::RenderWidgetHostViewQtDelegateClient *client) override; - QtWebEngineCore::RenderWidgetHostViewQtDelegate* CreateRenderWidgetHostViewQtDelegateForPopup(QtWebEngineCore::RenderWidgetHostViewQtDelegateClient *client) override { return CreateRenderWidgetHostViewQtDelegate(client); } + QtWebEngineCore::RenderWidgetHostViewQtDelegate* CreateRenderWidgetHostViewQtDelegateForPopup(QtWebEngineCore::RenderWidgetHostViewQtDelegateClient *client) override; void initializationFinished() override; void lifecycleStateChanged(LifecycleState state) override; void recommendedStateChanged(LifecycleState state) override; @@ -169,6 +140,7 @@ public: void runMouseLockPermissionRequest(const QUrl &securityOrigin) override; void runQuotaRequest(QWebEngineQuotaRequest) override; void runRegisterProtocolHandlerRequest(QWebEngineRegisterProtocolHandlerRequest) override; + void runFileSystemAccessRequest(QWebEngineFileSystemAccessRequest) override; QObject *accessibilityParentObject() override; QWebEngineSettings *webEngineSettings() const override; void allowCertificateError(const QWebEngineCertificateError &error) override; @@ -184,12 +156,16 @@ public: bool isEnabled() const override; void setToolTip(const QString &toolTipText) override; void printRequested() override; - QtWebEngineCore::TouchHandleDrawableClient *createTouchHandle(const QMap<int, QImage> &) override { return nullptr; } + QtWebEngineCore::TouchHandleDrawableDelegate * + createTouchHandleDelegate(const QMap<int, QImage> &) override { return nullptr; } void showTouchSelectionMenu(QtWebEngineCore::TouchSelectionMenuController *, const QRect &, const QSize &) override { } void hideTouchSelectionMenu() override { } const QObject *holdingQObject() const override; ClientType clientType() override { return QtWebEngineCore::WebContentsAdapterClient::WidgetsClient; } void findTextFinished(const QWebEngineFindTextResult &result) override; + void showAutofillPopup(QtWebEngineCore::AutofillPopupController *controller, + const QRect &bounds, bool autoselectFirstSuggestion) override; + void hideAutofillPopup() override; QtWebEngineCore::ProfileAdapter *profileAdapter() override; QtWebEngineCore::WebContentsAdapter *webContentsAdapter() override; @@ -225,7 +201,7 @@ public: bool defaultAudioMuted; qreal defaultZoomFactor; QTimer wasShownTimer; - QtWebEngineCore::RenderWidgetHostViewQtDelegateWidget *widget = nullptr; + QtWebEngineCore::RenderWidgetHostViewQtDelegateItem *delegateItem = nullptr; #if QT_CONFIG(webengine_printing_and_pdf) QPrinter *currentPrinter = nullptr; #endif diff --git a/src/core/api/qwebengineprofile.cpp b/src/core/api/qwebengineprofile.cpp index 85ae00501..4eacc8dc7 100644 --- a/src/core/api/qwebengineprofile.cpp +++ b/src/core/api/qwebengineprofile.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 "qwebengineprofile.h" #include "qwebengineprofile_p.h" @@ -49,6 +13,7 @@ #include "qtwebenginecoreglobal.h" #include "profile_adapter.h" #include "visited_links_manager_qt.h" +#include "web_engine_settings.h" #include <QDir> #include <QtWebEngineCore/qwebengineurlscheme.h> @@ -285,6 +250,11 @@ void QWebEngineProfilePrivate::removeWebContentsAdapterClient(QtWebEngineCore::W m_profileAdapter->removeWebContentsAdapterClient(adapter); } +QtWebEngineCore::WebEngineSettings *QWebEngineProfilePrivate::coreSettings() const +{ + return QtWebEngineCore::WebEngineSettings::get(settings()); +} + /*! Constructs a new off-the-record profile with the parent \a parent. @@ -899,3 +869,6 @@ void QWebEngineProfile::requestIconForIconURL(const QUrl &url, int desiredSizeIn } QT_END_NAMESPACE + +#include "moc_qwebengineprofile.cpp" +#include "moc_qwebengineurlrequestinterceptor.cpp" diff --git a/src/core/api/qwebengineprofile.h b/src/core/api/qwebengineprofile.h index 5e8deb216..c29202973 100644 --- a/src/core/api/qwebengineprofile.h +++ b/src/core/api/qwebengineprofile.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 #ifndef QWEBENGINEPROFILE_H #define QWEBENGINEPROFILE_H diff --git a/src/core/api/qwebengineprofile_p.h b/src/core/api/qwebengineprofile_p.h index 396c8b9bf..b12f778bc 100644 --- a/src/core/api/qwebengineprofile_p.h +++ b/src/core/api/qwebengineprofile_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef QWEBENGINEPROFILE_P_H #define QWEBENGINEPROFILE_P_H @@ -62,6 +26,7 @@ namespace QtWebEngineCore { class ProfileAdapter; +class WebEngineSettings; } QT_BEGIN_NAMESPACE @@ -79,6 +44,7 @@ public: QtWebEngineCore::ProfileAdapter *profileAdapter() const; QWebEngineSettings *settings() const { return m_settings; } + QtWebEngineCore::WebEngineSettings *coreSettings() const override; void downloadDestroyed(quint32 downloadId); diff --git a/src/core/api/qwebenginequotarequest.cpp b/src/core/api/qwebenginequotarequest.cpp index 7686d0806..ca1289625 100644 --- a/src/core/api/qwebenginequotarequest.cpp +++ b/src/core/api/qwebenginequotarequest.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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) 2017 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 "qwebenginequotarequest.h" @@ -111,3 +75,4 @@ qint64 QWebEngineQuotaRequest::requestedSize() const */ QT_END_NAMESPACE +#include "moc_qwebenginequotarequest.cpp" diff --git a/src/core/api/qwebenginequotarequest.h b/src/core/api/qwebenginequotarequest.h index 599ca8963..c10789360 100644 --- a/src/core/api/qwebenginequotarequest.h +++ b/src/core/api/qwebenginequotarequest.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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) 2017 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 #ifndef QWEBENGINEQUOTAREQUEST_H #define QWEBENGINEQUOTAREQUEST_H diff --git a/src/core/api/qwebengineregisterprotocolhandlerrequest.cpp b/src/core/api/qwebengineregisterprotocolhandlerrequest.cpp index bb59282ea..3e52302e4 100644 --- a/src/core/api/qwebengineregisterprotocolhandlerrequest.cpp +++ b/src/core/api/qwebengineregisterprotocolhandlerrequest.cpp @@ -1,45 +1,9 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 "qwebengineregisterprotocolhandlerrequest.h" -#include "register_protocol_handler_request_controller.h" +#include "custom_handlers/register_protocol_handler_request_controller.h" QT_BEGIN_NAMESPACE @@ -114,3 +78,5 @@ QString QWebEngineRegisterProtocolHandlerRequest::scheme() const */ QT_END_NAMESPACE + +#include "moc_qwebengineregisterprotocolhandlerrequest.cpp" diff --git a/src/core/api/qwebengineregisterprotocolhandlerrequest.h b/src/core/api/qwebengineregisterprotocolhandlerrequest.h index 86eb37404..d6e51695e 100644 --- a/src/core/api/qwebengineregisterprotocolhandlerrequest.h +++ b/src/core/api/qwebengineregisterprotocolhandlerrequest.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 #ifndef QWEBENGINEREGISTERPROTOCOLHANDLERREQUEST_H #define QWEBENGINEREGISTERPROTOCOLHANDLERREQUEST_H diff --git a/src/core/api/qwebenginescript.cpp b/src/core/api/qwebenginescript.cpp index e414a8a6f..29b92a396 100644 --- a/src/core/api/qwebenginescript.cpp +++ b/src/core/api/qwebenginescript.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 "qwebenginescript.h" @@ -315,3 +279,5 @@ QDebug operator<<(QDebug d, const QWebEngineScript &script) #endif QT_END_NAMESPACE + +#include "moc_qwebenginescript.cpp" diff --git a/src/core/api/qwebenginescript.h b/src/core/api/qwebenginescript.h index 4d2ecd2e5..9827c4879 100644 --- a/src/core/api/qwebenginescript.h +++ b/src/core/api/qwebenginescript.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef QWEBENGINESCRIPT_H #define QWEBENGINESCRIPT_H diff --git a/src/core/api/qwebenginescriptcollection.cpp b/src/core/api/qwebenginescriptcollection.cpp index d19fcaa24..0b157755c 100644 --- a/src/core/api/qwebenginescriptcollection.cpp +++ b/src/core/api/qwebenginescriptcollection.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 "qwebenginescriptcollection.h" #include "qwebenginescriptcollection_p.h" diff --git a/src/core/api/qwebenginescriptcollection.h b/src/core/api/qwebenginescriptcollection.h index 35a35e266..a3b3c1c08 100644 --- a/src/core/api/qwebenginescriptcollection.h +++ b/src/core/api/qwebenginescriptcollection.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 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) 2020 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 #ifndef QWEBENGINESCRIPTCOLLECTION_H #define QWEBENGINESCRIPTCOLLECTION_H diff --git a/src/core/api/qwebenginescriptcollection_p.h b/src/core/api/qwebenginescriptcollection_p.h index 62444c78f..d675e128a 100644 --- a/src/core/api/qwebenginescriptcollection_p.h +++ b/src/core/api/qwebenginescriptcollection_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 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) 2020 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 #ifndef QWEBENGINESCRIPTCOLLECTION_P_H #define QWEBENGINESCRIPTCOLLECTION_P_H diff --git a/src/core/api/qwebenginesettings.cpp b/src/core/api/qwebenginesettings.cpp index 08f76b80e..e9f0eb4db 100644 --- a/src/core/api/qwebenginesettings.cpp +++ b/src/core/api/qwebenginesettings.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 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) 2020 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 "qwebenginesettings.h" #include "web_engine_settings.h" diff --git a/src/core/api/qwebenginesettings.h b/src/core/api/qwebenginesettings.h index ff1935616..09656f670 100644 --- a/src/core/api/qwebenginesettings.h +++ b/src/core/api/qwebenginesettings.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 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) 2022 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 #ifndef QWEBENGINESETTINGS_H #define QWEBENGINESETTINGS_H @@ -95,6 +59,7 @@ public: JavascriptCanPaste, DnsPrefetchEnabled, PdfViewerEnabled, + NavigateOnDropEnabled, }; enum FontSize { diff --git a/src/core/api/qwebengineurlrequestinfo.cpp b/src/core/api/qwebengineurlrequestinfo.cpp index 10661ec8f..e330a16d9 100644 --- a/src/core/api/qwebengineurlrequestinfo.cpp +++ b/src/core/api/qwebengineurlrequestinfo.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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) 2019 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 "qwebengineurlrequestinfo.h" #include "qwebengineurlrequestinfo_p.h" @@ -181,6 +145,7 @@ QWebEngineUrlRequestInfo::QWebEngineUrlRequestInfo(QWebEngineUrlRequestInfoPriva \value ResourceTypePluginResource A resource requested by a plugin. (Added in Qt 5.7) \value ResourceTypeNavigationPreloadMainFrame A main-frame service worker navigation preload request. (Added in Qt 5.14) \value ResourceTypeNavigationPreloadSubFrame A sub-frame service worker navigation preload request. (Added in Qt 5.14) + \value ResourceTypeWebSocket A WebSocket request. (Added in Qt 6.4) \value ResourceTypeUnknown Unknown request type. \note For forward compatibility all values not matched should be treated as unknown, diff --git a/src/core/api/qwebengineurlrequestinfo.h b/src/core/api/qwebengineurlrequestinfo.h index 658386632..125e5373c 100644 --- a/src/core/api/qwebengineurlrequestinfo.h +++ b/src/core/api/qwebengineurlrequestinfo.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef QWEBENGINEURLREQUESTINFO_H #define QWEBENGINEURLREQUESTINFO_H @@ -46,6 +10,7 @@ #include <QtCore/qurl.h> namespace QtWebEngineCore { +class ContentBrowserClientQt; class InterceptedRequest; } // namespace QtWebEngineCore @@ -81,6 +46,7 @@ public: #ifndef Q_QDOC ResourceTypeLast = ResourceTypeNavigationPreloadSubFrame, #endif + ResourceTypeWebSocket = 254, ResourceTypeUnknown = 255 }; @@ -108,6 +74,7 @@ public: void setHttpHeader(const QByteArray &name, const QByteArray &value); private: + friend class QtWebEngineCore::ContentBrowserClientQt; friend class QtWebEngineCore::InterceptedRequest; Q_DISABLE_COPY(QWebEngineUrlRequestInfo) Q_DECLARE_PRIVATE(QWebEngineUrlRequestInfo) diff --git a/src/core/api/qwebengineurlrequestinfo_p.h b/src/core/api/qwebengineurlrequestinfo_p.h index 05a89c5cf..ec9cdda69 100644 --- a/src/core/api/qwebengineurlrequestinfo_p.h +++ b/src/core/api/qwebengineurlrequestinfo_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef QWEBENGINEURLREQUESTINFO_P_H #define QWEBENGINEURLREQUESTINFO_P_H diff --git a/src/core/api/qwebengineurlrequestinterceptor.h b/src/core/api/qwebengineurlrequestinterceptor.h index a96ded1a3..98f135e73 100644 --- a/src/core/api/qwebengineurlrequestinterceptor.h +++ b/src/core/api/qwebengineurlrequestinterceptor.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef QWEBENINGEURLREQUESTINTERCEPTOR_H #define QWEBENINGEURLREQUESTINTERCEPTOR_H diff --git a/src/core/api/qwebengineurlrequestjob.cpp b/src/core/api/qwebengineurlrequestjob.cpp index 13c0310c7..6c0adfddf 100644 --- a/src/core/api/qwebengineurlrequestjob.cpp +++ b/src/core/api/qwebengineurlrequestjob.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 "qwebengineurlrequestjob.h" @@ -192,3 +156,5 @@ void QWebEngineUrlRequestJob::redirect(const QUrl &url) } QT_END_NAMESPACE + +#include "moc_qwebengineurlrequestjob.cpp" diff --git a/src/core/api/qwebengineurlrequestjob.h b/src/core/api/qwebengineurlrequestjob.h index c7128fd3c..79947ccc4 100644 --- a/src/core/api/qwebengineurlrequestjob.h +++ b/src/core/api/qwebengineurlrequestjob.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef QWEBENGINEURLREQUESTJOB_H #define QWEBENGINEURLREQUESTJOB_H diff --git a/src/core/api/qwebengineurlscheme.cpp b/src/core/api/qwebengineurlscheme.cpp index c187fc840..4af89c616 100644 --- a/src/core/api/qwebengineurlscheme.cpp +++ b/src/core/api/qwebengineurlscheme.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 "qwebengineurlscheme.h" @@ -415,3 +379,5 @@ void QWebEngineUrlScheme::lockSchemes() } QT_END_NAMESPACE + +#include "moc_qwebengineurlscheme.cpp" diff --git a/src/core/api/qwebengineurlscheme.h b/src/core/api/qwebengineurlscheme.h index e934f39d5..5b6e088cf 100644 --- a/src/core/api/qwebengineurlscheme.h +++ b/src/core/api/qwebengineurlscheme.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 #ifndef QWEBENGINEURLSCHEME_H #define QWEBENGINEURLSCHEME_H diff --git a/src/core/api/qwebengineurlschemehandler.cpp b/src/core/api/qwebengineurlschemehandler.cpp index aecee5044..e78a206d6 100644 --- a/src/core/api/qwebengineurlschemehandler.cpp +++ b/src/core/api/qwebengineurlschemehandler.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 "qwebengineurlschemehandler.h" @@ -125,3 +89,5 @@ QWebEngineUrlSchemeHandler::~QWebEngineUrlSchemeHandler() */ QT_END_NAMESPACE + +#include "moc_qwebengineurlschemehandler.cpp" diff --git a/src/core/api/qwebengineurlschemehandler.h b/src/core/api/qwebengineurlschemehandler.h index c1625d9d7..848904719 100644 --- a/src/core/api/qwebengineurlschemehandler.h +++ b/src/core/api/qwebengineurlschemehandler.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef QWEBENGINEURLSCHEMEHANDLER_H #define QWEBENGINEURLSCHEMEHANDLER_H diff --git a/src/core/authentication_dialog_controller.cpp b/src/core/authentication_dialog_controller.cpp index e37ffab44..5ed38ecbd 100644 --- a/src/core/authentication_dialog_controller.cpp +++ b/src/core/authentication_dialog_controller.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 "authentication_dialog_controller.h" #include "authentication_dialog_controller_p.h" diff --git a/src/core/authentication_dialog_controller.h b/src/core/authentication_dialog_controller.h index ef2f2c724..ea8d9035e 100644 --- a/src/core/authentication_dialog_controller.h +++ b/src/core/authentication_dialog_controller.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 // // W A R N I N G diff --git a/src/core/authentication_dialog_controller_p.h b/src/core/authentication_dialog_controller_p.h index 1abff576d..6c35a60dc 100644 --- a/src/core/authentication_dialog_controller_p.h +++ b/src/core/authentication_dialog_controller_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef AUTHENTICATION_DIALOG_CONTROLLER_P_H #define AUTHENTICATION_DIALOG_CONTROLLER_P_H diff --git a/src/core/autofill_client_qt.cpp b/src/core/autofill_client_qt.cpp new file mode 100644 index 000000000..fb3f726ae --- /dev/null +++ b/src/core/autofill_client_qt.cpp @@ -0,0 +1,132 @@ +// Copyright (C) 2022 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 "autofill_client_qt.h" + +#include "autofill_popup_controller.h" +#include "autofill_popup_controller_p.h" +#include "render_widget_host_view_qt.h" +#include "type_conversion.h" +#include "web_contents_adapter_client.h" +#include "web_contents_view_qt.h" + +#include "base/task/thread_pool.h" +#include "base/threading/thread_task_runner_handle.h" +#include "chrome/browser/profiles/profile.h" +#include "components/autofill/core/common/autofill_prefs.h" +#include "content/browser/web_contents/web_contents_impl.h" + +namespace QtWebEngineCore { + +AutofillClientQt::AutofillClientQt(content::WebContents *webContents) + : content::WebContentsUserData<AutofillClientQt>(*webContents) + , content::WebContentsObserver(webContents) + , m_popupController(new AutofillPopupController(new AutofillPopupControllerPrivate)) +{ +} + +AutofillClientQt::~AutofillClientQt() { } + +autofill::PersonalDataManager *AutofillClientQt::GetPersonalDataManager() +{ + return nullptr; +} + +autofill::AutocompleteHistoryManager *AutofillClientQt::GetAutocompleteHistoryManager() +{ + return nullptr; +} + +PrefService *AutofillClientQt::GetPrefs() +{ + return const_cast<PrefService *>(base::as_const(*this).GetPrefs()); +} + +const PrefService *AutofillClientQt::GetPrefs() const +{ + Profile *profile = Profile::FromBrowserContext(web_contents()->GetBrowserContext()); + return profile->GetPrefs(); +} + +void AutofillClientQt::ShowAutofillPopup(const autofill::AutofillClient::PopupOpenArgs &open_args, + base::WeakPtr<autofill::AutofillPopupDelegate> delegate) +{ + // Specific popups (personal, address, credit card, password) are not supported. + DCHECK(open_args.popup_type == autofill::PopupType::kUnspecified); + + m_popupController->d->delegate = delegate; + m_popupController->d->suggestions = open_args.suggestions; + m_popupController->updateModel(); + + adapterClient()->showAutofillPopup(m_popupController.data(), + QRect(toQt(gfx::ToEnclosingRect(open_args.element_bounds))), + open_args.autoselect_first_suggestion.value()); +} + +void AutofillClientQt::UpdateAutofillPopupDataListValues(const std::vector<std::u16string> &values, + const std::vector<std::u16string> &labels) +{ + Q_UNUSED(labels); + + if (values.empty()) + HideAutofillPopup(autofill::PopupHidingReason::kNoSuggestions); +} + +void AutofillClientQt::PinPopupView() +{ + // Called by password_manager component only. + NOTIMPLEMENTED(); +} + +autofill::AutofillClient::PopupOpenArgs AutofillClientQt::GetReopenPopupArgs() const +{ + // Called by password_manager component only. + NOTIMPLEMENTED(); + return autofill::AutofillClient::PopupOpenArgs(); +} + +base::span<const autofill::Suggestion> AutofillClientQt::GetPopupSuggestions() const +{ + // Called by password_manager component only. + NOTIMPLEMENTED(); + return base::span<const autofill::Suggestion>(); +} + +void AutofillClientQt::UpdatePopup(const std::vector<autofill::Suggestion> &, autofill::PopupType) +{ + // Called by password_manager component only. + NOTIMPLEMENTED(); +} + +void AutofillClientQt::HideAutofillPopup(autofill::PopupHidingReason) +{ + adapterClient()->hideAutofillPopup(); +} + +bool AutofillClientQt::IsAutocompleteEnabled() +{ + return autofill::prefs::IsAutocompleteEnabled(GetPrefs()); +} + +bool AutofillClientQt::IsPasswordManagerEnabled() +{ + return false; +} + +void AutofillClientQt::PropagateAutofillPredictions(content::RenderFrameHost *, + const std::vector<autofill::FormStructure *> &) +{ + // For testing purposes only. + NOTIMPLEMENTED(); +} + +WebContentsAdapterClient *AutofillClientQt::adapterClient() +{ + return WebContentsViewQt::from( + static_cast<content::WebContentsImpl *>(web_contents())->GetView()) + ->client(); +} + +WEB_CONTENTS_USER_DATA_KEY_IMPL(AutofillClientQt); + +} // namespace QtWebEngineCore diff --git a/src/core/autofill_client_qt.h b/src/core/autofill_client_qt.h new file mode 100644 index 000000000..967c4b227 --- /dev/null +++ b/src/core/autofill_client_qt.h @@ -0,0 +1,74 @@ +// Copyright (C) 2022 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 + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#ifndef AUTOFILL_CLIENT_QT_H +#define AUTOFILL_CLIENT_QT_H + +#include <string> +#include <vector> + +#include "base/memory/weak_ptr.h" +#include "components/autofill/core/browser/autofill_client.h" +#include "content/public/browser/web_contents_observer.h" +#include "content/public/browser/web_contents_user_data.h" + +#include <QScopedPointer> + +namespace QtWebEngineCore { + +class AutofillPopupController; +class WebContentsAdapterClient; + +class AutofillClientQt : public autofill::AutofillClient, + public content::WebContentsUserData<AutofillClientQt>, + public content::WebContentsObserver +{ +public: + ~AutofillClientQt() override; + + // autofill::AutofillClient overrides: + autofill::PersonalDataManager *GetPersonalDataManager() override; + autofill::AutocompleteHistoryManager *GetAutocompleteHistoryManager() override; + PrefService *GetPrefs() override; + const PrefService *GetPrefs() const override; + + void ShowAutofillPopup(const autofill::AutofillClient::PopupOpenArgs &open_args, + base::WeakPtr<autofill::AutofillPopupDelegate> delegate) override; + void UpdateAutofillPopupDataListValues(const std::vector<std::u16string> &values, + const std::vector<std::u16string> &labels) override; + void PinPopupView() override; + autofill::AutofillClient::PopupOpenArgs GetReopenPopupArgs() const override; + 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 IsPasswordManagerEnabled() override; + void PropagateAutofillPredictions(content::RenderFrameHost *, + const std::vector<autofill::FormStructure *> &) override; + + +private: + explicit AutofillClientQt(content::WebContents *webContents); + + WebContentsAdapterClient *adapterClient(); + + QScopedPointer<AutofillPopupController> m_popupController; + + WEB_CONTENTS_USER_DATA_KEY_DECL(); + friend class content::WebContentsUserData<AutofillClientQt>; +}; + +} // namespace QtWebEngineCore + +#endif // AUTOFILL_CLIENT_QT_H diff --git a/src/core/autofill_popup_controller.cpp b/src/core/autofill_popup_controller.cpp new file mode 100644 index 000000000..260b1ca8a --- /dev/null +++ b/src/core/autofill_popup_controller.cpp @@ -0,0 +1,114 @@ +// Copyright (C) 2022 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 "autofill_popup_controller.h" +#include "autofill_popup_controller_p.h" + +#include "components/autofill/core/browser/ui/autofill_popup_delegate.h" +#include "components/autofill/core/browser/ui/suggestion.h" + +namespace QtWebEngineCore { + +AutofillPopupController::AutofillPopupController(AutofillPopupControllerPrivate *dd) +{ + Q_ASSERT(dd); + d.reset(dd); +} + +AutofillPopupController::~AutofillPopupController() { } + +void AutofillPopupController::setCurrentIndex(const QModelIndex &index) +{ + if (m_currentIndex == index) + return; + + m_currentIndex = index; + + if (m_currentIndex.isValid()) { + const autofill::Suggestion &suggestion = d->suggestions[m_currentIndex.row()]; + d->delegate->DidSelectSuggestion(suggestion.value, suggestion.frontend_id, suggestion.backend_id); + } + + Q_EMIT currentIndexChanged(index); +} + +void AutofillPopupController::selectPreviousSuggestion() +{ + if (!m_currentIndex.isValid()) { + setCurrentIndex(m_model.index(m_model.rowCount() - 1, 0)); + return; + } + + if (m_currentIndex.row() == 0) { + selectLastSuggestion(); + return; + } + + setCurrentIndex(m_model.index(m_currentIndex.row() - 1, 0)); +} + +void AutofillPopupController::selectNextSuggestion() +{ + if (!m_currentIndex.isValid()) { + setCurrentIndex(m_model.index(0, 0)); + return; + } + + if (m_currentIndex.row() == m_model.rowCount() - 1) { + selectFirstSuggestion(); + return; + } + + setCurrentIndex(m_model.index(m_currentIndex.row() + 1, 0)); +} + +void AutofillPopupController::selectFirstSuggestion() +{ + setCurrentIndex(m_model.index(0, 0)); +} + +void AutofillPopupController::selectLastSuggestion() +{ + setCurrentIndex(m_model.index(m_model.rowCount() - 1, 0)); +} + +void AutofillPopupController::acceptSuggestion() +{ + if (!m_currentIndex.isValid()) + return; + + const int index = m_currentIndex.row(); + const autofill::Suggestion &suggestion = d->suggestions[index]; + d->delegate->DidAcceptSuggestion(suggestion.value, suggestion.frontend_id, + suggestion.backend_id, index); +} + +void AutofillPopupController::notifyPopupShown() +{ + d->delegate->OnPopupShown(); +} + +void AutofillPopupController::notifyPopupHidden() +{ + d->delegate->OnPopupHidden(); +} + +void AutofillPopupController::selectSuggestion(int index) +{ + if (index < 0) + setCurrentIndex(QModelIndex()); + else + setCurrentIndex(m_model.index(index, 0)); +} + +void AutofillPopupController::updateModel() +{ + QStringList values; + for (size_t i = 0; i < d->suggestions.size(); ++i) { + values.append(QString::fromStdU16String(d->suggestions[i].value)); + } + m_model.setStringList(values); + setCurrentIndex(QModelIndex()); +} + +} // namespace QtWebEngineCore diff --git a/src/core/autofill_popup_controller.h b/src/core/autofill_popup_controller.h new file mode 100644 index 000000000..586149b95 --- /dev/null +++ b/src/core/autofill_popup_controller.h @@ -0,0 +1,62 @@ +// Copyright (C) 2022 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 + +#ifndef AUTOFILL_POPUP_CONTROLLER_H +#define AUTOFILL_POPUP_CONTROLLER_H + +#include <QtWebEngineCore/private/qtwebenginecoreglobal_p.h> + +#include <QModelIndex> +#include <QObject> +#include <QScopedPointer> +#include <QStringListModel> + +namespace QtWebEngineCore { + +class AutofillPopupControllerPrivate; + +class Q_WEBENGINECORE_PRIVATE_EXPORT AutofillPopupController : public QObject +{ + Q_OBJECT + Q_PROPERTY(QStringListModel *model READ model CONSTANT FINAL) + +public: + ~AutofillPopupController(); + + QStringListModel *model() { return &m_model; } + + void selectPreviousSuggestion(); + void selectNextSuggestion(); + void selectFirstSuggestion(); + void selectLastSuggestion(); + + void notifyPopupShown(); + void notifyPopupHidden(); + +public Q_SLOTS: + void selectSuggestion(int index); + void acceptSuggestion(); + +Q_SIGNALS: + void currentIndexChanged(const QModelIndex &index); + +private: + AutofillPopupController(AutofillPopupControllerPrivate *); + QScopedPointer<AutofillPopupControllerPrivate> d; + + void setCurrentIndex(const QModelIndex &index); + + // Only called by AutofillClientQt: + void updateModel(); + + QStringListModel m_model; + QModelIndex m_currentIndex; + + friend class AutofillClientQt; +}; + +} // namespace QtWebEngineCore + +Q_DECLARE_METATYPE(QtWebEngineCore::AutofillPopupController *) + +#endif // AUTOFILL_POPUP_CONTROLLER_H diff --git a/src/core/autofill_popup_controller_p.h b/src/core/autofill_popup_controller_p.h new file mode 100644 index 000000000..886fe4dcd --- /dev/null +++ b/src/core/autofill_popup_controller_p.h @@ -0,0 +1,40 @@ +// Copyright (C) 2022 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 + +#ifndef AUTOFILL_POPUP_CONTROLLER_P_H +#define AUTOFILL_POPUP_CONTROLLER_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <vector> + +#include "base/memory/weak_ptr.h" +#include "components/autofill/core/browser/ui/suggestion.h" + +namespace autofill { +class AutofillPopupDelegate; +} + +namespace QtWebEngineCore { + +class AutofillPopupControllerPrivate +{ +public: + AutofillPopupControllerPrivate() = default; + + base::WeakPtr<autofill::AutofillPopupDelegate> delegate = nullptr; + std::vector<autofill::Suggestion> suggestions; +}; + +} // namespace QtWebEngineCore + +#endif // AUTOFILL_POPUP_CONTROLLER_P_H diff --git a/src/core/browser_accessibility_manager_qt.cpp b/src/core/browser_accessibility_manager_qt.cpp index c35f92d7f..7c16d54a0 100644 --- a/src/core/browser_accessibility_manager_qt.cpp +++ b/src/core/browser_accessibility_manager_qt.cpp @@ -1,47 +1,17 @@ -/**************************************************************************** -** -** 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 "browser_accessibility_manager_qt.h" +#include "qtwebenginecoreglobal_p.h" #include "content/browser/accessibility/browser_accessibility.h" #include "ui/accessibility/ax_enums.mojom.h" +#if QT_CONFIG(webengine_extensions) +#include "content/browser/renderer_host/render_frame_host_impl.h" +#include "content/public/browser/web_contents.h" +#endif // QT_CONFIG(webengine_extensions) + #include "browser_accessibility_qt.h" #include "render_widget_host_view_qt.h" @@ -60,6 +30,17 @@ BrowserAccessibilityManager *BrowserAccessibilityManager::Create( Q_ASSERT(delegate); QtWebEngineCore::WebContentsAccessibilityQt *access = nullptr; access = static_cast<QtWebEngineCore::WebContentsAccessibilityQt *>(delegate->AccessibilityGetWebContentsAccessibility()); + +#if QT_CONFIG(webengine_extensions) + // Accessibility is not supported for guest views. + if (!access) { + Q_ASSERT(content::WebContents::FromRenderFrameHost( + static_cast<content::RenderFrameHostImpl *>(delegate)) + ->GetOuterWebContents()); + return nullptr; + } +#endif // QT_CONFIG(webengine_extensions) + return new BrowserAccessibilityManagerQt(access, initialTree, delegate); #else return nullptr; @@ -108,7 +89,8 @@ QAccessibleInterface *BrowserAccessibilityManagerQt::rootParentAccessible() } void BrowserAccessibilityManagerQt::FireBlinkEvent(ax::mojom::Event event_type, - BrowserAccessibility* node) + BrowserAccessibility *node, + int action_request_id) { auto *iface = toQAccessibleInterface(node); diff --git a/src/core/browser_accessibility_manager_qt.h b/src/core/browser_accessibility_manager_qt.h index de0022a49..6cd3c84de 100644 --- a/src/core/browser_accessibility_manager_qt.h +++ b/src/core/browser_accessibility_manager_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef BROWSER_ACCESSIBILITY_MANAGER_QT_H #define BROWSER_ACCESSIBILITY_MANAGER_QT_H @@ -63,7 +27,8 @@ public: BrowserAccessibilityDelegate *delegate); ~BrowserAccessibilityManagerQt() override; void FireBlinkEvent(ax::mojom::Event event_type, - BrowserAccessibility* node) override; + BrowserAccessibility *node, + int action_request_id) override; void FireGeneratedEvent(ui::AXEventGenerator::Event event_type, BrowserAccessibility* node) override; diff --git a/src/core/browser_accessibility_qt.cpp b/src/core/browser_accessibility_qt.cpp index 7b4a02647..35d5b49d4 100644 --- a/src/core/browser_accessibility_qt.cpp +++ b/src/core/browser_accessibility_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2022 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) 2022 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be @@ -56,26 +20,20 @@ namespace QtWebEngineCore { class BrowserAccessibilityInterface; -} -namespace content { class BrowserAccessibilityQt - : public BrowserAccessibility + : public content::BrowserAccessibility { public: - BrowserAccessibilityQt(); + BrowserAccessibilityQt(content::BrowserAccessibilityManager *manager, ui::AXNode *node); ~BrowserAccessibilityQt(); - void Init(BrowserAccessibilityManager *manager, ui::AXNode *node) override; - QtWebEngineCore::BrowserAccessibilityInterface *interface() const { return m_interface; } private: QtWebEngineCore::BrowserAccessibilityInterface *m_interface = nullptr; }; -} // namespace content -namespace QtWebEngineCore { class BrowserAccessibilityInterface : public QAccessibleInterface , public QAccessibleActionInterface @@ -85,9 +43,8 @@ class BrowserAccessibilityInterface , public QAccessibleTableCellInterface { public: - BrowserAccessibilityInterface(content::BrowserAccessibilityQt *chromiumInterface); + BrowserAccessibilityInterface(BrowserAccessibilityQt *chromiumInterface); - void init(); void destroy(); // QAccessibleInterface @@ -149,7 +106,7 @@ public: int selectedCellCount() const override; int selectedColumnCount() const override; int selectedRowCount() const override; - QList<QAccessibleInterface*> selectedCells() const override; + QList<QAccessibleInterface *> selectedCells() const override; QList<int> selectedColumns() const override; QList<int> selectedRows() const override; bool isColumnSelected(int column) const override; @@ -161,71 +118,54 @@ public: // QAccessibleTableCellInterface int columnExtent() const override; - QList<QAccessibleInterface*> columnHeaderCells() const override; + QList<QAccessibleInterface *> columnHeaderCells() const override; int columnIndex() const override; int rowExtent() const override; - QList<QAccessibleInterface*> rowHeaderCells() const override; + QList<QAccessibleInterface *> rowHeaderCells() const override; int rowIndex() const override; bool isSelected() const override; - QAccessibleInterface* table() const override; + QAccessibleInterface *table() const override; void modelChange(QAccessibleTableModelChangeEvent *event) override; private: QObject *m_object = nullptr; QAccessible::Id m_id = 0; - content::BrowserAccessibilityQt *q; + BrowserAccessibilityQt *q; }; -} // namespace QtWebEngineCore - -namespace content { - -// static -BrowserAccessibility *BrowserAccessibility::Create() -{ - return new BrowserAccessibilityQt(); -} -QAccessibleInterface *toQAccessibleInterface(BrowserAccessibility *obj) +BrowserAccessibilityQt::BrowserAccessibilityQt(content::BrowserAccessibilityManager *manager, ui::AXNode *node) + : content::BrowserAccessibility(manager, node), + m_interface(new BrowserAccessibilityInterface(this)) { - return static_cast<BrowserAccessibilityQt *>(obj)->interface(); } -const QAccessibleInterface *toQAccessibleInterface(const BrowserAccessibility *obj) +BrowserAccessibilityQt::~BrowserAccessibilityQt() { - return static_cast<const BrowserAccessibilityQt *>(obj)->interface(); + m_interface->destroy(); } -BrowserAccessibilityQt::BrowserAccessibilityQt() - : m_interface(new QtWebEngineCore::BrowserAccessibilityInterface(this)) +BrowserAccessibilityInterface::BrowserAccessibilityInterface(BrowserAccessibilityQt *chromiumInterface) + : q(chromiumInterface) { -} + if (parent() && parent()->object()) { + m_object = new QObject(parent()->object()); + QString name = toQt(q->GetAuthorUniqueId()); + if (!name.isEmpty()) + m_object->setObjectName(name); + } -void BrowserAccessibilityQt::Init(BrowserAccessibilityManager *manager, ui::AXNode *node) -{ - BrowserAccessibility::Init(manager, node); - m_interface->init(); + m_id = QAccessible::registerAccessibleInterface(this); } -BrowserAccessibilityQt::~BrowserAccessibilityQt() +void BrowserAccessibilityInterface::destroy() { - m_interface->destroy(); + QAccessible::deleteAccessibleInterface(m_id); } -} // namespace content - -namespace QtWebEngineCore { - -using namespace blink; -using namespace content; - -BrowserAccessibilityInterface::BrowserAccessibilityInterface(content::BrowserAccessibilityQt *chromiumInterface) - : q(chromiumInterface) -{} - bool BrowserAccessibilityInterface::isValid() const { - auto managerQt = static_cast<BrowserAccessibilityManagerQt *>(q->manager()); + auto managerQt = static_cast<content::BrowserAccessibilityManagerQt *>(q->manager()); return managerQt && managerQt->isValid(); } @@ -289,15 +229,15 @@ void *BrowserAccessibilityInterface::interface_cast(QAccessible::InterfaceType t QAccessibleInterface *BrowserAccessibilityInterface::parent() const { - BrowserAccessibility *chromiumParent = q->PlatformGetParent(); + content::BrowserAccessibility *chromiumParent = q->PlatformGetParent(); if (chromiumParent) return toQAccessibleInterface(chromiumParent); - return static_cast<BrowserAccessibilityManagerQt*>(q->manager())->rootParentAccessible(); + return static_cast<content::BrowserAccessibilityManagerQt*>(q->manager())->rootParentAccessible(); } QAccessibleInterface *BrowserAccessibilityInterface::child(int index) const { - BrowserAccessibility *chromiumChild = q->PlatformGetChild(index); + content::BrowserAccessibility *chromiumChild = q->PlatformGetChild(index); return chromiumChild ? toQAccessibleInterface(chromiumChild) : nullptr; } @@ -352,6 +292,7 @@ QRect BrowserAccessibilityInterface::rect() const if (!q->manager()) // needed implicitly by GetScreenBoundsRect() return QRect(); gfx::Rect bounds = q->GetUnclippedScreenBoundsRect(); + bounds = gfx::ScaleToRoundedRect(bounds, 1.f / q->manager()->device_scale_factor()); // FIXME: check return QRect(bounds.x(), bounds.y(), bounds.width(), bounds.height()); } @@ -576,7 +517,50 @@ QAccessible::Role BrowserAccessibilityInterface::role() const case ax::mojom::Role::kMarquee: return QAccessible::Section; case ax::mojom::Role::kMath: + case ax::mojom::Role::kMathMLMath: return QAccessible::Equation; + case ax::mojom::Role::kMathMLFraction: + return QAccessible::Grouping; + case ax::mojom::Role::kMathMLIdentifier: + return QAccessible::StaticText; + case ax::mojom::Role::kMathMLMultiscripts: + return QAccessible::Section; + case ax::mojom::Role::kMathMLNoneScript: + return QAccessible::Section; + case ax::mojom::Role::kMathMLNumber: + return QAccessible::StaticText; + case ax::mojom::Role::kMathMLOperator: + return QAccessible::StaticText; + case ax::mojom::Role::kMathMLOver: + return QAccessible::Section; + case ax::mojom::Role::kMathMLPrescriptDelimiter: + return QAccessible::Section; + case ax::mojom::Role::kMathMLRoot: + return QAccessible::Section; + case ax::mojom::Role::kMathMLRow: + return QAccessible::Section; + case ax::mojom::Role::kMathMLSquareRoot: + return QAccessible::Section; + case ax::mojom::Role::kMathMLStringLiteral: + return QAccessible::StaticText; + case ax::mojom::Role::kMathMLSub: + return QAccessible::Section; + case ax::mojom::Role::kMathMLSubSup: + return QAccessible::Section; + case ax::mojom::Role::kMathMLSup: + return QAccessible::Section; + case ax::mojom::Role::kMathMLTable: + return QAccessible::Table; + case ax::mojom::Role::kMathMLTableCell: + return QAccessible::Cell; + case ax::mojom::Role::kMathMLTableRow: + return QAccessible::Row; + case ax::mojom::Role::kMathMLText: + return QAccessible::StaticText; + case ax::mojom::Role::kMathMLUnder: + return QAccessible::Section; + case ax::mojom::Role::kMathMLUnderOver: + return QAccessible::Section; case ax::mojom::Role::kMenu: return QAccessible::PopupMenu; case ax::mojom::Role::kMenuBar: @@ -653,10 +637,14 @@ QAccessible::Role BrowserAccessibilityInterface::role() const return QAccessible::Indicator; case ax::mojom::Role::kStrong: return QAccessible::StaticText; + case ax::mojom::Role::kSubscript: + return QAccessible::Grouping; case ax::mojom::Role::kSuggestion: return QAccessible::Section; + case ax::mojom::Role::kSuperscript: + return QAccessible::Grouping; case ax::mojom::Role::kSvgRoot: - return QAccessible::Graphic; + return QAccessible::WebDocument; case ax::mojom::Role::kSwitch: return QAccessible::Button; case ax::mojom::Role::kTable: @@ -798,26 +786,6 @@ QAccessible::State BrowserAccessibilityInterface::state() const return state; } -void BrowserAccessibilityInterface::init() -{ - if (m_id) - return; - Q_ASSERT(parent()); - Q_ASSERT(parent()->object()); - m_object = new QObject(parent()->object()); - QString name = toQt(q->GetAuthorUniqueId()); - if (!name.isEmpty()) - m_object->setObjectName(name); - - m_id = QAccessible::registerAccessibleInterface(this); -} - -void BrowserAccessibilityInterface::destroy() -{ - // delete this - QAccessible::deleteAccessibleInterface(m_id); -} - QStringList BrowserAccessibilityInterface::actionNames() const { QStringList actions; @@ -840,7 +808,7 @@ QStringList BrowserAccessibilityInterface::keyBindingsForAction(const QString &a void BrowserAccessibilityInterface::addSelection(int startOffset, int endOffset) { - q->manager()->SetSelection(BrowserAccessibility::AXRange(q->CreatePositionAt(startOffset), q->CreatePositionAt(endOffset))); + q->manager()->SetSelection(content::BrowserAccessibility::AXRange(q->CreatePositionAt(startOffset), q->CreatePositionAt(endOffset))); } QString BrowserAccessibilityInterface::attributes(int offset, int *startOffset, int *endOffset) const @@ -898,19 +866,19 @@ QString BrowserAccessibilityInterface::text(int startOffset, int endOffset) cons void BrowserAccessibilityInterface::removeSelection(int selectionIndex) { - q->manager()->SetSelection(BrowserAccessibility::AXRange(q->CreatePositionAt(0), q->CreatePositionAt(0))); + q->manager()->SetSelection(content::BrowserAccessibility::AXRange(q->CreatePositionAt(0), q->CreatePositionAt(0))); } void BrowserAccessibilityInterface::setCursorPosition(int position) { - q->manager()->SetSelection(BrowserAccessibility::AXRange(q->CreatePositionAt(position), q->CreatePositionAt(position))); + q->manager()->SetSelection(content::BrowserAccessibility::AXRange(q->CreatePositionAt(position), q->CreatePositionAt(position))); } void BrowserAccessibilityInterface::setSelection(int selectionIndex, int startOffset, int endOffset) { if (selectionIndex != 0) return; - q->manager()->SetSelection(BrowserAccessibility::AXRange(q->CreatePositionAt(startOffset), q->CreatePositionAt(endOffset))); + q->manager()->SetSelection(content::BrowserAccessibility::AXRange(q->CreatePositionAt(startOffset), q->CreatePositionAt(endOffset))); } int BrowserAccessibilityInterface::characterCount() const @@ -990,9 +958,9 @@ QAccessibleInterface *BrowserAccessibilityInterface::cellAt(int row, int column) return nullptr; absl::optional<int> cell_id = q->GetCellId(row, column); - BrowserAccessibility *cell = cell_id ? q->manager()->GetFromID(*cell_id) : nullptr; + content::BrowserAccessibility *cell = cell_id ? q->manager()->GetFromID(*cell_id) : nullptr; if (cell) - return toQAccessibleInterface(cell); + return content::toQAccessibleInterface(cell); return nullptr; } @@ -1136,18 +1104,39 @@ bool BrowserAccessibilityInterface::isSelected() const QAccessibleInterface *BrowserAccessibilityInterface::table() const { - BrowserAccessibility *find_table = q->PlatformGetParent(); + content::BrowserAccessibility *find_table = q->PlatformGetParent(); while (find_table && find_table->GetRole() != ax::mojom::Role::kTable) find_table = find_table->PlatformGetParent(); if (!find_table) return nullptr; - return toQAccessibleInterface(find_table); + return content::toQAccessibleInterface(find_table); } void BrowserAccessibilityInterface::modelChange(QAccessibleTableModelChangeEvent *) { } +} // namespace QtWebEngineCore + +namespace content { + +// static +std::unique_ptr<BrowserAccessibility> BrowserAccessibility::Create(BrowserAccessibilityManager *man, ui::AXNode *node) +{ + return std::unique_ptr<BrowserAccessibility>(new QtWebEngineCore::BrowserAccessibilityQt(man, node)); +} + +QAccessibleInterface *toQAccessibleInterface(BrowserAccessibility *obj) +{ + return static_cast<QtWebEngineCore::BrowserAccessibilityQt *>(obj)->interface(); +} + +const QAccessibleInterface *toQAccessibleInterface(const BrowserAccessibility *obj) +{ + return static_cast<const QtWebEngineCore::BrowserAccessibilityQt *>(obj)->interface(); +} + } // namespace content + #endif // QT_CONFIG(accessibility) diff --git a/src/core/browser_accessibility_qt.h b/src/core/browser_accessibility_qt.h index fba6c9146..478ce0f62 100644 --- a/src/core/browser_accessibility_qt.h +++ b/src/core/browser_accessibility_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2022 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) 2022 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 #ifndef BROWSER_ACCESSIBILITY_QT_H #define BROWSER_ACCESSIBILITY_QT_H diff --git a/src/core/browser_main_parts_qt.cpp b/src/core/browser_main_parts_qt.cpp index 6d03f1175..10fc29ebf 100644 --- a/src/core/browser_main_parts_qt.cpp +++ b/src/core/browser_main_parts_qt.cpp @@ -1,46 +1,11 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 "browser_main_parts_qt.h" #include "api/qwebenginemessagepumpscheduler_p.h" +#include "base/message_loop/message_pump.h" #include "base/message_loop/message_pump_for_ui.h" #include "base/process/process.h" #include "base/task/current_thread.h" @@ -51,8 +16,8 @@ #include "base/threading/thread_restrictions.h" #include "chrome/browser/tab_contents/form_interaction_tab_helper.h" #include "components/device_event_log/device_event_log.h" +#include "components/performance_manager/embedder/graph_features.h" #include "components/performance_manager/embedder/performance_manager_lifetime.h" -#include "components/performance_manager/embedder/performance_manager_registry.h" #include "components/performance_manager/public/graph/graph.h" #include "components/performance_manager/public/performance_manager.h" #include "content/public/browser/browser_main_parts.h" @@ -62,19 +27,24 @@ #include "content/public/common/content_features.h" #include "content/public/common/result_codes.h" #include "extensions/buildflags/buildflags.h" +#include "ppapi/buildflags/buildflags.h" +#include "select_file_dialog_factory_qt.h" +#include "services/service_manager/public/cpp/connector.h" +#include "services/service_manager/public/cpp/service.h" +#include "ui/display/screen.h" + #if BUILDFLAG(ENABLE_EXTENSIONS) -#include "content/public/browser/plugin_service.h" #include "extensions/common/constants.h" #include "extensions/common/extensions_client.h" #include "extensions/extensions_browser_client_qt.h" #include "extensions/extension_system_factory_qt.h" -#include "extensions/plugin_service_filter_qt.h" #include "common/extensions/extensions_client_qt.h" -#endif //BUILDFLAG(ENABLE_EXTENSIONS) -#include "select_file_dialog_factory_qt.h" -#include "services/service_manager/public/cpp/connector.h" -#include "services/service_manager/public/cpp/service.h" -#include "ui/display/screen.h" +#endif // BUILDFLAG(ENABLE_EXTENSIONS) + +#if BUILDFLAG(ENABLE_PLUGINS) +#include "content/public/browser/plugin_service.h" +#include "extensions/plugin_service_filter_qt.h" +#endif // BUILDFLAG(ENABLE_PLUGINS) #include "web_engine_context.h" #include "web_usb_detector_qt.h" @@ -86,7 +56,7 @@ #include <QOpenGLContext> #endif -#if defined(OS_MAC) +#if BUILDFLAG(IS_MAC) #include "base/message_loop/message_pump_mac.h" #include "services/device/public/cpp/geolocation/geolocation_manager.h" #include "ui/base/idle/idle.h" @@ -147,9 +117,14 @@ public: m_scheduler.scheduleWork(); } - void ScheduleDelayedWork(const base::TimeTicks &delayed_work_time) override + void ScheduleDelayedWork(const Delegate::NextWorkInfo &next_work_info) override { // NOTE: This method may called from any thread at any time. + ScheduleDelayedWork(next_work_info.delayed_run_time); + } + + void ScheduleDelayedWork(const base::TimeTicks &delayed_work_time) + { ensureDelegate(); m_scheduler.scheduleDelayedWork(GetTimeIntervalMilliseconds(delayed_work_time)); } @@ -227,7 +202,7 @@ private: QWebEngineMessagePumpScheduler m_scheduler; }; -#if defined(OS_MAC) +#if BUILDFLAG(IS_MAC) class FakeGeolocationManager : public device::GeolocationManager { public: @@ -242,7 +217,7 @@ public: return device::LocationSystemPermissionStatus::kDenied; } }; -#endif // defined(OS_MAC) +#endif // BUILDFLAG(IS_MAC) std::unique_ptr<base::MessagePump> messagePumpFactory() { @@ -251,7 +226,7 @@ std::unique_ptr<base::MessagePump> messagePumpFactory() madePrimaryPump = true; return std::make_unique<MessagePumpForUIQt>(); } -#if defined(OS_MAC) +#if BUILDFLAG(IS_MAC) return base::MessagePumpMac::Create(); #else return std::make_unique<base::MessagePumpForUI>(); @@ -268,7 +243,7 @@ int BrowserMainPartsQt::PreEarlyInitialization() void BrowserMainPartsQt::PreCreateMainMessageLoop() { -#if defined(OS_MAC) +#if BUILDFLAG(IS_MAC) m_geolocationManager = std::make_unique<FakeGeolocationManager>(); #endif } @@ -287,10 +262,12 @@ int BrowserMainPartsQt::PreMainMessageLoopRun() extensions::ExtensionsClient::Set(new extensions::ExtensionsClientQt()); extensions::ExtensionsBrowserClient::Set(new extensions::ExtensionsBrowserClientQt()); extensions::ExtensionSystemFactoryQt::GetInstance(); +#endif // BUILDFLAG(ENABLE_EXTENSIONS) +#if BUILDFLAG(ENABLE_PLUGINS) content::PluginService *plugin_service = content::PluginService::GetInstance(); plugin_service->SetFilter(extensions::PluginServiceFilterQt::GetInstance()); -#endif //ENABLE_EXTENSIONS +#endif // BUILDFLAG(ENABLE_PLUGINS) if (base::FeatureList::IsEnabled(features::kWebUsb)) { m_webUsbDetector.reset(new WebUsbDetectorQt()); @@ -304,9 +281,7 @@ int BrowserMainPartsQt::PreMainMessageLoopRun() void BrowserMainPartsQt::PostMainMessageLoopRun() { - performance_manager_registry_->TearDown(); - performance_manager_registry_.reset(); - performance_manager::DestroyPerformanceManager(std::move(performance_manager_)); + performance_manager_lifetime_.reset(); m_webUsbDetector.reset(); @@ -317,15 +292,15 @@ void BrowserMainPartsQt::PostMainMessageLoopRun() int BrowserMainPartsQt::PreCreateThreads() { - base::ThreadRestrictions::SetIOAllowed(true); - -#if defined(OS_MAC) +#if BUILDFLAG(IS_MAC) ui::InitIdleMonitor(); #endif // Like ChromeBrowserMainExtraPartsViews::PreCreateThreads does. #if defined(Q_OS_WIN) display::Screen::SetScreenInstance(new display::win::ScreenWin); +#elif defined(Q_OS_DARWIN) + display::Screen::SetScreenInstance(display::CreateNativeScreen()); #else display::Screen::SetScreenInstance(new DesktopScreenQt); #endif @@ -339,13 +314,13 @@ static void CreatePoliciesAndDecorators(performance_manager::Graph *graph) void BrowserMainPartsQt::PostCreateThreads() { - performance_manager_ = - performance_manager::CreatePerformanceManagerWithDefaultDecorators( - base::BindOnce(&QtWebEngineCore::CreatePoliciesAndDecorators)); - performance_manager_registry_ = performance_manager::PerformanceManagerRegistry::Create(); + performance_manager_lifetime_ = + std::make_unique<performance_manager::PerformanceManagerLifetime>( + performance_manager::GraphFeatures::WithDefault(), + base::BindOnce(&QtWebEngineCore::CreatePoliciesAndDecorators)); } -#if defined(OS_MAC) +#if BUILDFLAG(IS_MAC) device::GeolocationManager *BrowserMainPartsQt::GetGeolocationManager() { return m_geolocationManager.get(); diff --git a/src/core/browser_main_parts_qt.h b/src/core/browser_main_parts_qt.h index 1ee392e7b..6828552b7 100644 --- a/src/core/browser_main_parts_qt.h +++ b/src/core/browser_main_parts_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 #ifndef BROWSER_MAIN_PARTS_QT_H #define BROWSER_MAIN_PARTS_QT_H @@ -57,8 +21,7 @@ class GeolocationManager; } namespace performance_manager { -class PerformanceManager; -class PerformanceManagerRegistry; +class PerformanceManagerLifetime; } namespace QtWebEngineCore { @@ -79,16 +42,14 @@ public: int PreCreateThreads() override; void PostCreateThreads() override; -#if defined(OS_MAC) +#if BUILDFLAG(IS_MAC) device::GeolocationManager *GetGeolocationManager(); #endif private: - DISALLOW_COPY_AND_ASSIGN(BrowserMainPartsQt); - std::unique_ptr<performance_manager::PerformanceManager> performance_manager_; - std::unique_ptr<performance_manager::PerformanceManagerRegistry> performance_manager_registry_; + std::unique_ptr<performance_manager::PerformanceManagerLifetime> performance_manager_lifetime_; std::unique_ptr<WebUsbDetectorQt> m_webUsbDetector; -#if defined(OS_MAC) +#if BUILDFLAG(IS_MAC) std::unique_ptr<device::GeolocationManager> m_geolocationManager; #endif }; diff --git a/src/core/browser_message_filter_qt.cpp b/src/core/browser_message_filter_qt.cpp index 118b0eeb7..e8fcb994a 100644 --- a/src/core/browser_message_filter_qt.cpp +++ b/src/core/browser_message_filter_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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) 2019 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 "browser_message_filter_qt.h" diff --git a/src/core/browser_message_filter_qt.h b/src/core/browser_message_filter_qt.h index c6e4e8d9d..53c48eb6e 100644 --- a/src/core/browser_message_filter_qt.h +++ b/src/core/browser_message_filter_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef BROWSER_MESSAGE_FILTER_QT_H #define BROWSER_MESSAGE_FILTER_QT_H diff --git a/src/core/browsing_data_remover_delegate_qt.cpp b/src/core/browsing_data_remover_delegate_qt.cpp index 6e79ab6c6..bbfd902ec 100644 --- a/src/core/browsing_data_remover_delegate_qt.cpp +++ b/src/core/browsing_data_remover_delegate_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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) 2017 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 "browsing_data_remover_delegate_qt.h" diff --git a/src/core/browsing_data_remover_delegate_qt.h b/src/core/browsing_data_remover_delegate_qt.h index a10409f39..4e690ffb1 100644 --- a/src/core/browsing_data_remover_delegate_qt.h +++ b/src/core/browsing_data_remover_delegate_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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) 2017 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 #ifndef BROWSING_DATA_REMOVER_DELEGATE_QT_H #define BROWSING_DATA_REMOVER_DELEGATE_QT_H diff --git a/src/core/build_config_qt.h b/src/core/build_config_qt.h index 9c7a77d65..5f6978e13 100644 --- a/src/core/build_config_qt.h +++ b/src/core/build_config_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 #ifndef BUILD_CONFIG_QT #define BUILD_CONFIG_QT diff --git a/src/core/certificate_error_controller.cpp b/src/core/certificate_error_controller.cpp index 1151fb5c5..014d74500 100644 --- a/src/core/certificate_error_controller.cpp +++ b/src/core/certificate_error_controller.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 "certificate_error_controller.h" @@ -78,9 +42,10 @@ ASSERT_ENUMS_MATCH(QWebEngineCertificateError::CertificateSymantecLegacy, net::ERR_CERT_SYMANTEC_LEGACY) ASSERT_ENUMS_MATCH(QWebEngineCertificateError::CertificateKnownInterceptionBlocked, net::ERR_CERT_KNOWN_INTERCEPTION_BLOCKED) -ASSERT_ENUMS_MATCH(QWebEngineCertificateError::SslObsoleteVersion, - net::ERR_SSL_OBSOLETE_VERSION) -// ASSERT_ENUMS_MATCH(QWebEngineCertificateError::CertificateErrorEnd, net::ERR_CERT_END) +// net::ERR_SSL_OBSOLETE_VERSION was removed again in Chromium 98 +//ASSERT_ENUMS_MATCH(QWebEngineCertificateError::SslObsoleteVersion, +// net::ERR_SSL_OBSOLETE_VERSION) +//ASSERT_ENUMS_MATCH(QWebEngineCertificateError::CertificateErrorEnd, net::ERR_CERT_END) // Copied from chrome/browser/ssl/ssl_error_handler.cc: static int IsCertErrorFatal(int cert_error) @@ -98,7 +63,6 @@ static int IsCertErrorFatal(int cert_error) case net::ERR_CERTIFICATE_TRANSPARENCY_REQUIRED: case net::ERR_CERT_SYMANTEC_LEGACY: case net::ERR_CERT_KNOWN_INTERCEPTION_BLOCKED: - case net::ERR_SSL_OBSOLETE_VERSION: return false; case net::ERR_CERT_CONTAINS_ERRORS: case net::ERR_CERT_REVOKED: diff --git a/src/core/certificate_error_controller.h b/src/core/certificate_error_controller.h index ec3e26806..b61845e7b 100644 --- a/src/core/certificate_error_controller.h +++ b/src/core/certificate_error_controller.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 // // W A R N I N G diff --git a/src/core/chromium_overrides.cpp b/src/core/chromium_overrides.cpp index 7a5ea3737..3a183d0d8 100644 --- a/src/core/chromium_overrides.cpp +++ b/src/core/chromium_overrides.cpp @@ -1,74 +1,24 @@ -/**************************************************************************** -** -** 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/renderer_host/render_widget_host_view_base.h" #include "content/browser/web_contents/web_contents_impl.h" #include "content/common/font_list.h" +#include "extensions/buildflags/buildflags.h" +#include "extensions/common/constants.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/gfx/render_text.h" -#include "ui/gfx/platform_font.h" -#endif - -#if defined(USE_OPENSSL_CERTS) -#include "net/ssl/openssl_client_key_store.h" -#endif - #if !QT_CONFIG(webengine_webrtc) && QT_CONFIG(webengine_extensions) #include "chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.h" #endif @@ -79,7 +29,6 @@ void *GetQtXDisplay() } namespace content { -class WebContentsImpl; class WebContentsView; class WebContentsViewDelegate; class RenderViewHostDelegateView; @@ -93,7 +42,7 @@ WebContentsView* CreateWebContentsView(WebContentsImpl *web_contents, return rv; } -#if defined(OS_MAC) +#if defined(Q_OS_DARWIN) #if defined(QT_MAC_FRAMEWORK_BUILD) base::FilePath getSandboxPath() { @@ -119,8 +68,8 @@ std::unique_ptr<base::ListValue> GetFontList_SlowBlocking() for (auto family : QFontDatabase::families()){ std::unique_ptr<base::ListValue> font_item(new base::ListValue()); - font_item->AppendString(family.toStdString()); - font_item->AppendString(family.toStdString()); // localized name. + 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)); } @@ -149,6 +98,12 @@ std::unique_ptr<ui::OSExchangeDataProvider> ui::OSExchangeDataProviderFactory::C return nullptr; } +#if !BUILDFLAG(ENABLE_EXTENSIONS) +namespace extensions { + const char kExtensionScheme[] = "chrome-extension"; +} +#endif + #if !QT_CONFIG(webengine_webrtc) && QT_CONFIG(webengine_extensions) namespace extensions { ExtensionFunction::ResponseAction WebrtcLoggingPrivateSetMetaDataFunction::Run() diff --git a/src/core/client_cert_select_controller.cpp b/src/core/client_cert_select_controller.cpp index b515fd418..a4ce6f6da 100644 --- a/src/core/client_cert_select_controller.cpp +++ b/src/core/client_cert_select_controller.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 "client_cert_select_controller.h" @@ -45,6 +9,7 @@ #include <net/ssl/client_cert_identity.h> #include <net/ssl/ssl_cert_request_info.h> #include <net/ssl/ssl_info.h> +#include "net/ssl/ssl_private_key.h" #include "type_conversion.h" diff --git a/src/core/client_cert_select_controller.h b/src/core/client_cert_select_controller.h index e98c15802..4807f11f1 100644 --- a/src/core/client_cert_select_controller.h +++ b/src/core/client_cert_select_controller.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 // // W A R N I N G diff --git a/src/core/clipboard_change_observer.h b/src/core/clipboard_change_observer.h index 2ba189c97..33a382fbe 100644 --- a/src/core/clipboard_change_observer.h +++ b/src/core/clipboard_change_observer.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 #ifndef CLIPBOARD_CHANGE_OBSERVER_H #define CLIPBOARD_CHANGE_OBSERVER_H diff --git a/src/core/clipboard_qt.cpp b/src/core/clipboard_qt.cpp index e69148ce4..69690dd99 100644 --- a/src/core/clipboard_qt.cpp +++ b/src/core/clipboard_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be @@ -54,10 +18,13 @@ #include "ui/base/clipboard/clipboard_monitor.h" #include "ui/base/clipboard/clipboard_constants.h" #include "ui/base/clipboard/clipboard_format_type.h" +#include "ui/base/data_transfer_policy/data_transfer_endpoint.h" #include "ui/base/ui_base_features.h" +#include <QBuffer> #include <QGuiApplication> #include <QImage> +#include <QImageWriter> #include <QMimeData> namespace QtWebEngineCore { @@ -230,6 +197,9 @@ bool ClipboardQt::IsFormatAvailable(const ui::ClipboardFormatType &format, { const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData( type == ui::ClipboardBuffer::kCopyPaste ? QClipboard::Clipboard : QClipboard::Selection); + + if (format == ui::ClipboardFormatType::BitmapType()) + return mimeData && mimeData->hasImage(); return mimeData && mimeData->hasFormat(QString::fromStdString(format.GetName())); } @@ -347,38 +317,21 @@ void ClipboardQt::ReadRTF(ui::ClipboardBuffer type, *result = std::string(byteArray.constData(), byteArray.length()); } -void ClipboardQt::ReadImage(ui::ClipboardBuffer type, - const ui::DataTransferEndpoint *data_dst, - ReadImageCallback callback) const +void ClipboardQt::ReadPng(ui::ClipboardBuffer type, const ui::DataTransferEndpoint *, ui::Clipboard::ReadPngCallback callback) const { const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData( type == ui::ClipboardBuffer::kCopyPaste ? QClipboard::Clipboard : QClipboard::Selection); if (!mimeData) - return std::move(callback).Run(SkBitmap()); + return std::move(callback).Run({}); QImage image = qvariant_cast<QImage>(mimeData->imageData()); - image = image.convertToFormat(QImage::Format_ARGB32); - SkBitmap bitmap; - - bitmap.allocN32Pixels(image.width(), image.height(), true); - const size_t bytesPerRowDst = bitmap.rowBytes(); - const size_t bytesPerLineSrc = static_cast<size_t>(image.bytesPerLine()); - const size_t dataBytes = std::min(bytesPerRowDst, bytesPerLineSrc); - uchar *dst = static_cast<uchar *>(bitmap.getPixels()); - const uchar *src = image.constBits(); - for (int y = 0; y < image.height(); ++y) { - memcpy(dst, src, dataBytes); - dst += bytesPerRowDst; - src += bytesPerLineSrc; - } - - return std::move(callback).Run(bitmap); -} - -void ClipboardQt::ReadPng(ui::ClipboardBuffer type, const ui::DataTransferEndpoint *, ui::Clipboard::ReadPngCallback callback) const -{ - // TODO(crbug.com/1201018): Implement this. - NOTIMPLEMENTED(); + QBuffer buffer; + QImageWriter writer(&buffer, "png"); + writer.write(image); + std::vector<uint8_t> pngData; + pngData.resize(buffer.size()); + memcpy(pngData.data(), buffer.data().data(), buffer.size()); + return std::move(callback).Run(std::move(pngData)); } void ClipboardQt::ReadCustomData(ui::ClipboardBuffer clipboard_type, const std::u16string &type, @@ -475,17 +428,23 @@ bool ClipboardQt::IsSelectionBufferAvailable() const } #endif -std::vector<std::u16string> ClipboardQt::ReadAvailablePlatformSpecificFormatNames(ui::ClipboardBuffer buffer, const ui::DataTransferEndpoint *data_dst) const +// This is the same as ReadAvailableTypes minus dealing with custom-data +std::vector<std::u16string> ClipboardQt::GetStandardFormats(ui::ClipboardBuffer buffer, const ui::DataTransferEndpoint *data_dst) const { Q_UNUSED(data_dst); const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData( buffer == ui::ClipboardBuffer::kCopyPaste ? QClipboard::Clipboard : QClipboard::Selection); if (!mimeData) return {}; + std::vector<std::u16string> types; const QStringList formats = mimeData->formats(); - for (const QString &mimeType : formats) - types.push_back(toString16(mimeType)); + if (mimeData->hasImage() && !formats.contains(QStringLiteral("image/png"))) + types.push_back(toString16(QStringLiteral("image/png"))); + for (const QString &mimeType : formats) { + if (mimeType != QString::fromLatin1(ui::kMimeTypeWebCustomData)) + types.push_back(toString16(mimeType)); + } return types; } diff --git a/src/core/clipboard_qt.h b/src/core/clipboard_qt.h index a9a1ef7d8..0351112e6 100644 --- a/src/core/clipboard_qt.h +++ b/src/core/clipboard_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef CLIPBOARD_QT_H #define CLIPBOARD_QT_H @@ -60,7 +24,6 @@ public: void ReadHTML(ui::ClipboardBuffer type, const ui::DataTransferEndpoint *data_dst, std::u16string *markup, std::string *src_url, uint32_t *fragment_start, uint32_t *fragment_end) const override; void ReadRTF(ui::ClipboardBuffer type, const ui::DataTransferEndpoint *data_dst, std::string *result) const override; - void ReadImage(ui::ClipboardBuffer buffer, const ui::DataTransferEndpoint *data_dst, ReadImageCallback callback) const override; void ReadCustomData(ui::ClipboardBuffer clipboard_type, const std::u16string &type, const ui::DataTransferEndpoint *data_dst, std::u16string *result) const override; void ReadBookmark(const ui::DataTransferEndpoint *data_dst, std::u16string *title, std::string *url) const override; void ReadData(const ui::ClipboardFormatType &format, const ui::DataTransferEndpoint *data_dst, std::string *result) const override; @@ -70,8 +33,8 @@ public: void OnPreShutdown() override {} void ReadSvg(ui::ClipboardBuffer, const ui::DataTransferEndpoint *, std::u16string *) const override; void ReadPng(ui::ClipboardBuffer, const ui::DataTransferEndpoint *, ui::Clipboard::ReadPngCallback) const override; - std::vector<std::u16string> ReadAvailablePlatformSpecificFormatNames(ui::ClipboardBuffer buffer, const ui::DataTransferEndpoint *data_dst) const override; + std::vector<std::u16string> GetStandardFormats(ui::ClipboardBuffer buffer, const ui::DataTransferEndpoint *data_dst) const override; const ui::DataTransferEndpoint *GetSource(ui::ClipboardBuffer buffer) const override; void ReadFilenames(ui::ClipboardBuffer buffer, diff --git a/src/core/clipboard_util_win.cpp b/src/core/clipboard_util_win.cpp index ae615b3b6..601e44180 100644 --- a/src/core/clipboard_util_win.cpp +++ b/src/core/clipboard_util_win.cpp @@ -1,31 +1,6 @@ -/* - * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - +// Copyright (C) 2007, 2008 Apple Inc. All rights reserved. // Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE.Chromium file. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause #include <string> diff --git a/src/core/color_chooser_controller.cpp b/src/core/color_chooser_controller.cpp index 361ff93ba..fcaef2eba 100644 --- a/src/core/color_chooser_controller.cpp +++ b/src/core/color_chooser_controller.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 "content/browser/web_contents/web_contents_impl.h" @@ -101,5 +65,4 @@ void ColorChooserController::reject() didEndColorDialog(); } - -} // namespace +} // namespace QtWebEngineCore diff --git a/src/core/color_chooser_controller.h b/src/core/color_chooser_controller.h index 493847f4e..7eafc143a 100644 --- a/src/core/color_chooser_controller.h +++ b/src/core/color_chooser_controller.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 // // W A R N I N G @@ -83,6 +47,6 @@ private: friend class ColorChooserQt; }; -} // namespace +} // namespace QtWebEngineCore #endif // COLOR_CHOOSER_CONTROLLER_H diff --git a/src/core/color_chooser_controller_p.h b/src/core/color_chooser_controller_p.h index a03167f21..45eeb9471 100644 --- a/src/core/color_chooser_controller_p.h +++ b/src/core/color_chooser_controller_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef COLOR_CHOOSER_CONTROLLER_P_H #define COLOR_CHOOSER_CONTROLLER_P_H @@ -54,7 +18,7 @@ #include <QColor> namespace content { - class WebContents; +class WebContents; } namespace QtWebEngineCore { @@ -67,7 +31,7 @@ public: QColor m_initialColor; }; -} // namespace +} // namespace QtWebEngineCore #endif // COLOR_CHOOSER_CONTROLLER_P_H diff --git a/src/core/color_chooser_qt.cpp b/src/core/color_chooser_qt.cpp index 749d04148..de2e833a0 100644 --- a/src/core/color_chooser_qt.cpp +++ b/src/core/color_chooser_qt.cpp @@ -1,49 +1,11 @@ -/**************************************************************************** -** -** 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 "color_chooser_qt.h" #include "color_chooser_controller.h" #include "color_chooser_controller_p.h" -namespace content { - class WebContents; -} +#include <QColor> namespace QtWebEngineCore { @@ -57,4 +19,4 @@ QSharedPointer<ColorChooserController> ColorChooserQt::controller() return m_controller; } -} // namespace +} // namespace QtWebEngineCore diff --git a/src/core/color_chooser_qt.h b/src/core/color_chooser_qt.h index 200db3266..dde9a51ce 100644 --- a/src/core/color_chooser_qt.h +++ b/src/core/color_chooser_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef COLOR_CHOOSER_QT_H #define COLOR_CHOOSER_QT_H @@ -43,11 +7,12 @@ #include "content/public/browser/color_chooser.h" #include "type_conversion.h" -#include <QColor> #include <QSharedPointer> +QT_FORWARD_DECLARE_CLASS(QColor) + namespace content { - class WebContents; +class WebContents; } namespace QtWebEngineCore { @@ -68,7 +33,6 @@ private: QSharedPointer<ColorChooserController> m_controller; }; - -} // namespace +} // namespace QtWebEngineCore #endif // COLOR_CHOOSER_QT_H diff --git a/src/core/common/extensions/extensions_api_provider_qt.cpp b/src/core/common/extensions/extensions_api_provider_qt.cpp index 81eb76f3e..1c8e89747 100644 --- a/src/core/common/extensions/extensions_api_provider_qt.cpp +++ b/src/core/common/extensions/extensions_api_provider_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 "extensions_api_provider_qt.h" diff --git a/src/core/common/extensions/extensions_api_provider_qt.h b/src/core/common/extensions/extensions_api_provider_qt.h index 7d8c5f98b..34e8bdd9f 100644 --- a/src/core/common/extensions/extensions_api_provider_qt.h +++ b/src/core/common/extensions/extensions_api_provider_qt.h @@ -1,48 +1,10 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 #ifndef EXTENSIONS_API_PROVIDER_QT_H #define EXTENSIONS_API_PROVIDER_QT_H #include "extensions/common/extensions_api_provider.h" -#include "base/macros.h" - namespace extensions { class ExtensionsAPIProviderQt : public ExtensionsAPIProvider @@ -64,8 +26,6 @@ public: // Registers permissions for any associated API features. void RegisterPermissions(PermissionsInfo* permissions_info) override; - -DISALLOW_COPY_AND_ASSIGN(ExtensionsAPIProviderQt); }; } diff --git a/src/core/common/extensions/extensions_client_qt.cpp b/src/core/common/extensions/extensions_client_qt.cpp index c4cc2321a..30d1836ca 100644 --- a/src/core/common/extensions/extensions_client_qt.cpp +++ b/src/core/common/extensions/extensions_client_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 // Portions copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be @@ -153,7 +117,7 @@ const GURL &ExtensionsClientQt::GetWebstoreUpdateURL() const // Returns a flag indicating whether or not a given URL is a valid // extension blacklist URL. -bool ExtensionsClientQt::IsBlacklistUpdateURL(const GURL &url) const +bool ExtensionsClientQt::IsBlocklistUpdateURL(const GURL &url) const { return true; } diff --git a/src/core/common/extensions/extensions_client_qt.h b/src/core/common/extensions/extensions_client_qt.h index 2466e14e3..b0069db22 100644 --- a/src/core/common/extensions/extensions_client_qt.h +++ b/src/core/common/extensions/extensions_client_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 // Portions copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be @@ -46,9 +10,7 @@ #include "extensions/common/extensions_client.h" -#include "base/compiler_specific.h" #include "base/lazy_instance.h" -#include "base/macros.h" #include "chrome/common/extensions/permissions/chrome_permission_message_provider.h" #include "extensions/common/features/feature_provider.h" #include "extensions/common/features/json_feature_provider_source.h" @@ -110,7 +72,7 @@ public: // Returns a flag indicating whether or not a given URL is a valid // extension blacklist URL. - bool IsBlacklistUpdateURL(const GURL &url) const override; + bool IsBlocklistUpdateURL(const GURL &url) const override; // Returns the set of file paths corresponding to any images within an // extension's contents that may be displayed directly within the browser UI @@ -131,7 +93,6 @@ private: const ChromePermissionMessageProvider permission_message_provider_; mutable GURL update_url_; mutable GURL base_url_; - DISALLOW_COPY_AND_ASSIGN(ExtensionsClientQt); }; } // namespace extensions diff --git a/src/core/common/qt_messages.cpp b/src/core/common/qt_messages.cpp index 2f087d21f..bc3a1560d 100644 --- a/src/core/common/qt_messages.cpp +++ b/src/core/common/qt_messages.cpp @@ -1,6 +1,5 @@ // Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE.Chromium file. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause // Get basic type definitions. #define IPC_MESSAGE_IMPL diff --git a/src/core/common/qt_messages.h b/src/core/common/qt_messages.h index 940019c16..17adcbb0d 100644 --- a/src/core/common/qt_messages.h +++ b/src/core/common/qt_messages.h @@ -1,6 +1,5 @@ // Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE.Chromium file. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause // Multiply-included file, no traditional include guard. diff --git a/src/core/compositor/compositor.cpp b/src/core/compositor/compositor.cpp index 655126f20..ada039afc 100644 --- a/src/core/compositor/compositor.cpp +++ b/src/core/compositor/compositor.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 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) 2020 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 "compositor.h" diff --git a/src/core/compositor/compositor.h b/src/core/compositor/compositor.h index b0c7d212e..9cadab4d4 100644 --- a/src/core/compositor/compositor.h +++ b/src/core/compositor/compositor.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 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) 2020 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 #ifndef COMPOSITOR_H #define COMPOSITOR_H diff --git a/src/core/compositor/compositor_resource_fence.cpp b/src/core/compositor/compositor_resource_fence.cpp index d03e260d6..bd1c95cd9 100644 --- a/src/core/compositor/compositor_resource_fence.cpp +++ b/src/core/compositor/compositor_resource_fence.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 "compositor_resource_fence.h" #include "ozone/gl_surface_qt.h" diff --git a/src/core/compositor/compositor_resource_fence.h b/src/core/compositor/compositor_resource_fence.h index 574416b8b..ab92ca5c7 100644 --- a/src/core/compositor/compositor_resource_fence.h +++ b/src/core/compositor/compositor_resource_fence.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 #ifndef COMPOSITOR_RESOURCE_FENCE_H #define COMPOSITOR_RESOURCE_FENCE_H diff --git a/src/core/compositor/content_gpu_client_qt.cpp b/src/core/compositor/content_gpu_client_qt.cpp index f934979a0..4c022dc7f 100644 --- a/src/core/compositor/content_gpu_client_qt.cpp +++ b/src/core/compositor/content_gpu_client_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 "content_gpu_client_qt.h" diff --git a/src/core/compositor/content_gpu_client_qt.h b/src/core/compositor/content_gpu_client_qt.h index d7ad43881..75d9d68be 100644 --- a/src/core/compositor/content_gpu_client_qt.h +++ b/src/core/compositor/content_gpu_client_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 #ifndef CONTENT_GPU_CLIENT_QT_H #define CONTENT_GPU_CLIENT_QT_H diff --git a/src/core/compositor/display_gl_output_surface.cpp b/src/core/compositor/display_gl_output_surface.cpp index cdc93ce62..a13dc2f35 100644 --- a/src/core/compositor/display_gl_output_surface.cpp +++ b/src/core/compositor/display_gl_output_surface.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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) 2019 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 "display_gl_output_surface.h" diff --git a/src/core/compositor/display_gl_output_surface.h b/src/core/compositor/display_gl_output_surface.h index 30fb0cd0d..28625ef0e 100644 --- a/src/core/compositor/display_gl_output_surface.h +++ b/src/core/compositor/display_gl_output_surface.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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) 2019 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 #ifndef DISPLAY_GL_OUTPUT_SURFACE_H #define DISPLAY_GL_OUTPUT_SURFACE_H diff --git a/src/core/compositor/display_overrides.cpp b/src/core/compositor/display_overrides.cpp index d41765272..bf5daf8e5 100644 --- a/src/core/compositor/display_overrides.cpp +++ b/src/core/compositor/display_overrides.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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) 2019 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 "display_gl_output_surface.h" #include "display_skia_output_device.h" diff --git a/src/core/compositor/display_skia_output_device.cpp b/src/core/compositor/display_skia_output_device.cpp index c33a31b87..ee693ed81 100644 --- a/src/core/compositor/display_skia_output_device.cpp +++ b/src/core/compositor/display_skia_output_device.cpp @@ -1,48 +1,12 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 "display_skia_output_device.h" #include "type_conversion.h" #include "gpu/command_buffer/service/skia_utils.h" -#include "skia/ext/legacy_display_globals.h" +#include "third_party/skia/include/core/SkSurfaceProps.h" namespace QtWebEngineCore { @@ -53,29 +17,31 @@ public: : m_parent(parent) , m_shape(m_parent->m_shape) { - auto formatIndex = static_cast<int>(m_shape.format); - const auto &colorType = m_parent->capabilities_.sk_color_types[formatIndex]; - DCHECK(colorType != kUnknown_SkColorType) - << "SkColorType is invalid for format: " << formatIndex; + const auto &colorType = m_shape.characterization.colorType(); + DCHECK(colorType != kUnknown_SkColorType); m_texture = m_parent->m_contextState->gr_context()->createBackendTexture( - m_shape.sizeInPixels.width(), m_shape.sizeInPixels.height(), colorType, + m_shape.characterization.width(), m_shape.characterization.height(), colorType, GrMipMapped::kNo, GrRenderable::kYes); DCHECK(m_texture.isValid()); if (m_texture.backend() == GrBackendApi::kVulkan) { +#if BUILDFLAG(ENABLE_VULKAN) GrVkImageInfo info; bool result = m_texture.getVkImageInfo(&info); DCHECK(result); m_estimatedSize = info.fAlloc.fSize; +#else + NOTREACHED(); +#endif } else { - auto info = SkImageInfo::Make(m_shape.sizeInPixels.width(), m_shape.sizeInPixels.height(), + auto info = SkImageInfo::Make(m_shape.characterization.width(), m_shape.characterization.height(), colorType, kUnpremul_SkAlphaType); m_estimatedSize = info.computeMinByteSize(); } m_parent->memory_type_tracker_->TrackMemAlloc(m_estimatedSize); - SkSurfaceProps surfaceProps = skia::LegacyDisplayGlobals::GetSkSurfaceProps(); + SkSurfaceProps surfaceProps = SkSurfaceProps{0, kUnknown_SkPixelGeometry}; m_surface = SkSurface::MakeFromBackendTexture( m_parent->m_contextState->gr_context(), m_texture, m_parent->capabilities_.output_surface_origin == gfx::SurfaceOrigin::kTopLeft @@ -129,6 +95,7 @@ DisplaySkiaOutputDevice::DisplaySkiaOutputDevice( , m_contextState(contextState) { capabilities_.uses_default_gl_framebuffer = false; + capabilities_.supports_surfaceless = true; capabilities_.sk_color_types[static_cast<int>(gfx::BufferFormat::RGBA_8888)] = kRGBA_8888_SkColorType; @@ -149,13 +116,12 @@ void DisplaySkiaOutputDevice::SetFrameSinkId(const viz::FrameSinkId &id) bind(id); } -bool DisplaySkiaOutputDevice::Reshape(const gfx::Size& sizeInPixels, - float devicePixelRatio, - const gfx::ColorSpace& colorSpace, - gfx::BufferFormat format, +bool DisplaySkiaOutputDevice::Reshape(const SkSurfaceCharacterization &characterization, + const gfx::ColorSpace &colorSpace, + float device_scale_factor, gfx::OverlayTransform transform) { - m_shape = Shape{sizeInPixels, devicePixelRatio, colorSpace, format}; + m_shape = Shape{characterization, device_scale_factor, colorSpace}; DCHECK_EQ(transform, gfx::OVERLAY_TRANSFORM_NONE); return true; } @@ -188,10 +154,8 @@ void DisplaySkiaOutputDevice::DiscardBackbuffer() { } -SkSurface *DisplaySkiaOutputDevice::BeginPaint(bool allocate_frame_buffer, - std::vector<GrBackendSemaphore> *) +SkSurface *DisplaySkiaOutputDevice::BeginPaint(std::vector<GrBackendSemaphore> *) { - Q_UNUSED(allocate_frame_buffer); // FIXME? if (!m_backBuffer || m_backBuffer->shape() != m_shape) m_backBuffer = std::make_unique<Buffer>(this); return m_backBuffer->surface(); @@ -234,7 +198,7 @@ int DisplaySkiaOutputDevice::textureId() QSize DisplaySkiaOutputDevice::size() { - return m_frontBuffer ? toQt(m_frontBuffer->shape().sizeInPixels) : QSize(); + return m_frontBuffer ? toQt(m_frontBuffer->shape().characterization.dimensions()) : QSize(); } bool DisplaySkiaOutputDevice::hasAlphaChannel() @@ -255,7 +219,7 @@ void DisplaySkiaOutputDevice::SwapBuffersFinished() } FinishSwapBuffers(gfx::SwapCompletionResult(gfx::SwapResult::SWAP_ACK), - gfx::Size(m_shape.sizeInPixels.width(), m_shape.sizeInPixels.height()), + gfx::Size(m_shape.characterization.width(), m_shape.characterization.height()), std::move(m_frame)); } diff --git a/src/core/compositor/display_skia_output_device.h b/src/core/compositor/display_skia_output_device.h index b5503ee5e..943d37214 100644 --- a/src/core/compositor/display_skia_output_device.h +++ b/src/core/compositor/display_skia_output_device.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 #ifndef DISPLAY_SKIA_OUTPUT_DEVICE_H #define DISPLAY_SKIA_OUTPUT_DEVICE_H @@ -61,17 +25,15 @@ public: // Overridden from SkiaOutputDevice. void SetFrameSinkId(const viz::FrameSinkId &frame_sink_id) override; - bool Reshape(const gfx::Size& size, - float devicePixelRatio, + bool Reshape(const SkSurfaceCharacterization &characterization, const gfx::ColorSpace& colorSpace, - gfx::BufferFormat format, + float device_scale_factor, gfx::OverlayTransform transform) override; void SwapBuffers(BufferPresentedCallback feedback, viz::OutputSurfaceFrame frame) override; void EnsureBackbuffer() override; void DiscardBackbuffer() override; - SkSurface *BeginPaint(bool allocate_frame_buffer, - std::vector<GrBackendSemaphore> *semaphores) override; + SkSurface *BeginPaint(std::vector<GrBackendSemaphore> *semaphores) override; void EndPaint() override; // Overridden from Compositor. @@ -85,17 +47,15 @@ public: private: struct Shape { - gfx::Size sizeInPixels; + SkSurfaceCharacterization characterization; float devicePixelRatio; gfx::ColorSpace colorSpace; - gfx::BufferFormat format; bool operator==(const Shape &that) const { - return (sizeInPixels == that.sizeInPixels && + return (characterization == that.characterization && devicePixelRatio == that.devicePixelRatio && - colorSpace == that.colorSpace && - format == that.format); + colorSpace == that.colorSpace); } bool operator!=(const Shape &that) const { return !(*this == that); } }; diff --git a/src/core/compositor/display_software_output_surface.cpp b/src/core/compositor/display_software_output_surface.cpp index c4bd6052b..2277dfea3 100644 --- a/src/core/compositor/display_software_output_surface.cpp +++ b/src/core/compositor/display_software_output_surface.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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) 2019 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 "display_software_output_surface.h" diff --git a/src/core/compositor/display_software_output_surface.h b/src/core/compositor/display_software_output_surface.h index 27687c7c0..5bb4e77c3 100644 --- a/src/core/compositor/display_software_output_surface.h +++ b/src/core/compositor/display_software_output_surface.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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) 2019 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 #ifndef DISPLAY_SOFTWARE_OUTPUT_SURFACE_H #define DISPLAY_SOFTWARE_OUTPUT_SURFACE_H diff --git a/src/core/configure/BUILD.root.gn.in b/src/core/configure/BUILD.root.gn.in index 445454706..08faf24d5 100644 --- a/src/core/configure/BUILD.root.gn.in +++ b/src/core/configure/BUILD.root.gn.in @@ -78,6 +78,14 @@ config("QtWebEngineCore_config") { ] } +declare_args() { + use_embedded_config = false +} + +config("embedded_config") { + defines = [ "QTWEBENGINE_EMBEDDED_SWITCHES=1" ] +} + config("cpp17_config") { # static initialized constexpr expressions must be compiled always as c++14 or always as c++17 # and our qtwebengine core sources use them as c++17 @@ -104,6 +112,9 @@ shared_library("QtWebEngineCore") { defines = [ "CHROMIUM_VERSION=\"" + chromium_version[0] + "\"" ] deps = [ "//base", + "//components/autofill/content/browser", + "//components/autofill/content/renderer", + "//components/autofill/core/browser", "//components/cdm/renderer", "//components/error_page/common", "//components/favicon/content", @@ -118,6 +129,7 @@ shared_library("QtWebEngineCore") { "//components/web_cache/browser", "//components/web_cache/renderer", "//components/spellcheck:buildflags", + "//components/profile_metrics", "//components/proxy_config", "//components/user_prefs", "//content/public/app", @@ -146,13 +158,13 @@ shared_library("QtWebEngineCore") { deps += [ "//third_party/webrtc_overrides:webrtc_component" ] } - if (use_xscrnsaver) { - deps += [ "//ui/base/x" ] - } - if (is_win) { + configs += [ "//build/config/compiler:rtti" ] data_deps = [ ":QtWebEngineCoreSandbox" ] } + if (use_embedded_config) { + configs += [ ":embedded_config" ] + } sources = [ @GN_HEADERS@, @@ -185,10 +197,9 @@ source_set("qtwebengine_spellcheck_sources") { "//chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h", "//chrome/browser/spellchecker/spellcheck_service.cc", "//chrome/browser/spellchecker/spellcheck_service.h", - "//components/language/core/browser/pref_names.cc", - "//components/language/core/browser/pref_names.h", ] deps = [ + "//components/language/core/browser", "//components/spellcheck/browser", "//components/spellcheck/renderer", "//third_party/blink/public:blink", @@ -196,7 +207,7 @@ source_set("qtwebengine_spellcheck_sources") { ] if (is_mac && use_browser_spellchecker) { sources += [ - "//chrome/browser/spellchecker/spell_check_host_chrome_impl_mac.cc", + "//chrome/browser/spellchecker/spelling_request.cc", ] } } @@ -211,13 +222,15 @@ source_set("qtwebengine_sources") { "//build:branding_buildflags", "//chrome/browser:dev_ui_browser_resources_grit", "//chrome/browser/resources/net_internals:resources", - "//chrome/browser/resources/quota_internals:resources", "//chrome/common:buildflags", "//chromeos/components/chromebox_for_meetings/buildflags", + "//components/custom_handlers", "//components/nacl/common:buildflags", "//components/performance_manager", "//components/plugins/renderer/", + "//content/browser/resources/quota:resources", "//extensions/buildflags:buildflags", + "//pdf:buildflags", "//printing/buildflags:buildflags", "//qtwebengine/common:mojo_bindings", "//rlz/buildflags:buildflags", @@ -226,10 +239,6 @@ source_set("qtwebengine_sources") { sources = [ "//chrome/browser/accessibility/accessibility_ui.cc", "//chrome/browser/accessibility/accessibility_ui.h", - "//chrome/browser/custom_handlers/protocol_handler_registry.cc", - "//chrome/browser/custom_handlers/protocol_handler_registry.h", - "//chrome/browser/custom_handlers/protocol_handler_registry_factory.cc", - "//chrome/browser/custom_handlers/protocol_handler_registry_factory.h", "//chrome/browser/devtools/devtools_eye_dropper.cc", "//chrome/browser/devtools/devtools_eye_dropper.h", "//chrome/browser/media/webrtc/desktop_media_list.h", @@ -251,20 +260,10 @@ source_set("qtwebengine_sources") { "//chrome/browser/ui/webui/devtools_ui_data_source.h", "//chrome/browser/ui/webui/net_internals/net_internals_ui.cc", "//chrome/browser/ui/webui/net_internals/net_internals_ui.h", - "//chrome/browser/ui/webui/quota_internals/quota_internals_handler.cc", - "//chrome/browser/ui/webui/quota_internals/quota_internals_handler.h", - "//chrome/browser/ui/webui/quota_internals/quota_internals_proxy.cc", - "//chrome/browser/ui/webui/quota_internals/quota_internals_proxy.h", - "//chrome/browser/ui/webui/quota_internals/quota_internals_types.cc", - "//chrome/browser/ui/webui/quota_internals/quota_internals_types.h", - "//chrome/browser/ui/webui/quota_internals/quota_internals_ui.cc", - "//chrome/browser/ui/webui/quota_internals/quota_internals_ui.h", "//chrome/browser/ui/webui/user_actions/user_actions_ui.cc", "//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/common/custom_handlers/protocol_handler.cc", - "//chrome/common/custom_handlers/protocol_handler.h", "//chrome/browser/ui/webui/webui_util.cc", "//chrome/browser/ui/webui/webui_util.h", "//chrome/common/chrome_switches.cc", @@ -282,7 +281,6 @@ source_set("qtwebengine_sources") { "//chrome/app:generated_resources", "//chrome/browser/extensions/api:api_registration", "//chrome/browser/resources:component_extension_resources_grit", - "//chrome/common/extensions/api", "//chrome/common/extensions/api:api", "//chrome/common/extensions/api:extensions_features", "//components/crx_file", @@ -314,9 +312,6 @@ source_set("qtwebengine_sources") { "//chrome/common/extensions/permissions/chrome_permission_message_rules.h", ] } else { - deps += [ - "//extensions/common:common_constants", - ] sources += [ "//extensions/common/url_pattern.cc", "//extensions/common/url_pattern.h", @@ -337,14 +332,9 @@ source_set("qtwebengine_sources") { } if (enable_plugins) { sources += [ - "//chrome/renderer/pepper/pepper_flash_font_file_host.cc", - "//chrome/renderer/pepper/pepper_flash_font_file_host.h", "//chrome/renderer/pepper/pepper_shared_memory_message_filter.cc", "//chrome/renderer/pepper/pepper_shared_memory_message_filter.h", ] - if (is_linux) { - deps += [ "//pdf:font_table_linux" ] - } } if (enable_basic_printing || enable_print_preview) { sources += [ @@ -361,10 +351,9 @@ source_set("qtwebengine_sources") { if (enable_pdf) { deps += [ "//pdf", - "//pdf:buildflags", - "//pdf:pdf_ppapi", "//chrome/browser/resources/pdf:resources", "//components/pdf/browser", + "//components/pdf/browser:interceptors", "//components/pdf/common", "//components/pdf/renderer", "//components/printing/browser", @@ -453,17 +442,16 @@ repack("qtwebengine_repack_resources") { "$root_gen_dir/chrome/common_resources.pak", "$root_gen_dir/chrome/dev_ui_browser_resources.pak", "$root_gen_dir/chrome/net_internals_resources.pak", - "$root_gen_dir/chrome/quota_internals_resources.pak", "$root_gen_dir/components/components_resources.pak", "$root_gen_dir/components/dev_ui_components_resources.pak", "$root_gen_dir/content/browser/resources/media/media_internals_resources.pak", "$root_gen_dir/content/browser/tracing/tracing_resources.pak", "$root_gen_dir/content/content_resources.pak", "$root_gen_dir/content/dev_ui_content_resources.pak", + "$root_gen_dir/content/quota_internals_resources.pak", "$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/resources/webui_generated_resources.pak", ] output = "$root_out_dir/qtwebengine_resources.pak" @@ -471,18 +459,17 @@ repack("qtwebengine_repack_resources") { "//qtwebengine/browser:qt_webengine_resources", "//chrome/browser:dev_ui_browser_resources_grit", "//chrome/browser/resources/net_internals:resources", - "//chrome/browser/resources/quota_internals:resources", "//chrome/common:resources_grit", "//components/resources:components_resources_grit", "//components/resources:dev_ui_components_resources_grit", "//content/browser/resources/media:resources", "//content/browser/tracing:resources", - "//content:content_resources_grit", + "//content:content_resources", + "//content/browser/resources/quota:resources", "//content:dev_ui_content_resources_grit", "//mojo/public/js:resources", "//net:net_resources_grit", "//third_party/blink/public:resources_grit", - "//ui/resources:webui_resources_grd_grit", "//ui/resources:webui_generated_resources_grd", ] if (enable_extensions) { @@ -588,9 +575,9 @@ repack("qtwebengine_repack_resources_devtools") { } chrome_repack_locales("qtwebengine_repack_locales_pack") { - input_locales = locales + input_locales = platform_pak_locales output_dir = "$root_out_dir/qtwebengine_locales" - output_locales = locales + output_locales = platform_pak_locales } if (enable_extensions) { diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index f6ecb31b4..99a3aa3f4 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -1,54 +1,18 @@ -/**************************************************************************** -** -** 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 "content_browser_client_qt.h" #include "base/files/file_util.h" #include "base/task/post_task.h" -#include "chrome/browser/custom_handlers/protocol_handler_registry.h" -#include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" #include "chrome/browser/tab_contents/form_interaction_tab_helper.h" +#include "components/autofill/content/browser/content_autofill_driver_factory.h" +#include "components/custom_handlers/protocol_handler_registry.h" #include "components/error_page/common/error.h" #include "components/error_page/common/localized_error.h" #include "components/navigation_interception/intercept_navigation_throttle.h" -#include "components/navigation_interception/navigation_params.h" #include "components/network_hints/browser/simple_network_hints_handler_impl.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" #include "content/browser/web_contents/web_contents_impl.h" @@ -58,10 +22,12 @@ #include "content/public/browser/client_certificate_delegate.h" #include "content/public/browser/file_url_loader.h" #include "content/public/browser/media_observer.h" +#include "content/public/browser/navigation_handle.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/shared_cors_origin_access_list.h" +#include "content/public/browser/url_loader_request_interceptor.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_user_data.h" #include "content/public/browser/web_ui_url_loader_factory.h" @@ -70,10 +36,15 @@ #include "content/public/common/user_agent.h" #include "extensions/buildflags/buildflags.h" #include "mojo/public/cpp/bindings/self_owned_associated_receiver.h" +#include "pdf/buildflags.h" #include "net/ssl/client_cert_identity.h" #include "net/ssl/client_cert_store.h" +#include "net/ssl/ssl_private_key.h" +#include "printing/buildflags/buildflags.h" #include "services/device/public/cpp/geolocation/geolocation_manager.h" #include "services/network/network_service.h" +#include "services/network/public/cpp/web_sandbox_flags.h" +#include "services/network/public/mojom/websocket.mojom.h" #include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h" #include "third_party/blink/public/common/loader/url_loader_throttle.h" #include "ui/base/resource/resource_bundle.h" @@ -81,14 +52,15 @@ #include "url/url_util_qt.h" #include "qtwebengine/common/renderer_configuration.mojom.h" -#include "qtwebengine/grit/qt_webengine_resources.h" #include "profile_adapter.h" #include "browser_main_parts_qt.h" #include "browser_message_filter_qt.h" #include "certificate_error_controller.h" #include "client_cert_select_controller.h" +#include "custom_handlers/protocol_handler_registry_factory.h" #include "devtools_manager_delegate_qt.h" +#include "file_system_access/file_system_access_permission_request_manager_qt.h" #include "login_delegate_qt.h" #include "media_capture_devices_dispatcher.h" #include "net/cookie_monster_delegate_qt.h" @@ -113,6 +85,7 @@ #include "web_engine_settings.h" #include "api/qwebenginecookiestore.h" #include "api/qwebenginecookiestore_p.h" +#include "api/qwebengineurlrequestinfo_p.h" #if QT_CONFIG(opengl) #include <QOpenGLContext> @@ -124,12 +97,6 @@ #include "location_provider_qt.h" #endif -#if QT_CONFIG(webengine_pepper_plugins) -#include "content/public/browser/browser_ppapi_host.h" -#include "ppapi/host/ppapi_host.h" -#include "renderer_host/pepper/pepper_host_factory_qt.h" -#endif - #if QT_CONFIG(webengine_spellchecker) #include "chrome/browser/spellchecker/spell_check_host_chrome_impl.h" #include "components/spellcheck/common/spellcheck.mojom.h" @@ -152,7 +119,7 @@ #include "extensions/browser/extension_protocols.h" #include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_util.h" -#include "extensions/browser/guest_view/extensions_guest_view_message_filter.h" +#include "extensions/browser/guest_view/extensions_guest_view.h" #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h" #include "extensions/browser/guest_view/web_view/web_view_guest.h" #include "extensions/browser/process_map.h" @@ -162,7 +129,6 @@ #include "extensions/common/manifest_handlers/mime_types_handler.h" #include "extensions/extension_web_contents_observer_qt.h" #include "extensions/extensions_browser_client_qt.h" -#include "extensions/pdf_iframe_navigation_throttle_qt.h" #include "net/plugin_response_interceptor_url_loader_throttle.h" #endif @@ -172,9 +138,20 @@ #endif #if BUILDFLAG(ENABLE_PRINTING) && BUILDFLAG(ENABLE_PRINT_PREVIEW) +#include "printing/pdf_stream_delegate_qt.h" #include "printing/print_view_manager_qt.h" #endif +#if BUILDFLAG(ENABLE_PDF) +#include "components/pdf/browser/pdf_navigation_throttle.h" +#include "components/pdf/browser/pdf_url_loader_request_interceptor.h" +#include "components/pdf/browser/pdf_web_contents_helper.h" +#endif + +#if BUILDFLAG(ENABLE_PDF) && BUILDFLAG(ENABLE_EXTENSIONS) +#include "extensions/pdf_iframe_navigation_throttle_qt.h" +#endif + #include <QGuiApplication> #include <QStandardPaths> #include <qpa/qplatformnativeinterface.h> @@ -234,7 +211,7 @@ ContentBrowserClientQt::~ContentBrowserClientQt() { } -std::unique_ptr<content::BrowserMainParts> ContentBrowserClientQt::CreateBrowserMainParts(const content::MainFunctionParams&) +std::unique_ptr<content::BrowserMainParts> ContentBrowserClientQt::CreateBrowserMainParts(content::MainFunctionParams) { Q_ASSERT(!m_browserMainParts); auto browserMainParts = std::make_unique<BrowserMainPartsQt>(); @@ -263,7 +240,6 @@ void ContentBrowserClientQt::RenderProcessWillLaunch(content::RenderProcessHost host->AddFilter(new BrowserMessageFilterQt(id, profile)); #if BUILDFLAG(ENABLE_EXTENSIONS) host->AddFilter(new extensions::ExtensionMessageFilter(id, profile)); - host->AddFilter(new extensions::ExtensionsGuestViewMessageFilter(id, profile)); #endif //ENABLE_EXTENSIONS bool is_incognito_process = profile->IsOffTheRecord(); @@ -411,27 +387,11 @@ void ContentBrowserClientQt::GetAdditionalMappedFilesForChildProcess(const base: } #endif -#if QT_CONFIG(webengine_pepper_plugins) -void ContentBrowserClientQt::DidCreatePpapiPlugin(content::BrowserPpapiHost* browser_host) -{ - browser_host->GetPpapiHost()->AddHostFactoryFilter( - std::make_unique<QtWebEngineCore::PepperHostFactoryQt>(browser_host)); -} -#endif - std::unique_ptr<content::DevToolsManagerDelegate> ContentBrowserClientQt::CreateDevToolsManagerDelegate() { return std::make_unique<DevToolsManagerDelegateQt>(); } -content::PlatformNotificationService *ContentBrowserClientQt::GetPlatformNotificationService(content::BrowserContext *browser_context) -{ - ProfileQt *profile = static_cast<ProfileQt *>(browser_context); - if (!profile) - return nullptr; - return profile->platformNotificationService(); -} - void ContentBrowserClientQt::BindHostReceiverForRenderer(content::RenderProcessHost *render_process_host, mojo::GenericPendingReceiver receiver) { @@ -479,7 +439,6 @@ void ContentBrowserClientQt::RegisterBrowserInterfaceBindersForFrame( content::RenderFrameHost *render_frame_host, mojo::BinderMapWithContext<content::RenderFrameHost *> *map) { - Q_UNUSED(render_frame_host); map->Add<network_hints::mojom::NetworkHintsHandler>(base::BindRepeating(&BindNetworkHintsHandler)); #if BUILDFLAG(ENABLE_EXTENSIONS) map->Add<extensions::mime_handler::MimeHandlerService>(base::BindRepeating(&BindMimeHandlerService)); @@ -496,6 +455,8 @@ void ContentBrowserClientQt::RegisterBrowserInterfaceBindersForFrame( extensions::ExtensionsBrowserClient::Get()->RegisterBrowserInterfaceBindersForFrame(map, render_frame_host, extension); +#else + Q_UNUSED(render_frame_host); #endif } @@ -508,40 +469,60 @@ void ContentBrowserClientQt::ExposeInterfacesToRenderer(service_manager::BinderR #if BUILDFLAG(ENABLE_EXTENSIONS) associated_registry->AddInterface(base::BindRepeating(&extensions::EventRouter::BindForRenderer, render_process_host->GetID())); + associated_registry->AddInterface(base::BindRepeating(&extensions::ExtensionsGuestView::CreateForComponents, + render_process_host->GetID())); + associated_registry->AddInterface(base::BindRepeating(&extensions::ExtensionsGuestView::CreateForExtensions, + render_process_host->GetID())); #else Q_UNUSED(associated_registry); #endif } -bool ContentBrowserClientQt::BindAssociatedReceiverFromFrame(content::RenderFrameHost *rfh, - const std::string &interface_name, - mojo::ScopedInterfaceEndpointHandle *handle) +void ContentBrowserClientQt::RegisterAssociatedInterfaceBindersForRenderFrameHost( + content::RenderFrameHost &rfh, + blink::AssociatedInterfaceRegistry &associated_registry) { #if QT_CONFIG(webengine_webchannel) - if (interface_name == qtwebchannel::mojom::WebChannelTransportHost::Name_) { - auto *web_contents = content::WebContents::FromRenderFrameHost(rfh); - auto *adapter = static_cast<WebContentsDelegateQt *>(web_contents->GetDelegate())->webContentsAdapter(); - adapter->webChannelTransport()->BindReceiver( - mojo::PendingAssociatedReceiver<qtwebchannel::mojom::WebChannelTransportHost>(std::move(*handle)), rfh); - return true; - } + associated_registry.AddInterface( + base::BindRepeating( + [](content::RenderFrameHost *render_frame_host, + mojo::PendingAssociatedReceiver<qtwebchannel::mojom::WebChannelTransportHost> receiver) { + auto *web_contents = content::WebContents::FromRenderFrameHost(render_frame_host); + auto *adapter = static_cast<WebContentsDelegateQt *>(web_contents->GetDelegate())->webContentsAdapter(); + adapter->webChannelTransport()->BindReceiver(std::move(receiver), render_frame_host); + }, &rfh)); #endif #if BUILDFLAG(ENABLE_PRINTING) && BUILDFLAG(ENABLE_PRINT_PREVIEW) - if (interface_name == printing::mojom::PrintManagerHost::Name_) { - mojo::PendingAssociatedReceiver<printing::mojom::PrintManagerHost> receiver(std::move(*handle)); - PrintViewManagerQt::BindPrintManagerHost(std::move(receiver), rfh); - return true; - } + associated_registry.AddInterface( + base::BindRepeating( + [](content::RenderFrameHost* render_frame_host, + mojo::PendingAssociatedReceiver<printing::mojom::PrintManagerHost> receiver) { + PrintViewManagerQt::BindPrintManagerHost(std::move(receiver), render_frame_host); + }, &rfh)); #endif #if BUILDFLAG(ENABLE_EXTENSIONS) - if (interface_name == extensions::mojom::LocalFrameHost::Name_) { - extensions::ExtensionWebContentsObserverQt::BindLocalFrameHost( - mojo::PendingAssociatedReceiver<extensions::mojom::LocalFrameHost>(std::move(*handle)), rfh); - return true; - } + associated_registry.AddInterface( + base::BindRepeating( + [](content::RenderFrameHost *render_frame_host, + mojo::PendingAssociatedReceiver<extensions::mojom::LocalFrameHost> receiver) { + extensions::ExtensionWebContentsObserverQt::BindLocalFrameHost(std::move(receiver), render_frame_host); + }, &rfh)); #endif - DCHECK(!ContentBrowserClient::BindAssociatedReceiverFromFrame(rfh, interface_name, handle)); - return false; + associated_registry.AddInterface( + base::BindRepeating( + [](content::RenderFrameHost *render_frame_host, + mojo::PendingAssociatedReceiver<autofill::mojom::AutofillDriver> receiver) { + autofill::ContentAutofillDriverFactory::BindAutofillDriver(std::move(receiver), render_frame_host); + }, &rfh)); +#if BUILDFLAG(ENABLE_PDF) + associated_registry.AddInterface( + base::BindRepeating( + [](content::RenderFrameHost *render_frame_host, + mojo::PendingAssociatedReceiver<pdf::mojom::PdfService> receiver) { + pdf::PDFWebContentsHelper::BindPdfService(std::move(receiver), render_frame_host); + }, &rfh)); +#endif // BUILDFLAG(ENABLE_PDF) + ContentBrowserClient::RegisterAssociatedInterfaceBindersForRenderFrameHost(rfh, associated_registry); } bool ContentBrowserClientQt::CanCreateWindow( @@ -595,7 +576,7 @@ std::unique_ptr<device::LocationProvider> ContentBrowserClientQt::OverrideSystem device::GeolocationManager *ContentBrowserClientQt::GetGeolocationManager() { -#if defined(OS_MAC) +#if BUILDFLAG(IS_MAC) return m_browserMainParts->GetGeolocationManager(); #else return nullptr; @@ -631,20 +612,9 @@ bool ContentBrowserClientQt::WillCreateRestrictedCookieManager(network::mojom::R return false; // only made a proxy, still need the actual impl to be made. } -bool ContentBrowserClientQt::AllowAppCache(const GURL &manifest_url, - const GURL &first_party, - const absl::optional<url::Origin> &top_frame_origin, - content::BrowserContext *context) -{ - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - if (!context || context->ShutdownStarted()) - return false; - return static_cast<ProfileQt *>(context)->profileAdapter()->cookieStore()->d_func()->canAccessCookies(toQt(first_party), toQt(manifest_url)); -} - content::AllowServiceWorkerResult ContentBrowserClientQt::AllowServiceWorker(const GURL &scope, - const GURL &site_for_cookies, + const net::SiteForCookies &site_for_cookies, const absl::optional<url::Origin> & /*top_frame_origin*/, const GURL & /*script_url*/, content::BrowserContext *context) @@ -654,7 +624,7 @@ ContentBrowserClientQt::AllowServiceWorker(const GURL &scope, return content::AllowServiceWorkerResult::No(); // FIXME: Chrome also checks if javascript is enabled here to check if has been disabled since the service worker // was started. - return static_cast<ProfileQt *>(context)->profileAdapter()->cookieStore()->d_func()->canAccessCookies(toQt(site_for_cookies), toQt(scope)) + return static_cast<ProfileQt *>(context)->profileAdapter()->cookieStore()->d_func()->canAccessCookies(toQt(site_for_cookies.first_party_url()), toQt(scope)) ? content::AllowServiceWorkerResult::Yes() : content::AllowServiceWorkerResult::No(); } @@ -685,20 +655,41 @@ bool ContentBrowserClientQt::AllowWorkerIndexedDB(const GURL &url, static void LaunchURL(const GURL& url, base::RepeatingCallback<content::WebContents*()> web_contents_getter, - ui::PageTransition page_transition, bool is_main_frame, bool has_user_gesture) + ui::PageTransition page_transition, + network::mojom::WebSandboxFlags sandbox_flags, + bool is_main_frame, bool has_user_gesture) { Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); content::WebContents* webContents = std::move(web_contents_getter).Run(); if (!webContents) return; - ProtocolHandlerRegistry* protocolHandlerRegistry = - ProtocolHandlerRegistryFactory::GetForBrowserContext( - webContents->GetBrowserContext()); - if (protocolHandlerRegistry && - protocolHandlerRegistry->IsHandledProtocol(url.scheme())) + custom_handlers::ProtocolHandlerRegistry *protocolHandlerRegistry = + ProtocolHandlerRegistryFactory::GetForBrowserContext(webContents->GetBrowserContext()); + if (protocolHandlerRegistry && protocolHandlerRegistry->IsHandledProtocol(url.scheme())) return; + // Sandbox flag logic from chrome/browser/chrome_content_browser_client.cc: + if (!is_main_frame) { + using SandboxFlags = network::mojom::WebSandboxFlags; + auto allow = [&](SandboxFlags flag) { + return (sandbox_flags & flag) == SandboxFlags::kNone; + }; + bool allowed = (allow(SandboxFlags::kPopups)) || + (allow(SandboxFlags::kTopNavigation)) || + (allow(SandboxFlags::kTopNavigationByUserActivation) && + has_user_gesture); + + if (!allowed) { + content::RenderFrameHost *rfh = webContents->GetMainFrame(); + if (!base::CommandLine::ForCurrentProcess()->HasSwitch("disable-sandbox-external-protocols")) { + rfh->AddMessageToConsole(blink::mojom::ConsoleMessageLevel::kError, + "Navigation to external protocol blocked by sandbox."); + return; + } + } + } + WebContentsDelegateQt *contentsDelegate = static_cast<WebContentsDelegateQt*>(webContents->GetDelegate()); contentsDelegate->launchExternalURL(toQt(url), page_transition, is_main_frame, has_user_gesture); } @@ -706,19 +697,22 @@ static void LaunchURL(const GURL& url, bool ContentBrowserClientQt::HandleExternalProtocol(const GURL &url, base::RepeatingCallback<content::WebContents*()> web_contents_getter, - int child_id, int frame_tree_node_id, content::NavigationUIData *navigation_data, - bool is_main_frame, + bool is_primary_main_frame, + bool is_in_fenced_frame_tree, + network::mojom::WebSandboxFlags sandbox_flags, ui::PageTransition page_transition, bool has_user_gesture, const absl::optional<url::Origin> &initiating_origin, + content::RenderFrameHost *initiator_document, mojo::PendingRemote<network::mojom::URLLoaderFactory> *out_factory) { - Q_UNUSED(child_id); Q_UNUSED(frame_tree_node_id); + Q_UNUSED(is_in_fenced_frame_tree); Q_UNUSED(navigation_data); Q_UNUSED(initiating_origin); + Q_UNUSED(initiator_document); Q_UNUSED(out_factory); base::PostTask(FROM_HERE, {content::BrowserThread::UI}, @@ -726,7 +720,8 @@ bool ContentBrowserClientQt::HandleExternalProtocol(const GURL &url, url, std::move(web_contents_getter), page_transition, - is_main_frame, + sandbox_flags, + is_primary_main_frame, has_user_gesture)); return true; } @@ -736,7 +731,7 @@ namespace { class ProtocolHandlerThrottle : public blink::URLLoaderThrottle { public: - explicit ProtocolHandlerThrottle(ProtocolHandlerRegistry *protocol_handler_registry) + explicit ProtocolHandlerThrottle(custom_handlers::ProtocolHandlerRegistry *protocol_handler_registry) : protocol_handler_registry_(protocol_handler_registry) { } @@ -767,7 +762,7 @@ private: *url = translated_url; } - ProtocolHandlerRegistry *protocol_handler_registry_; + custom_handlers::ProtocolHandlerRegistry *protocol_handler_registry_; }; } // namespace @@ -813,14 +808,14 @@ WebContentsAdapterClient::NavigationType pageTransitionToNavigationType(ui::Page } } -static bool navigationThrottleCallback(content::WebContents *source, - const navigation_interception::NavigationParams ¶ms) +static bool navigationThrottleCallback(content::NavigationHandle *handle) { // 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<ProfileQt *>(source->GetBrowserContext()); - if (params.is_external_protocol() && !profile->profileAdapter()->urlSchemeHandler(toQByteArray(params.url().scheme()))) + if (handle->IsExternalProtocol() && !profile->profileAdapter()->urlSchemeHandler(toQByteArray(handle->GetURL().scheme()))) return false; bool navigationAccepted = true; @@ -831,14 +826,14 @@ static bool navigationThrottleCallback(content::WebContents *source, return false; // Redirects might not be reflected in transition_type at this point (see also chrome/.../web_navigation_api_helpers.cc) - auto transition_type = params.transition_type(); - if (params.is_redirect()) + auto transition_type = handle->GetPageTransition(); + if (handle->WasServerRedirect()) transition_type = ui::PageTransitionFromInt(transition_type | ui::PAGE_TRANSITION_SERVER_REDIRECT); client->navigationRequested(pageTransitionToNavigationType(transition_type), - toQt(params.url()), + toQt(handle->GetURL()), navigationAccepted, - params.is_main_frame()); + handle->IsInPrimaryMainFrame()); return !navigationAccepted; } @@ -851,9 +846,12 @@ std::vector<std::unique_ptr<content::NavigationThrottle>> ContentBrowserClientQt base::BindRepeating(&navigationThrottleCallback), navigation_interception::SynchronyMode::kSync)); +#if BUILDFLAG(ENABLE_PDF) #if BUILDFLAG(ENABLE_EXTENSIONS) MaybeAddThrottle(extensions::PDFIFrameNavigationThrottleQt::MaybeCreateThrottleFor(navigation_handle), &throttles); -#endif +#endif // BUILDFLAG(ENABLE_EXTENSIONS) + MaybeAddThrottle(pdf::PdfNavigationThrottle::MaybeCreateThrottleFor(navigation_handle, std::make_unique<PdfStreamDelegateQt>()), &throttles); +#endif // BUILDFLAG(ENABLE_PDF) return throttles; } @@ -866,7 +864,7 @@ bool ContentBrowserClientQt::IsHandledURL(const GURL &url) bool ContentBrowserClientQt::HasCustomSchemeHandler(content::BrowserContext *browser_context, const std::string &scheme) { - if (ProtocolHandlerRegistry *protocol_handler_registry = + if (custom_handlers::ProtocolHandlerRegistry *protocol_handler_registry = ProtocolHandlerRegistryFactory::GetForBrowserContext(browser_context)) { return protocol_handler_registry->IsHandledProtocol(scheme); } @@ -1065,8 +1063,16 @@ void ContentBrowserClientQt::RegisterNonNetworkWorkerMainResourceURLLoaderFactor void ContentBrowserClientQt::RegisterNonNetworkServiceWorkerUpdateURLLoaderFactories(content::BrowserContext* browser_context, NonNetworkURLLoaderFactoryMap* factories) { - DCHECK(browser_context); - DCHECK(factories); + Profile *profile = Profile::FromBrowserContext(browser_context); + ProfileAdapter *profileAdapter = static_cast<ProfileQt *>(profile)->profileAdapter(); + + for (const QByteArray &scheme : profileAdapter->customUrlSchemes()) { + if (const url::CustomScheme *cs = url::CustomScheme::FindScheme(scheme.toStdString())) { + if (cs->flags & url::CustomScheme::ServiceWorkersAllowed) + factories->emplace(scheme.toStdString(), CreateCustomURLLoaderFactory(profileAdapter)); + } + } + #if BUILDFLAG(ENABLE_EXTENSIONS) factories->emplace( extensions::kExtensionScheme, @@ -1075,8 +1081,10 @@ void ContentBrowserClientQt::RegisterNonNetworkServiceWorkerUpdateURLLoaderFacto } void ContentBrowserClientQt::RegisterNonNetworkSubresourceURLLoaderFactories(int render_process_id, int render_frame_id, + const absl::optional<url::Origin> &request_initiator_origin, NonNetworkURLLoaderFactoryMap *factories) { + Q_UNUSED(request_initiator_origin); content::RenderProcessHost *process_host = content::RenderProcessHost::FromID(render_process_id); Profile *profile = Profile::FromBrowserContext(process_host->GetBrowserContext()); ProfileAdapter *profileAdapter = static_cast<ProfileQt *>(profile)->profileAdapter(); @@ -1168,6 +1176,9 @@ base::flat_set<std::string> ContentBrowserClientQt::GetPluginMimeTypesWithExtern } } #endif +#if BUILDFLAG(ENABLE_PDF) + mime_types.insert("application/x-google-chrome-pdf"); +#endif return mime_types; } @@ -1205,6 +1216,93 @@ bool ContentBrowserClientQt::WillCreateURLLoaderFactory( return true; } +std::vector<std::unique_ptr<content::URLLoaderRequestInterceptor>> +ContentBrowserClientQt::WillCreateURLLoaderRequestInterceptors(content::NavigationUIData* navigation_ui_data, + int frame_tree_node_id, + const scoped_refptr<network::SharedURLLoaderFactory>& network_loader_factory) +{ + std::vector<std::unique_ptr<content::URLLoaderRequestInterceptor>> interceptors; +#if BUILDFLAG(ENABLE_PDF) + { + std::unique_ptr<content::URLLoaderRequestInterceptor> pdf_interceptor = + pdf::PdfURLLoaderRequestInterceptor::MaybeCreateInterceptor( + frame_tree_node_id, std::make_unique<PdfStreamDelegateQt>()); + if (pdf_interceptor) + interceptors.push_back(std::move(pdf_interceptor)); + } +#endif + + return interceptors; +} + +bool ContentBrowserClientQt::WillInterceptWebSocket(content::RenderFrameHost *frame) +{ + return frame != nullptr; +} + +QWebEngineUrlRequestInterceptor *getProfileInterceptorFromFrame(content::RenderFrameHost *frame) +{ + ProfileQt *profile = static_cast<ProfileQt *>(frame->GetBrowserContext()); + if (profile) + return profile->profileAdapter()->requestInterceptor(); + return nullptr; +} + +QWebEngineUrlRequestInterceptor *getPageInterceptor(content::WebContents *web_contents) +{ + if (web_contents) { + auto view = static_cast<content::WebContentsImpl *>(web_contents)->GetView(); + if (WebContentsAdapterClient *client = WebContentsViewQt::from(view)->client()) + return client->webContentsAdapter()->requestInterceptor(); + } + return nullptr; +} + +void ContentBrowserClientQt::CreateWebSocket( + content::RenderFrameHost *frame, + WebSocketFactory factory, + const GURL &url, + const net::SiteForCookies &site_for_cookies, + const absl::optional<std::string> &user_agent, + mojo::PendingRemote<network::mojom::WebSocketHandshakeClient> handshake_client) +{ + QWebEngineUrlRequestInterceptor *profileInterceptor = getProfileInterceptorFromFrame(frame); + content::WebContents *web_contents = content::WebContents::FromRenderFrameHost(frame); + QWebEngineUrlRequestInterceptor *pageInterceptor = getPageInterceptor(web_contents); + std::vector<network::mojom::HttpHeaderPtr> headers; + GURL to_url = url; + bool addedUserAgent = false; + if (profileInterceptor || pageInterceptor) { + QUrl initiator = web_contents ? toQt(web_contents->GetURL()) : QUrl(); + auto *infoPrivate = new QWebEngineUrlRequestInfoPrivate( + QWebEngineUrlRequestInfo::ResourceTypeWebSocket, + QWebEngineUrlRequestInfo::NavigationTypeOther, + toQt(url), toQt(site_for_cookies.first_party_url()), initiator, + QByteArrayLiteral("GET")); + QWebEngineUrlRequestInfo requestInfo(infoPrivate); + if (profileInterceptor) { + profileInterceptor->interceptRequest(requestInfo); + pageInterceptor = getPageInterceptor(web_contents); + } + if (pageInterceptor && !requestInfo.changed()) + pageInterceptor->interceptRequest(requestInfo); + if (infoPrivate->shouldBlockRequest) + return; // ### should we call OnFailure on handshake_client? + if (infoPrivate->shouldRedirectRequest) + to_url = toGurl(infoPrivate->url); + for (auto header = infoPrivate->extraHeaders.constBegin(); header != infoPrivate->extraHeaders.constEnd(); ++header) { + std::string h = header.key().toStdString(); + if (base::LowerCaseEqualsASCII(h, net::HttpRequestHeaders::kUserAgent)) + addedUserAgent = true; + headers.push_back(network::mojom::HttpHeader::New(h, header.value().toStdString())); + } + } + if (!addedUserAgent && user_agent) + headers.push_back(network::mojom::HttpHeader::New(net::HttpRequestHeaders::kUserAgent, *user_agent)); + + std::move(factory).Run(to_url, std::move(headers), std::move(handshake_client), mojo::NullRemote(), mojo::NullRemote()); +} + void ContentBrowserClientQt::SiteInstanceGotProcess(content::SiteInstance *site_instance) { #if BUILDFLAG(ENABLE_EXTENSIONS) @@ -1240,6 +1338,7 @@ void ContentBrowserClientQt::SiteInstanceDeleting(content::SiteInstance *site_in content::WebContentsViewDelegate *ContentBrowserClientQt::GetWebContentsViewDelegate(content::WebContents *web_contents) { FormInteractionTabHelper::CreateForWebContents(web_contents); + FileSystemAccessPermissionRequestManagerQt::CreateForWebContents(web_contents); if (auto *registry = performance_manager::PerformanceManagerRegistry::GetInstance()) registry->MaybeCreatePageNodeForWebContents(web_contents); diff --git a/src/core/content_browser_client_qt.h b/src/core/content_browser_client_qt.h index 3079d33d0..4ee5c0228 100644 --- a/src/core/content_browser_client_qt.h +++ b/src/core/content_browser_client_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef CONTENT_BROWSER_CLIENT_QT_H #define CONTENT_BROWSER_CLIENT_QT_H @@ -78,7 +42,7 @@ class ContentBrowserClientQt : public content::ContentBrowserClient public: ContentBrowserClientQt(); ~ContentBrowserClientQt(); - std::unique_ptr<content::BrowserMainParts> CreateBrowserMainParts(const content::MainFunctionParams&) override; + std::unique_ptr<content::BrowserMainParts> CreateBrowserMainParts(content::MainFunctionParams) override; void RenderProcessWillLaunch(content::RenderProcessHost *host) override; gl::GLShareGroup* GetInProcessGpuShareGroup() override; content::MediaObserver* GetMediaObserver() override; @@ -98,7 +62,6 @@ public: std::unique_ptr<content::ClientCertificateDelegate> delegate) override; std::unique_ptr<net::ClientCertStore> CreateClientCertStore(content::BrowserContext *browser_context) override; std::unique_ptr<content::DevToolsManagerDelegate> CreateDevToolsManagerDelegate() override; - content::PlatformNotificationService * GetPlatformNotificationService(content::BrowserContext *browser_context) override; std::string GetApplicationLocale() override; std::string GetAcceptLangs(content::BrowserContext* context) override; @@ -117,9 +80,8 @@ public: void ExposeInterfacesToRenderer(service_manager::BinderRegistry *registry, blink::AssociatedInterfaceRegistry *associated_registry, content::RenderProcessHost *render_process_host) override; - bool BindAssociatedReceiverFromFrame(content::RenderFrameHost *render_frame_host, - const std::string &interface_name, - mojo::ScopedInterfaceEndpointHandle *handle) override; + void RegisterAssociatedInterfaceBindersForRenderFrameHost(content::RenderFrameHost &render_frame_host, + blink::AssociatedInterfaceRegistry &associated_registry) override; bool CanCreateWindow(content::RenderFrameHost *opener, const GURL &opener_url, @@ -145,14 +107,18 @@ public: int process_id, int routing_id, mojo::PendingReceiver<network::mojom::RestrictedCookieManager> *receiver) override; + bool WillInterceptWebSocket(content::RenderFrameHost *frame) override; + void CreateWebSocket( + content::RenderFrameHost *frame, + WebSocketFactory factory, + const GURL &url, + const net::SiteForCookies &site_for_cookies, + const absl::optional<std::string> &user_agent, + mojo::PendingRemote<network::mojom::WebSocketHandshakeClient> handshake_client) override; - bool AllowAppCache(const GURL &manifest_url, - const GURL &first_party, - const absl::optional<url::Origin> &top_frame_origin, - content::BrowserContext *context) override; content::AllowServiceWorkerResult AllowServiceWorker( const GURL &scope, - const GURL &site_for_cookies, + const net::SiteForCookies &site_for_cookies, const absl::optional<url::Origin> &top_frame_origin, const GURL &script_url, content::BrowserContext *context) override; @@ -190,10 +156,6 @@ public: void GetAdditionalMappedFilesForChildProcess(const base::CommandLine& command_line, int child_process_id, content::PosixFileDescriptorInfo* mappings) override; #endif -#if QT_CONFIG(webengine_pepper_plugins) - void DidCreatePpapiPlugin(content::BrowserPpapiHost* browser_host) override; -#endif - std::unique_ptr<content::LoginDelegate> CreateLoginDelegate( const net::AuthChallengeInfo &auth_info, content::WebContents *web_contents, @@ -207,13 +169,15 @@ public: bool HandleExternalProtocol( const GURL &url, base::RepeatingCallback<content::WebContents*()> web_contents_getter, - int child_id, int frame_tree_node_id, content::NavigationUIData *navigation_data, - bool is_main_frame, + bool is_primary_main_frame, + bool is_in_fenced_frame_tree, + network::mojom::WebSandboxFlags sandbox_flags, ui::PageTransition page_transition, bool has_user_gesture, const absl::optional<url::Origin> &initiating_origin, + content::RenderFrameHost *initiator_document, mojo::PendingRemote<network::mojom::URLLoaderFactory> *out_factory) override; std::vector<std::unique_ptr<blink::URLLoaderThrottle>> CreateURLLoaderThrottles( @@ -228,7 +192,10 @@ public: bool HasErrorPage(int http_status_code, content::WebContents *contents) override; bool HasCustomSchemeHandler(content::BrowserContext *browser_context, const std::string &scheme) override; - + std::vector<std::unique_ptr<content::URLLoaderRequestInterceptor>> + WillCreateURLLoaderRequestInterceptors(content::NavigationUIData *navigation_ui_data, + int frame_tree_node_id, + const scoped_refptr<network::SharedURLLoaderFactory> &network_loader_factory) override; bool WillCreateURLLoaderFactory(content::BrowserContext *browser_context, content::RenderFrameHost *frame, int render_process_id, @@ -255,6 +222,7 @@ public: ukm::SourceIdObj ukm_source_id, NonNetworkURLLoaderFactoryMap *factories) override; void RegisterNonNetworkSubresourceURLLoaderFactories(int render_process_id, int render_frame_id, + const absl::optional<url::Origin>& request_initiator_origin, NonNetworkURLLoaderFactoryMap *factories) override; void RegisterNonNetworkWorkerMainResourceURLLoaderFactories(content::BrowserContext* browser_context, NonNetworkURLLoaderFactoryMap* factories) override; diff --git a/src/core/content_client_qt.cpp b/src/core/content_client_qt.cpp index 6f7a6c785..92a00a5c8 100644 --- a/src/core/content_client_qt.cpp +++ b/src/core/content_client_qt.cpp @@ -1,50 +1,15 @@ -/**************************************************************************** -** -** 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 "content_client_qt.h" #include "base/command_line.h" #include "base/files/file_util.h" +#include "base/json/json_string_value_serializer.h" #include "base/strings/string_piece.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" -#include "base/strings/utf_string_conversions.h" +#include "base/values.h" #include "base/version.h" #include "content/public/common/cdm_info.h" #include "content/public/common/content_constants.h" @@ -74,9 +39,9 @@ // File name of the CDM on different platforms. const char kWidevineCdmFileName[] = -#if defined(OS_MAC) +#if BUILDFLAG(IS_MAC) "widevinecdm.plugin"; -#elif defined(OS_WIN) +#elif BUILDFLAG(IS_WIN) "widevinecdm.dll"; #else // OS_LINUX, etc. "libwidevinecdm.so"; @@ -86,7 +51,6 @@ const char kWidevineCdmFileName[] = #if QT_CONFIG(webengine_printing_and_pdf) #include "pdf/pdf.h" -#include "pdf/pdf_ppapi.h" const char kPdfPluginMimeType[] = "application/x-google-chrome-pdf"; const char kPdfPluginPath[] = "internal-pdf-viewer"; #endif // QT_CONFIG(webengine_printing_and_pdf) @@ -161,10 +125,6 @@ void ComputeBuiltInPlugins(std::vector<content::PepperPluginInfo>* plugins) pdf_info.path = base::FilePath::FromUTF8Unsafe(kPdfPluginPath); content::WebPluginMimeType pdf_mime_type(kPdfPluginMimeType, "pdf", "Portable Document Format"); pdf_info.mime_types.push_back(pdf_mime_type); - pdf_info.internal_entry_points.get_interface = chrome_pdf::PPP_GetInterface; - pdf_info.internal_entry_points.initialize_module = chrome_pdf::PPP_InitializeModule; - pdf_info.internal_entry_points.shutdown_module = chrome_pdf::PPP_ShutdownModule; - pdf_info.permissions = ppapi::PERMISSION_DEV | ppapi::PERMISSION_PDF; plugins->push_back(pdf_info); #endif // QT_CONFIG(webengine_printing_and_pdf) } @@ -182,6 +142,37 @@ void ContentClientQt::AddPepperPlugins(std::vector<content::PepperPluginInfo>* p namespace QtWebEngineCore { #if defined(WIDEVINE_CDM_AVAILABLE_NOT_COMPONENT) +#if defined(Q_OS_LINUX) +static const QDir widevineCdmDirHint(const QDir &widevineDir) +{ + const QString hintFilePath = widevineDir.absolutePath() % QDir::separator() + % QLatin1String("latest-component-updated-widevine-cdm"); + if (!QFileInfo::exists(hintFilePath)) { + // CDM hint file does not exist. + return widevineDir; + } + + std::string jsonString; + if (!base::ReadFileToString(toFilePath(hintFilePath), &jsonString)) { + // Could not read the CDM hint file. + return widevineDir; + } + + JSONStringValueDeserializer deserializer(jsonString); + std::unique_ptr<base::Value> dict = deserializer.Deserialize(nullptr, nullptr); + if (!dict || !dict->is_dict()) { + // Could not deserialize the CDM hint file. + return widevineDir; + } + + std::string *widevineCdmDirPath = dict->FindStringKey("Path"); + if (!widevineCdmDirPath) + return widevineDir; + + return QDir(QString::fromStdString(*widevineCdmDirPath)); +} +#endif // defined(Q_OS_LINUX) + static bool IsWidevineAvailable(base::FilePath *cdm_path, media::CdmCapability *capability) { @@ -256,7 +247,7 @@ static bool IsWidevineAvailable(base::FilePath *cdm_path, // Google Chrome widevine modules QDir chromeWidevineDir(QDir::homePath() + "/.config/google-chrome/WidevineCdm"); if (chromeWidevineDir.exists()) - potentialWidevineVersionDirs << chromeWidevineDir; + potentialWidevineVersionDirs << widevineCdmDirHint(chromeWidevineDir); // Firefox widevine modules QDir firefoxPotentialProfilesDir(QDir::homePath() + "/.mozilla/firefox"); @@ -272,11 +263,12 @@ static bool IsWidevineAvailable(base::FilePath *cdm_path, // Chromium widevine modules (might not work with proprietary codecs) QDir chromiumWidevineDir(QDir::homePath() + "/.config/chromium/WidevineCdm"); if (chromiumWidevineDir.exists()) - potentialWidevineVersionDirs << chromiumWidevineDir; + potentialWidevineVersionDirs << widevineCdmDirHint(chromiumWidevineDir); // Search for widewine versions for (const QDir &dir : potentialWidevineVersionDirs) { QFileInfoList widevineVersionDirs = dir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name | QDir::Reversed); + widevineVersionDirs.prepend(QFileInfo(dir.absolutePath())); // ### alternatively look up in the manifest.json and take the path from there. #if Q_PROCESSOR_WORDSIZE == 8 const QString library = QLatin1String("/_platform_specific/linux_x64/libwidevinecdm.so"); @@ -310,12 +302,15 @@ static bool IsWidevineAvailable(base::FilePath *cdm_path, // Add the supported codecs as if they came from the component manifest. // This list must match the CDM that is being bundled with Chrome. const std::vector<media::VideoCodecProfile> kAllProfiles = {}; - capability->video_codecs.emplace(media::VideoCodec::kCodecVP8, kAllProfiles); - capability->video_codecs.emplace(media::VideoCodec::kCodecVP9, kAllProfiles); - capability->video_codecs.emplace(media::VideoCodec::kCodecAV1, kAllProfiles); + capability->video_codecs.emplace(media::VideoCodec::kVP8, kAllProfiles); + capability->video_codecs.emplace(media::VideoCodec::kVP9, kAllProfiles); + capability->video_codecs.emplace(media::VideoCodec::kAV1, kAllProfiles); #if BUILDFLAG(USE_PROPRIETARY_CODECS) - capability->video_codecs.emplace(media::VideoCodec::kCodecH264, kAllProfiles); + capability->video_codecs.emplace(media::VideoCodec::kH264, kAllProfiles); #endif // BUILDFLAG(USE_PROPRIETARY_CODECS) +#if BUILDFLAG(ENABLE_PLATFORM_HEVC) + capability->video_codecs.emplace(media::VideoCodec::kHEVC, kAllProfiles); +#endif capability->audio_codecs = media::GetCdmSupportedAudioCodecs(); // Add the supported encryption schemes as if they came from the @@ -346,7 +341,7 @@ void ContentClientQt::AddContentDecryptionModules(std::vector<content::CdmInfo> const base::Version version; cdms->push_back(content::CdmInfo(kWidevineKeySystem, Robustness::kSoftwareSecure, std::move(capability), /*supports_sub_key_systems=*/false, kWidevineCdmDisplayName, - kWidevineCdmGuid, version, cdm_path, kWidevineCdmFileSystemId)); + kWidevineCdmType, version, cdm_path)); } #endif // defined(WIDEVINE_CDM_AVAILABLE_NOT_COMPONENT) @@ -376,14 +371,14 @@ void ContentClientQt::AddContentDecryptionModules(std::vector<content::CdmInfo> cdms->push_back(content::CdmInfo(kExternalClearKeyDifferentGuidTestKeySystem, Robustness::kSoftwareSecure, capability, /*supports_sub_key_systems=*/false, media::kClearKeyCdmDisplayName, - media::kClearKeyCdmDifferentGuid, base::Version("0.1.0.0"), - clear_key_cdm_path, media::kClearKeyCdmFileSystemId)); + media::kClearKeyCdmDifferentCdmType, base::Version("0.1.0.0"), + clear_key_cdm_path)); cdms->push_back(content::CdmInfo(kExternalClearKeyKeySystem, Robustness::kSoftwareSecure, capability, /*supports_sub_key_systems=*/true, media::kClearKeyCdmDisplayName, - media::kClearKeyCdmGuid, base::Version("0.1.0.0"), - clear_key_cdm_path, media::kClearKeyCdmFileSystemId)); + media::kClearKeyCdmType, base::Version("0.1.0.0"), + clear_key_cdm_path)); } #endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) } diff --git a/src/core/content_client_qt.h b/src/core/content_client_qt.h index d44563f41..f0afdcb58 100644 --- a/src/core/content_client_qt.h +++ b/src/core/content_client_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef CONTENT_CLIENT_QT_H #define CONTENT_CLIENT_QT_H diff --git a/src/core/content_main_delegate_qt.cpp b/src/core/content_main_delegate_qt.cpp index 0c04fb071..bd7a23497 100644 --- a/src/core/content_main_delegate_qt.cpp +++ b/src/core/content_main_delegate_qt.cpp @@ -1,47 +1,12 @@ -/**************************************************************************** -** -** 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 "content_main_delegate_qt.h" #include "base/command_line.h" #include "base/i18n/rtl.h" #include "base/logging.h" +#include "base/memory/ref_counted_memory.h" #include "base/no_destructor.h" #include "base/path_service.h" #include "base/strings/string_number_conversions.h" @@ -65,11 +30,11 @@ #include "web_engine_context.h" #include "web_engine_library_info.h" -#if defined(ARCH_CPU_ARM_FAMILY) && (defined(OS_ANDROID) || defined(OS_LINUX)) +#if defined(ARCH_CPU_ARM_FAMILY) && (BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX)) #include "base/cpu.h" #endif -#if defined(OS_LINUX) +#if BUILDFLAG(IS_LINUX) #include "media/audio/audio_manager.h" #include "ui/base/ui_base_switches.h" #endif @@ -77,12 +42,12 @@ // must be included before vaapi_wrapper.h #include <QtCore/qcoreapplication.h> -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) #include "media/gpu/windows/dxva_video_decode_accelerator_win.h" #include "media/gpu/windows/media_foundation_video_encode_accelerator_win.h" #endif -#if defined(OS_MAC) +#if BUILDFLAG(IS_MAC) #include "base/trace_event/trace_event.h" #include "content/public/common/content_features.h" #include "media/gpu/mac/vt_video_decode_accelerator_mac.h" @@ -120,9 +85,6 @@ struct LazyDirectoryListerCacher dict.SetString("headerDateModified", l10n_util::GetStringUTF16(IDS_DIRECTORY_LISTING_DATE_MODIFIED)); dict.SetString("language", l10n_util::GetLanguage(base::i18n::GetConfiguredLocale())); - dict.SetString("listingParsingErrorBoxText", - l10n_util::GetStringFUTF16(IDS_DIRECTORY_LISTING_PARSING_ERROR_BOX_TEXT, - toString16(QCoreApplication::applicationName()))); dict.SetString("textdirection", base::i18n::IsRTL() ? "rtl" : "ltr"); std::string html = webui::GetI18nTemplateHtml( @@ -172,7 +134,7 @@ static logging::LoggingDestination DetermineLogMode(const base::CommandLine& com void ContentMainDelegateQt::PreSandboxStartup() { -#if defined(ARCH_CPU_ARM_FAMILY) && (defined(OS_ANDROID) || defined(OS_LINUX)) +#if defined(ARCH_CPU_ARM_FAMILY) && (BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX)) // Create an instance of the CPU class to parse /proc/cpuinfo and cache // cpu_brand info. base::CPU cpu_info; @@ -205,7 +167,7 @@ void ContentMainDelegateQt::PreSandboxStartup() } } -#if defined(OS_POSIX) && !defined(OS_ANDROID) +#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_ANDROID) if (parsedCommandLine->HasSwitch(switches::kSingleProcess)) setlocale(LC_NUMERIC, "C"); #endif @@ -214,12 +176,12 @@ void ContentMainDelegateQt::PreSandboxStartup() #if BUILDFLAG(USE_VAAPI) media::VaapiWrapper::PreSandboxInitialization(); #endif -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) media::DXVAVideoDecodeAccelerator::PreSandboxInitialization(); media::MediaFoundationVideoEncodeAccelerator::PreSandboxInitialization(); #endif -#if defined(OS_MAC) +#if BUILDFLAG(IS_MAC) { TRACE_EVENT0("gpu", "Initialize VideoToolbox"); media::InitializeVideoToolbox(); @@ -230,7 +192,7 @@ void ContentMainDelegateQt::PreSandboxStartup() std::string appName = parsedCommandLine->GetSwitchValueASCII(switches::kApplicationName); appName = QByteArray::fromPercentEncoding(QByteArray::fromStdString(appName)).toStdString(); QCoreApplication::setApplicationName(QString::fromStdString(appName)); -#if defined(OS_LINUX) +#if BUILDFLAG(IS_LINUX) media::AudioManager::SetGlobalAppName(appName); #endif } @@ -260,7 +222,7 @@ content::ContentGpuClient *ContentMainDelegateQt::CreateContentGpuClient() content::ContentRendererClient *ContentMainDelegateQt::CreateContentRendererClient() { -#if defined(OS_LINUX) +#if BUILDFLAG(IS_LINUX) base::CommandLine *parsedCommandLine = base::CommandLine::ForCurrentProcess(); std::string process_type = parsedCommandLine->GetSwitchValueASCII(switches::kProcessType); bool no_sandbox = parsedCommandLine->HasSwitch(sandbox::policy::switches::kNoSandbox); diff --git a/src/core/content_main_delegate_qt.h b/src/core/content_main_delegate_qt.h index 170ccc3ca..f88c3dea0 100644 --- a/src/core/content_main_delegate_qt.h +++ b/src/core/content_main_delegate_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef CONTENT_MAIN_DELEGATE_QT_H #define CONTENT_MAIN_DELEGATE_QT_H diff --git a/src/core/content_utility_client_qt.cpp b/src/core/content_utility_client_qt.cpp index f3b1e764d..c76cab2f9 100644 --- a/src/core/content_utility_client_qt.cpp +++ b/src/core/content_utility_client_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 "content_utility_client_qt.h" diff --git a/src/core/content_utility_client_qt.h b/src/core/content_utility_client_qt.h index bcdf077f3..f2d287cf5 100644 --- a/src/core/content_utility_client_qt.h +++ b/src/core/content_utility_client_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 #ifndef CONTENT_UTILITY_CLIENT_QT_H #define CONTENT_UTILITY_CLIENT_QT_H diff --git a/src/core/custom_handlers/protocol_handler_registry_delegate_qt.cpp b/src/core/custom_handlers/protocol_handler_registry_delegate_qt.cpp new file mode 100644 index 000000000..a5074fb88 --- /dev/null +++ b/src/core/custom_handlers/protocol_handler_registry_delegate_qt.cpp @@ -0,0 +1,36 @@ +// Copyright (C) 2022 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 + +// based on chrome/browser/custom_handlers/chrome_protocol_handler_registry_delegate.cc: +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "protocol_handler_registry_delegate_qt.h" + +#include "content/public/browser/child_process_security_policy.h" +#include "url/url_util_qt.h" + +namespace QtWebEngineCore { + +using content::ChildProcessSecurityPolicy; + +ProtocolHandlerRegistryDelegateQt::ProtocolHandlerRegistryDelegateQt() = default; + +ProtocolHandlerRegistryDelegateQt::~ProtocolHandlerRegistryDelegateQt() = default; + +// ProtocolHandlerRegistry::Delegate: +void ProtocolHandlerRegistryDelegateQt::RegisterExternalHandler(const std::string &protocol) +{ + ChildProcessSecurityPolicy *policy = ChildProcessSecurityPolicy::GetInstance(); + if (!policy->IsWebSafeScheme(protocol)) { + policy->RegisterWebSafeScheme(protocol); + } +} + +bool ProtocolHandlerRegistryDelegateQt::IsExternalHandlerRegistered(const std::string &protocol) +{ + return url::IsHandledProtocol(protocol); +} + +} // namespace QtWebEngineCore diff --git a/src/core/custom_handlers/protocol_handler_registry_delegate_qt.h b/src/core/custom_handlers/protocol_handler_registry_delegate_qt.h new file mode 100644 index 000000000..6a0753d22 --- /dev/null +++ b/src/core/custom_handlers/protocol_handler_registry_delegate_qt.h @@ -0,0 +1,35 @@ +// Copyright (C) 2022 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 + +// based on chrome/browser/custom_handlers/chrome_protocol_handler_registry_delegate.h: +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef PROTOCOL_HANDLER_REGISTRY_DELEGATE_QT_H_ +#define PROTOCOL_HANDLER_REGISTRY_DELEGATE_QT_H_ + +#include <string> + +#include "components/custom_handlers/protocol_handler_registry.h" + +namespace QtWebEngineCore { + +// This class implements the ProtocolHandlerRegistry::Delegate +// abstract class to provide an OS dependent implementation +class ProtocolHandlerRegistryDelegateQt : public custom_handlers::ProtocolHandlerRegistry::Delegate { +public: + ProtocolHandlerRegistryDelegateQt(); + ~ProtocolHandlerRegistryDelegateQt() override; + + ProtocolHandlerRegistryDelegateQt(const ProtocolHandlerRegistryDelegateQt &other) = delete; + ProtocolHandlerRegistryDelegateQt &operator=(const ProtocolHandlerRegistryDelegateQt &other) = delete; + + // ProtocolHandlerRegistry::Delegate: + void RegisterExternalHandler(const std::string &protocol) override; + bool IsExternalHandlerRegistered(const std::string &protocol) override; +}; + +} // namespace QtWebEngineCore + +#endif // PROTOCOL_HANDLER_REGISTRY_DELEGATE_QT_H_ diff --git a/src/core/custom_handlers/protocol_handler_registry_factory.cpp b/src/core/custom_handlers/protocol_handler_registry_factory.cpp new file mode 100644 index 000000000..50b17006b --- /dev/null +++ b/src/core/custom_handlers/protocol_handler_registry_factory.cpp @@ -0,0 +1,75 @@ +// Copyright (C) 2022 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 + +// based on chrome/browser/custom_handlers/protocol_handler_registry_factory.cc +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "protocol_handler_registry_factory.h" + +#include <memory> + +#include "base/memory/singleton.h" +#include "components/custom_handlers/protocol_handler_registry.h" +#include "components/keyed_service/content/browser_context_dependency_manager.h" + +#include "protocol_handler_registry_delegate_qt.h" + +namespace QtWebEngineCore { + +// static +ProtocolHandlerRegistryFactory *ProtocolHandlerRegistryFactory::GetInstance() +{ + return base::Singleton<ProtocolHandlerRegistryFactory>::get(); +} + +// static +custom_handlers::ProtocolHandlerRegistry *ProtocolHandlerRegistryFactory::GetForBrowserContext(content::BrowserContext *context) +{ + return static_cast<custom_handlers::ProtocolHandlerRegistry *>(GetInstance()->GetServiceForBrowserContext(context, true)); +} + +ProtocolHandlerRegistryFactory::ProtocolHandlerRegistryFactory() + : BrowserContextKeyedServiceFactory("ProtocolHandlerRegistry", BrowserContextDependencyManager::GetInstance()) {} + +ProtocolHandlerRegistryFactory::~ProtocolHandlerRegistryFactory() +{ +} + +// Will be created when initializing profile_io_data, so we might +// as well have the framework create this along with other +// PKSs to preserve orderly civic conduct :) +bool ProtocolHandlerRegistryFactory::ServiceIsCreatedWithBrowserContext() const +{ + return true; +} + +// Allows the produced registry to be used in incognito mode. +content::BrowserContext *ProtocolHandlerRegistryFactory::GetBrowserContextToUse(content::BrowserContext *context) const +{ + return context; +// return chrome::GetBrowserContextRedirectedInIncognito(context); +} + +// Do not create this service for tests. MANY tests will fail +// due to the threading requirements of this service. ALSO, +// not creating this increases test isolation (which is GOOD!) +bool ProtocolHandlerRegistryFactory::ServiceIsNULLWhileTesting() const +{ + return true; +} + +KeyedService *ProtocolHandlerRegistryFactory::BuildServiceInstanceFor(content::BrowserContext *context) const +{ + custom_handlers::ProtocolHandlerRegistry *registry = + new custom_handlers::ProtocolHandlerRegistry(/*prefs*/ nullptr, + std::make_unique<ProtocolHandlerRegistryDelegateQt>()); + + // Must be called as a part of the creation process. + registry->InitProtocolSettings(); + + return registry; +} + +} // namespace QtWebEngineCore diff --git a/src/core/custom_handlers/protocol_handler_registry_factory.h b/src/core/custom_handlers/protocol_handler_registry_factory.h new file mode 100644 index 000000000..6559addc0 --- /dev/null +++ b/src/core/custom_handlers/protocol_handler_registry_factory.h @@ -0,0 +1,57 @@ +// Copyright (C) 2022 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 + +// based on chrome/browser/custom_handlers/protocol_handler_registry_factory.h: +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef PROTOCOL_HANDLER_REGISTRY_FACTORY_H_ +#define PROTOCOL_HANDLER_REGISTRY_FACTORY_H_ + +#include "components/keyed_service/content/browser_context_keyed_service_factory.h" + +namespace custom_handlers { +class ProtocolHandlerRegistry; +} + +namespace base { +template <typename T> struct DefaultSingletonTraits; +} + +namespace QtWebEngineCore { + +// Singleton that owns all ProtocolHandlerRegistrys and associates them with +// Profiles. Listens for the Profile's destruction notification and cleans up +// the associated ProtocolHandlerRegistry. +class ProtocolHandlerRegistryFactory : public BrowserContextKeyedServiceFactory { +public: + // Returns the singleton instance of the ProtocolHandlerRegistryFactory. + static ProtocolHandlerRegistryFactory *GetInstance(); + + // Returns the ProtocolHandlerRegistry that provides intent registration for + // |context|. Ownership stays with this factory object. + static custom_handlers::ProtocolHandlerRegistry *GetForBrowserContext(content::BrowserContext *context); + + ProtocolHandlerRegistryFactory(const ProtocolHandlerRegistryFactory &) = delete; + ProtocolHandlerRegistryFactory &operator=(const ProtocolHandlerRegistryFactory &) = delete; + +protected: + // BrowserContextKeyedServiceFactory implementation. + bool ServiceIsCreatedWithBrowserContext() const override; + content::BrowserContext *GetBrowserContextToUse(content::BrowserContext *context) const override; + bool ServiceIsNULLWhileTesting() const override; + +private: + friend struct base::DefaultSingletonTraits<ProtocolHandlerRegistryFactory>; + + ProtocolHandlerRegistryFactory(); + ~ProtocolHandlerRegistryFactory() override; + + // BrowserContextKeyedServiceFactory implementation. + KeyedService *BuildServiceInstanceFor(content::BrowserContext *profile) const override; +}; + +} // namespace QtWebEngineCore + +#endif // PROTOCOL_HANDLER_REGISTRY_FACTORY_H_ diff --git a/src/core/custom_handlers/register_protocol_handler_request_controller.h b/src/core/custom_handlers/register_protocol_handler_request_controller.h new file mode 100644 index 000000000..6305ce5b7 --- /dev/null +++ b/src/core/custom_handlers/register_protocol_handler_request_controller.h @@ -0,0 +1,26 @@ +// Copyright (C) 2018 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 + +#ifndef REGISTER_PROTOCOL_HANDLER_REQUEST_CONTROLLER_H +#define REGISTER_PROTOCOL_HANDLER_REQUEST_CONTROLLER_H + +#include "request_controller.h" + +namespace QtWebEngineCore { + +class RegisterProtocolHandlerRequestController : public RequestController { +public: + RegisterProtocolHandlerRequestController(QUrl origin, QString scheme) + : RequestController(std::move(origin)) + , m_scheme(std::move(scheme)) + {} + + QString scheme() const { return m_scheme; } + +private: + QString m_scheme; +}; + +} // namespace QtWebEngineCore + +#endif // REGISTER_PROTOCOL_HANDLER_REQUEST_CONTROLLER_H diff --git a/src/core/custom_handlers/register_protocol_handler_request_controller_impl.cpp b/src/core/custom_handlers/register_protocol_handler_request_controller_impl.cpp new file mode 100644 index 000000000..efaf54cd2 --- /dev/null +++ b/src/core/custom_handlers/register_protocol_handler_request_controller_impl.cpp @@ -0,0 +1,49 @@ +// Copyright (C) 2018 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 "custom_handlers/register_protocol_handler_request_controller_impl.h" + +#include "components/custom_handlers/protocol_handler_registry.h" +#include "content/public/browser/web_contents.h" + +#include "custom_handlers/protocol_handler_registry_factory.h" +#include "type_conversion.h" + +namespace QtWebEngineCore { + +RegisterProtocolHandlerRequestControllerImpl::RegisterProtocolHandlerRequestControllerImpl( + content::WebContents *webContents, + custom_handlers::ProtocolHandler handler) + : RegisterProtocolHandlerRequestController( + toQt(handler.url()), + toQt(handler.protocol())) + , content::WebContentsObserver(webContents) + , m_handler(handler) +{} + +RegisterProtocolHandlerRequestControllerImpl::~RegisterProtocolHandlerRequestControllerImpl() +{ + reject(); +} + +custom_handlers::ProtocolHandlerRegistry *RegisterProtocolHandlerRequestControllerImpl::protocolHandlerRegistry() +{ + content::WebContents *webContents = web_contents(); + if (!webContents) + return nullptr; + content::BrowserContext *context = webContents->GetBrowserContext(); + return ProtocolHandlerRegistryFactory::GetForBrowserContext(context); +} + +void RegisterProtocolHandlerRequestControllerImpl::accepted() +{ + if (custom_handlers::ProtocolHandlerRegistry *registry = protocolHandlerRegistry()) + registry->OnAcceptRegisterProtocolHandler(m_handler); +} + +void RegisterProtocolHandlerRequestControllerImpl::rejected() +{ + if (custom_handlers::ProtocolHandlerRegistry *registry = protocolHandlerRegistry()) + registry->OnIgnoreRegisterProtocolHandler(m_handler); +} + +} // namespace QtWebEngineCore diff --git a/src/core/custom_handlers/register_protocol_handler_request_controller_impl.h b/src/core/custom_handlers/register_protocol_handler_request_controller_impl.h new file mode 100644 index 000000000..073ca9bf8 --- /dev/null +++ b/src/core/custom_handlers/register_protocol_handler_request_controller_impl.h @@ -0,0 +1,38 @@ +// Copyright (C) 2018 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 + +#ifndef REGISTER_PROTOCOL_HANDLER_REQUEST_CONTROLLER_IMPL_H +#define REGISTER_PROTOCOL_HANDLER_REQUEST_CONTROLLER_IMPL_H + +#include "register_protocol_handler_request_controller.h" + +#include "content/public/browser/web_contents_observer.h" +#include "components/custom_handlers/protocol_handler.h" + +namespace custom_handlers { +class ProtocolHandlerRegistry; +} + +namespace QtWebEngineCore { + +class RegisterProtocolHandlerRequestControllerImpl final : public RegisterProtocolHandlerRequestController, + private content::WebContentsObserver { +public: + RegisterProtocolHandlerRequestControllerImpl( + content::WebContents *webContents, + custom_handlers::ProtocolHandler handler); + + ~RegisterProtocolHandlerRequestControllerImpl(); + +protected: + void accepted() override; + void rejected() override; + +private: + custom_handlers::ProtocolHandlerRegistry *protocolHandlerRegistry(); + custom_handlers::ProtocolHandler m_handler; +}; + +} // namespace QtWebEngineCore + +#endif // REGISTER_PROTOCOL_HANDLER_REQUEST_CONTROLLER_IMPL_H diff --git a/src/core/delegated_frame_host_client_qt.cpp b/src/core/delegated_frame_host_client_qt.cpp index 2d3966bd5..ad1de91f6 100644 --- a/src/core/delegated_frame_host_client_qt.cpp +++ b/src/core/delegated_frame_host_client_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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) 2019 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 "delegated_frame_host_client_qt.h" @@ -65,9 +29,7 @@ void DelegatedFrameHostClientQt::OnFrameTokenChanged(uint32_t frame_token, base: float DelegatedFrameHostClientQt::GetDeviceScaleFactor() const { - display::ScreenInfo screen_info; - p->GetScreenInfo(&screen_info); - return screen_info.device_scale_factor; + return p->GetScreenInfo().device_scale_factor; } void DelegatedFrameHostClientQt::InvalidateLocalSurfaceIdOnEviction() diff --git a/src/core/delegated_frame_host_client_qt.h b/src/core/delegated_frame_host_client_qt.h index 89cd3700c..184b84d7a 100644 --- a/src/core/delegated_frame_host_client_qt.h +++ b/src/core/delegated_frame_host_client_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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) 2019 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 #ifndef DELEGATED_FRAME_HOST_CLIENT_QT_H #define DELEGATED_FRAME_HOST_CLIENT_QT_H diff --git a/src/core/desktop_screen_qt.cpp b/src/core/desktop_screen_qt.cpp index fd7a2c54f..47210aa09 100644 --- a/src/core/desktop_screen_qt.cpp +++ b/src/core/desktop_screen_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 "desktop_screen_qt.h" @@ -46,6 +10,15 @@ #include <QGuiApplication> #include <QScreen> +#if defined(USE_OZONE) +#include "ui/ozone/buildflags.h" +#if BUILDFLAG(OZONE_PLATFORM_X11) +#define USE_XSCREENSAVER +#include "ui/base/x/x11_screensaver.h" +#include "ui/base/x/x11_util.h" +#endif +#endif + #include <cmath> namespace QtWebEngineCore { @@ -69,12 +42,21 @@ display::Display toDisplayDisplay(int id, const QScreen *screen) { auto display = display::Display(id, toGfx(screen->geometry())); display.set_work_area(toGfx(screen->availableGeometry())); - display.set_device_scale_factor(screen->devicePixelRatio()); display.set_is_monochrome(screen->depth() == 1); display.set_color_depth(screen->depth()); display.set_depth_per_component(8); // FIXME: find the real value display.set_display_frequency(std::ceil(screen->refreshRate())); display.set_rotation(toDisplayRotation(screen->orientation())); + + // FIXME: support lower scale factor + float pixelRatio = screen->devicePixelRatio(); + if (pixelRatio < 1) { + qWarning("Unsupported scale factor (%f) detected on Display%d", pixelRatio, id); + display.set_device_scale_factor(qGuiApp->devicePixelRatio()); + } else { + display.set_device_scale_factor(pixelRatio); + } + if (screen->nativeOrientation() != Qt::PrimaryOrientation) display.set_panel_rotation(toDisplayRotation(screen->nativeOrientation())); return display; @@ -137,4 +119,24 @@ display::Display DesktopScreenQt::GetDisplayNearestWindow(gfx::NativeWindow /*wi return GetPrimaryDisplay(); } +#if BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX) +bool DesktopScreenQt::SetScreenSaverSuspended(bool suspend) +{ +#if defined(USE_XSCREENSAVER) + return ui::SuspendX11ScreenSaver(suspend); +#else + return false; +#endif +} +#endif + +bool DesktopScreenQt::IsScreenSaverActive() const +{ +#if defined(USE_XSCREENSAVER) + return ui::IsXScreensaverActive(); +#else + return false; +#endif +} + } // namespace QtWebEngineCore diff --git a/src/core/desktop_screen_qt.h b/src/core/desktop_screen_qt.h index 1b2e095a4..33f0cf870 100644 --- a/src/core/desktop_screen_qt.h +++ b/src/core/desktop_screen_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 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) 2020 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 #ifndef DESKTOP_SCREEN_QT_H #define DESKTOP_SCREEN_QT_H @@ -53,6 +17,10 @@ public: ~DesktopScreenQt() override; display::Display GetDisplayNearestWindow(gfx::NativeWindow /*window*/) const override; +#if BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX) + bool SetScreenSaverSuspended(bool suspend) override; +#endif + bool IsScreenSaverActive() const override; private: void initializeScreens(); diff --git a/src/core/devtools_frontend_qt.cpp b/src/core/devtools_frontend_qt.cpp index 968302bec..e706c680a 100644 --- a/src/core/devtools_frontend_qt.cpp +++ b/src/core/devtools_frontend_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 // based on content/shell/browser/shell_devtools_frontend.cc: // Copyright 2013 The Chromium Authors. All rights reserved. @@ -52,7 +16,6 @@ #include "base/json/json_reader.h" #include "base/json/json_writer.h" #include "base/json/string_escape.h" -#include "base/macros.h" #include "base/memory/ptr_util.h" #include "base/strings/string_number_conversions.h" #include "base/strings/stringprintf.h" @@ -66,6 +29,7 @@ #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/devtools_frontend_host.h" #include "content/public/browser/file_url_loader.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/navigation_handle.h" @@ -89,11 +53,10 @@ namespace { constexpr char kScreencastEnabled[] = "screencastEnabled"; -std::unique_ptr<base::DictionaryValue> BuildObjectForResponse(const net::HttpResponseHeaders *rh, - bool success, - int net_error) +base::DictionaryValue BuildObjectForResponse(const net::HttpResponseHeaders *rh, + bool success, int net_error) { - auto response = std::make_unique<base::DictionaryValue>(); + base::DictionaryValue response; int responseCode = 200; if (rh) { responseCode = rh->response_code(); @@ -101,9 +64,9 @@ std::unique_ptr<base::DictionaryValue> BuildObjectForResponse(const net::HttpRes // In case of no headers, assume file:// URL and failed to load responseCode = 404; } - response->SetInteger("statusCode", responseCode); - response->SetInteger("netError", net_error); - response->SetString("netErrorName", net::ErrorToString(net_error)); + response.SetInteger("statusCode", responseCode); + response.SetInteger("netError", net_error); + response.SetString("netErrorName", net::ErrorToString(net_error)); auto headers = std::make_unique<base::DictionaryValue>(); size_t iterator = 0; @@ -114,7 +77,7 @@ std::unique_ptr<base::DictionaryValue> BuildObjectForResponse(const net::HttpRes while (rh && rh->EnumerateHeaderLines(&iterator, &name, &value)) headers->SetString(name, value); - response->Set("headers", std::move(headers)); + response.Set("headers", std::move(headers)); return response; } @@ -167,14 +130,14 @@ private: base::Value id(stream_id_); base::Value encodedValue(encoded); - bindings_->CallClientFunction("DevToolsAPI.streamWrite", &id, &chunkValue, &encodedValue); + bindings_->CallClientFunction("DevToolsAPI", "streamWrite", std::move(id), std::move(chunkValue), std::move(encodedValue)); std::move(resume).Run(); } void OnComplete(bool success) override { auto response = BuildObjectForResponse(response_headers_.get(), success, loader_->NetError()); - bindings_->SendMessageAck(request_id_, response.get()); + bindings_->SendMessageAck(request_id_, std::move(response)); bindings_->m_loaders.erase(bindings_->m_loaders.find(this)); } @@ -185,8 +148,6 @@ private: DevToolsFrontendQt *const bindings_; std::unique_ptr<network::SimpleURLLoader> loader_; scoped_refptr<net::HttpResponseHeaders> response_headers_; - - DISALLOW_COPY_AND_ASSIGN(NetworkResourceLoader); }; // This constant should be in sync with @@ -306,7 +267,7 @@ void DevToolsFrontendQt::ReadyToCommitNavigation(content::NavigationHandle *navi } } -void DevToolsFrontendQt::DocumentAvailableInMainFrame(content::RenderFrameHost * /*render_frame_host*/) +void DevToolsFrontendQt::DocumentOnLoadCompletedInPrimaryMainFrame() { if (!m_inspectedContents) return; @@ -368,6 +329,7 @@ void DevToolsFrontendQt::CreateJsonPreferences(bool clear) JsonPrefStore *jsonPrefStore = new JsonPrefStore( browserContext->GetPath().Append(FILE_PATH_LITERAL("devtoolsprefs.json"))); // We effectively clear the preferences by not calling ReadPrefs + base::ScopedAllowBlockingForTesting allowBlocking; if (!clear) jsonPrefStore->ReadPrefs(); @@ -392,9 +354,10 @@ void DevToolsFrontendQt::HandleMessageFromDevToolsFrontend(base::Value message) int request_id = message.FindIntKey("id").value_or(0); const std::string &method = *method_ptr; - base::Value::ListView params; + base::Value::List *paramsPtr; if (params_value) - params = params_value->GetList(); + paramsPtr = params_value->GetIfList(); + base::Value::List ¶ms = *paramsPtr; if (method == "dispatchProtocolMessage" && params.size() == 1) { const std::string *protocol_message = params[0].GetIfString(); @@ -419,7 +382,7 @@ void DevToolsFrontendQt::HandleMessageFromDevToolsFrontend(base::Value message) base::DictionaryValue response; response.SetInteger("statusCode", 404); response.SetBoolean("urlValid", false); - SendMessageAck(request_id, &response); + SendMessageAck(request_id, std::move(response)); return; } @@ -464,7 +427,7 @@ void DevToolsFrontendQt::HandleMessageFromDevToolsFrontend(base::Value message) } else if (content::HasWebUIScheme(gurl)) { base::DictionaryValue response; response.SetInteger("statusCode", 403); - SendMessageAck(request_id, &response); + SendMessageAck(request_id, std::move(response)); return; } else { auto *partition = web_contents()->GetBrowserContext()->GetStoragePartitionForUrl(gurl); @@ -484,7 +447,7 @@ void DevToolsFrontendQt::HandleMessageFromDevToolsFrontend(base::Value message) SetPreference(kScreencastEnabled, "false"); m_preferences = std::move(*m_prefStore->GetValues()); - SendMessageAck(request_id, &m_preferences); + SendMessageAck(request_id, m_preferences.Clone()); return; } else if (method == "setPreference" && params.size() >= 2) { const std::string *name = params[0].GetIfString(); @@ -560,7 +523,7 @@ void DevToolsFrontendQt::HandleMessageFromDevToolsFrontend(base::Value message) } if (request_id) - SendMessageAck(request_id, nullptr); + SendMessageAck(request_id, base::Value()); } void DevToolsFrontendQt::SetEyeDropperActive(bool active) @@ -584,60 +547,56 @@ void DevToolsFrontendQt::ColorPickedInEyeDropper(int r, int g, int b, int a) color.SetInteger("g", g); color.SetInteger("b", b); color.SetInteger("a", a); - CallClientFunction("DevToolsAPI.eyeDropperPickedColor", &color, nullptr, nullptr); + CallClientFunction("DevToolsAPI", "eyeDropperPickedColor", std::move(color)); } void DevToolsFrontendQt::DispatchProtocolMessage(content::DevToolsAgentHost *agentHost, base::span<const uint8_t> message) { Q_UNUSED(agentHost); - base::StringPiece message_sp(reinterpret_cast<const char*>(message.data()), message.size()); - if (message_sp.length() < kMaxMessageChunkSize) { - std::string param; - base::EscapeJSONString(message_sp, true, ¶m); - std::string code = "DevToolsAPI.dispatchMessage(" + param + ");"; - std::u16string javascript = base::UTF8ToUTF16(code); - web_contents()->GetMainFrame()->ExecuteJavaScript(javascript, base::NullCallback()); - return; - } + base::StringPiece str_message(reinterpret_cast<const char*>(message.data()), message.size()); + + if (str_message.length() < kMaxMessageChunkSize) { + CallClientFunction("DevToolsAPI", "dispatchMessage", + base::Value(std::string(str_message))); + } else { + size_t total_size = str_message.length(); + for (size_t pos = 0; pos < str_message.length(); pos += kMaxMessageChunkSize) { + base::StringPiece str_message_chunk = str_message.substr(pos, kMaxMessageChunkSize); - size_t total_size = message_sp.length(); - for (size_t pos = 0; pos < message_sp.length(); pos += kMaxMessageChunkSize) { - std::string param; - base::EscapeJSONString(message_sp.substr(pos, kMaxMessageChunkSize), true, ¶m); - std::string code = "DevToolsAPI.dispatchMessageChunk(" + param + "," - + std::to_string(pos ? 0 : total_size) + ");"; - std::u16string javascript = base::UTF8ToUTF16(code); - web_contents()->GetMainFrame()->ExecuteJavaScript(javascript, base::NullCallback()); + CallClientFunction("DevToolsAPI", "dispatchMessageChunk", + base::Value(std::string(str_message_chunk)), + base::Value(base::NumberToString(pos ? 0 : total_size))); + } } } -void DevToolsFrontendQt::CallClientFunction(const std::string &function_name, - const base::Value *arg1, - const base::Value *arg2, - const base::Value *arg3) +void DevToolsFrontendQt::CallClientFunction(const std::string &object_name, + const std::string &method_name, + base::Value arg1, base::Value arg2, base::Value arg3, + base::OnceCallback<void(base::Value)> cb) + { - std::string javascript = function_name + "("; - if (arg1) { - std::string json; - base::JSONWriter::Write(*arg1, &json); - javascript.append(json); - if (arg2) { - base::JSONWriter::Write(*arg2, &json); - javascript.append(", ").append(json); - if (arg3) { - base::JSONWriter::Write(*arg3, &json); - javascript.append(", ").append(json); + base::Value::List arguments; + if (!arg1.is_none()) { + arguments.Append(std::move(arg1)); + if (!arg2.is_none()) { + arguments.Append(std::move(arg2)); + if (!arg3.is_none()) { + arguments.Append(std::move(arg3)); } } } - javascript.append(");"); - web_contents()->GetMainFrame()->ExecuteJavaScript(base::UTF8ToUTF16(javascript), base::NullCallback()); + web_contents()->GetMainFrame()->ExecuteJavaScriptMethod(base::ASCIIToUTF16(object_name), + base::ASCIIToUTF16(method_name), + std::move(arguments), + std::move(cb)); + } -void DevToolsFrontendQt::SendMessageAck(int request_id, const base::Value *arg) +void DevToolsFrontendQt::SendMessageAck(int request_id, base::Value arg) { base::Value id_value(request_id); - CallClientFunction("DevToolsAPI.embedderMessageAck", &id_value, arg, nullptr); + CallClientFunction("DevToolsAPI", "embedderMessageAck", std::move(id_value), std::move(arg)); } void DevToolsFrontendQt::AgentHostClosed(content::DevToolsAgentHost *agentHost) diff --git a/src/core/devtools_frontend_qt.h b/src/core/devtools_frontend_qt.h index 68e6c1b42..78a3aaefc 100644 --- a/src/core/devtools_frontend_qt.h +++ b/src/core/devtools_frontend_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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) 2017 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 #ifndef DEVTOOLS_FRONTEND_QT_H #define DEVTOOLS_FRONTEND_QT_H @@ -45,14 +9,9 @@ #include "web_contents_delegate_qt.h" -#include "base/compiler_specific.h" #include "base/containers/unique_ptr_adapters.h" -#include "base/macros.h" -#include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" -#include "base/values.h" #include "content/public/browser/devtools_agent_host.h" -#include "content/public/browser/devtools_frontend_host.h" #include "content/public/browser/web_contents_observer.h" namespace base { @@ -60,8 +19,8 @@ class Value; } namespace content { +class DevToolsFrontendHost; class NavigationHandle; -class RenderViewHost; class WebContents; } // namespace content @@ -82,10 +41,12 @@ public: void DisconnectFromTarget(); - void CallClientFunction(const std::string& function_name, - const base::Value* arg1, - const base::Value* arg2, - const base::Value* arg3); + void CallClientFunction(const std::string &object_name, + const std::string &method_name, + base::Value arg1 = {}, + base::Value arg2 = {}, + base::Value arg3 = {}, + base::OnceCallback<void(base::Value)> cb = base::NullCallback()); WebContentsDelegateQt *frontendDelegate() const { @@ -106,10 +67,10 @@ protected: private: // WebContentsObserver overrides void ReadyToCommitNavigation(content::NavigationHandle* navigation_handle) override; - void DocumentAvailableInMainFrame(content::RenderFrameHost *render_frame_host) override; + void DocumentOnLoadCompletedInPrimaryMainFrame() override; void WebContentsDestroyed() override; - void SendMessageAck(int request_id, const base::Value* arg1); + void SendMessageAck(int request_id, base::Value arg1); void SetPreference(const std::string &name, const std::string &value); void RemovePreference(const std::string &name); void ClearPreferences(); @@ -134,8 +95,6 @@ private: base::DictionaryValue m_preferences; scoped_refptr<PersistentPrefStore> m_prefStore; base::WeakPtrFactory<DevToolsFrontendQt> m_weakFactory; - - DISALLOW_COPY_AND_ASSIGN(DevToolsFrontendQt); }; } // namespace QtWebEngineCore diff --git a/src/core/devtools_manager_delegate_qt.cpp b/src/core/devtools_manager_delegate_qt.cpp index 51f00d3e5..6654ead0e 100644 --- a/src/core/devtools_manager_delegate_qt.cpp +++ b/src/core/devtools_manager_delegate_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 // based on content/shell/browser/shell_devtools_manager_delegate.cc: // Copyright 2013 The Chromium Authors. All rights reserved. @@ -43,31 +7,19 @@ // found in the LICENSE.Chromium file. #include "devtools_manager_delegate_qt.h" +#include "qtwebengine/grit/qt_webengine_resources.h" #include "base/command_line.h" #include "base/files/file_path.h" -#include "base/memory/ptr_util.h" -#include "base/strings/string_number_conversions.h" -#include "base/strings/utf_string_conversions.h" #include "content/browser/devtools/devtools_http_handler.h" #include "content/public/browser/devtools_agent_host.h" -#include "content/public/browser/devtools_frontend_host.h" #include "content/public/browser/devtools_socket_factory.h" -#include "content/public/browser/favicon_status.h" -#include "content/public/browser/navigation_entry.h" -#include "content/public/browser/render_view_host.h" -#include "content/public/browser/web_contents.h" -#include "content/public/browser/web_contents_delegate.h" #include "content/public/common/content_switches.h" #include "net/base/ip_endpoint.h" #include "net/base/net_errors.h" #include "net/socket/tcp_server_socket.h" #include "ui/base/resource/resource_bundle.h" -#include "qtwebengine/grit/qt_webengine_resources.h" - -#include "type_conversion.h" - using content::DevToolsAgentHost; namespace { @@ -93,7 +45,6 @@ private: const std::string m_address; int m_port; int m_backlog; - DISALLOW_COPY_AND_ASSIGN(TCPServerSocketFactory); }; } // namespace @@ -189,4 +140,4 @@ bool DevToolsManagerDelegateQt::HasBundledFrontendResources() return true; } -} //namespace QtWebEngineCore +} // namespace QtWebEngineCore diff --git a/src/core/devtools_manager_delegate_qt.h b/src/core/devtools_manager_delegate_qt.h index 3a519a03f..6e02b04a4 100644 --- a/src/core/devtools_manager_delegate_qt.h +++ b/src/core/devtools_manager_delegate_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef DEV_TOOLS_HTTP_HANDLER_DELEGATE_QT_H #define DEV_TOOLS_HTTP_HANDLER_DELEGATE_QT_H diff --git a/src/core/doc/snippets/qtwebengine_qwebenginepage_snippet.cpp b/src/core/doc/snippets/qtwebengine_qwebenginepage_snippet.cpp index b948fa597..309ad8233 100644 --- a/src/core/doc/snippets/qtwebengine_qwebenginepage_snippet.cpp +++ b/src/core/doc/snippets/qtwebengine_qwebenginepage_snippet.cpp @@ -1,29 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only void wrapInFunction() { diff --git a/src/core/doc/snippets/qtwebenginecore_build_snippet.qdoc b/src/core/doc/snippets/qtwebenginecore_build_snippet.qdoc index ba23c8887..ee22ea774 100644 --- a/src/core/doc/snippets/qtwebenginecore_build_snippet.qdoc +++ b/src/core/doc/snippets/qtwebenginecore_build_snippet.qdoc @@ -1,39 +1,10 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only //! [0] QT += webenginecore //! [0] - -//! [1] -#include <QtWebEngineCore> -//! [1] - //! [2] find_package(Qt6 REQUIRED COMPONENTS WebEngineCore) target_link_libraries(target PRIVATE Qt::WebEngineCore) diff --git a/src/core/doc/src/external-resources.qdoc b/src/core/doc/src/external-resources.qdoc index df6c40c4f..775492c7e 100644 --- a/src/core/doc/src/external-resources.qdoc +++ b/src/core/doc/src/external-resources.qdoc @@ -1,29 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! \externalpage http://www.chromium.org diff --git a/src/core/doc/src/qt6-changes.qdoc b/src/core/doc/src/qt6-changes.qdoc index 6ae6918ca..5061c77ab 100644 --- a/src/core/doc/src/qt6-changes.qdoc +++ b/src/core/doc/src/qt6-changes.qdoc @@ -1,29 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! \page qtwebengine-changes-qt6.html diff --git a/src/core/doc/src/qt_webengine_add_convert_dictionary.qdoc b/src/core/doc/src/qt_webengine_add_convert_dictionary.qdoc index d2670fa1f..74a3ecb48 100644 --- a/src/core/doc/src/qt_webengine_add_convert_dictionary.qdoc +++ b/src/core/doc/src/qt_webengine_add_convert_dictionary.qdoc @@ -1,29 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! \page qt_add_webengine_dictionary.html diff --git a/src/core/doc/src/qtwebengine-debugging.qdoc b/src/core/doc/src/qtwebengine-debugging.qdoc index f84cca312..3599ec55e 100644 --- a/src/core/doc/src/qtwebengine-debugging.qdoc +++ b/src/core/doc/src/qtwebengine-debugging.qdoc @@ -1,29 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! \page qtwebengine-debugging.html @@ -52,10 +28,14 @@ \QWE based browser, such as the Chrome browser. To activate the developer tools, start an application that uses \QWE - with the command-line arguments: + with the command-line argument \c {--remote-debugging-port=<portnumber>}. + + \note Any WebEngine command line options should be specified after the + \c {--webEngineArgs} option, which is used to separate the user's application + specific options from the WebEngine's ones. \badcode - --remote-debugging-port=<port_number> + --webEngineArgs --remote-debugging-port=<portnumber> \endcode Where \c <port_number> refers to a local network port. The web developer diff --git a/src/core/doc/src/qtwebengine-deploying.qdoc b/src/core/doc/src/qtwebengine-deploying.qdoc index 505d38e62..3fb46a672 100644 --- a/src/core/doc/src/qtwebengine-deploying.qdoc +++ b/src/core/doc/src/qtwebengine-deploying.qdoc @@ -1,29 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! \page qtwebengine-deploying.html diff --git a/src/core/doc/src/qtwebengine-features.qdoc b/src/core/doc/src/qtwebengine-features.qdoc index 3b34ffbf6..dc38f5069 100644 --- a/src/core/doc/src/qtwebengine-features.qdoc +++ b/src/core/doc/src/qtwebengine-features.qdoc @@ -1,29 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! \page qtwebengine-features.html @@ -64,14 +40,14 @@ (MP3), have been enabled. Proprietary codecs can be enabled by passing the following option to the \c configure tool when configuring Qt: - \code + \badcode -webengine-proprietary-codecs \endcode For example, the following option could be passed when configuring Qt for building it at the top level: - \code + \badcode configure -webengine-proprietary-codecs \endcode @@ -81,7 +57,7 @@ command can be used to configure and build (in this example, the \QWE source code is located in \c {C:\qt\qtwebengine}): - \code + \badcode qt-configure-module C:\qt\qtwebengine -webengine-proprietary-codecs cmake --build . --parallel \endcode @@ -107,6 +83,14 @@ {Simple Browser} or \l{WebEngine Quick Nano Browser}{Nano Browser}) to connect to \c {http://localhost:[your-port]}. + \note Any WebEngine command line options should be specified after the + \c {--webEngineArgs} option, which is used to separate the user's application + specific options from the WebEngine's ones. + + \badcode + --webEngineArgs --remote-debugging-port=5000 + \endcode + The Chromium DevTools page can also be shown within the application. To set this up, you can call either QWebEnginePage::setInspectedPage() to the page to be inspected, which implicitly loads the DevTools into the \c this page, @@ -193,17 +177,17 @@ location can be also passed with \c {QTWEBENGINE_CHROMIUM_FLAGS} using \c {widevine-path}. On Windows: - \code + \badcode set QTWEBENGINE_CHROMIUM_FLAGS=--widevine-path="C:/some path/widevinecdm.dll" \endcode On Linux: - \code + \badcode export QTWEBENGINE_CHROMIUM_FLAGS=--widevine-path="/some path/libwidevinecdm.so" \endcode On macOS: - \code + \badcode export QTWEBENGINE_CHROMIUM_FLAGS=--widevine-path="/some path/libwidevinecdm.dylib" \endcode @@ -287,14 +271,14 @@ entries, separated by commas, that contain the file path and one or several MIME types, separated by semicolons: - \code + \badcode <file-path-plugin1>;<mime-type-plugin1>,<file-path-plugin2>;<mime-type1-plugin2>;<mime-type2-plugin2> \endcode For example: - \code - --register-pepper-plugins="libppapi_example.so;application/x-ppapi-example" + \badcode + --webEngineArgs --register-pepper-plugins="libppapi_example.so;application/x-ppapi-example" \endcode The MIME type is important because it determines which embeds the plugin is @@ -565,14 +549,14 @@ For opening the source view in the current tab, URLs with \l{view-source URI scheme} are also supported. For example, you can type the following URL to the URL bar to view the HTML source of the qt.io web page: - \code + \badcode view-source:https://www.qt.io/ \endcode Auto-completion of incomplete URLs with \l{view-source URI scheme} makes the usage of this feature more comfortable. For example, the following incomplete URL also loads the source view of the qt.io web page: - \code + \badcode view-source:qt.io \endcode diff --git a/src/core/doc/src/qtwebengine-global.qdoc b/src/core/doc/src/qtwebengine-global.qdoc index 435fbac68..57df8b3ac 100644 --- a/src/core/doc/src/qtwebengine-global.qdoc +++ b/src/core/doc/src/qtwebengine-global.qdoc @@ -1,29 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2022 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! \headerfile <qtwebenginecoreglobal.h> diff --git a/src/core/doc/src/qtwebengine-index.qdoc b/src/core/doc/src/qtwebengine-index.qdoc index 4c1dedaa9..b20a96dc1 100644 --- a/src/core/doc/src/qtwebengine-index.qdoc +++ b/src/core/doc/src/qtwebengine-index.qdoc @@ -1,29 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! \page qtwebengine-index.html diff --git a/src/core/doc/src/qtwebengine-modules.qdoc b/src/core/doc/src/qtwebengine-modules.qdoc index 11281288a..ee1ad8188 100644 --- a/src/core/doc/src/qtwebengine-modules.qdoc +++ b/src/core/doc/src/qtwebengine-modules.qdoc @@ -1,29 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! \page qtwebengine-modules.html diff --git a/src/core/doc/src/qtwebengine-overview.qdoc b/src/core/doc/src/qtwebengine-overview.qdoc index 5b20945c6..3937ca9bb 100644 --- a/src/core/doc/src/qtwebengine-overview.qdoc +++ b/src/core/doc/src/qtwebengine-overview.qdoc @@ -1,29 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! \page qtwebengine-overview.html diff --git a/src/core/doc/src/qtwebengine-platform-notes.qdoc b/src/core/doc/src/qtwebengine-platform-notes.qdoc index 7c8f4d472..76f5bbfda 100644 --- a/src/core/doc/src/qtwebengine-platform-notes.qdoc +++ b/src/core/doc/src/qtwebengine-platform-notes.qdoc @@ -1,29 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! \page qtwebengine-platform-notes.html @@ -73,7 +49,7 @@ \li Visual Studio 2019 or later, or clang-cl version 10 or later \li Active Template Library (ATL), usually included in the Visual Studio installation - \li Windows 10 SDK version 10.0.19041 or later + \li Windows 10 SDK version 10.0.20348.0 or later \endlist \QWE can only be built on 64-bit Windows, with a x64-bit toolchain. @@ -125,8 +101,8 @@ \section1 Using Earlier Qt Versions to Build \QWE Building \QWE with earlier Qt versions (down to the last LTS - version) is supported. It means that \QWE 6.3 can be built with - Qt 6.2.x, and Qt 6.3. + version) is supported. It means that \QWE 6.4 can be built with + Qt 6.2.x, Qt 6.3.x, and Qt 6.4. To use an earlier Qt version to build Qt Webengine: diff --git a/src/core/doc/src/qtwebenginecore-index.qdoc b/src/core/doc/src/qtwebenginecore-index.qdoc index a8e9ca395..cd6f2efe4 100644 --- a/src/core/doc/src/qtwebenginecore-index.qdoc +++ b/src/core/doc/src/qtwebenginecore-index.qdoc @@ -1,29 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! \page qtwebenginecore-index.html @@ -35,11 +11,6 @@ \section1 Getting Started - To include the definitions of the module's classes, use the - following directive: - - \snippet qtwebenginecore_build_snippet.qdoc 1 - To link against the module, add this line to your qmake project file: \snippet qtwebenginecore_build_snippet.qdoc 0 diff --git a/src/core/doc/src/qtwebenginecore-module.qdoc b/src/core/doc/src/qtwebenginecore-module.qdoc index 1647866bb..188609793 100644 --- a/src/core/doc/src/qtwebenginecore-module.qdoc +++ b/src/core/doc/src/qtwebenginecore-module.qdoc @@ -1,29 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! @@ -36,11 +12,6 @@ \qtvariable webenginecore \qtcmakepackage WebEngineCore - To include the definitions of the module's classes, use the - following directive: - - \snippet qtwebenginecore_build_snippet.qdoc 1 - If you use qmake to build your projects, \QWE Core is usually indirectly included through the \l{Qt WebEngine QML Types}{Qt WebEngine Quick} or \l{Qt WebEngine Widgets C++ Classes}{Qt WebEngine Widgets} modules. diff --git a/src/core/doc/src/qwebengine-licensing.qdoc b/src/core/doc/src/qwebengine-licensing.qdoc index f6a0a6c32..2b1bd2845 100644 --- a/src/core/doc/src/qwebengine-licensing.qdoc +++ b/src/core/doc/src/qwebengine-licensing.qdoc @@ -1,29 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! \group qtwebengine-licensing diff --git a/src/core/doc/src/qwebenginehistory_lgpl.qdoc b/src/core/doc/src/qwebenginehistory_lgpl.qdoc index 37f96e7c1..f61bb3b85 100644 --- a/src/core/doc/src/qwebenginehistory_lgpl.qdoc +++ b/src/core/doc/src/qwebenginehistory_lgpl.qdoc @@ -1,22 +1,6 @@ -/* - Copyright (C) 2015 The Qt Company Ltd. - Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ +// Copyright (C) 2015 The Qt Company Ltd. +// Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only // The documentation in this file was imported from QtWebKit and is thus constrained // by its LGPL license. Documentation written from scratch for new methods should be diff --git a/src/core/doc/src/qwebenginepage_lgpl.qdoc b/src/core/doc/src/qwebenginepage_lgpl.qdoc index 4a058460b..19efa2903 100644 --- a/src/core/doc/src/qwebenginepage_lgpl.qdoc +++ b/src/core/doc/src/qwebenginepage_lgpl.qdoc @@ -1,24 +1,8 @@ -/* - Copyright (C) 2019 The Qt Company Ltd. - Copyright (C) 2008, 2009, 2012 Nokia Corporation and/or its subsidiary(-ies) - Copyright (C) 2007 Staikos Computing Services Inc. - Copyright (C) 2007 Apple Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ +// Copyright (C) 2019 The Qt Company Ltd. +// Copyright (C) 2008, 2009, 2012 Nokia Corporation and/or its subsidiary(-ies) +// Copyright (C) 2007 Staikos Computing Services Inc. +// Copyright (C) 2007 Apple Inc. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only // The documentation in this file was imported from QtWebKit and is thus constrained // by its LGPL license. Documentation written from scratch for new methods should be diff --git a/src/core/doc/src/qwebenginesettings_lgpl.qdoc b/src/core/doc/src/qwebenginesettings_lgpl.qdoc index 6a7f1f958..5cd1e5419 100644 --- a/src/core/doc/src/qwebenginesettings_lgpl.qdoc +++ b/src/core/doc/src/qwebenginesettings_lgpl.qdoc @@ -1,22 +1,6 @@ -/* - Copyright (C) 2015 The Qt Company Ltd. - Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ +// Copyright (C) 2022 The Qt Company Ltd. +// Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only // The documentation in this file was imported from QtWebKit and is thus constrained // by its LGPL license. Documentation written from scratch for new methods should be @@ -56,7 +40,7 @@ \value CursiveFont \value FantasyFont \value PictographFont - (added in Qt 5.7) + (added in Qt 5.7, deprecated Qt 6.4) */ /*! @@ -97,7 +81,8 @@ Enables support for the HTML 5 local storage feature. Enabled by default. \value LocalContentCanAccessRemoteUrls Allows local origin documents to access remote resources that would normally be blocked. - Disabled by default. + Disabled by default. Note DnsPrefetchEnabled below operates independently of this setting, + and can if enabled, cause remote accesses from local content. \value XSSAuditingEnabled Obsolete and has no effect. \value SpatialNavigationEnabled @@ -180,6 +165,9 @@ \value PdfViewerEnabled Specifies that PDF documents will be opened in the internal PDF viewer instead of being downloaded. Enabled by default. (Added in Qt 5.13) + \value NavigateOnDropEnabled Specifies that navigations can be triggered by dropping URLs on + the view. + Enabled by default. (Added in Qt 6.4) */ /*! diff --git a/src/core/download_manager_delegate_qt.cpp b/src/core/download_manager_delegate_qt.cpp index 2a8a964f4..65884c9b6 100644 --- a/src/core/download_manager_delegate_qt.cpp +++ b/src/core/download_manager_delegate_qt.cpp @@ -1,46 +1,8 @@ -/**************************************************************************** -** -** 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 "download_manager_delegate_qt.h" -#include "base/files/file_util.h" -#include "base/time/time_to_iso8601.h" #include "content/public/browser/download_item_utils.h" #include "content/public/browser/download_manager.h" #include "content/public/browser/save_page_type.h" @@ -49,9 +11,7 @@ #include "net/http/http_content_disposition.h" #include <QDir> -#include <QFile> #include <QFileInfo> -#include <QMap> #include <QMimeDatabase> #include <QStandardPaths> @@ -94,6 +54,7 @@ void DownloadManagerDelegateQt::cancelDownload(content::DownloadTargetCallback c download::DownloadDangerType::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT, download::DownloadItem::UNKNOWN, base::FilePath(), + base::FilePath(), absl::nullopt, download::DownloadInterruptReason::DOWNLOAD_INTERRUPT_REASON_USER_CANCELED); } @@ -135,6 +96,7 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(download::DownloadItem * download::DownloadDangerType::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, download::DownloadItem::VALIDATED, item->GetForcedFilePath(), + item->GetFileNameToReportUser(), absl::nullopt, download::DownloadInterruptReason::DOWNLOAD_INTERRUPT_REASON_NONE); return true; @@ -204,14 +166,14 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(download::DownloadItem * QFileInfo suggestedFile(info.path); if (info.accepted && !suggestedFile.absoluteDir().mkpath(suggestedFile.absolutePath())) { -#if defined(OS_WIN) +#if defined(Q_OS_WIN) // TODO: Remove this when https://bugreports.qt.io/browse/QTBUG-85997 is fixed. QDir suggestedDir = QDir(suggestedFile.absolutePath()); if (!suggestedDir.isRoot() || !suggestedDir.exists()) { #endif qWarning("Creating download path failed, download cancelled: %s", suggestedFile.absolutePath().toUtf8().data()); info.accepted = false; -#if defined(OS_WIN) +#if defined(Q_OS_WIN) } #endif } @@ -227,6 +189,7 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(download::DownloadItem * download::DownloadDangerType::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT, download::DownloadItem::VALIDATED, filePathForCallback.AddExtension(toFilePathString("download")), + base::FilePath(), absl::nullopt, download::DownloadInterruptReason::DOWNLOAD_INTERRUPT_REASON_NONE); } else diff --git a/src/core/download_manager_delegate_qt.h b/src/core/download_manager_delegate_qt.h index 7b8de08df..f807301d1 100644 --- a/src/core/download_manager_delegate_qt.h +++ b/src/core/download_manager_delegate_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef DOWNLOAD_MANAGER_DELEGATE_QT_H #define DOWNLOAD_MANAGER_DELEGATE_QT_H @@ -60,8 +24,6 @@ class DownloadItem; namespace QtWebEngineCore { class ProfileAdapter; -class DownloadManagerDelegateInstance; -class DownloadTargetHelper; class DownloadManagerDelegateQt : public content::DownloadManagerDelegate @@ -101,11 +63,8 @@ private: uint32_t m_currentId; base::WeakPtrFactory<DownloadManagerDelegateQt> m_weakPtrFactory; - - friend class DownloadManagerDelegateInstance; - DISALLOW_COPY_AND_ASSIGN(DownloadManagerDelegateQt); }; } // namespace QtWebEngineCore -#endif //DOWNLOAD_MANAGER_DELEGATE_QT_H +#endif // DOWNLOAD_MANAGER_DELEGATE_QT_H diff --git a/src/core/extensions/component_extension_resource_manager_qt.cpp b/src/core/extensions/component_extension_resource_manager_qt.cpp index 0bb6efc97..b2cb7e356 100644 --- a/src/core/extensions/component_extension_resource_manager_qt.cpp +++ b/src/core/extensions/component_extension_resource_manager_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 // based on chrome/browser/extensions/chrome_component_extension_resource_manager.cc: // Copyright 2014 The Chromium Authors. All rights reserved. @@ -46,7 +10,6 @@ #include "base/check.h" #include "base/containers/contains.h" -#include "base/logging.h" #include "base/path_service.h" #include "base/stl_util.h" #include "base/values.h" @@ -79,7 +42,7 @@ ComponentExtensionResourceManagerQt::ComponentExtensionResourceManagerQt() pdf_extension_util::AddAdditionalData(&dict); ui::TemplateReplacements pdf_viewer_replacements; - ui::TemplateReplacementsFromDictionaryValue(base::Value::AsDictionaryValue(dict), &pdf_viewer_replacements); + ui::TemplateReplacementsFromDictionaryValue(dict.GetDict(), &pdf_viewer_replacements); template_replacements_[extension_misc::kPdfExtensionId] = std::move(pdf_viewer_replacements); #endif } diff --git a/src/core/extensions/component_extension_resource_manager_qt.h b/src/core/extensions/component_extension_resource_manager_qt.h index b029a7f71..4da18890e 100644 --- a/src/core/extensions/component_extension_resource_manager_qt.h +++ b/src/core/extensions/component_extension_resource_manager_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 // Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be @@ -47,7 +11,6 @@ #include <map> #include "base/files/file_path.h" -#include "base/macros.h" #include "extensions/browser/component_extension_resource_manager.h" #include "ui/base/webui/resource_path.h" @@ -74,8 +37,6 @@ private: // A map from an extension ID to its i18n template replacements. std::map<std::string, ui::TemplateReplacements> template_replacements_; - - DISALLOW_COPY_AND_ASSIGN(ComponentExtensionResourceManagerQt); }; } // namespace extensions diff --git a/src/core/extensions/extension_host_delegate_qt.cpp b/src/core/extensions/extension_host_delegate_qt.cpp index 4db1aeb71..6cc268e75 100644 --- a/src/core/extensions/extension_host_delegate_qt.cpp +++ b/src/core/extensions/extension_host_delegate_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 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) 2020 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 "extension_host_delegate_qt.h" #include "extension_web_contents_observer_qt.h" @@ -105,13 +69,9 @@ bool ExtensionHostDelegateQt::CheckMediaAccessPermission(content::RenderFrameHos return false; } -content::PictureInPictureResult ExtensionHostDelegateQt::EnterPictureInPicture(content::WebContents *web_contents, - const viz::SurfaceId &surface_id, - const gfx::Size &natural_size) +content::PictureInPictureResult ExtensionHostDelegateQt::EnterPictureInPicture(content::WebContents *web_contents) { Q_UNUSED(web_contents); - Q_UNUSED(surface_id); - Q_UNUSED(natural_size); Q_UNREACHABLE(); return content::PictureInPictureResult::kNotSupported; diff --git a/src/core/extensions/extension_host_delegate_qt.h b/src/core/extensions/extension_host_delegate_qt.h index 04ffb9d16..e5577b3fd 100644 --- a/src/core/extensions/extension_host_delegate_qt.h +++ b/src/core/extensions/extension_host_delegate_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 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) 2020 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 #ifndef EXTENSION_HOST_DELEGATE_QT_H #define EXTENSION_HOST_DELEGATE_QT_H @@ -66,9 +30,7 @@ public: const GURL &security_origin, blink::mojom::MediaStreamType type, const Extension *extension) override; - content::PictureInPictureResult EnterPictureInPicture(content::WebContents *web_contents, - const viz::SurfaceId &surface_id, - const gfx::Size &natural_size) override; + content::PictureInPictureResult EnterPictureInPicture(content::WebContents *web_contents) override; void ExitPictureInPicture() override; }; diff --git a/src/core/extensions/extension_system_factory_qt.cpp b/src/core/extensions/extension_system_factory_qt.cpp index b63b41a86..63d88fcaf 100644 --- a/src/core/extensions/extension_system_factory_qt.cpp +++ b/src/core/extensions/extension_system_factory_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be diff --git a/src/core/extensions/extension_system_factory_qt.h b/src/core/extensions/extension_system_factory_qt.h index 6e840b6d6..b6f6acc5d 100644 --- a/src/core/extensions/extension_system_factory_qt.h +++ b/src/core/extensions/extension_system_factory_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be @@ -44,7 +8,6 @@ #ifndef EXTENSION_SYSTEM_FACTORY_QT_H_ #define EXTENSION_SYSTEM_FACTORY_QT_H_ -#include "base/macros.h" #include "base/memory/singleton.h" #include "components/keyed_service/content/browser_context_keyed_service_factory.h" #include "extensions/browser/extension_system_provider.h" @@ -73,8 +36,6 @@ private: KeyedService *BuildServiceInstanceFor(content::BrowserContext *context) const override; content::BrowserContext *GetBrowserContextToUse(content::BrowserContext *context) const override; bool ServiceIsCreatedWithBrowserContext() const override; - - DISALLOW_COPY_AND_ASSIGN(ExtensionSystemFactoryQt); }; } // namespace extensions diff --git a/src/core/extensions/extension_system_qt.cpp b/src/core/extensions/extension_system_qt.cpp index a9699f30d..67750fa6a 100644 --- a/src/core/extensions/extension_system_qt.cpp +++ b/src/core/extensions/extension_system_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 // Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be @@ -63,14 +27,16 @@ #include "build/build_config.h" #include "chrome/common/buildflags.h" #include "components/crx_file/id_util.h" +#include "components/value_store/value_store_factory.h" +#include "components/value_store/value_store_factory_impl.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" -#include "content/public/browser/plugin_service.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/url_data_source.h" #include "content/public/common/webplugininfo.h" +#include "extensions/browser/app_sorting.h" #include "extensions/browser/content_verifier.h" #include "extensions/browser/content_verifier_delegate.h" #include "extensions/browser/extension_pref_store.h" @@ -80,21 +46,24 @@ #include "extensions/browser/extension_registry.h" #include "extensions/browser/info_map.h" #include "extensions/browser/notification_types.h" -#include "extensions/browser/null_app_sorting.h" #include "extensions/browser/quota_service.h" #include "extensions/browser/renderer_startup_helper.h" -#include "extensions/browser/runtime_data.h" #include "extensions/browser/service_worker_manager.h" #include "extensions/browser/user_script_manager.h" -#include "extensions/browser/value_store/value_store_factory_impl.h" #include "extensions/common/constants.h" #include "extensions/common/manifest_constants.h" #include "extensions/common/manifest_handlers/mime_types_handler.h" #include "extensions/common/manifest_url_handlers.h" #include "net/base/mime_util.h" +#include "pdf/buildflags.h" +#include "ppapi/buildflags/buildflags.h" #include "qtwebengine/grit/qt_webengine_resources.h" #include "ui/base/resource/resource_bundle.h" +#if BUILDFLAG(ENABLE_PLUGINS) +#include "content/public/browser/plugin_service.h" +#endif + using content::BrowserThread; namespace extensions { @@ -220,6 +189,7 @@ void ExtensionSystemQt::NotifyExtensionLoaded(const Extension *extension) // know about it. extension_registry_->TriggerOnLoaded(extension); +#if BUILDFLAG(ENABLE_PLUGINS) // Register plugins included with the extension. // Implementation based on PluginManager::OnExtensionLoaded. const MimeTypesHandler *handler = MimeTypesHandler::GetHandler(extension); @@ -245,6 +215,7 @@ void ExtensionSystemQt::NotifyExtensionLoaded(const Extension *extension) plugin_service->RefreshPlugins(); plugin_service->RegisterInternalPlugin(info, true); } +#endif // BUILDFLAG(ENABLE_PLUGINS) } bool ExtensionSystemQt::FinishDelayedInstallationIfReady(const std::string &extension_id, bool install_immediately) @@ -269,11 +240,6 @@ ExtensionService *ExtensionSystemQt::extension_service() return nullptr; } -RuntimeData *ExtensionSystemQt::runtime_data() -{ - return runtime_data_.get(); -} - ManagementPolicy *ExtensionSystemQt::management_policy() { return nullptr; @@ -294,7 +260,12 @@ StateStore *ExtensionSystemQt::rules_store() return nullptr; } -scoped_refptr<ValueStoreFactory> ExtensionSystemQt::store_factory() +StateStore *ExtensionSystemQt::dynamic_user_scripts_store() +{ + return nullptr; +} + +scoped_refptr<value_store::ValueStoreFactory> ExtensionSystemQt::store_factory() { return store_factory_; } @@ -313,7 +284,7 @@ QuotaService *ExtensionSystemQt::quota_service() AppSorting *ExtensionSystemQt::app_sorting() { - return app_sorting_.get(); + return nullptr; } ContentVerifier *ExtensionSystemQt::content_verifier() @@ -326,7 +297,7 @@ ContentVerifier *ExtensionSystemQt::content_verifier() ExtensionSystemQt::ExtensionSystemQt(content::BrowserContext *browserContext) : browser_context_(browserContext) - , store_factory_(new ValueStoreFactoryImpl(browserContext->GetPath())) + , store_factory_(new value_store::ValueStoreFactoryImpl(browserContext->GetPath())) , extension_registry_(ExtensionRegistry::Get(browserContext)) , renderer_helper_(extensions::RendererStartupHelperFactory::GetForBrowserContext(browserContext)) , initialized_(false) @@ -345,13 +316,9 @@ void ExtensionSystemQt::Init(bool extensions_enabled) initialized_ = true; - service_worker_manager_.reset(new ServiceWorkerManager(browser_context_)); - runtime_data_.reset(new RuntimeData(extension_registry_)); - quota_service_.reset(new QuotaService); - app_sorting_.reset(new NullAppSorting); - - user_script_manager_ = - std::make_unique<UserScriptManager>(browser_context_); + service_worker_manager_ = std::make_unique<ServiceWorkerManager>(browser_context_); + user_script_manager_ = std::make_unique<UserScriptManager>(browser_context_); + quota_service_ = std::make_unique<QuotaService>(); // Make the chrome://extension-icon/ resource available. // content::URLDataSource::Add(browser_context_, new ExtensionIconSource(browser_context_)); @@ -360,6 +327,7 @@ void ExtensionSystemQt::Init(bool extensions_enabled) // Inform the rest of the extensions system to start. ready_.Signal(); +#if BUILDFLAG(ENABLE_PDF) { std::string pdf_manifest = ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(IDR_PDF_MANIFEST); base::ReplaceFirstSubstringAfterOffset(&pdf_manifest, 0, "<NAME>", "chromium-pdf"); @@ -371,6 +339,7 @@ void ExtensionSystemQt::Init(bool extensions_enabled) std::string id = GenerateId(pdfManifestDict.get(), path); LoadExtension(id, std::move(pdfManifestDict), path); } +#endif // BUILDFLAG(ENABLE_PDF) #if BUILDFLAG(ENABLE_HANGOUT_SERVICES_EXTENSION) { @@ -417,12 +386,11 @@ void ExtensionSystemQt::RegisterExtensionWithRequestContexts(const Extension *ex std::move(callback)); } -void ExtensionSystemQt::UnregisterExtensionWithRequestContexts(const std::string &extension_id, - const UnloadedExtensionReason reason) +void ExtensionSystemQt::UnregisterExtensionWithRequestContexts(const std::string &extension_id) { base::PostTask( FROM_HERE, {BrowserThread::IO}, - base::BindOnce(&InfoMap::RemoveExtension, info_map(), extension_id, reason)); + base::BindOnce(&InfoMap::RemoveExtension, info_map(), extension_id)); } bool ExtensionSystemQt::is_ready() const diff --git a/src/core/extensions/extension_system_qt.h b/src/core/extensions/extension_system_qt.h index 2ae92581a..02fbaee37 100644 --- a/src/core/extensions/extension_system_qt.h +++ b/src/core/extensions/extension_system_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 // Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be @@ -50,12 +14,15 @@ #include <string> #include "base/one_shot_event.h" -#include "base/macros.h" #include "base/memory/weak_ptr.h" #include "build/build_config.h" #include "extensions/browser/extension_system.h" #include "extensions/common/extension_set.h" +namespace value_store { +class ValueStoreFactory; +} + namespace extensions { class ExtensionRegistry; @@ -63,8 +30,6 @@ class InfoMap; class RendererStartupHelper; class ServiceWorkerManager; class StateStoreNotificationObserver; -class ValueStoreFactory; -class ValueStoreFactoryImpl; // The ExtensionSystem for ProfileImpl and OffTheRecordProfileImpl. // Implementation details: non-shared services are owned by @@ -86,13 +51,13 @@ public: // ExtensionSystem implementation: void InitForRegularProfile(bool extensions_enabled) override; ExtensionService *extension_service() override; - RuntimeData *runtime_data() override; ManagementPolicy *management_policy() override; ServiceWorkerManager *service_worker_manager() override; UserScriptManager *user_script_manager() override; StateStore *state_store() override; StateStore *rules_store() override; - scoped_refptr<ValueStoreFactory> store_factory() override; + StateStore *dynamic_user_scripts_store() override; + scoped_refptr<value_store::ValueStoreFactory> store_factory() override; InfoMap *info_map() override; QuotaService *quota_service() override; AppSorting *app_sorting() override; @@ -100,8 +65,7 @@ public: void RegisterExtensionWithRequestContexts(const Extension *extension, base::OnceClosure callback) override; - void UnregisterExtensionWithRequestContexts(const std::string &extension_id, - const UnloadedExtensionReason reason) override; + void UnregisterExtensionWithRequestContexts(const std::string &extension_id) override; ContentVerifier *content_verifier() override; std::unique_ptr<ExtensionSet> GetDependentExtensions(const Extension *extension) override; @@ -126,9 +90,7 @@ private: scoped_refptr<InfoMap> info_map_; std::unique_ptr<ServiceWorkerManager> service_worker_manager_; - std::unique_ptr<RuntimeData> runtime_data_; std::unique_ptr<QuotaService> quota_service_; - std::unique_ptr<AppSorting> app_sorting_; std::unique_ptr<UserScriptManager> user_script_manager_; @@ -137,13 +99,12 @@ private: base::OneShotEvent ready_; content::BrowserContext *browser_context_; - scoped_refptr<ValueStoreFactory> store_factory_; + scoped_refptr<value_store::ValueStoreFactory> store_factory_; ExtensionRegistry *extension_registry_; extensions::RendererStartupHelper *renderer_helper_; bool initialized_; base::WeakPtrFactory<ExtensionSystemQt> weak_ptr_factory_; - DISALLOW_COPY_AND_ASSIGN(ExtensionSystemQt); }; } // namespace extensions diff --git a/src/core/extensions/extension_web_contents_observer_qt.cpp b/src/core/extensions/extension_web_contents_observer_qt.cpp index 947815d7b..22092be30 100644 --- a/src/core/extensions/extension_web_contents_observer_qt.cpp +++ b/src/core/extensions/extension_web_contents_observer_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 // Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be @@ -43,9 +7,8 @@ #include "extension_web_contents_observer_qt.h" -#include "components/guest_view/browser/guest_view_base.h" +#include "content/browser/renderer_host/render_frame_host_impl.h" #include "content/public/browser/child_process_security_policy.h" -#include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_view_host.h" #include "extensions/browser/extension_registry.h" @@ -58,6 +21,7 @@ namespace extensions { ExtensionWebContentsObserverQt::ExtensionWebContentsObserverQt(content::WebContents *web_contents) : ExtensionWebContentsObserver(web_contents) + , content::WebContentsUserData<ExtensionWebContentsObserverQt>(*web_contents) { } @@ -78,6 +42,17 @@ void ExtensionWebContentsObserverQt::RenderFrameCreated(content::RenderFrameHost { ExtensionWebContentsObserver::RenderFrameCreated(render_frame_host); + if (web_contents()->IsInnerWebContentsForGuest() && static_cast<content::RenderFrameHostImpl *>(render_frame_host)->is_local_root_subframe()) { + content::WebContents *parent = web_contents()->GetOutermostWebContents(); + QtWebEngineCore::RenderWidgetHostViewQt *main_rwhv = static_cast<QtWebEngineCore::RenderWidgetHostViewQt *>(parent->GetRenderWidgetHostView()); + // Main frame of guest WebContents + content::RenderWidgetHost *guest_render_widget_host = web_contents()->GetRenderViewHost()->GetWidget(); + main_rwhv->addGuest(guest_render_widget_host); + // The frame which holds the actual PDF content inside the guest + content::RenderWidgetHost *pdf_render_widget_host = render_frame_host->GetRenderWidgetHost(); + main_rwhv->addGuest(pdf_render_widget_host); + } + const Extension *extension = GetExtensionFromFrame(render_frame_host, false); if (!extension) return; @@ -89,16 +64,6 @@ void ExtensionWebContentsObserverQt::RenderFrameCreated(content::RenderFrameHost policy->GrantRequestOrigin(process_id, url::Origin::Create(GURL(blink::kChromeUIResourcesURL))); } -void ExtensionWebContentsObserverQt::RenderViewReady() -{ - if (web_contents()->IsInnerWebContentsForGuest()) { - content::RenderWidgetHost *render_widget_host = web_contents()->GetRenderViewHost()->GetWidget(); - content::WebContents *parent_web_contents = guest_view::GuestViewBase::GetTopLevelWebContents(web_contents()); - QtWebEngineCore::RenderWidgetHostViewQt *parent_rwhv = static_cast<QtWebEngineCore::RenderWidgetHostViewQt *>(parent_web_contents->GetRenderWidgetHostView()); - parent_rwhv->setGuest(static_cast<content::RenderWidgetHostImpl *>(render_widget_host)); - } -} - -WEB_CONTENTS_USER_DATA_KEY_IMPL(ExtensionWebContentsObserverQt) +WEB_CONTENTS_USER_DATA_KEY_IMPL(ExtensionWebContentsObserverQt); } // namespace extensions diff --git a/src/core/extensions/extension_web_contents_observer_qt.h b/src/core/extensions/extension_web_contents_observer_qt.h index 346e94d4a..ff50b28e2 100644 --- a/src/core/extensions/extension_web_contents_observer_qt.h +++ b/src/core/extensions/extension_web_contents_observer_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 // Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be @@ -61,12 +25,10 @@ public: // content::WebContentsObserver overrides. void RenderFrameCreated(content::RenderFrameHost *render_frame_host) override; - void RenderViewReady() override; private: friend class content::WebContentsUserData<ExtensionWebContentsObserverQt>; WEB_CONTENTS_USER_DATA_KEY_DECL(); - DISALLOW_COPY_AND_ASSIGN(ExtensionWebContentsObserverQt); }; } // namespace extensions diff --git a/src/core/extensions/extensions_api_client_qt.cpp b/src/core/extensions/extensions_api_client_qt.cpp index 925fd10da..3d86c65f7 100644 --- a/src/core/extensions/extensions_api_client_qt.cpp +++ b/src/core/extensions/extensions_api_client_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 // Portions copyright 2015 The Chromium Embedded Framework Authors. // Portions copyright 2014 The Chromium Authors. All rights reserved. @@ -46,12 +10,21 @@ #include "messaging_delegate_qt.h" #include <memory> -#include "components/pdf/browser/pdf_web_contents_helper.h" + #include "extension_web_contents_observer_qt.h" #include "extensions/browser/guest_view/extensions_guest_view_manager_delegate.h" #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest_delegate.h" #include "mime_handler_view_guest_delegate_qt.h" +#include "pdf/buildflags.h" +#include "printing/buildflags/buildflags.h" + +#if BUILDFLAG(ENABLE_PDF) +#include "components/pdf/browser/pdf_web_contents_helper.h" +#endif + +#if BUILDFLAG(ENABLE_PRINTING) && BUILDFLAG(ENABLE_PRINT_PREVIEW) #include "printing/print_view_manager_qt.h" +#endif namespace extensions { @@ -79,7 +52,9 @@ std::unique_ptr<MimeHandlerViewGuestDelegate> ExtensionsAPIClientQt::CreateMimeH void ExtensionsAPIClientQt::AttachWebContentsHelpers(content::WebContents *web_contents) const { // PrefsTabHelper::CreateForWebContents(web_contents); +#if BUILDFLAG(ENABLE_PRINTING) && BUILDFLAG(ENABLE_PRINT_PREVIEW) QtWebEngineCore::PrintViewManagerQt::CreateForWebContents(web_contents); +#endif ExtensionWebContentsObserverQt::CreateForWebContents(web_contents); } diff --git a/src/core/extensions/extensions_api_client_qt.h b/src/core/extensions/extensions_api_client_qt.h index b1b6356e8..7eb74b96c 100644 --- a/src/core/extensions/extensions_api_client_qt.h +++ b/src/core/extensions/extensions_api_client_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 // Portions copyright 2015 The Chromium Embedded Framework Authors. // Portions copyright 2014 The Chromium Authors. All rights reserved. diff --git a/src/core/extensions/extensions_browser_client_qt.cpp b/src/core/extensions/extensions_browser_client_qt.cpp index a01b074c2..f013c04a4 100644 --- a/src/core/extensions/extensions_browser_client_qt.cpp +++ b/src/core/extensions/extensions_browser_client_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 // Portions copyright 2015 The Chromium Embedded Framework Authors. // Portions copyright 2014 The Chromium Authors. All rights reserved. @@ -203,7 +167,8 @@ private: if (!head->mime_type.empty()) { head->headers->AddHeader(net::HttpRequestHeaders::kContentType, head->mime_type.c_str()); } - client_->OnReceiveResponse(std::move(head)); + client_->OnReceiveResponse(std::move(head), + mojo::ScopedDataPipeConsumerHandle()); client_->OnStartLoadingResponseBody(std::move(consumer_handle)); uint32_t write_size = data->size(); @@ -245,8 +210,6 @@ private: mojo::Remote<network::mojom::URLLoaderClient> client_; scoped_refptr<net::HttpResponseHeaders> response_headers_; base::WeakPtrFactory<ResourceBundleFileLoader> weak_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(ResourceBundleFileLoader); }; } // namespace @@ -266,8 +229,6 @@ public: api::ChromeGeneratedFunctionRegistry::RegisterAll(registry); } -private: - DISALLOW_COPY_AND_ASSIGN(ChromeExtensionsBrowserAPIProvider); }; class QtWebEngineExtensionsBrowserAPIProvider : public ExtensionsBrowserAPIProvider @@ -281,9 +242,6 @@ public: // Generated APIs from QtWebEngine. api::QtWebEngineGeneratedFunctionRegistry::RegisterAll(registry); } - -private: - DISALLOW_COPY_AND_ASSIGN(QtWebEngineExtensionsBrowserAPIProvider); }; ExtensionsBrowserClientQt::ExtensionsBrowserClientQt() @@ -544,7 +502,6 @@ ExtensionWebContentsObserver *ExtensionsBrowserClientQt::GetExtensionWebContents KioskDelegate *ExtensionsBrowserClientQt::GetKioskDelegate() { - NOTREACHED(); return nullptr; } diff --git a/src/core/extensions/extensions_browser_client_qt.h b/src/core/extensions/extensions_browser_client_qt.h index 9b07fa3e9..e111c1283 100644 --- a/src/core/extensions/extensions_browser_client_qt.h +++ b/src/core/extensions/extensions_browser_client_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 // Portions copyright 2015 The Chromium Embedded Framework Authors. // Portions copyright 2014 The Chromium Authors. All rights reserved. @@ -45,7 +9,6 @@ #ifndef EXTENSIONS_BROWSER_CLIENT_QT_H_ #define EXTENSIONS_BROWSER_CLIENT_QT_H_ -#include "base/compiler_specific.h" #include "extensions/browser/extensions_browser_client.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_remote.h" @@ -146,8 +109,6 @@ private: std::unique_ptr<ComponentExtensionResourceManager> resource_manager_; //scoped_refptr<EventRouterForwarder> event_router_forwarder_; - - DISALLOW_COPY_AND_ASSIGN(ExtensionsBrowserClientQt); }; } // namespace extensions diff --git a/src/core/extensions/messaging_delegate_qt.cpp b/src/core/extensions/messaging_delegate_qt.cpp index c666daa09..791949cb5 100644 --- a/src/core/extensions/messaging_delegate_qt.cpp +++ b/src/core/extensions/messaging_delegate_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 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) 2020 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 "messaging_delegate_qt.h" diff --git a/src/core/extensions/messaging_delegate_qt.h b/src/core/extensions/messaging_delegate_qt.h index 44bfdc2d5..f1d312544 100644 --- a/src/core/extensions/messaging_delegate_qt.h +++ b/src/core/extensions/messaging_delegate_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 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) 2020 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 #ifndef MESSAGING_DELEGATE_QT_H #define MESSAGING_DELEGATE_QT_H diff --git a/src/core/extensions/mime_handler_view_guest_delegate_qt.cpp b/src/core/extensions/mime_handler_view_guest_delegate_qt.cpp index 16a747929..fcea708b0 100644 --- a/src/core/extensions/mime_handler_view_guest_delegate_qt.cpp +++ b/src/core/extensions/mime_handler_view_guest_delegate_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 // Portions copyright 2015 The Chromium Embedded Framework Authors. // Portions copyright 2014 The Chromium Authors. All rights reserved. @@ -70,8 +34,9 @@ MimeHandlerViewGuestDelegateQt::~MimeHandlerViewGuestDelegateQt() delete m_contextMenuRequest; } -bool MimeHandlerViewGuestDelegateQt::HandleContextMenu(content::WebContents *web_contents, const content::ContextMenuParams ¶ms) +bool MimeHandlerViewGuestDelegateQt::HandleContextMenu(content::RenderFrameHost &render_frame_host, const content::ContextMenuParams ¶ms) { + content::WebContents *web_contents = content::WebContents::FromRenderFrameHost(&render_frame_host); content::WebContents *parent_web_contents = guest_view::GuestViewBase::GetTopLevelWebContents(web_contents); if (auto rwhv = static_cast<QtWebEngineCore::RenderWidgetHostViewQt *>(parent_web_contents->GetRenderWidgetHostView())) { if (rwhv->getTouchSelectionControllerClient()->handleContextMenu(params)) diff --git a/src/core/extensions/mime_handler_view_guest_delegate_qt.h b/src/core/extensions/mime_handler_view_guest_delegate_qt.h index c9b822aa1..bdb3c840b 100644 --- a/src/core/extensions/mime_handler_view_guest_delegate_qt.h +++ b/src/core/extensions/mime_handler_view_guest_delegate_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 // Portions copyright 2015 The Chromium Embedded Framework Authors. // Portions copyright 2014 The Chromium Authors. All rights reserved. @@ -65,12 +29,11 @@ public: explicit MimeHandlerViewGuestDelegateQt(MimeHandlerViewGuest *guest); ~MimeHandlerViewGuestDelegateQt() override; - bool HandleContextMenu(content::WebContents *web_contents, + bool HandleContextMenu(content::RenderFrameHost &render_frame_host, const content::ContextMenuParams ¶ms) override; private: QWebEngineContextMenuRequest *m_contextMenuRequest; - DISALLOW_COPY_AND_ASSIGN(MimeHandlerViewGuestDelegateQt); }; } // namespace extensions diff --git a/src/core/extensions/pdf_iframe_navigation_throttle_qt.cpp b/src/core/extensions/pdf_iframe_navigation_throttle_qt.cpp index 7c2fe75f0..a55294981 100644 --- a/src/core/extensions/pdf_iframe_navigation_throttle_qt.cpp +++ b/src/core/extensions/pdf_iframe_navigation_throttle_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 // based on //chrome/browser/plugins/pdf_iframe_navigation_throttle.cc // Copyright 2017 The Chromium Authors. All rights reserved. @@ -61,6 +25,8 @@ #include "ui/base/webui/jstemplate_builder.h" #include "ui/base/webui/web_ui_util.h" +#include <QtGlobal> + namespace extensions { constexpr char kPDFMimeType[] = "application/pdf"; @@ -70,7 +36,8 @@ class PdfWebContentsLifetimeHelper : public content::WebContentsUserData<PdfWebC { public: explicit PdfWebContentsLifetimeHelper(content::WebContents *web_contents) - : web_contents_(web_contents) + : content::WebContentsUserData<PdfWebContentsLifetimeHelper>(*web_contents) + , web_contents_(web_contents) {} base::WeakPtr<PdfWebContentsLifetimeHelper> GetWeakPtr() @@ -86,26 +53,31 @@ public: private: friend class content::WebContentsUserData<PdfWebContentsLifetimeHelper>; - content::WebContents* const web_contents_; + content::WebContents *const web_contents_; base::WeakPtrFactory<PdfWebContentsLifetimeHelper> weak_factory_{this}; WEB_CONTENTS_USER_DATA_KEY_DECL(); }; -WEB_CONTENTS_USER_DATA_KEY_IMPL(PdfWebContentsLifetimeHelper) +WEB_CONTENTS_USER_DATA_KEY_IMPL(PdfWebContentsLifetimeHelper); bool IsPDFPluginEnabled(content::NavigationHandle *navigation_handle, bool *is_stale) { content::WebContents *web_contents = navigation_handle->GetWebContents(); + Q_ASSERT(web_contents); + + if (web_contents->IsInnerWebContentsForGuest()) + web_contents = web_contents->GetOuterWebContents(); + int process_id = web_contents->GetMainFrame()->GetProcess()->GetID(); int routing_id = web_contents->GetMainFrame()->GetRoutingID(); content::WebPluginInfo plugin_info; // Will check WebEngineSettings by PluginServiceFilterQt return content::PluginService::GetInstance()->GetPluginInfo( - process_id, routing_id, navigation_handle->GetURL(), - web_contents->GetMainFrame()->GetLastCommittedOrigin(), kPDFMimeType, - false /* allow_wildcard */, is_stale, &plugin_info, - nullptr /* actual_mime_type */); + process_id, routing_id, 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/extensions/pdf_iframe_navigation_throttle_qt.h b/src/core/extensions/pdf_iframe_navigation_throttle_qt.h index 37f5bf1d6..fdc168aec 100644 --- a/src/core/extensions/pdf_iframe_navigation_throttle_qt.h +++ b/src/core/extensions/pdf_iframe_navigation_throttle_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 // based on //chrome/browser/plugins/pdf_iframe_navigation_throttle.h // Copyright 2017 The Chromium Authors. All rights reserved. diff --git a/src/core/extensions/pdf_web_contents_helper_client_qt.h b/src/core/extensions/pdf_web_contents_helper_client_qt.h deleted file mode 100644 index 9a37375b3..000000000 --- a/src/core/extensions/pdf_web_contents_helper_client_qt.h +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef PDF_WEB_CONTENTS_HELPER_CLIENT_QT_H_ -#define PDF_WEB_CONTENTS_HELPER_CLIENT_QT_H_ - -#include "base/macros.h" -#include "components/pdf/browser/pdf_web_contents_helper_client.h" - -namespace extensions { - -class PDFWebContentsHelperClientQt : public pdf::PDFWebContentsHelperClient -{ -public: - PDFWebContentsHelperClientQt(); - ~PDFWebContentsHelperClientQt() override; - -private: - // pdf::PDFWebContentsHelperClient: - void UpdateContentRestrictions(content::WebContents *contents, int content_restrictions) override; - void OnPDFHasUnsupportedFeature(content::WebContents *contents) override; - void OnSaveURL(content::WebContents *contents) override; - - DISALLOW_COPY_AND_ASSIGN(PDFWebContentsHelperClientQt); -}; - -} // namespace extensions - -#endif // PDF_WEB_CONTENTS_HELPER_CLIENT_QT_H_ diff --git a/src/core/extensions/plugin_service_filter_qt.cpp b/src/core/extensions/plugin_service_filter_qt.cpp index 778f803c3..9c66ea6c3 100644 --- a/src/core/extensions/plugin_service_filter_qt.cpp +++ b/src/core/extensions/plugin_service_filter_qt.cpp @@ -1,46 +1,9 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 "extensions/plugin_service_filter_qt.h" -#include "content/public/browser/render_frame_host.h" -#include "content/public/browser/web_contents.h" +#include "content/public/browser/render_process_host.h" #include "web_contents_delegate_qt.h" #include "web_engine_settings.h" @@ -50,16 +13,16 @@ using namespace QtWebEngineCore; namespace extensions { // static -PluginServiceFilterQt *PluginServiceFilterQt::GetInstance() { +PluginServiceFilterQt *PluginServiceFilterQt::GetInstance() +{ return base::Singleton<PluginServiceFilterQt>::get(); } bool PluginServiceFilterQt::IsPluginAvailable(int render_process_id, int render_frame_id, - const GURL &url, - const url::Origin &main_frame_origin, - content::WebPluginInfo *plugin) + const content::WebPluginInfo &plugin) { + Q_UNUSED(plugin); content::RenderFrameHost *frame_host = content::RenderFrameHost::FromID(render_process_id, render_frame_id); content::WebContents *web_contents = content::WebContents::FromRenderFrameHost(frame_host); if (!web_contents) { diff --git a/src/core/extensions/plugin_service_filter_qt.h b/src/core/extensions/plugin_service_filter_qt.h index ea5f082f2..e26a71d68 100644 --- a/src/core/extensions/plugin_service_filter_qt.h +++ b/src/core/extensions/plugin_service_filter_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 #ifndef PLUGIN_SERVICE_FILTER_QT #define PLUGIN_SERVICE_FILTER_QT @@ -52,9 +16,7 @@ public: bool IsPluginAvailable(int render_process_id, int render_frame_id, - const GURL &url, - const url::Origin &main_frame_origin, - content::WebPluginInfo *plugin) override; + const content::WebPluginInfo &plugin) override; bool CanLoadPlugin(int render_process_id, const base::FilePath &path) override; diff --git a/src/core/favicon_driver_qt.cpp b/src/core/favicon_driver_qt.cpp index be5f7267e..bb4a734b4 100644 --- a/src/core/favicon_driver_qt.cpp +++ b/src/core/favicon_driver_qt.cpp @@ -1,41 +1,10 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 + +// Based on components/favicon/content/content_favicon_driver.cc: +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #include "favicon_driver_qt.h" #include "type_conversion.h" @@ -56,16 +25,6 @@ namespace QtWebEngineCore { namespace { -void ExtractManifestIcons(FaviconDriverQt::ManifestDownloadCallback callback, - const GURL &manifest_url, blink::mojom::ManifestPtr manifest) -{ - std::vector<favicon::FaviconURL> candidates; - for (const auto &icon : manifest->icons) { - candidates.emplace_back(icon.src, favicon_base::IconType::kWebManifestIcon, icon.sizes); - } - std::move(callback).Run(candidates); -} - int activeHandlersCount(QWebEngineSettings *settings) { bool touchIconsEnabled = settings->testAttribute(QWebEngineSettings::TouchIconsEnabled); @@ -81,7 +40,7 @@ FaviconStatusQt::FaviconStatusQt() // static void FaviconDriverQt::CreateForWebContents(content::WebContents *webContents, - favicon::FaviconService *faviconService, + favicon::CoreFaviconService *faviconService, WebContentsAdapterClient *viewClient) { if (FromWebContents(webContents)) @@ -93,9 +52,10 @@ void FaviconDriverQt::CreateForWebContents(content::WebContents *webContents, } FaviconDriverQt::FaviconDriverQt(content::WebContents *webContents, - favicon::FaviconService *faviconService, + favicon::CoreFaviconService *faviconService, WebContentsAdapterClient *viewClient) : content::WebContentsObserver(webContents) + , content::WebContentsUserData<FaviconDriverQt>(*webContents) , m_faviconService(faviconService) , m_viewClient(viewClient) { @@ -165,6 +125,13 @@ GURL FaviconDriverQt::GetActiveURL() return entry ? entry->GetURL() : GURL(); } +GURL FaviconDriverQt::GetManifestURL(content::RenderFrameHost *rfh) +{ + DocumentManifestData *document_data = DocumentManifestData::GetOrCreateForCurrentDocument(rfh); + return document_data->has_manifest_url ? rfh->GetPage().GetManifestUrl().value_or(GURL()) + : GURL(); +} + GURL FaviconDriverQt::GetFaviconURL() const { content::NavigationController &controller = web_contents()->GetController(); @@ -175,20 +142,62 @@ GURL FaviconDriverQt::GetFaviconURL() const return GURL(); } +FaviconDriverQt::DocumentManifestData::DocumentManifestData(content::RenderFrameHost *rfh) + : content::DocumentUserData<DocumentManifestData>(rfh) +{ +} + +FaviconDriverQt::DocumentManifestData::~DocumentManifestData() = default; + +FaviconDriverQt::NavigationManifestData::NavigationManifestData( + content::NavigationHandle &navigation_handle) +{ +} + +FaviconDriverQt::NavigationManifestData::~NavigationManifestData() = default; + +void FaviconDriverQt::OnDidDownloadManifest(ManifestDownloadCallback callback, + const GURL &manifest_url, + blink::mojom::ManifestPtr manifest) +{ + Q_UNUSED(manifest_url); + + // ~WebContentsImpl triggers running any pending callbacks for manifests. + // As we're about to be destroyed ignore the request. To do otherwise may + // result in calling back to this and attempting to use the WebContents, which + // will crash. + if (!web_contents()) + return; + + std::vector<favicon::FaviconURL> candidates; + if (manifest) { + for (const auto &icon : manifest->icons) { + candidates.emplace_back(icon.src, favicon_base::IconType::kWebManifestIcon, icon.sizes); + } + } + std::move(callback).Run(candidates); +} + int FaviconDriverQt::DownloadImage(const GURL &url, int max_image_size, ImageDownloadCallback callback) { bool bypass_cache = (m_bypassCachePageURL == GetActiveURL()); m_bypassCachePageURL = GURL(); - return web_contents()->DownloadImage(url, true, /*preferred_size=*/max_image_size, - /*max_bitmap_size=*/max_image_size, bypass_cache, - std::move(callback)); + const gfx::Size preferred_size(max_image_size, max_image_size); + return web_contents()->DownloadImage(url, true, preferred_size, + /*max_bitmap_size=*/max_image_size, + bypass_cache, std::move(callback)); } void FaviconDriverQt::DownloadManifest(const GURL &url, ManifestDownloadCallback callback) { - web_contents()->GetMainFrame()->GetPage().GetManifest(base::BindOnce(&ExtractManifestIcons, std::move(callback))); + // TODO(crbug.com/1201237): This appears to be reachable from pages other + // than the primary page. This code should likely be refactored so that either + // this is unreachable from other pages, or the correct page is plumbed in + // here. + web_contents()->GetPrimaryPage().GetManifest(base::BindOnce( + &FaviconDriverQt::OnDidDownloadManifest, base::Unretained(this), std::move(callback))); } bool FaviconDriverQt::IsOffTheRecord() @@ -245,14 +254,12 @@ void FaviconDriverQt::OnHandlerCompleted(favicon::FaviconHandler *handler) } void FaviconDriverQt::DidUpdateFaviconURL( - content::RenderFrameHost *render_frame_host, - const std::vector<blink::mojom::FaviconURLPtr> &candidates) + content::RenderFrameHost *rfh, const std::vector<blink::mojom::FaviconURLPtr> &candidates) { - Q_UNUSED(render_frame_host); - // Ignore the update if there is no last committed navigation entry. This can // occur when loading an initially blank page. content::NavigationEntry *entry = web_contents()->GetController().GetLastCommittedEntry(); + if (!entry) return; @@ -263,50 +270,45 @@ void FaviconDriverQt::DidUpdateFaviconURL( faviconUrls.push_back(candidate.Clone()); m_faviconUrls = std::move(faviconUrls); - if (!m_documentOnLoadCompleted) + if (!rfh->IsDocumentOnLoadCompletedInMainFrame()) return; - OnUpdateCandidates(entry->GetURL(), - favicon::FaviconURLsFromContentFaviconURLs(candidates), - m_manifestUrl); + OnUpdateCandidates(rfh->GetLastCommittedURL(), + favicon::FaviconURLsFromContentFaviconURLs(candidates), GetManifestURL(rfh)); } -void FaviconDriverQt::DidUpdateWebManifestURL(content::RenderFrameHost *target_frame, +void FaviconDriverQt::DidUpdateWebManifestURL(content::RenderFrameHost *rfh, const GURL &manifest_url) { - Q_UNUSED(target_frame); + Q_UNUSED(manifest_url); // Ignore the update if there is no last committed navigation entry. This can // occur when loading an initially blank page. content::NavigationEntry *entry = web_contents()->GetController().GetLastCommittedEntry(); - if (!entry || !m_documentOnLoadCompleted) + if (!entry || !rfh->IsDocumentOnLoadCompletedInMainFrame()) return; - m_manifestUrl = manifest_url; + DocumentManifestData *document_data = DocumentManifestData::GetOrCreateForCurrentDocument(rfh); + document_data->has_manifest_url = true; // On regular page loads, DidUpdateManifestURL() is guaranteed to be called // before DidUpdateFaviconURL(). However, a page can update the favicons via // javascript. - if (m_faviconUrls.has_value()) { - OnUpdateCandidates(entry->GetURL(), - favicon::FaviconURLsFromContentFaviconURLs(*m_faviconUrls), - m_manifestUrl); + if (!rfh->FaviconURLs().empty()) { + OnUpdateCandidates(rfh->GetLastCommittedURL(), + favicon::FaviconURLsFromContentFaviconURLs(rfh->FaviconURLs()), + GetManifestURL(rfh)); } } void FaviconDriverQt::DidStartNavigation(content::NavigationHandle *navigation_handle) { - if (!navigation_handle->IsInMainFrame()) + if (!navigation_handle->IsInPrimaryMainFrame()) return; - m_faviconUrls.reset(); - if (!navigation_handle->IsSameDocument()) { m_completedHandlersCount = 0; m_latestFavicon = FaviconStatusQt(); - m_documentOnLoadCompleted = false; - m_manifestUrl = GURL(); - m_viewClient->iconChanged(QUrl()); } @@ -314,18 +316,33 @@ void FaviconDriverQt::DidStartNavigation(content::NavigationHandle *navigation_h if (reload_type == content::ReloadType::NONE || IsOffTheRecord()) return; - m_bypassCachePageURL = navigation_handle->GetURL(); + if (!navigation_handle->IsSameDocument()) { + NavigationManifestData *navigation_data = + NavigationManifestData::GetOrCreateForNavigationHandle(*navigation_handle); + navigation_data->has_manifest_url = false; + } + + if (reload_type == content::ReloadType::BYPASSING_CACHE) + m_bypassCachePageURL = navigation_handle->GetURL(); + SetFaviconOutOfDateForPage(navigation_handle->GetURL(), reload_type == content::ReloadType::BYPASSING_CACHE); } void FaviconDriverQt::DidFinishNavigation(content::NavigationHandle *navigation_handle) { - if (!navigation_handle->IsInMainFrame() || !navigation_handle->HasCommitted() + if (!navigation_handle->IsInPrimaryMainFrame() || !navigation_handle->HasCommitted() || navigation_handle->IsErrorPage()) { return; } + // Transfer in-flight navigation data to the document user data. + NavigationManifestData *navigation_data = + NavigationManifestData::GetOrCreateForNavigationHandle(*navigation_handle); + DocumentManifestData *document_data = DocumentManifestData::GetOrCreateForCurrentDocument( + navigation_handle->GetRenderFrameHost()); + document_data->has_manifest_url = navigation_data->has_manifest_url; + // Wait till the user navigates to a new URL to start checking the cache // again. The cache may be ignored for non-reload navigations (e.g. // history.replace() in-page navigation). This is allowed to increase the @@ -341,11 +358,6 @@ void FaviconDriverQt::DidFinishNavigation(content::NavigationHandle *navigation_ FetchFavicon(url, navigation_handle->IsSameDocument()); } -void FaviconDriverQt::DocumentOnLoadCompletedInMainFrame(content::RenderFrameHost * /*render_frame_host*/) -{ - m_documentOnLoadCompleted = true; -} - void FaviconDriverQt::SetFaviconOutOfDateForPage(const GURL &url, bool force_reload) { if (m_faviconService) { @@ -403,6 +415,8 @@ void FaviconDriverQt::emitIconChangedIfNeeded() m_viewClient->iconChanged(toQt(m_latestFavicon.url)); } -WEB_CONTENTS_USER_DATA_KEY_IMPL(FaviconDriverQt) +NAVIGATION_HANDLE_USER_DATA_KEY_IMPL(FaviconDriverQt::NavigationManifestData); +DOCUMENT_USER_DATA_KEY_IMPL(FaviconDriverQt::DocumentManifestData); +WEB_CONTENTS_USER_DATA_KEY_IMPL(FaviconDriverQt); } // namespace QtWebEngineCore diff --git a/src/core/favicon_driver_qt.h b/src/core/favicon_driver_qt.h index 4de85104a..96bd682a2 100644 --- a/src/core/favicon_driver_qt.h +++ b/src/core/favicon_driver_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 // // W A R N I N G @@ -55,7 +19,9 @@ #include "components/favicon/core/favicon_driver.h" #include "components/favicon/core/favicon_handler.h" +#include "content/public/browser/document_user_data.h" #include "content/public/browser/favicon_status.h" +#include "content/public/browser/navigation_handle_user_data.h" #include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_user_data.h" #include "third_party/blink/public/mojom/favicon/favicon_url.mojom.h" @@ -65,7 +31,7 @@ class WebContents; } namespace favicon { -class FaviconService; +class CoreFaviconService; } namespace QtWebEngineCore { @@ -87,7 +53,7 @@ class FaviconDriverQt : public favicon::FaviconDriver, { public: static void CreateForWebContents(content::WebContents *webContents, - favicon::FaviconService *faviconService, + favicon::CoreFaviconService *faviconService, WebContentsAdapterClient *viewClient); // FaviconDriver implementation. @@ -96,15 +62,38 @@ public: bool FaviconIsValid() const override; GURL GetActiveURL() override; + GURL GetManifestURL(content::RenderFrameHost *rfh); GURL GetFaviconURL() const; protected: - FaviconDriverQt(content::WebContents *webContent, favicon::FaviconService *faviconService, + FaviconDriverQt(content::WebContents *webContent, favicon::CoreFaviconService *faviconService, WebContentsAdapterClient *viewClient); private: friend class content::WebContentsUserData<FaviconDriverQt>; + // TODO(crbug.com/1205018): these two classes are current used to ensure that + // we disregard manifest URL updates that arrive prior to onload firing. + struct DocumentManifestData : public content::DocumentUserData<DocumentManifestData> + { + explicit DocumentManifestData(content::RenderFrameHost *rfh); + ~DocumentManifestData() override; + DOCUMENT_USER_DATA_KEY_DECL(); + bool has_manifest_url = false; + }; + + struct NavigationManifestData : public content::NavigationHandleUserData<NavigationManifestData> + { + explicit NavigationManifestData(content::NavigationHandle &navigation_handle); + ~NavigationManifestData() override; + NAVIGATION_HANDLE_USER_DATA_KEY_DECL(); + bool has_manifest_url = false; + }; + + // Callback when a manifest is downloaded. + void OnDidDownloadManifest(ManifestDownloadCallback callback, const GURL &manifest_url, + blink::mojom::ManifestPtr manifest); + // FaviconHandler::Delegate implementation. int DownloadImage(const GURL &url, int max_image_size, ImageDownloadCallback callback) override; void DownloadManifest(const GURL &url, ManifestDownloadCallback callback) override; @@ -119,15 +108,13 @@ private: void OnHandlerCompleted(favicon::FaviconHandler *handler) override; // content::WebContentsObserver implementation. - void DidUpdateFaviconURL(content::RenderFrameHost *render_frame_host, + void DidUpdateFaviconURL(content::RenderFrameHost *rfh, const std::vector<blink::mojom::FaviconURLPtr> &candidates) override; - void DidUpdateWebManifestURL(content::RenderFrameHost *target_frame, - const GURL &manifest_url) override; + void DidUpdateWebManifestURL(content::RenderFrameHost *rfh, const GURL &manifest_url) override; void DidStartNavigation(content::NavigationHandle *navigation_handle) override; void DidFinishNavigation(content::NavigationHandle *navigation_handle) override; - void DocumentOnLoadCompletedInMainFrame(content::RenderFrameHost *render_frame_host) override; - // Informs FaviconService that the favicon for |url| is out of date. If + // Informs CoreFaviconService that the favicon for |url| is out of date. If // |force_reload| is true, then discard information about favicon download // failures. void SetFaviconOutOfDateForPage(const GURL &url, bool force_reload); @@ -141,26 +128,22 @@ private: // KeyedService used by FaviconDriverImpl. It may be null during testing, // but if it is defined, it must outlive the FaviconDriverImpl. - favicon::FaviconService *m_faviconService; + raw_ptr<favicon::CoreFaviconService> m_faviconService; WebContentsAdapterClient *m_viewClient; - // FaviconHandlers used to download the different kind of favicons. + // FaviconHandlers are used to download the different kind of favicons. std::vector<std::unique_ptr<favicon::FaviconHandler>> m_handlers; GURL m_bypassCachePageURL; - bool m_documentOnLoadCompleted = false; // nullopt until the actual list is reported via DidUpdateFaviconURL(). absl::optional<std::vector<blink::mojom::FaviconURLPtr>> m_faviconUrls; - // Web Manifest URL or empty URL if none. - GURL m_manifestUrl; int m_completedHandlersCount = 0; FaviconStatusQt m_latestFavicon; WEB_CONTENTS_USER_DATA_KEY_DECL(); - DISALLOW_COPY_AND_ASSIGN(FaviconDriverQt); }; } // namespace QtWebEngineCore diff --git a/src/core/favicon_service_factory_qt.cpp b/src/core/favicon_service_factory_qt.cpp index 6810927c9..6963f7e9b 100644 --- a/src/core/favicon_service_factory_qt.cpp +++ b/src/core/favicon_service_factory_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 "favicon_service_factory_qt.h" diff --git a/src/core/favicon_service_factory_qt.h b/src/core/favicon_service_factory_qt.h index 1ba0db076..2816140ba 100644 --- a/src/core/favicon_service_factory_qt.h +++ b/src/core/favicon_service_factory_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 // // W A R N I N G diff --git a/src/core/file_picker_controller.cpp b/src/core/file_picker_controller.cpp index 140cb7dba..4d8b185df 100644 --- a/src/core/file_picker_controller.cpp +++ b/src/core/file_picker_controller.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 "file_picker_controller.h" #include "type_conversion.h" @@ -114,16 +78,16 @@ void FilePickerController::accepted(const QStringList &files) base::FilePath filePath = toFilePath(urlString).NormalizePathSeparators(); std::vector<base::FilePath::StringType> pathComponents; // Splits the file URL into scheme, host name, path and file name. - filePath.GetComponents(&pathComponents); + pathComponents = filePath.GetComponents(); QString absolutePath; -#if !defined(OS_WIN) +#if !defined(Q_OS_WIN) absolutePath = "/"; #endif QString scheme = toQt(pathComponents[0]); if (scheme.size() > 5) { -#if defined(OS_WIN) +#if defined(Q_OS_WIN) // There is no slash at the end of the file scheme and it is valid on Windows: file:C:/ if (scheme.size() == 7 && scheme.at(5).isLetter() && scheme.at(6) == ':') { absolutePath += scheme.at(5) + ":/"; @@ -131,7 +95,7 @@ void FilePickerController::accepted(const QStringList &files) #endif qWarning("Ignoring invalid item in FilePickerController::accepted(QStringList): %s", qPrintable(urlString)); continue; -#if defined(OS_WIN) +#if defined(Q_OS_WIN) } #endif } @@ -140,7 +104,7 @@ void FilePickerController::accepted(const QStringList &files) if (base::FilePath::IsSeparator(urlString.at(5).toLatin1()) && base::FilePath::IsSeparator(urlString.at(6).toLatin1()) && !base::FilePath::IsSeparator(urlString.at(7).toLatin1())) { -#if defined(OS_WIN) +#if defined(Q_OS_WIN) if (urlString.at(8) != ':' && pathComponents.size() > 2) { absolutePath += "//"; #else @@ -245,6 +209,10 @@ void FilePickerController::filesSelectedInChooser(const QStringList &filesList) else d_ptr->fileSystemAccessDialogListener->MultiFilesSelected(files, nullptr); } + + // release the fileSelectListener manually because it blocks fullscreen requests in chromium + // see QTBUG-106975 + d_ptr->fileDialogListener.reset(); } QStringList FilePickerController::acceptedMimeTypes() const @@ -287,7 +255,7 @@ QStringList FilePickerController::nameFilters(const QStringList &acceptedMimeTyp const QMimeType &mimeType = mimeDatabase.mimeTypeForName(type); if (mimeType.isValid() && !mimeType.globPatterns().isEmpty()) { QString globs = mimeType.globPatterns().join(" "); - acceptedGlobs.append(globs); + acceptedGlobs.append(mimeType.globPatterns()); nameFilters.append(mimeType.comment() + " (" + globs + ")"); } } else if (type.endsWith("/*")) { @@ -298,7 +266,7 @@ QStringList FilePickerController::nameFilters(const QStringList &acceptedMimeTyp for (const QMimeType &m : allMimeTypes) { if (m.name().startsWith(type) && !m.globPatterns().isEmpty()) { QString globs = m.globPatterns().join(" "); - acceptedGlobs.append(globs); + acceptedGlobs.append(m.globPatterns()); nameFilters.append(m.comment() + " (" + globs + ")"); } } diff --git a/src/core/file_picker_controller.h b/src/core/file_picker_controller.h index ec3b5ba1d..82c72a9e6 100644 --- a/src/core/file_picker_controller.h +++ b/src/core/file_picker_controller.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 // // W A R N I N G 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 new file mode 100644 index 000000000..51c8a8991 --- /dev/null +++ b/src/core/file_system_access/file_system_access_permission_context_factory_qt.cpp @@ -0,0 +1,61 @@ +// Copyright (C) 2022 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 "file_system_access_permission_context_factory_qt.h" + +#include "components/keyed_service/content/browser_context_dependency_manager.h" + +#include <QtGlobal> + +namespace QtWebEngineCore { + +// static +FileSystemAccessPermissionContextQt * +FileSystemAccessPermissionContextFactoryQt::GetForProfile(content::BrowserContext *profile) +{ + return static_cast<FileSystemAccessPermissionContextQt *>( + GetInstance()->GetServiceForBrowserContext(profile, true)); +} + +// static +FileSystemAccessPermissionContextQt * +FileSystemAccessPermissionContextFactoryQt::GetForProfileIfExists(content::BrowserContext *profile) +{ + return static_cast<FileSystemAccessPermissionContextQt *>( + GetInstance()->GetServiceForBrowserContext(profile, true)); +} + +// static +FileSystemAccessPermissionContextFactoryQt * +FileSystemAccessPermissionContextFactoryQt::GetInstance() +{ + return base::Singleton<FileSystemAccessPermissionContextFactoryQt>::get(); +} + +FileSystemAccessPermissionContextFactoryQt::FileSystemAccessPermissionContextFactoryQt() + : BrowserContextKeyedServiceFactory("FileSystemAccessPermissionContext", + BrowserContextDependencyManager::GetInstance()) +{ +} + +FileSystemAccessPermissionContextFactoryQt::~FileSystemAccessPermissionContextFactoryQt() = default; + +content::BrowserContext *FileSystemAccessPermissionContextFactoryQt::GetBrowserContextToUse( + content::BrowserContext *context) const +{ + return context; +} + +KeyedService *FileSystemAccessPermissionContextFactoryQt::BuildServiceInstanceFor( + content::BrowserContext *context) const +{ + return new FileSystemAccessPermissionContextQt(context); +} + +void FileSystemAccessPermissionContextFactoryQt::BrowserContextShutdown( + content::BrowserContext *context) +{ + Q_UNUSED(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 new file mode 100644 index 000000000..1d98243d6 --- /dev/null +++ b/src/core/file_system_access/file_system_access_permission_context_factory_qt.h @@ -0,0 +1,37 @@ +// Copyright (C) 2022 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 + +#ifndef FILE_SYSTEM_ACCESS_PERMISSION_CONTEXT_FACTORY_QT_H +#define FILE_SYSTEM_ACCESS_PERMISSION_CONTEXT_FACTORY_QT_H + +#include "base/memory/singleton.h" +#include "components/keyed_service/content/browser_context_keyed_service_factory.h" + +#include "file_system_access_permission_context_qt.h" + +namespace QtWebEngineCore { + +class FileSystemAccessPermissionContextFactoryQt : public BrowserContextKeyedServiceFactory +{ +public: + static FileSystemAccessPermissionContextQt *GetForProfile(content::BrowserContext *profile); + static FileSystemAccessPermissionContextQt * + GetForProfileIfExists(content::BrowserContext *profile); + static FileSystemAccessPermissionContextFactoryQt *GetInstance(); + +private: + friend struct base::DefaultSingletonTraits<FileSystemAccessPermissionContextFactoryQt>; + + FileSystemAccessPermissionContextFactoryQt(); + ~FileSystemAccessPermissionContextFactoryQt() override; + + // BrowserContextKeyedServiceFactory + content::BrowserContext * + GetBrowserContextToUse(content::BrowserContext *context) const override; + KeyedService *BuildServiceInstanceFor(content::BrowserContext *profile) const override; + void BrowserContextShutdown(content::BrowserContext *context) override; +}; + +} // namespace QtWebEngineCore + +#endif // FILE_SYSTEM_ACCESS_PERMISSION_CONTEXT_FACTORY_QT_H 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 new file mode 100644 index 000000000..3a9c80288 --- /dev/null +++ b/src/core/file_system_access/file_system_access_permission_context_qt.cpp @@ -0,0 +1,395 @@ +// Copyright (C) 2022 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 + +// This file is based on chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc: +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "file_system_access_permission_context_qt.h" + +#include "base/base_paths.h" +#include "base/path_service.h" +#include "base/task/task_traits.h" +#include "base/task/thread_pool.h" +#include "chrome/common/chrome_paths.h" +#include "components/content_settings/core/common/content_settings_types.h" +#include "content/browser/web_contents/web_contents_impl.h" + +#include "file_system_access_permission_grant_qt.h" +#include "type_conversion.h" + +#include <QCoreApplication> +#include <QStandardPaths> + +namespace QtWebEngineCore { + +// Sentinel used to indicate that no PathService key is specified for a path in +// the struct below. +constexpr const int kNoBasePathKey = -1; + +enum BlockType { kBlockAllChildren, kBlockNestedDirectories, kDontBlockChildren, kDontBlockAppFolder }; + +const struct +{ + // base::BasePathKey value (or one of the platform specific extensions to it) + // for a path that should be blocked. Specify kNoBasePathKey if |path| should + // be used instead. + int base_path_key; + + // Explicit path to block instead of using |base_path_key|. Set to nullptr to + // use |base_path_key| on its own. If both |base_path_key| and |path| are set, + // |path| is treated relative to the path |base_path_key| resolves to. + const base::FilePath::CharType *path; + + // If this is set to kDontBlockChildren, only the given path and its parents + // are blocked. If this is set to kBlockAllChildren, all children of the given + // path are blocked as well. Finally if this is set to kBlockNestedDirectories + // access is allowed to individual files in the directory, but nested + // directories are still blocked. + // The BlockType of the nearest ancestor of a path to check is what ultimately + // determines if a path is blocked or not. If a blocked path is a descendent + // of another blocked path, then it may override the child-blocking policy of + // its ancestor. For example, if /home blocks all children, but + // /home/downloads does not, then /home/downloads/file.ext will *not* be + // blocked. + BlockType type; +} kBlockedPaths[] = { + // Don't allow users to share their entire home directory, entire desktop or + // entire documents folder, but do allow sharing anything inside those + // directories not otherwise blocked. + { base::DIR_HOME, nullptr, kDontBlockChildren }, + { base::DIR_USER_DESKTOP, nullptr, kDontBlockChildren }, + { chrome::DIR_USER_DOCUMENTS, nullptr, kDontBlockChildren }, + // Similar restrictions for the downloads directory. + { chrome::DIR_DEFAULT_DOWNLOADS, nullptr, kDontBlockChildren }, + { chrome::DIR_DEFAULT_DOWNLOADS_SAFE, nullptr, kDontBlockChildren }, + // The Chrome installation itself should not be modified by the web. + { base::DIR_EXE, nullptr, kBlockAllChildren }, + { base::DIR_MODULE, nullptr, kBlockAllChildren }, + { base::DIR_ASSETS, nullptr, kBlockAllChildren }, + // And neither should the configuration of at least the currently running + // Chrome instance (note that this does not take --user-data-dir command + // line overrides into account). + { chrome::DIR_USER_DATA, nullptr, kBlockAllChildren }, + // ~/.ssh is pretty sensitive on all platforms, so block access to that. + { base::DIR_HOME, FILE_PATH_LITERAL(".ssh"), kBlockAllChildren }, + // And limit access to ~/.gnupg as well. + { base::DIR_HOME, FILE_PATH_LITERAL(".gnupg"), kBlockAllChildren }, +#if defined(OS_WIN) + // Some Windows specific directories to block, basically all apps, the + // operating system itself, as well as configuration data for apps. + { base::DIR_PROGRAM_FILES, nullptr, kBlockAllChildren }, + { base::DIR_PROGRAM_FILESX86, nullptr, kBlockAllChildren }, + { base::DIR_PROGRAM_FILES6432, nullptr, kBlockAllChildren }, + { base::DIR_WINDOWS, nullptr, kBlockAllChildren }, + { base::DIR_ROAMING_APP_DATA, nullptr, kBlockAllChildren }, + { base::DIR_LOCAL_APP_DATA, nullptr, kBlockAllChildren }, + // Whitelist AppData\Local\Temp to make the default location of QDir::tempPath(), + // QTemporaryFile and QTemporaryDir working on Windows. + { base::DIR_LOCAL_APP_DATA, FILE_PATH_LITERAL("Temp"), kDontBlockAppFolder }, + { base::DIR_COMMON_APP_DATA, nullptr, kBlockAllChildren }, + // Opening a file from an MTP device, such as a smartphone or a camera, is + // implemented by Windows as opening a file in the temporary internet files + // directory. To support that, allow opening files in that directory, but + // not whole directories. + { base::DIR_IE_INTERNET_CACHE, nullptr, kBlockNestedDirectories }, +#endif +#if defined(OS_MAC) + // Similar Mac specific blocks. + { base::DIR_APP_DATA, nullptr, kBlockAllChildren }, + { base::DIR_HOME, FILE_PATH_LITERAL("Library"), kBlockAllChildren }, + // Allow access to iCloud files. + { base::DIR_HOME, FILE_PATH_LITERAL("Library/Mobile Documents"), kDontBlockChildren }, +#endif +#if defined(OS_LINUX) || defined(OS_CHROMEOS) + // On Linux also block access to devices via /dev, as well as security + // sensitive data in /sys and /proc. + { kNoBasePathKey, FILE_PATH_LITERAL("/dev"), kBlockAllChildren }, + { kNoBasePathKey, FILE_PATH_LITERAL("/sys"), kBlockAllChildren }, + { kNoBasePathKey, FILE_PATH_LITERAL("/proc"), kBlockAllChildren }, + // And block all of ~/.config, matching the similar restrictions on mac + // and windows. + { base::DIR_HOME, FILE_PATH_LITERAL(".config"), kBlockAllChildren }, + // Block ~/.dbus as well, just in case, although there probably isn't much a + // website can do with access to that directory and its contents. + { base::DIR_HOME, FILE_PATH_LITERAL(".dbus"), kBlockAllChildren }, +#endif + // TODO(https://crbug.com/984641): Refine this list, for example add + // XDG_CONFIG_HOME when it is not set ~/.config? +}; + +bool ShouldBlockAccessToPath(const base::FilePath &check_path, HandleType handle_type) +{ + DCHECK(!check_path.empty()); + DCHECK(check_path.IsAbsolute()); + + base::FilePath nearest_ancestor; + int nearest_ancestor_path_key = kNoBasePathKey; + BlockType nearest_ancestor_block_type = kDontBlockChildren; + for (const auto &block : kBlockedPaths) { + base::FilePath blocked_path; + if (block.base_path_key != kNoBasePathKey) { + if (!base::PathService::Get(block.base_path_key, &blocked_path)) + continue; + if (block.path) + blocked_path = blocked_path.Append(block.path); + } else { + DCHECK(block.path); + blocked_path = base::FilePath(block.path); + } + + if (check_path == blocked_path || check_path.IsParent(blocked_path)) { + VLOG(1) << "Blocking access to " << check_path << " because it is a parent of " + << blocked_path << " (" << block.base_path_key << ")"; + return true; + } + + if (blocked_path.IsParent(check_path) + && (nearest_ancestor.empty() || nearest_ancestor.IsParent(blocked_path))) { + nearest_ancestor = blocked_path; + nearest_ancestor_path_key = block.base_path_key; + nearest_ancestor_block_type = block.type; + } + } + + // The path we're checking is not in a potentially blocked directory, or the + // nearest ancestor does not block access to its children. Grant access. + if (nearest_ancestor.empty() || nearest_ancestor_block_type == kDontBlockChildren) + return false; + + // The path we're checking is a file, and the nearest ancestor only blocks + // access to directories. Grant access. + if (handle_type == HandleType::kFile && nearest_ancestor_block_type == kBlockNestedDirectories) + return false; + + if (nearest_ancestor_block_type == kDontBlockAppFolder) { + // Relative path from the nearest blocklisted ancestor + base::FilePath diff; + nearest_ancestor.AppendRelativePath(check_path, &diff); + + auto diff_components = diff.GetComponents(); + if (diff_components.size() > 0 && toQt(diff_components[0]).contains(QCoreApplication::applicationName())) { + // The relative path contains the application name. Grant access. + return false; + } + } + + // The nearest ancestor blocks access to its children, so block access. + VLOG(1) << "Blocking access to " << check_path << " because it is inside " << nearest_ancestor + << " (" << nearest_ancestor_path_key << ")"; + return true; +} + +struct FileSystemAccessPermissionContextQt::OriginState +{ + // Raw pointers, owned collectively by all the handles that reference this + // grant. When last reference goes away this state is cleared as well by + // PermissionGrantDestroyed(). + std::map<base::FilePath, FileSystemAccessPermissionGrantQt *> read_grants; + std::map<base::FilePath, FileSystemAccessPermissionGrantQt *> write_grants; +}; + +FileSystemAccessPermissionContextQt::FileSystemAccessPermissionContextQt( + content::BrowserContext *context) + : m_profile(context) +{ +} + +FileSystemAccessPermissionContextQt::~FileSystemAccessPermissionContextQt() = default; + +scoped_refptr<content::FileSystemAccessPermissionGrant> +FileSystemAccessPermissionContextQt::GetReadPermissionGrant(const url::Origin &origin, + const base::FilePath &path, + HandleType handle_type, + UserAction user_action) +{ + Q_UNUSED(user_action); + + auto &origin_state = m_origins[origin]; + auto *&existing_grant = origin_state.read_grants[path]; + scoped_refptr<FileSystemAccessPermissionGrantQt> new_grant; + + if (existing_grant && existing_grant->handleType() != handle_type) { + // |path| changed from being a directory to being a file or vice versa, + // don't just re-use the existing grant but revoke the old grant before + // creating a new grant. + existing_grant->SetStatus(PermissionStatus::DENIED); + existing_grant = nullptr; + } + + if (!existing_grant) { + new_grant = base::MakeRefCounted<FileSystemAccessPermissionGrantQt>( + m_weakFactory.GetWeakPtr(), origin, path, handle_type, GrantType::kRead); + existing_grant = new_grant.get(); + } + + return existing_grant; +} + +scoped_refptr<content::FileSystemAccessPermissionGrant> +FileSystemAccessPermissionContextQt::GetWritePermissionGrant(const url::Origin &origin, + const base::FilePath &path, + HandleType handle_type, + UserAction user_action) +{ + Q_UNUSED(user_action); + + auto &origin_state = m_origins[origin]; + auto *&existing_grant = origin_state.write_grants[path]; + scoped_refptr<FileSystemAccessPermissionGrantQt> new_grant; + + if (existing_grant && existing_grant->handleType() != handle_type) { + // |path| changed from being a directory to being a file or vice versa, + // don't just re-use the existing grant but revoke the old grant before + // creating a new grant. + existing_grant->SetStatus(PermissionStatus::DENIED); + existing_grant = nullptr; + } + + if (!existing_grant) { + new_grant = base::MakeRefCounted<FileSystemAccessPermissionGrantQt>( + m_weakFactory.GetWeakPtr(), origin, path, handle_type, GrantType::kWrite); + existing_grant = new_grant.get(); + } + + return existing_grant; +} + +void FileSystemAccessPermissionContextQt::ConfirmSensitiveDirectoryAccess( + const url::Origin &origin, PathType path_type, const base::FilePath &path, + HandleType handle_type, content::GlobalRenderFrameHostId frame_id, + base::OnceCallback<void(SensitiveDirectoryResult)> callback) +{ + if (path_type == PathType::kExternal) { + std::move(callback).Run(SensitiveDirectoryResult::kAllowed); + return; + } + + base::ThreadPool::PostTaskAndReplyWithResult( + FROM_HERE, { base::MayBlock(), base::TaskPriority::USER_VISIBLE }, + base::BindOnce(&ShouldBlockAccessToPath, path, handle_type), + base::BindOnce(&FileSystemAccessPermissionContextQt::DidConfirmSensitiveDirectoryAccess, + m_weakFactory.GetWeakPtr(), origin, path, handle_type, frame_id, + std::move(callback))); +} + +void FileSystemAccessPermissionContextQt::PerformAfterWriteChecks( + std::unique_ptr<content::FileSystemAccessWriteItem> item, + content::GlobalRenderFrameHostId frame_id, + base::OnceCallback<void(AfterWriteCheckResult)> callback) +{ + Q_UNUSED(item); + Q_UNUSED(frame_id); + std::move(callback).Run(AfterWriteCheckResult::kAllow); +} + +bool FileSystemAccessPermissionContextQt::CanObtainReadPermission(const url::Origin &origin) +{ + Q_UNUSED(origin); + return true; +} + +bool FileSystemAccessPermissionContextQt::CanObtainWritePermission(const url::Origin &origin) +{ + Q_UNUSED(origin); + return true; +} + +void FileSystemAccessPermissionContextQt::SetLastPickedDirectory(const url::Origin &origin, + const std::string &id, + const base::FilePath &path, + const PathType type) +{ + Q_UNUSED(origin); + + FileSystemAccessPermissionContextQt::PathInfo info; + info.path = path; + info.type = type; + m_lastPickedDirectories.insert({ id, info }); +} + +FileSystemAccessPermissionContextQt::PathInfo +FileSystemAccessPermissionContextQt::GetLastPickedDirectory(const url::Origin &origin, + const std::string &id) +{ + Q_UNUSED(origin); + + return m_lastPickedDirectories.find(id) != m_lastPickedDirectories.end() + ? m_lastPickedDirectories[id] + : FileSystemAccessPermissionContextQt::PathInfo(); +} + +base::FilePath FileSystemAccessPermissionContextQt::GetWellKnownDirectoryPath( + blink::mojom::WellKnownDirectory directory) +{ + QStandardPaths::StandardLocation location = QStandardPaths::DocumentsLocation; + switch (directory) { + case blink::mojom::WellKnownDirectory::kDefault: + location = QStandardPaths::DocumentsLocation; + break; + case blink::mojom::WellKnownDirectory::kDirDesktop: + location = QStandardPaths::DesktopLocation; + break; + case blink::mojom::WellKnownDirectory::kDirDocuments: + location = QStandardPaths::DocumentsLocation; + break; + case blink::mojom::WellKnownDirectory::kDirDownloads: + location = QStandardPaths::DownloadLocation; + break; + case blink::mojom::WellKnownDirectory::kDirMusic: + location = QStandardPaths::MusicLocation; + break; + case blink::mojom::WellKnownDirectory::kDirPictures: + location = QStandardPaths::PicturesLocation; + break; + case blink::mojom::WellKnownDirectory::kDirVideos: + location = QStandardPaths::MoviesLocation; + break; + } + + return toFilePath(QStandardPaths::writableLocation(location)); +} + +void FileSystemAccessPermissionContextQt::NavigatedAwayFromOrigin(const url::Origin &origin) +{ + // If the last top-level WebContents for an origin is closed (or is navigated to another + // origin), all the permissions for that origin will be revoked. + + auto it = m_origins.find(origin); + // If we have no permissions for the origin, there is nothing to do. + if (it == m_origins.end()) + return; + + std::vector<content::WebContentsImpl *> list = content::WebContentsImpl::GetAllWebContents(); + for (content::WebContentsImpl *web_contents : list) { + url::Origin web_contents_origin = url::Origin::Create(web_contents->GetLastCommittedURL()); + // Found a tab for this origin, so early exit and don't revoke grants. + if (web_contents_origin == origin) + return; + } + + OriginState &origin_state = it->second; + for (auto &grant : origin_state.read_grants) + grant.second->SetStatus(PermissionStatus::ASK); + for (auto &grant : origin_state.write_grants) + grant.second->SetStatus(PermissionStatus::ASK); +} + +void FileSystemAccessPermissionContextQt::DidConfirmSensitiveDirectoryAccess( + const url::Origin &origin, const base::FilePath &path, HandleType handle_type, + content::GlobalRenderFrameHostId frame_id, + base::OnceCallback<void(SensitiveDirectoryResult)> callback, bool should_block) +{ + Q_UNUSED(origin); + Q_UNUSED(path); + Q_UNUSED(handle_type); + Q_UNUSED(frame_id); + + if (should_block) + std::move(callback).Run(SensitiveDirectoryResult::kAbort); + else + std::move(callback).Run(SensitiveDirectoryResult::kAllowed); +} + +} // 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 new file mode 100644 index 000000000..722e44d14 --- /dev/null +++ b/src/core/file_system_access/file_system_access_permission_context_qt.h @@ -0,0 +1,78 @@ +// Copyright (C) 2022 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 + +// This file is based on chrome/browser/file_system_access/chrome_file_system_access_permission_context.h: +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FILE_SYSTEM_ACCESS_PERMISSION_CONTEXT_QT_H +#define FILE_SYSTEM_ACCESS_PERMISSION_CONTEXT_QT_H + +#include "base/files/file_path.h" +#include "components/keyed_service/core/keyed_service.h" +#include "content/public/browser/file_system_access_permission_context.h" +#include "content/public/browser/global_routing_id.h" + +namespace content { +class BrowserContext; +} + +namespace QtWebEngineCore { + +class FileSystemAccessPermissionContextQt : public content::FileSystemAccessPermissionContext, + public KeyedService +{ +public: + explicit FileSystemAccessPermissionContextQt(content::BrowserContext *context); + ~FileSystemAccessPermissionContextQt() override; + + enum class GrantType { kRead, kWrite }; + + // content::FileSystemAccessPermissionContext: + scoped_refptr<content::FileSystemAccessPermissionGrant> + GetReadPermissionGrant(const url::Origin &origin, const base::FilePath &path, + HandleType handle_type, UserAction user_action) override; + scoped_refptr<content::FileSystemAccessPermissionGrant> + GetWritePermissionGrant(const url::Origin &origin, const base::FilePath &path, + HandleType handle_type, UserAction user_action) override; + void ConfirmSensitiveDirectoryAccess( + const url::Origin &origin, PathType path_type, const base::FilePath &path, + HandleType handle_type, content::GlobalRenderFrameHostId frame_id, + base::OnceCallback<void(SensitiveDirectoryResult)> callback) override; + void PerformAfterWriteChecks(std::unique_ptr<content::FileSystemAccessWriteItem> item, + content::GlobalRenderFrameHostId frame_id, + base::OnceCallback<void(AfterWriteCheckResult)> callback) override; + 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 + GetLastPickedDirectory(const url::Origin &origin, const std::string &id) override; + base::FilePath GetWellKnownDirectoryPath(blink::mojom::WellKnownDirectory directory) override; + + void NavigatedAwayFromOrigin(const url::Origin &origin); + content::BrowserContext *profile() const { return m_profile; } + +private: + class PermissionGrantImpl; + + void DidConfirmSensitiveDirectoryAccess( + const url::Origin &origin, const base::FilePath &path, HandleType handle_type, + content::GlobalRenderFrameHostId frame_id, + base::OnceCallback<void(SensitiveDirectoryResult)> callback, bool should_block); + + content::BrowserContext *m_profile; + + // Permission state per origin. + struct OriginState; + std::map<url::Origin, OriginState> m_origins; + + std::map<std::string, FileSystemAccessPermissionContextQt::PathInfo> m_lastPickedDirectories; + + base::WeakPtrFactory<FileSystemAccessPermissionContextQt> m_weakFactory { this }; +}; + +} // namespace QtWebEngineCore + +#endif // FILE_SYSTEM_ACCESS_PERMISSION_CONTEXT_QT_H 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 new file mode 100644 index 000000000..27f225755 --- /dev/null +++ b/src/core/file_system_access/file_system_access_permission_grant_qt.cpp @@ -0,0 +1,142 @@ +// Copyright (C) 2022 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 "file_system_access_permission_grant_qt.h" + +#include "file_system_access_permission_request_manager_qt.h" + +#include "components/permissions/permission_util.h" +#include "content/public/browser/browser_task_traits.h" +#include "content/public/browser/browser_thread.h" +#include "content/public/browser/render_frame_host.h" +#include "content/public/browser/render_process_host.h" +#include "content/public/browser/web_contents.h" +#include "content/public/browser/disallow_activation_reason.h" +#include "url/origin.h" + +namespace QtWebEngineCore { + +FileSystemAccessPermissionGrantQt::FileSystemAccessPermissionGrantQt( + base::WeakPtr<FileSystemAccessPermissionContextQt> 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) +{ +} + +void FileSystemAccessPermissionGrantQt::RequestPermission( + content::GlobalRenderFrameHostId frame_id, UserActivationState user_activation_state, + base::OnceCallback<void(PermissionRequestOutcome)> callback) +{ + // Check if a permission request has already been processed previously. This + // check is done first because we don't want to reset the status of a + // permission if it has already been granted. + if (GetStatus() != PermissionStatus::ASK || !m_context) { + if (GetStatus() == PermissionStatus::GRANTED) + SetStatus(PermissionStatus::GRANTED); + std::move(callback).Run(PermissionRequestOutcome::kRequestAborted); + return; + } + + // Otherwise, perform checks and ask the user for permission. + + content::RenderFrameHost *rfh = content::RenderFrameHost::FromID(frame_id); + if (!rfh) { + // Requested from a no longer valid render frame host. + std::move(callback).Run(PermissionRequestOutcome::kInvalidFrame); + return; + } + + // Don't show request permission UI for an inactive RenderFrameHost as the + // page might not distinguish properly between user denying the permission + // and automatic rejection, leading to an inconsistent UX once the page + // becomes active again. + // - If this is called when RenderFrameHost is in BackForwardCache, evict + // the document from the cache. + // - If this is called when RenderFrameHost is in prerendering, cancel + // prerendering. + if (rfh->IsInactiveAndDisallowActivation( + content::DisallowActivationReasonId::kFileSystemAccessPermissionRequest)) { + std::move(callback).Run(PermissionRequestOutcome::kInvalidFrame); + return; + } + + if (user_activation_state == UserActivationState::kRequired + && !rfh->HasTransientUserActivation()) { + // No permission prompts without user activation. + std::move(callback).Run(PermissionRequestOutcome::kNoUserActivation); + return; + } + + content::WebContents *web_contents = content::WebContents::FromRenderFrameHost(rfh); + if (!web_contents) { + // Requested from a worker, or a no longer existing tab. + std::move(callback).Run(PermissionRequestOutcome::kInvalidFrame); + return; + } + + url::Origin embedding_origin = url::Origin::Create(web_contents->GetLastCommittedURL()); + if (embedding_origin != m_origin) { + // Third party iframes are not allowed to request more permissions. + std::move(callback).Run(PermissionRequestOutcome::kThirdPartyContext); + return; + } + + auto *request_manager = + FileSystemAccessPermissionRequestManagerQt::FromWebContents(web_contents); + if (!request_manager) { + std::move(callback).Run(PermissionRequestOutcome::kRequestAborted); + return; + } + + // Drop fullscreen mode so that the user sees the URL bar. + base::ScopedClosureRunner fullscreen_block = web_contents->ForSecurityDropFullscreen(); + + FileSystemAccessPermissionRequestManagerQt::Access access = m_type == GrantType::kRead + ? FileSystemAccessPermissionRequestManagerQt::Access::kRead + : FileSystemAccessPermissionRequestManagerQt::Access::kWrite; + + // If a website wants both read and write access, code in content will + // request those as two separate requests. The |request_manager| will then + // detect this and combine the two requests into one prompt. As such this + // code does not have to have any way to request Access::kReadWrite. + + request_manager->AddRequest( + { m_origin, m_path, m_handleType, access }, + base::BindOnce(&FileSystemAccessPermissionGrantQt::OnPermissionRequestResult, this, + std::move(callback)), + std::move(fullscreen_block)); +} + +void FileSystemAccessPermissionGrantQt::SetStatus(PermissionStatus status) +{ + bool should_notify = m_status != status; + m_status = status; + if (should_notify) + NotifyPermissionStatusChanged(); +} + +void FileSystemAccessPermissionGrantQt::OnPermissionRequestResult( + base::OnceCallback<void(PermissionRequestOutcome)> callback, PermissionAction result) +{ + switch (result) { + case PermissionAction::GRANTED: + SetStatus(PermissionStatus::GRANTED); + std::move(callback).Run(PermissionRequestOutcome::kUserGranted); + break; + case PermissionAction::DENIED: + SetStatus(PermissionStatus::DENIED); + std::move(callback).Run(PermissionRequestOutcome::kUserDenied); + break; + case PermissionAction::DISMISSED: + case PermissionAction::IGNORED: + std::move(callback).Run(PermissionRequestOutcome::kUserDismissed); + break; + case PermissionAction::REVOKED: + case PermissionAction::GRANTED_ONCE: + case PermissionAction::NUM: + NOTREACHED(); + break; + } +} + +} // namespace QtWebEngineCore 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 new file mode 100644 index 000000000..a54b2a3d3 --- /dev/null +++ b/src/core/file_system_access/file_system_access_permission_grant_qt.h @@ -0,0 +1,58 @@ +// Copyright (C) 2022 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 + +#ifndef FILE_SYSTEM_ACCESS_PERMISSION_GRANT_QT_H +#define FILE_SYSTEM_ACCESS_PERMISSION_GRANT_QT_H + +#include "content/public/browser/file_system_access_permission_grant.h" +#include "url/origin.h" +#include "file_system_access_permission_context_qt.h" +#include "content/public/browser/global_routing_id.h" +#include "components/permissions/permission_util.h" + +namespace QtWebEngineCore { + +using HandleType = content::FileSystemAccessPermissionContext::HandleType; +using GrantType = FileSystemAccessPermissionContextQt::GrantType; +using blink::mojom::PermissionStatus; +using permissions::PermissionAction; + +class FileSystemAccessPermissionGrantQt : public content::FileSystemAccessPermissionGrant +{ +public: + FileSystemAccessPermissionGrantQt(base::WeakPtr<FileSystemAccessPermissionContextQt> context, + const url::Origin &origin, const base::FilePath &path, + HandleType handle_type, GrantType type); + + // content::FileSystemAccessPermissionGrant: + PermissionStatus GetStatus() override { return m_status; } + base::FilePath GetPath() override { return m_path; } + void RequestPermission(content::GlobalRenderFrameHostId frame_id, + UserActivationState user_activation_state, + base::OnceCallback<void(PermissionRequestOutcome)> callback) override; + + const url::Origin &origin() const { return m_origin; } + HandleType handleType() const { return m_handleType; } + const base::FilePath &path() const { return m_path; } + GrantType type() const { return m_type; } + + void SetStatus(PermissionStatus status); + +private: + void OnPermissionRequestResult(base::OnceCallback<void(PermissionRequestOutcome)> callback, + PermissionAction result); + + base::WeakPtr<FileSystemAccessPermissionContextQt> const m_context; + const url::Origin m_origin; + const base::FilePath m_path; + const HandleType m_handleType; + const GrantType m_type; + + // This member should only be updated via SetStatus(), to make sure + // observers are properly notified about any change in status. + PermissionStatus m_status = PermissionStatus::ASK; +}; + +} // namespace QtWebEngineCore + +#endif // FILE_SYSTEM_ACCESS_PERMISSION_GRANT_QT_H 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 new file mode 100644 index 000000000..f1b446de6 --- /dev/null +++ b/src/core/file_system_access/file_system_access_permission_request_controller.h @@ -0,0 +1,39 @@ +// Copyright (C) 2022 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 + +#ifndef FILE_SYSTEM_ACCESS_PERMISSION_REQUEST_CONTROLLER_H +#define FILE_SYSTEM_ACCESS_PERMISSION_REQUEST_CONTROLLER_H + +#include "api/qwebenginefilesystemaccessrequest.h" +#include "request_controller.h" + +using HandleType = QWebEngineFileSystemAccessRequest::HandleType; +using AccessFlags = QWebEngineFileSystemAccessRequest::AccessFlags; + +namespace QtWebEngineCore { + +class FileSystemAccessPermissionRequestController : public RequestController +{ +public: + FileSystemAccessPermissionRequestController(const QUrl &origin, const QUrl &filePath, + HandleType handleType, AccessFlags accessType) + : RequestController(std::move(origin)) + , m_filePath(filePath) + , m_handleType(handleType) + , m_accessType(accessType) + { + } + + QUrl filePath() const { return m_filePath; } + HandleType handleType() const { return m_handleType; } + AccessFlags accessFlags() const { return m_accessType; } + +private: + QUrl m_filePath; + HandleType m_handleType; + AccessFlags m_accessType; +}; + +} // namespace QtWebEngineCore + +#endif // FILE_SYSTEM_ACCESS_PERMISSION_REQUEST_CONTROLLER_H 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 new file mode 100644 index 000000000..7dc5f5211 --- /dev/null +++ b/src/core/file_system_access/file_system_access_permission_request_controller_impl.cpp @@ -0,0 +1,48 @@ +// Copyright (C) 2022 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 "file_system_access_permission_request_controller_impl.h" + +#include "components/permissions/permission_util.h" +#include "content/public/browser/file_system_access_permission_context.h" +#include "type_conversion.h" + +namespace QtWebEngineCore { + +ASSERT_ENUMS_MATCH(content::FileSystemAccessPermissionContext::HandleType::kFile, + QWebEngineFileSystemAccessRequest::HandleType::File); +ASSERT_ENUMS_MATCH(content::FileSystemAccessPermissionContext::HandleType::kDirectory, + QWebEngineFileSystemAccessRequest::HandleType::Directory); + +ASSERT_ENUMS_MATCH(FileSystemAccessPermissionRequestManagerQt::Access::kRead, + QWebEngineFileSystemAccessRequest::AccessFlag::Read); +ASSERT_ENUMS_MATCH(FileSystemAccessPermissionRequestManagerQt::Access::kWrite, + QWebEngineFileSystemAccessRequest::AccessFlag::Write); + +FileSystemAccessPermissionRequestControllerImpl::FileSystemAccessPermissionRequestControllerImpl( + const FileSystemAccessPermissionRequestManagerQt::RequestData &request, + base::OnceCallback<void(permissions::PermissionAction result)> callback) + : FileSystemAccessPermissionRequestController( + toQt(request.origin.GetURL()), toQt(request.path.value()), + (HandleType)request.handle_type, AccessFlags((int)request.access)) + , m_callback(std::move(callback)) +{ +} + +FileSystemAccessPermissionRequestControllerImpl::~FileSystemAccessPermissionRequestControllerImpl() +{ + if (m_callback) + std::move(m_callback).Run(permissions::PermissionAction::IGNORED); +} + +void FileSystemAccessPermissionRequestControllerImpl::accepted() +{ + std::move(m_callback).Run(permissions::PermissionAction::GRANTED); +} + +void FileSystemAccessPermissionRequestControllerImpl::rejected() +{ + std::move(m_callback).Run(permissions::PermissionAction::DENIED); +} + +} // namespace QtWebEngineCore diff --git a/src/core/file_system_access/file_system_access_permission_request_controller_impl.h b/src/core/file_system_access/file_system_access_permission_request_controller_impl.h new file mode 100644 index 000000000..6cca1e549 --- /dev/null +++ b/src/core/file_system_access/file_system_access_permission_request_controller_impl.h @@ -0,0 +1,32 @@ +// Copyright (C) 2022 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 + +#ifndef FILE_SYSTEM_ACCESS_PERMISSION_REQUEST_CONTROLLER_IMPL_H +#define FILE_SYSTEM_ACCESS_PERMISSION_REQUEST_CONTROLLER_IMPL_H + +#include "file_system_access_permission_request_controller.h" +#include "file_system_access_permission_request_manager_qt.h" + +namespace QtWebEngineCore { + +class FileSystemAccessPermissionRequestControllerImpl final + : public FileSystemAccessPermissionRequestController +{ +public: + FileSystemAccessPermissionRequestControllerImpl( + const FileSystemAccessPermissionRequestManagerQt::RequestData &request, + base::OnceCallback<void(permissions::PermissionAction result)> callback); + + ~FileSystemAccessPermissionRequestControllerImpl(); + +protected: + void accepted() override; + void rejected() override; + +private: + base::OnceCallback<void(permissions::PermissionAction result)> m_callback; +}; + +} // namespace QtWebEngineCore + +#endif // FILE_SYSTEM_ACCESS_PERMISSION_REQUEST_CONTROLLER_IMPL_H 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 new file mode 100644 index 000000000..423cdd777 --- /dev/null +++ b/src/core/file_system_access/file_system_access_permission_request_manager_qt.cpp @@ -0,0 +1,195 @@ +// Copyright (C) 2022 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 "file_system_access_permission_request_manager_qt.h" + +#include "components/permissions/permission_util.h" +#include "content/browser/web_contents/web_contents_impl.h" +#include "content/public/browser/browser_task_traits.h" +#include "content/public/browser/browser_thread.h" +#include "content/public/browser/navigation_handle.h" + +#include "api/qwebenginefilesystemaccessrequest.h" +#include "file_system_access_permission_context_factory_qt.h" +#include "file_system_access_permission_request_controller_impl.h" +#include "web_contents_adapter_client.h" +#include "web_contents_view_qt.h" + +namespace QtWebEngineCore { + +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 + && 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; +} + +struct FileSystemAccessPermissionRequestManagerQt::Request +{ + Request(RequestData data, + base::OnceCallback<void(permissions::PermissionAction result)> callback, + base::ScopedClosureRunner fullscreen_block) + : data(std::move(data)) + { + callbacks.push_back(std::move(callback)); + fullscreen_blocks.push_back(std::move(fullscreen_block)); + } + + RequestData data; + std::vector<base::OnceCallback<void(permissions::PermissionAction result)>> callbacks; + std::vector<base::ScopedClosureRunner> fullscreen_blocks; +}; + +FileSystemAccessPermissionRequestManagerQt::~FileSystemAccessPermissionRequestManagerQt() = default; + +void FileSystemAccessPermissionRequestManagerQt::AddRequest( + RequestData data, base::OnceCallback<void(permissions::PermissionAction result)> callback, + base::ScopedClosureRunner fullscreen_block) +{ + // Check if any pending requests are identical to the new request. + if (m_currentRequest && RequestsAreIdentical(m_currentRequest->data, data)) { + m_currentRequest->callbacks.push_back(std::move(callback)); + m_currentRequest->fullscreen_blocks.push_back(std::move(fullscreen_block)); + return; + } + for (const auto &request : m_queuedRequests) { + if (RequestsAreIdentical(request->data, data)) { + request->callbacks.push_back(std::move(callback)); + request->fullscreen_blocks.push_back(std::move(fullscreen_block)); + return; + } + if (RequestsAreForSamePath(request->data, data)) { + // This means access levels are different. Change the existing request + // to kReadWrite, and add the new callback. + request->data.access = Access::kReadWrite; + request->callbacks.push_back(std::move(callback)); + request->fullscreen_blocks.push_back(std::move(fullscreen_block)); + return; + } + } + + m_queuedRequests.push_back(std::make_unique<Request>(std::move(data), std::move(callback), + std::move(fullscreen_block))); + if (!IsShowingRequest()) + ScheduleShowRequest(); +} + +FileSystemAccessPermissionRequestManagerQt::FileSystemAccessPermissionRequestManagerQt( + content::WebContents *web_contents) + : content::WebContentsObserver(web_contents) + , content::WebContentsUserData<FileSystemAccessPermissionRequestManagerQt>(*web_contents) +{ +} + +bool FileSystemAccessPermissionRequestManagerQt::CanShowRequest() const +{ + // Delay showing requests until the main frame is fully loaded. + // ScheduleShowRequest() will be called again when that happens. + return web_contents()->IsDocumentOnLoadCompletedInPrimaryMainFrame() && !m_queuedRequests.empty() + && !m_currentRequest; +} + +void FileSystemAccessPermissionRequestManagerQt::ScheduleShowRequest() +{ + if (!CanShowRequest()) + return; + + content::GetUIThreadTaskRunner({})->PostTask( + FROM_HERE, + base::BindOnce(&FileSystemAccessPermissionRequestManagerQt::DequeueAndShowRequest, + m_weakFactory.GetWeakPtr())); +} + +void FileSystemAccessPermissionRequestManagerQt::DequeueAndShowRequest() +{ + if (!CanShowRequest()) + return; + + m_currentRequest = std::move(m_queuedRequests.front()); + m_queuedRequests.pop_front(); + + WebContentsAdapterClient *client = + WebContentsViewQt::from( + static_cast<content::WebContentsImpl *>(web_contents())->GetView()) + ->client(); + if (!client) { + LOG(ERROR) + << "Attempt to request file system access from content missing WebContents client"; + for (auto &callback : m_currentRequest->callbacks) + std::move(callback).Run(permissions::PermissionAction::DENIED); + return; + } + + QWebEngineFileSystemAccessRequest request( + std::make_shared<FileSystemAccessPermissionRequestControllerImpl>( + m_currentRequest->data, + base::BindOnce( + &FileSystemAccessPermissionRequestManagerQt::OnPermissionDialogResult, + m_weakFactory.GetWeakPtr()))); + client->runFileSystemAccessRequest(std::move(request)); +} + +void FileSystemAccessPermissionRequestManagerQt::DocumentOnLoadCompletedInPrimaryMainFrame() +{ + // This is scheduled because while all calls to the browser have been + // issued at DOMContentLoaded, they may be bouncing around in scheduled + // callbacks finding the UI thread still. This makes sure we allow those + // scheduled calls to AddRequest to complete before we show the page-load + // permissions bubble. + if (!m_queuedRequests.empty()) + ScheduleShowRequest(); +} + +void FileSystemAccessPermissionRequestManagerQt::DidFinishNavigation( + content::NavigationHandle *navigation) +{ + // We only care about top-level navigations that actually committed. + if (!navigation->IsInMainFrame() || !navigation->HasCommitted()) + return; + + auto src_origin = url::Origin::Create(navigation->GetPreviousMainFrameURL()); + auto dest_origin = url::Origin::Create(navigation->GetURL()); + if (src_origin == dest_origin) + return; + + // Navigated away from |src_origin|, tell permission context to check if + // permissions need to be revoked. + auto *context = FileSystemAccessPermissionContextFactoryQt::GetForProfileIfExists( + web_contents()->GetBrowserContext()); + if (context) + context->NavigatedAwayFromOrigin(src_origin); +} + +void FileSystemAccessPermissionRequestManagerQt::WebContentsDestroyed() +{ + auto src_origin = web_contents()->GetMainFrame()->GetLastCommittedOrigin(); + + // Navigated away from |src_origin|, tell permission context to check if + // permissions need to be revoked. + auto *context = FileSystemAccessPermissionContextFactoryQt::GetForProfileIfExists( + web_contents()->GetBrowserContext()); + if (context) + context->NavigatedAwayFromOrigin(src_origin); +} + +void FileSystemAccessPermissionRequestManagerQt::OnPermissionDialogResult( + permissions::PermissionAction result) +{ + DCHECK(m_currentRequest); + for (auto &callback : m_currentRequest->callbacks) + std::move(callback).Run(result); + + m_currentRequest = nullptr; + if (!m_queuedRequests.empty()) + ScheduleShowRequest(); +} + +WEB_CONTENTS_USER_DATA_KEY_IMPL(FileSystemAccessPermissionRequestManagerQt); + +} // namespace QtWebEngineCore 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 new file mode 100644 index 000000000..f8746eabf --- /dev/null +++ b/src/core/file_system_access/file_system_access_permission_request_manager_qt.h @@ -0,0 +1,79 @@ +// Copyright (C) 2022 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 + +#ifndef FILE_SYSTEM_ACCESS_PERMISSION_REQUEST_MANAGER_QT_H +#define FILE_SYSTEM_ACCESS_PERMISSION_REQUEST_MANAGER_QT_H + +#include "base/callback_helpers.h" +#include "base/containers/circular_deque.h" +#include "base/files/file_path.h" +#include "base/memory/weak_ptr.h" +#include "content/public/browser/file_system_access_permission_context.h" +#include "content/public/browser/web_contents_observer.h" +#include "content/public/browser/web_contents_user_data.h" +#include "url/origin.h" + +namespace permissions { +enum class PermissionAction; +} + +namespace QtWebEngineCore { + +class FileSystemAccessPermissionRequestManagerQt + : public content::WebContentsObserver, + public content::WebContentsUserData<FileSystemAccessPermissionRequestManagerQt> +{ +public: + ~FileSystemAccessPermissionRequestManagerQt() override; + + enum class Access { + // Only ask for read access. + kRead = 0x1, + // Only ask for write access, assuming read access has already been granted. + kWrite = 0x2, + // Ask for both read and write access. + kReadWrite = 0x3 + }; + + struct RequestData + { + url::Origin origin; + base::FilePath path; + content::FileSystemAccessPermissionContext::HandleType handle_type; + Access access; + }; + + void AddRequest(RequestData request, + base::OnceCallback<void(permissions::PermissionAction result)> callback, + base::ScopedClosureRunner fullscreen_block); + +private: + friend class content::WebContentsUserData<FileSystemAccessPermissionRequestManagerQt>; + + explicit FileSystemAccessPermissionRequestManagerQt(content::WebContents *web_contents); + + bool IsShowingRequest() const { return m_currentRequest != nullptr; } + bool CanShowRequest() const; + void ScheduleShowRequest(); + void DequeueAndShowRequest(); + + // content::WebContentsObserver + void DocumentOnLoadCompletedInPrimaryMainFrame() override; + void DidFinishNavigation(content::NavigationHandle *navigation_handle) override; + void WebContentsDestroyed() override; + + void OnPermissionDialogResult(permissions::PermissionAction result); + + struct Request; + // Request currently being shown in prompt. + std::unique_ptr<Request> m_currentRequest; + // Queued up requests. + base::circular_deque<std::unique_ptr<Request>> m_queuedRequests; + + base::WeakPtrFactory<FileSystemAccessPermissionRequestManagerQt> m_weakFactory { this }; + WEB_CONTENTS_USER_DATA_KEY_DECL(); +}; + +} // namespace QtWebEngineCore + +#endif // FILE_SYSTEM_ACCESS_PERMISSION_REQUEST_MANAGER_QT_H diff --git a/src/core/find_text_helper.cpp b/src/core/find_text_helper.cpp index 3f0852536..5dc12fab7 100644 --- a/src/core/find_text_helper.cpp +++ b/src/core/find_text_helper.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 "find_text_helper.h" #include "qwebenginefindtextresult.h" @@ -121,7 +85,7 @@ void FindTextHelper::startFinding(const QString &findText, bool caseSensitively, m_previousFindText = findText; m_currentFindRequestId = m_findRequestIdCounter++; - m_webContents->Find(m_currentFindRequestId, toString16(findText), std::move(options)); + m_webContents->Find(m_currentFindRequestId, toString16(findText), std::move(options), /*skip_delay=*/true); } void FindTextHelper::stopFinding() diff --git a/src/core/find_text_helper.h b/src/core/find_text_helper.h index f795731e3..38a0b9d13 100644 --- a/src/core/find_text_helper.h +++ b/src/core/find_text_helper.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 // // W A R N I N G diff --git a/src/core/global_descriptors_qt.h b/src/core/global_descriptors_qt.h index b9d622606..f9b08f1d6 100644 --- a/src/core/global_descriptors_qt.h +++ b/src/core/global_descriptors_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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) 2017 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 #ifndef GLOBAL_DESCRIPTORS_QT_H #define GLOBAL_DESCRIPTORS_QT_H diff --git a/src/core/javascript_dialog_controller.cpp b/src/core/javascript_dialog_controller.cpp index d47d5363d..c8a6a58bf 100644 --- a/src/core/javascript_dialog_controller.cpp +++ b/src/core/javascript_dialog_controller.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 "javascript_dialog_controller.h" #include "javascript_dialog_controller_p.h" diff --git a/src/core/javascript_dialog_controller.h b/src/core/javascript_dialog_controller.h index ba9f51944..5845c156c 100644 --- a/src/core/javascript_dialog_controller.h +++ b/src/core/javascript_dialog_controller.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 // // W A R N I N G diff --git a/src/core/javascript_dialog_controller_p.h b/src/core/javascript_dialog_controller_p.h index 44c0dace5..8345cd50b 100644 --- a/src/core/javascript_dialog_controller_p.h +++ b/src/core/javascript_dialog_controller_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef JAVASCRIPT_DIALOG_CONTROLLER_P_H #define JAVASCRIPT_DIALOG_CONTROLLER_P_H @@ -57,6 +21,7 @@ #include "web_contents_adapter_client.h" #include <QString> +#include <QUrl> namespace content { class WebContents; diff --git a/src/core/javascript_dialog_manager_qt.cpp b/src/core/javascript_dialog_manager_qt.cpp index 64c084810..c5ee357ad 100644 --- a/src/core/javascript_dialog_manager_qt.cpp +++ b/src/core/javascript_dialog_manager_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 "javascript_dialog_manager_qt.h" diff --git a/src/core/javascript_dialog_manager_qt.h b/src/core/javascript_dialog_manager_qt.h index 4684961e8..2a587afc7 100644 --- a/src/core/javascript_dialog_manager_qt.h +++ b/src/core/javascript_dialog_manager_qt.h @@ -1,45 +1,8 @@ -/**************************************************************************** -** -** 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 #ifndef JAVASCRIPT_DIALOG_MANAGER_QT_H #define JAVASCRIPT_DIALOG_MANAGER_QT_H -#include "base/callback.h" #include "content/public/browser/javascript_dialog_manager.h" #include "web_contents_adapter_client.h" diff --git a/src/core/location_provider_qt.cpp b/src/core/location_provider_qt.cpp index 09938ca4f..c7273eaea 100644 --- a/src/core/location_provider_qt.cpp +++ b/src/core/location_provider_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 "location_provider_qt.h" diff --git a/src/core/location_provider_qt.h b/src/core/location_provider_qt.h index db6b94e20..bd1391586 100644 --- a/src/core/location_provider_qt.h +++ b/src/core/location_provider_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef LOCATION_PROVIDER_QT_H #define LOCATION_PROVIDER_QT_H diff --git a/src/core/login_delegate_qt.cpp b/src/core/login_delegate_qt.cpp index c00866e6e..845872012 100644 --- a/src/core/login_delegate_qt.cpp +++ b/src/core/login_delegate_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 // Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be @@ -64,7 +28,6 @@ #if BUILDFLAG(ENABLE_EXTENSIONS) #include "extensions/extension_system_qt.h" #endif // BUILDFLAG(ENABLE_EXTENSIONS) -#include "resource_context_qt.h" #include "type_conversion.h" #include "web_contents_view_qt.h" #include "web_engine_context.h" diff --git a/src/core/login_delegate_qt.h b/src/core/login_delegate_qt.h index 7b8d869e1..b1bae0c0b 100644 --- a/src/core/login_delegate_qt.h +++ b/src/core/login_delegate_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 #ifndef LOGIN_DELEGATE_QT_H #define LOGIN_DELEGATE_QT_H diff --git a/src/core/macos_context_type_helper.h b/src/core/macos_context_type_helper.h index a7b989bc3..1a2b0ff61 100644 --- a/src/core/macos_context_type_helper.h +++ b/src/core/macos_context_type_helper.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 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) 2020 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 #ifndef MACOS_CONTEXT_TYPE_HELPER_H_ #define MACOS_CONTEXT_TYPE_HELPER_H_ bool isCurrentContextSoftware(); diff --git a/src/core/macos_context_type_helper.mm b/src/core/macos_context_type_helper.mm index 4c9302482..9bdd36085 100644 --- a/src/core/macos_context_type_helper.mm +++ b/src/core/macos_context_type_helper.mm @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 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) 2020 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 #import <Foundation/Foundation.h> #import <AppKit/AppKit.h> diff --git a/src/core/media_capture_devices_dispatcher.cpp b/src/core/media_capture_devices_dispatcher.cpp index 9a3295363..cddb5a290 100644 --- a/src/core/media_capture_devices_dispatcher.cpp +++ b/src/core/media_capture_devices_dispatcher.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be @@ -43,13 +7,12 @@ #include "media_capture_devices_dispatcher.h" -#include "javascript_dialog_manager_qt.h" #include "type_conversion.h" #include "web_contents_delegate_qt.h" #include "web_contents_view_qt.h" #include "web_engine_settings.h" -#include "base/strings/utf_string_conversions.h" +#include "base/task/post_task.h" #include "content/browser/web_contents/web_contents_impl.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/desktop_media_id.h" @@ -59,15 +22,12 @@ #include "media/audio/audio_device_description.h" #include "media/audio/audio_manager_base.h" #include "services/network/public/cpp/is_potentially_trustworthy.h" -#include "ui/base/l10n/l10n_util.h" #if QT_CONFIG(webengine_webrtc) #include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h" #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h" #endif -#include <QtCore/qcoreapplication.h> - #if defined(WEBRTC_USE_X11) #include <dlfcn.h> #include <X11/extensions/Xrandr.h> @@ -90,7 +50,7 @@ const blink::MediaStreamDevice *findDeviceWithId(const blink::MediaStreamDevices return &(*iter); } } - return 0; + return nullptr; } // Based on chrome/browser/media/webrtc/desktop_capture_devices_util.cc: @@ -256,7 +216,7 @@ public: } private: - gfx::NativeViewId OnStarted(base::OnceClosure stop, SourceCallback source, + gfx::NativeViewId OnStarted(base::RepeatingClosure stop, SourceCallback source, const std::string& label, std::vector<content::DesktopMediaID> screen_capture_ids, StateChangeCallback state_change) override @@ -282,9 +242,7 @@ private: base::WeakPtr<WebContentsDelegateQt> m_delegate; const blink::MediaStreamDevices m_devices; bool m_started = false; - base::OnceClosure m_onStop; // currently unused - - DISALLOW_COPY_AND_ASSIGN(MediaStreamUIQt); + base::RepeatingClosure m_onStop; // currently unused }; } // namespace @@ -336,6 +294,7 @@ void MediaCaptureDevicesDispatcher::handleMediaAccessPermissionResponse(content: case blink::MEDIA_DEVICE_ACCESS: case blink::MEDIA_DEVICE_UPDATE: case blink::MEDIA_GENERATE_STREAM: + case blink::MEDIA_GET_OPEN_DEVICE: getDefaultDevices(request.requested_audio_device_id, request.requested_video_device_id, microphoneRequested, webcamRequested, &devices); break; @@ -375,7 +334,7 @@ MediaCaptureDevicesDispatcher *MediaCaptureDevicesDispatcher::GetInstance() MediaCaptureDevicesDispatcher::MediaCaptureDevicesDispatcher() : m_webContentsCollection(this) { -#if defined(OS_WIN) +#if defined(Q_OS_WIN) // Currently loopback audio capture is supported only on Windows. m_loopbackAudioSupported = true; #endif diff --git a/src/core/media_capture_devices_dispatcher.h b/src/core/media_capture_devices_dispatcher.h index 91ddc30a8..cdb84ee24 100644 --- a/src/core/media_capture_devices_dispatcher.h +++ b/src/core/media_capture_devices_dispatcher.h @@ -1,56 +1,18 @@ -/**************************************************************************** -** -** Copyright (c) 2012 The Chromium Authors. All rights reserved. -** 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) 2012 The Chromium Authors. All rights reserved. +// 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 #ifndef MEDIA_CAPTURE_DEVICES_DISPATCHER_H #define MEDIA_CAPTURE_DEVICES_DISPATCHER_H #include "web_contents_adapter_client.h" -#include "base/callback.h" #include "base/containers/circular_deque.h" #include "base/containers/flat_map.h" #include "base/memory/singleton.h" -#include "base/observer_list.h" #include "chrome/browser/tab_contents/web_contents_collection.h" #include "content/public/browser/media_observer.h" -#include "content/public/browser/web_contents_delegate.h" +#include "content/public/browser/media_stream_request.h" namespace QtWebEngineCore { @@ -119,8 +81,6 @@ private: WebContentsCollection m_webContentsCollection; bool m_loopbackAudioSupported = false; - - DISALLOW_COPY_AND_ASSIGN(MediaCaptureDevicesDispatcher); }; } // namespace QtWebEngineCore diff --git a/src/core/native_web_keyboard_event_qt.cpp b/src/core/native_web_keyboard_event_qt.cpp index 9942ecf17..4755c60bf 100644 --- a/src/core/native_web_keyboard_event_qt.cpp +++ b/src/core/native_web_keyboard_event_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 // Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be diff --git a/src/core/net/client_cert_override.cpp b/src/core/net/client_cert_override.cpp index 4f7ae665f..9a8cca839 100644 --- a/src/core/net/client_cert_override.cpp +++ b/src/core/net/client_cert_override.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 "client_cert_override.h" @@ -43,6 +7,7 @@ #include "base/task/post_task.h" #include "base/callback_forward.h" #include "content/public/browser/browser_task_traits.h" +#include "crypto/crypto_buildflags.h" #include "net/ssl/client_cert_store.h" #include "net/ssl/ssl_cert_request_info.h" #include "net/ssl/ssl_private_key.h" @@ -56,15 +21,15 @@ #include <QtNetwork/qtnetworkglobal.h> -#if defined(USE_NSS_CERTS) +#if BUILDFLAG(USE_NSS_CERTS) #include "net/ssl/client_cert_store_nss.h" #endif -#if defined(OS_WIN) +#if defined(Q_OS_WIN) #include "net/ssl/client_cert_store_win.h" #endif -#if defined(OS_MAC) +#if BUILDFLAG(IS_MAC) #include "net/ssl/client_cert_store_mac.h" #endif @@ -82,13 +47,6 @@ public: std::move(private_key_callback).Run(m_key); } -#if defined(OS_MAC) - SecIdentityRef sec_identity_ref() const override - { - return nullptr; - } -#endif - private: scoped_refptr<net::SSLPrivateKey> m_key; }; @@ -159,11 +117,11 @@ void ClientCertOverrideStore::GetClientCerts(const net::SSLCertRequestInfo &cert // static std::unique_ptr<net::ClientCertStore> ClientCertOverrideStore::createNativeStore() { -#if defined(USE_NSS_CERTS) +#if BUILDFLAG(USE_NSS_CERTS) return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreNSS(net::ClientCertStoreNSS::PasswordDelegateFactory())); -#elif defined(OS_WIN) +#elif defined(Q_OS_WIN) return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreWin()); -#elif defined(OS_MAC) +#elif BUILDFLAG(IS_MAC) return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreMac()); #else return nullptr; diff --git a/src/core/net/client_cert_override.h b/src/core/net/client_cert_override.h index 7fd28eaeb..6f740cc9c 100644 --- a/src/core/net/client_cert_override.h +++ b/src/core/net/client_cert_override.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 #ifndef CLIENT_CERT_OVERRIDE_P_H #define CLIENT_CERT_OVERRIDE_P_H diff --git a/src/core/net/client_cert_store_data.cpp b/src/core/net/client_cert_store_data.cpp index 1a957e691..75c35ecc1 100644 --- a/src/core/net/client_cert_store_data.cpp +++ b/src/core/net/client_cert_store_data.cpp @@ -1,48 +1,9 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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) 2019 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 "net/client_cert_store_data.h" #if QT_CONFIG(ssl) -#include "base/logging.h" -#include "base/macros.h" -#include "base/memory/ptr_util.h" #include "net/base/net_errors.h" #include "net/cert/x509_certificate.h" #include "net/ssl/ssl_platform_key_util.h" @@ -113,8 +74,6 @@ public: private: EVP_PKEY *m_key; BIO *m_mem; - - DISALLOW_COPY_AND_ASSIGN(SSLPlatformKeyOverride); }; scoped_refptr<net::SSLPrivateKey> wrapOpenSSLPrivateKey(const QByteArray &sslKeyInBytes) diff --git a/src/core/net/client_cert_store_data.h b/src/core/net/client_cert_store_data.h index 312396d1c..c2e28ac18 100644 --- a/src/core/net/client_cert_store_data.h +++ b/src/core/net/client_cert_store_data.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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) 2019 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 #ifndef CLIENT_CERT_STORE_DATA_H #define CLIENT_CERT_STORE_DATA_H diff --git a/src/core/net/cookie_monster_delegate_qt.cpp b/src/core/net/cookie_monster_delegate_qt.cpp index 274326395..dc47de207 100644 --- a/src/core/net/cookie_monster_delegate_qt.cpp +++ b/src/core/net/cookie_monster_delegate_qt.cpp @@ -1,49 +1,9 @@ -/**************************************************************************** -** -** 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 "cookie_monster_delegate_qt.h" #include "base/bind.h" -#include "base/memory/ptr_util.h" -#include "base/task/post_task.h" -#include "content/public/browser/browser_task_traits.h" -#include "content/public/browser/browser_thread.h" #include "net/cookies/cookie_util.h" #include "services/network/public/mojom/cookie_manager.mojom.h" @@ -51,6 +11,8 @@ #include "api/qwebenginecookiestore_p.h" #include "type_conversion.h" +#include <QNetworkCookie> + namespace QtWebEngineCore { class CookieChangeListener : public network::mojom::CookieChangeListener @@ -67,8 +29,6 @@ public: private: CookieMonsterDelegateQt *m_delegate; - - DISALLOW_COPY_AND_ASSIGN(CookieChangeListener); }; class CookieAccessFilter : public network::mojom::CookieRemoteAccessFilter @@ -85,8 +45,6 @@ public: private: CookieMonsterDelegateQt *m_delegate; - - DISALLOW_COPY_AND_ASSIGN(CookieAccessFilter); }; @@ -182,7 +140,7 @@ void CookieMonsterDelegateQt::deleteAllCookies() m_mojoCookieManager->DeleteCookies(std::move(filter), network::mojom::CookieManager::DeleteCookiesCallback()); } -void CookieMonsterDelegateQt::setMojoCookieManager(network::mojom::CookieManagerPtrInfo cookie_manager_info) +void CookieMonsterDelegateQt::setMojoCookieManager(mojo::PendingRemote<network::mojom::CookieManager> cookie_manager_info) { if (m_mojoCookieManager.is_bound()) unsetMojoCookieManager(); diff --git a/src/core/net/cookie_monster_delegate_qt.h b/src/core/net/cookie_monster_delegate_qt.h index 4359119f9..4273e96ef 100644 --- a/src/core/net/cookie_monster_delegate_qt.h +++ b/src/core/net/cookie_monster_delegate_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 // // W A R N I N G @@ -60,7 +24,7 @@ #endif #include "base/memory/ref_counted.h" #include "mojo/public/cpp/bindings/receiver.h" -#include "net/cookies/cookie_change_dispatcher.h" +#include "mojo/public/cpp/bindings/remote.h" #include "net/cookies/cookie_store.h" #include "services/network/public/mojom/cookie_manager.mojom-forward.h" #include "services/network/public/mojom/cookie_manager.mojom.h" @@ -69,9 +33,9 @@ #undef StAsH_signals #endif -#include <QNetworkCookie> #include <QPointer> +QT_FORWARD_DECLARE_CLASS(QNetworkCookie) QT_FORWARD_DECLARE_CLASS(QWebEngineCookieStore) namespace QtWebEngineCore { @@ -83,7 +47,7 @@ class Q_WEBENGINECORE_PRIVATE_EXPORT CookieMonsterDelegateQt : public base::RefC QPointer<QWebEngineCookieStore> m_client; std::vector<std::unique_ptr<net::CookieChangeSubscription>> m_subscriptions; - network::mojom::CookieManagerPtr m_mojoCookieManager; + mojo::Remote<network::mojom::CookieManager> m_mojoCookieManager; std::unique_ptr<network::mojom::CookieChangeListener> m_listener; std::unique_ptr<network::mojom::CookieRemoteAccessFilter> m_filter; mojo::Receiver<network::mojom::CookieChangeListener> m_receiver; @@ -102,7 +66,7 @@ public: void deleteAllCookies(); void setClient(QWebEngineCookieStore *client); - void setMojoCookieManager(network::mojom::CookieManagerPtrInfo cookie_manager_info); + void setMojoCookieManager(mojo::PendingRemote<network::mojom::CookieManager> cookie_manager_info); void unsetMojoCookieManager(); void setHasFilter(bool b); @@ -113,6 +77,6 @@ public: void OnCookieChanged(const net::CookieChangeInfo &change); }; -} +} // namespace QtWebEngineCore #endif // COOKIE_MONSTER_DELEGATE_QT_H diff --git a/src/core/net/custom_url_loader_factory.cpp b/src/core/net/custom_url_loader_factory.cpp index 892f21dac..bd7d7dc58 100644 --- a/src/core/net/custom_url_loader_factory.cpp +++ b/src/core/net/custom_url_loader_factory.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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) 2019 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 "custom_url_loader_factory.h" @@ -80,13 +44,13 @@ class CustomURLLoader : public network::mojom::URLLoader { public: static void CreateAndStart(const network::ResourceRequest &request, - network::mojom::URLLoaderRequest loader, - network::mojom::URLLoaderClientPtrInfo client_info, + mojo::PendingReceiver<network::mojom::URLLoader> loader, + mojo::PendingRemote<network::mojom::URLLoaderClient> client_remote, QPointer<ProfileAdapter> profileAdapter) { // CustomURLLoader will handle its own life-cycle, and delete when // the client lets go. - auto *customUrlLoader = new CustomURLLoader(request, std::move(loader), std::move(client_info), profileAdapter); + auto *customUrlLoader = new CustomURLLoader(request, std::move(loader), std::move(client_remote), profileAdapter); customUrlLoader->Start(); } @@ -119,14 +83,14 @@ public: private: CustomURLLoader(const network::ResourceRequest &request, - network::mojom::URLLoaderRequest loader, - network::mojom::URLLoaderClientPtrInfo client_info, + mojo::PendingReceiver<network::mojom::URLLoader> loader, + mojo::PendingRemote<network::mojom::URLLoaderClient> client_remote, QPointer<ProfileAdapter> profileAdapter) // ### We can opt to run the url-loader on the UI thread instead : m_taskRunner(base::CreateSingleThreadTaskRunner({ content::BrowserThread::IO })) , m_proxy(new URLRequestCustomJobProxy(this, request.url.scheme(), profileAdapter)) , m_receiver(this, std::move(loader)) - , m_client(std::move(client_info)) + , m_client(std::move(client_remote)) , m_request(request) { DCHECK(m_taskRunner->RunsTasksInCurrentSequence()); @@ -322,7 +286,7 @@ private: m_head->mime_type = m_mimeType; m_head->charset = m_charset; m_headerBytesRead = m_head->headers->raw_headers().length(); - m_client->OnReceiveResponse(std::move(m_head)); + m_client->OnReceiveResponse(std::move(m_head), mojo::ScopedDataPipeConsumerHandle()); m_client->OnStartLoadingResponseBody(std::move(m_pipeConsumerHandle)); m_head = nullptr; @@ -373,7 +337,7 @@ private: m_head->headers = base::MakeRefCounted<net::HttpResponseHeaders>(net::HttpUtil::AssembleRawHeaders(headers)); m_head->encoded_data_length = m_head->headers->raw_headers().length(); m_head->content_length = m_head->encoded_body_length = -1; - m_client->OnReceiveResponse(std::move(m_head)); + m_client->OnReceiveResponse(std::move(m_head), mojo::ScopedDataPipeConsumerHandle()); CompleteWithFailure(net::Error(error)); } void notifyReadyRead() override @@ -462,7 +426,7 @@ private: scoped_refptr<URLRequestCustomJobProxy> m_proxy; mojo::Receiver<network::mojom::URLLoader> m_receiver; - network::mojom::URLLoaderClientPtr m_client; + mojo::Remote<network::mojom::URLLoaderClient> m_client; mojo::ScopedDataPipeProducerHandle m_pipeProducerHandle; mojo::ScopedDataPipeConsumerHandle m_pipeConsumerHandle; std::unique_ptr<mojo::SimpleWatcher> m_watcher; @@ -478,8 +442,6 @@ private: bool m_isLocal; base::WeakPtrFactory<CustomURLLoader> m_weakPtrFactory{this}; - - DISALLOW_COPY_AND_ASSIGN(CustomURLLoader); }; class CustomURLLoaderFactory : public network::mojom::URLLoaderFactory { @@ -535,7 +497,6 @@ public: const scoped_refptr<base::SequencedTaskRunner> m_taskRunner; mojo::ReceiverSet<network::mojom::URLLoaderFactory> m_receivers; QPointer<ProfileAdapter> m_profileAdapter; - DISALLOW_COPY_AND_ASSIGN(CustomURLLoaderFactory); }; } // namespace diff --git a/src/core/net/custom_url_loader_factory.h b/src/core/net/custom_url_loader_factory.h index a9eecbd1c..fb0c74627 100644 --- a/src/core/net/custom_url_loader_factory.h +++ b/src/core/net/custom_url_loader_factory.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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) 2019 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 // // W A R N I N G 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 0fc518a9b..1bcb3ddea 100644 --- a/src/core/net/plugin_response_interceptor_url_loader_throttle.cpp +++ b/src/core/net/plugin_response_interceptor_url_loader_throttle.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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) 2019 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 // based on chrome/browser/plugins/plugin_response_interceptor_url_loader_throttle.cc // Copyright 2018 The Chromium Authors. All rights reserved. @@ -64,6 +28,51 @@ #include "web_engine_settings.h" #include <string> +#include <tuple> + +namespace { +void ClearAllButFrameAncestors(network::mojom::URLResponseHead *response_head) +{ + response_head->headers->RemoveHeader("Content-Security-Policy"); + response_head->headers->RemoveHeader("Content-Security-Policy-Report-Only"); + + if (!response_head->parsed_headers) + return; + + std::vector<network::mojom::ContentSecurityPolicyPtr> &csp = + response_head->parsed_headers->content_security_policy; + std::vector<network::mojom::ContentSecurityPolicyPtr> cleared; + + for (auto &policy : csp) { + auto frame_ancestors = policy->directives.find(network::mojom::CSPDirectiveName::FrameAncestors); + if (frame_ancestors == policy->directives.end()) + continue; + + auto cleared_policy = network::mojom::ContentSecurityPolicy::New(); + cleared_policy->self_origin = std::move(policy->self_origin); + cleared_policy->header = std::move(policy->header); + cleared_policy->header->header_value = ""; + cleared_policy->directives[network::mojom::CSPDirectiveName::FrameAncestors] = std::move(frame_ancestors->second); + + auto raw_frame_ancestors = policy->raw_directives.find(network::mojom::CSPDirectiveName::FrameAncestors); + DCHECK(raw_frame_ancestors != policy->raw_directives.end()); + + cleared_policy->header->header_value = "frame-ancestors " + raw_frame_ancestors->second; + response_head->headers->AddHeader( + cleared_policy->header->type == network::mojom::ContentSecurityPolicyType::kEnforce + ? "Content-Security-Policy" + : "Content-Security-Policy-Report-Only", + cleared_policy->header->header_value); + cleared_policy->raw_directives[network::mojom::CSPDirectiveName::FrameAncestors] = + std::move(raw_frame_ancestors->second); + + cleared.push_back(std::move(cleared_policy)); + } + + csp.swap(cleared); +} +} // namespace + namespace QtWebEngineCore { @@ -108,7 +117,7 @@ void PluginResponseInterceptorURLLoaderThrottle::WillProcessResponse(const GURL // Content-Security-Policy, and does not currently respect the policy anyway. // Ignore CSP served on a PDF response. https://crbug.com/271452 if (extension_id == extension_misc::kPdfExtensionId && response_head->headers) - response_head->headers->RemoveHeader("Content-Security-Policy"); + ClearAllButFrameAncestors(response_head); MimeTypesHandler::ReportUsedHandler(extension_id); @@ -117,7 +126,7 @@ void PluginResponseInterceptorURLLoaderThrottle::WillProcessResponse(const GURL std::string payload = view_id; mojo::PendingRemote<network::mojom::URLLoader> dummy_new_loader; - ignore_result(dummy_new_loader.InitWithNewPipeAndPassReceiver()); + std::ignore = dummy_new_loader.InitWithNewPipeAndPassReceiver(); mojo::Remote<network::mojom::URLLoaderClient> new_client; mojo::PendingReceiver<network::mojom::URLLoaderClient> new_client_receiver = new_client.BindNewPipeAndPassReceiver(); @@ -151,9 +160,11 @@ void PluginResponseInterceptorURLLoaderThrottle::WillProcessResponse(const GURL mojo::PendingRemote<network::mojom::URLLoader> original_loader; mojo::PendingReceiver<network::mojom::URLLoaderClient> original_client; + mojo::ScopedDataPipeConsumerHandle body; delegate_->InterceptResponse(std::move(dummy_new_loader), - std::move(new_client_receiver), &original_loader, - &original_client); + std::move(new_client_receiver), + &original_loader, &original_client, + &body); // Make a deep copy of URLResponseHead before passing it cross-thread. auto deep_copied_response = response_head->Clone(); @@ -171,6 +182,7 @@ void PluginResponseInterceptorURLLoaderThrottle::WillProcessResponse(const GURL transferrable_loader->url_loader_client = std::move(original_client); transferrable_loader->head = std::move(deep_copied_response); transferrable_loader->head->intercepted_by_plugin = true; + transferrable_loader->body = std::move(body); bool embedded = m_request_destination != network::mojom::RequestDestination::kDocument; @@ -179,7 +191,6 @@ void PluginResponseInterceptorURLLoaderThrottle::WillProcessResponse(const GURL base::BindOnce( &extensions::StreamsPrivateAPI::SendExecuteMimeTypeHandlerEvent, extension_id, view_id, embedded, m_frame_tree_node_id, - -1 /* render_process_id */, -1 /* render_frame_id */, std::move(transferrable_loader), response_url)); } diff --git a/src/core/net/plugin_response_interceptor_url_loader_throttle.h b/src/core/net/plugin_response_interceptor_url_loader_throttle.h index d4ff87846..fb3918c45 100644 --- a/src/core/net/plugin_response_interceptor_url_loader_throttle.h +++ b/src/core/net/plugin_response_interceptor_url_loader_throttle.h @@ -1,46 +1,9 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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) 2019 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 #ifndef PLUGIN_RESPONSE_INTERCEPTOR_URL_LOADER_THROTTLE_H_ #define PLUGIN_RESPONSE_INTERCEPTOR_URL_LOADER_THROTTLE_H_ -#include "base/macros.h" #include "base/memory/weak_ptr.h" #include "services/network/public/mojom/fetch_api.mojom-shared.h" #include "third_party/blink/public/common/loader/url_loader_throttle.h" @@ -71,8 +34,6 @@ private: base::WeakPtrFactory<PluginResponseInterceptorURLLoaderThrottle> weak_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(PluginResponseInterceptorURLLoaderThrottle); }; } // namespace QtWebEngineCore diff --git a/src/core/net/proxy_config_monitor.cpp b/src/core/net/proxy_config_monitor.cpp index de0211f2f..d4543947a 100644 --- a/src/core/net/proxy_config_monitor.cpp +++ b/src/core/net/proxy_config_monitor.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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) 2019 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 // originally based on chrome/browser/net/proxy_config_monitor.cc // Copyright 2017 The Chromium Authors. All rights reserved. diff --git a/src/core/net/proxy_config_monitor.h b/src/core/net/proxy_config_monitor.h index fda6a6fb9..69655b807 100644 --- a/src/core/net/proxy_config_monitor.h +++ b/src/core/net/proxy_config_monitor.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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) 2019 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 // originally based on chrome/browser/net/proxy_config_monitor.h // Copyright 2017 The Chromium Authors. All rights reserved. @@ -48,7 +12,6 @@ #include <memory> #include <string> -#include "base/macros.h" #include "build/buildflag.h" #include "extensions/buildflags/buildflags.h" #include "mojo/public/cpp/bindings/receiver_set.h" @@ -96,8 +59,6 @@ private: mojo::ReceiverSet<network::mojom::ProxyConfigPollerClient> poller_receiver_set_; mojo::RemoteSet<network::mojom::ProxyConfigClient> proxy_config_client_set_; - - DISALLOW_COPY_AND_ASSIGN(ProxyConfigMonitor); }; #endif // !PROXY_CONFIG_MONITOR_H diff --git a/src/core/net/proxy_config_service_qt.cpp b/src/core/net/proxy_config_service_qt.cpp index bc934c960..14514a615 100644 --- a/src/core/net/proxy_config_service_qt.cpp +++ b/src/core/net/proxy_config_service_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 //================ Based on ChromeProxyConfigService ======================= @@ -71,7 +35,7 @@ net::ProxyServer ProxyConfigServiceQt::fromQNetworkProxy(const QNetworkProxy &qt } ProxyConfigServiceQt::ProxyConfigServiceQt(PrefService *prefService, - const scoped_refptr<base::SingleThreadTaskRunner> &taskRunner) + const scoped_refptr<base::SequencedTaskRunner> &taskRunner) : m_baseService(net::ConfiguredProxyResolutionService::CreateSystemProxyConfigService(taskRunner)) , m_usesSystemConfiguration(false) , m_registeredObserver(false) diff --git a/src/core/net/proxy_config_service_qt.h b/src/core/net/proxy_config_service_qt.h index c0928bc03..dcbc5074f 100644 --- a/src/core/net/proxy_config_service_qt.h +++ b/src/core/net/proxy_config_service_qt.h @@ -1,48 +1,12 @@ -/**************************************************************************** -** -** 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 #ifndef PROXY_CONFIG_SERVICE_QT_H #define PROXY_CONFIG_SERVICE_QT_H #include "base/memory/ref_counted.h" #include "base/observer_list.h" -#include "base/single_thread_task_runner.h" +#include "base/task/sequenced_task_runner.h" #include "net/proxy_resolution/proxy_config.h" #include "net/proxy_resolution/proxy_config_service.h" @@ -61,7 +25,7 @@ public: static net::ProxyServer fromQNetworkProxy(const QNetworkProxy &); explicit ProxyConfigServiceQt(PrefService *prefService, - const scoped_refptr<base::SingleThreadTaskRunner> &taskRunner); + const scoped_refptr<base::SequencedTaskRunner> &taskRunner); ~ProxyConfigServiceQt() override; // ProxyConfigService implementation: @@ -97,8 +61,6 @@ private: ProxyPrefs::ConfigState m_prefState; SEQUENCE_CHECKER(m_sequenceChecker); - - DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceQt); }; #endif // PROXY_CONFIG_SERVICE_QT_H diff --git a/src/core/net/proxying_restricted_cookie_manager_qt.cpp b/src/core/net/proxying_restricted_cookie_manager_qt.cpp index f66a4c1a7..ab435f8e2 100644 --- a/src/core/net/proxying_restricted_cookie_manager_qt.cpp +++ b/src/core/net/proxying_restricted_cookie_manager_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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) 2019 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 // originally based on android_webview/browser/network_service/aw_proxying_restricted_cookie_manager.cc: // Copyright 2019 The Chromium Authors. All rights reserved. @@ -105,12 +69,14 @@ 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), std::move(callback)); + underlying_restricted_cookie_manager_->GetAllForUrl(url, site_for_cookies, top_frame_origin, std::move(options), + partitioned_cookies_runtime_feature_enabled, std::move(callback)); } else { std::move(callback).Run(std::vector<net::CookieWithAccessResult>()); } @@ -120,12 +86,13 @@ void ProxyingRestrictedCookieManagerQt::SetCanonicalCookie(const net::CanonicalC const GURL &url, const net::SiteForCookies &site_for_cookies, const url::Origin &top_frame_origin, + net::CookieInclusionStatus status, 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, std::move(callback)); + underlying_restricted_cookie_manager_->SetCanonicalCookie(cookie, url, site_for_cookies, top_frame_origin, status, std::move(callback)); } else { std::move(callback).Run(false); } @@ -145,12 +112,14 @@ 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, std::move(callback)); + underlying_restricted_cookie_manager_->SetCookieFromString(url, site_for_cookies, top_frame_origin, cookie, + partitioned_cookies_runtime_feature_enabled, std::move(callback)); } else { std::move(callback).Run(); } @@ -159,12 +128,14 @@ 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, std::move(callback)); + underlying_restricted_cookie_manager_->GetCookiesString(url, site_for_cookies, top_frame_origin, + partitioned_cookies_runtime_feature_enabled, std::move(callback)); } else { std::move(callback).Run(""); } diff --git a/src/core/net/proxying_restricted_cookie_manager_qt.h b/src/core/net/proxying_restricted_cookie_manager_qt.h index 37271dfd3..7ac6807ac 100644 --- a/src/core/net/proxying_restricted_cookie_manager_qt.h +++ b/src/core/net/proxying_restricted_cookie_manager_qt.h @@ -1,46 +1,9 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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) 2019 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 #ifndef PROXYING_RESTRICTED_COOKIE_MANAGER_QT_H #define PROXYING_RESTRICTED_COOKIE_MANAGER_QT_H -#include "base/macros.h" #include "base/memory/weak_ptr.h" #include "mojo/public/cpp/bindings/remote.h" #include "services/network/public/mojom/restricted_cookie_manager.mojom.h" @@ -65,11 +28,13 @@ 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, const net::SiteForCookies &site_for_cookies, const url::Origin &top_frame_origin, + net::CookieInclusionStatus status, SetCanonicalCookieCallback callback) override; void AddChangeListener(const GURL &url, const net::SiteForCookies &site_for_cookies, @@ -80,10 +45,12 @@ 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, @@ -106,8 +73,6 @@ private: mojo::Remote<network::mojom::RestrictedCookieManager> underlying_restricted_cookie_manager_; base::WeakPtrFactory<ProxyingRestrictedCookieManagerQt> weak_factory_; - - DISALLOW_COPY_AND_ASSIGN(ProxyingRestrictedCookieManagerQt); }; } // namespace QtWebEngineCore diff --git a/src/core/net/proxying_url_loader_factory_qt.cpp b/src/core/net/proxying_url_loader_factory_qt.cpp index ba2051d60..a4713150b 100644 --- a/src/core/net/proxying_url_loader_factory_qt.cpp +++ b/src/core/net/proxying_url_loader_factory_qt.cpp @@ -1,56 +1,19 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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) 2019 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 "proxying_url_loader_factory_qt.h" #include <utility> #include "base/bind.h" -#include "base/task/post_task.h" #include "content/browser/web_contents/web_contents_impl.h" -#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/web_contents.h" #include "content/public/common/content_switches.h" #include "net/base/filename_util.h" #include "net/http/http_status_code.h" #include "services/network/public/cpp/cors/cors.h" +#include "services/network/public/cpp/resource_request.h" #include "services/network/public/mojom/early_hints.mojom.h" #include "third_party/blink/public/mojom/loader/resource_load_info.mojom-shared.h" #include "url/url_util.h" @@ -62,8 +25,6 @@ #include "web_contents_adapter_client.h" #include "web_contents_view_qt.h" -#include <QVariant> - // originally based on aw_proxying_url_loader_factory.cc: // Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be @@ -125,7 +86,7 @@ public: void Restart(); // network::mojom::URLLoaderClient - void OnReceiveResponse(network::mojom::URLResponseHeadPtr head) override; + void OnReceiveResponse(network::mojom::URLResponseHeadPtr head, mojo::ScopedDataPipeConsumerHandle) override; void OnReceiveRedirect(const net::RedirectInfo &redirect_info, network::mojom::URLResponseHeadPtr head) override; void OnUploadProgress(int64_t current_position, int64_t total_size, OnUploadProgressCallback callback) override; void OnReceiveCachedMetadata(mojo_base::BigBuffer data) override; @@ -195,7 +156,6 @@ private: mojo::Remote<network::mojom::URLLoaderFactory> target_factory_; base::WeakPtrFactory<InterceptedRequest> weak_factory_; - DISALLOW_COPY_AND_ASSIGN(InterceptedRequest); }; InterceptedRequest::InterceptedRequest(ProfileAdapter *profile_adapter, @@ -416,11 +376,11 @@ void InterceptedRequest::ContinueAfterIntercept() // URLLoaderClient methods. -void InterceptedRequest::OnReceiveResponse(network::mojom::URLResponseHeadPtr head) +void InterceptedRequest::OnReceiveResponse(network::mojom::URLResponseHeadPtr head, mojo::ScopedDataPipeConsumerHandle handle) { current_response_ = head.Clone(); - target_client_->OnReceiveResponse(std::move(head)); + target_client_->OnReceiveResponse(std::move(head), std::move(handle)); } void InterceptedRequest::OnReceiveRedirect(const net::RedirectInfo &redirect_info, network::mojom::URLResponseHeadPtr head) diff --git a/src/core/net/proxying_url_loader_factory_qt.h b/src/core/net/proxying_url_loader_factory_qt.h index ae8e41eaf..904a40c2d 100644 --- a/src/core/net/proxying_url_loader_factory_qt.h +++ b/src/core/net/proxying_url_loader_factory_qt.h @@ -1,51 +1,12 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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) 2019 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 #ifndef PROXYING_URL_LOADER_FACTORY_QT_H_ #define PROXYING_URL_LOADER_FACTORY_QT_H_ -#include "base/callback.h" -#include "base/macros.h" #include "base/memory/weak_ptr.h" #include "mojo/public/cpp/bindings/receiver_set.h" #include "net/traffic_annotation/network_traffic_annotation.h" -#include "services/network/public/cpp/resource_request.h" #include "services/network/public/mojom/url_loader.mojom.h" #include "services/network/public/mojom/url_loader_factory.mojom.h" @@ -55,6 +16,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +namespace network { +struct ResourceRequest; +} + namespace QtWebEngineCore { class ProfileAdapter; @@ -85,8 +50,6 @@ private: mojo::ReceiverSet<network::mojom::URLLoaderFactory> m_proxyReceivers; mojo::Remote<network::mojom::URLLoaderFactory> m_targetFactory; base::WeakPtrFactory<ProxyingURLLoaderFactoryQt> m_weakFactory; - - DISALLOW_COPY_AND_ASSIGN(ProxyingURLLoaderFactoryQt); }; } // namespace QtWebEngineCore diff --git a/src/core/net/qrc_url_scheme_handler.cpp b/src/core/net/qrc_url_scheme_handler.cpp index 73bf24f1d..ab66acac0 100644 --- a/src/core/net/qrc_url_scheme_handler.cpp +++ b/src/core/net/qrc_url_scheme_handler.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 "qrc_url_scheme_handler.h" @@ -67,7 +31,10 @@ void QrcUrlSchemeHandler::requestStarted(QWebEngineUrlRequestJob *job) QFileInfo fileInfo(*file); QMimeDatabase mimeDatabase; QMimeType mimeType = mimeDatabase.mimeTypeForFile(fileInfo); - job->reply(mimeType.name().toUtf8(), file.take()); + if (mimeType.name() == QStringLiteral("application/x-extension-html")) + job->reply("text/html", file.take()); + else + job->reply(mimeType.name().toUtf8(), file.take()); } } // namespace QtWebEngineCore diff --git a/src/core/net/qrc_url_scheme_handler.h b/src/core/net/qrc_url_scheme_handler.h index 586147cdf..96155b05b 100644 --- a/src/core/net/qrc_url_scheme_handler.h +++ b/src/core/net/qrc_url_scheme_handler.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 #ifndef QRC_URL_SCHEME_HANDLER_H #define QRC_URL_SCHEME_HANDLER_H diff --git a/src/core/net/ssl_host_state_delegate_qt.cpp b/src/core/net/ssl_host_state_delegate_qt.cpp index ba2f46342..2c64132f3 100644 --- a/src/core/net/ssl_host_state_delegate_qt.cpp +++ b/src/core/net/ssl_host_state_delegate_qt.cpp @@ -1,47 +1,9 @@ -/**************************************************************************** -** -** 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 "base/callback.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 "ssl_host_state_delegate_qt.h" -#include "type_conversion.h" +#include "base/callback.h" namespace QtWebEngineCore { diff --git a/src/core/net/ssl_host_state_delegate_qt.h b/src/core/net/ssl_host_state_delegate_qt.h index 96eac63e7..ff25a0587 100644 --- a/src/core/net/ssl_host_state_delegate_qt.h +++ b/src/core/net/ssl_host_state_delegate_qt.h @@ -1,47 +1,13 @@ -/**************************************************************************** -** -** 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 #ifndef SSL_HOST_STATE_DELEGATE_QT_H #define SSL_HOST_STATE_DELEGATE_QT_H #include "content/public/browser/ssl_host_state_delegate.h" -#include "profile_adapter.h" + +#include <map> +#include <string> namespace QtWebEngineCore { diff --git a/src/core/net/system_network_context_manager.cpp b/src/core/net/system_network_context_manager.cpp index f6e7cb630..3ee06b7c9 100644 --- a/src/core/net/system_network_context_manager.cpp +++ b/src/core/net/system_network_context_manager.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 // based on chrome/browser/net/system_network_context_manager.cc: // Copyright 2017 The Chromium Authors. All rights reserved. @@ -73,9 +37,8 @@ SystemNetworkContextManager *g_system_network_context_manager = nullptr; network::mojom::HttpAuthStaticParamsPtr CreateHttpAuthStaticParams() { - network::mojom::HttpAuthStaticParamsPtr auth_static_params = network::mojom::HttpAuthStaticParams::New(); - - auth_static_params->supported_schemes = { "basic", "digest", "ntlm", "negotiate" }; + network::mojom::HttpAuthStaticParamsPtr auth_static_params = + network::mojom::HttpAuthStaticParams::New(); return auth_static_params; } @@ -84,6 +47,8 @@ network::mojom::HttpAuthDynamicParamsPtr CreateHttpAuthDynamicParams() { network::mojom::HttpAuthDynamicParamsPtr auth_dynamic_params = network::mojom::HttpAuthDynamicParams::New(); + auth_dynamic_params->allowed_schemes = { "basic", "digest", "ntlm", "negotiate" }; + auto *command_line = base::CommandLine::ForCurrentProcess(); auth_dynamic_params->server_allowlist = command_line->GetSwitchValueASCII(switches::kAuthServerAllowlist); // auth_dynamic_params->delegate_allowlist = command_line->GetSwitchValueASCII(switches::kAuthNegotiateDelegateWhitelist); @@ -143,8 +108,6 @@ private: SEQUENCE_CHECKER(sequence_checker_); SystemNetworkContextManager *manager_; - - DISALLOW_COPY_AND_ASSIGN(URLLoaderFactoryForSystem); }; network::mojom::NetworkContext *SystemNetworkContextManager::GetContext() @@ -224,27 +187,39 @@ void SystemNetworkContextManager::OnNetworkServiceCreated(network::mojom::Networ network_service->ConfigureHttpAuthPrefs(CreateHttpAuthDynamicParams()); // Configure the Certificate Transparency logs. - std::vector<std::pair<std::string, base::TimeDelta>> disqualified_logs = + std::vector<std::pair<std::string, base::Time>> disqualified_logs = certificate_transparency::GetDisqualifiedLogs(); std::vector<network::mojom::CTLogInfoPtr> log_list_mojo; for (const auto &ct_log : certificate_transparency::GetKnownLogs()) { network::mojom::CTLogInfoPtr log_info = network::mojom::CTLogInfo::New(); log_info->public_key = std::string(ct_log.log_key, ct_log.log_key_length); + log_info->id = crypto::SHA256HashString(log_info->public_key); log_info->name = ct_log.log_name; + log_info->current_operator = ct_log.current_operator; - std::string log_id = crypto::SHA256HashString(log_info->public_key); auto it = std::lower_bound( - std::begin(disqualified_logs), std::end(disqualified_logs), log_id, + std::begin(disqualified_logs), std::end(disqualified_logs), log_info->id, [](const auto& disqualified_log, const std::string& log_id) { return disqualified_log.first < log_id; }); - if (it != std::end(disqualified_logs) && it->first == log_id) + if (it != std::end(disqualified_logs) && it->first == log_info->id) log_info->disqualified_at = it->second; + + for (size_t i = 0; i < ct_log.previous_operators_length; i++) { + const auto& op = ct_log.previous_operators[i]; + network::mojom::PreviousOperatorEntryPtr previous_operator = + network::mojom::PreviousOperatorEntry::New(); + previous_operator->name = op.name; + previous_operator->end_time = op.end_time; + log_info->previous_operators.push_back(std::move(previous_operator)); + } + log_list_mojo.push_back(std::move(log_info)); } network_service->UpdateCtLogList( - std::move(log_list_mojo), - certificate_transparency::GetLogListTimestamp()); + std::move(log_list_mojo), + certificate_transparency::GetLogListTimestamp(), + base::DoNothing()); // The system NetworkContext is created first network_service_network_context_.reset(); @@ -317,17 +292,10 @@ network::mojom::NetworkContextParamsPtr SystemNetworkContextManager::CreateNetwo cert_verifier_creation_params = cert_verifier::mojom::CertVerifierCreationParams::New(); ConfigureDefaultNetworkContextParams(network_context_params.get(), cert_verifier_creation_params.get()); - network_context_params->context_name = std::string("system"); - network_context_params->enable_referrers = false; network_context_params->http_cache_enabled = false; - // These are needed for PAC scripts that use FTP URLs. -#if !BUILDFLAG(DISABLE_FTP_SUPPORT) - network_context_params->enable_ftp_url_support = true; -#endif - proxy_config_monitor_.AddToNetworkContextParams(network_context_params.get()); network_context_params->cert_verifier_params = diff --git a/src/core/net/system_network_context_manager.h b/src/core/net/system_network_context_manager.h index 0078d710a..fa761cb44 100644 --- a/src/core/net/system_network_context_manager.h +++ b/src/core/net/system_network_context_manager.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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) 2019 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 // based on chrome/browser/net/system_network_context_manager.h: // Copyright 2017 The Chromium Authors. All rights reserved. @@ -47,7 +11,6 @@ #include <memory> -#include "base/macros.h" #include "services/network/public/mojom/network_context.mojom.h" #include "services/network/public/mojom/network_service.mojom-forward.h" #include "services/network/public/mojom/url_loader_factory.mojom.h" @@ -149,8 +112,6 @@ private: mojo::Remote<network::mojom::URLLoaderFactory> url_loader_factory_; ProxyConfigMonitor proxy_config_monitor_; - - DISALLOW_COPY_AND_ASSIGN(SystemNetworkContextManager); }; #endif // SYSTEM_NETWORK_CONTEXT_MANAGER_H_ diff --git a/src/core/net/url_request_custom_job_delegate.cpp b/src/core/net/url_request_custom_job_delegate.cpp index ff307bede..d05b7d5a0 100644 --- a/src/core/net/url_request_custom_job_delegate.cpp +++ b/src/core/net/url_request_custom_job_delegate.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 "url_request_custom_job_delegate.h" #include "url_request_custom_job_proxy.h" diff --git a/src/core/net/url_request_custom_job_delegate.h b/src/core/net/url_request_custom_job_delegate.h index 93ae39e84..7b0d6538c 100644 --- a/src/core/net/url_request_custom_job_delegate.h +++ b/src/core/net/url_request_custom_job_delegate.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 // // W A R N I N G diff --git a/src/core/net/url_request_custom_job_proxy.cpp b/src/core/net/url_request_custom_job_proxy.cpp index 65d652a1c..45372f020 100644 --- a/src/core/net/url_request_custom_job_proxy.cpp +++ b/src/core/net/url_request_custom_job_proxy.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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) 2017 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 "url_request_custom_job_proxy.h" #include "url_request_custom_job_delegate.h" diff --git a/src/core/net/url_request_custom_job_proxy.h b/src/core/net/url_request_custom_job_proxy.h index 1d9eebb24..3795f7f14 100644 --- a/src/core/net/url_request_custom_job_proxy.h +++ b/src/core/net/url_request_custom_job_proxy.h @@ -1,47 +1,11 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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) 2017 Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef URL_REQUEST_CUSTOM_JOB_PROXY_H_ #define URL_REQUEST_CUSTOM_JOB_PROXY_H_ #include "base/memory/weak_ptr.h" -#include "base/sequenced_task_runner.h" +#include "base/task/sequenced_task_runner.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "url/gurl.h" #include "url/origin.h" diff --git a/src/core/net/webui_controller_factory_qt.cpp b/src/core/net/webui_controller_factory_qt.cpp index 4c39ac030..68bbb42fa 100644 --- a/src/core/net/webui_controller_factory_qt.cpp +++ b/src/core/net/webui_controller_factory_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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) 2017 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 // Based on chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc: // Copyright (c) 2012 The Chromium Authors. All rights reserved. @@ -53,18 +17,16 @@ #include "chrome/browser/ui/webui/device_log_ui.h" #include "chrome/browser/ui/webui/devtools_ui.h" #include "chrome/browser/ui/webui/net_internals/net_internals_ui.h" -#include "chrome/browser/ui/webui/quota_internals/quota_internals_ui.h" #include "chrome/browser/ui/webui/user_actions/user_actions_ui.h" #include "chrome/common/url_constants.h" #include "content/public/browser/web_ui.h" #include "content/public/common/url_utils.h" #include "extensions/buildflags/buildflags.h" #include "media/media_buildflags.h" -#include "ppapi/buildflags/buildflags.h" #include "printing/buildflags/buildflags.h" #include "url/gurl.h" -#if defined(OS_LINUX) || defined(OS_ANDROID) +#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) #include "chrome/browser/ui/webui/sandbox/sandbox_internals_ui.h" #endif @@ -130,9 +92,6 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI *web_ui, Profile *profile, co if (url.host() == chrome::kChromeUINetInternalsHost) return &NewWebUI<NetInternalsUI>; - if (url.host() == chrome::kChromeUIQuotaInternalsHost) - return &NewWebUI<QuotaInternalsUI>; - if (url.SchemeIs(content::kChromeDevToolsScheme)) { // if (!DevToolsUIBindings::IsValidFrontendURL(url)) // return nullptr; @@ -168,7 +127,7 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI *web_ui, Profile *profile, co if (url.host_piece() == chrome::kChromeUIWebRtcLogsHost) return &NewWebUI<WebRtcLogsUI>; #endif -#if defined(OS_LINUX) || defined(OS_ANDROID) +#if BUILDFLAG(IS_LINUX) // Consider enabling for BUILDFLAG(IS_WIN) if (url.host_piece() == chrome::kChromeUISandboxHost) return &NewWebUI<SandboxInternalsUI>; #endif diff --git a/src/core/net/webui_controller_factory_qt.h b/src/core/net/webui_controller_factory_qt.h index b5f01a504..22219dd5a 100644 --- a/src/core/net/webui_controller_factory_qt.h +++ b/src/core/net/webui_controller_factory_qt.h @@ -1,46 +1,9 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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) 2017 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 #ifndef WEB_UI_CONTROLLER_FACTORY_QT_H_ #define WEB_UI_CONTROLLER_FACTORY_QT_H_ -#include "base/macros.h" #include "base/memory/singleton.h" #include "content/public/browser/web_ui.h" #include "content/public/browser/web_ui_controller_factory.h" @@ -62,8 +25,6 @@ protected: private: friend struct base::DefaultSingletonTraits<WebUIControllerFactoryQt>; - - DISALLOW_COPY_AND_ASSIGN(WebUIControllerFactoryQt); }; } // namespace QtWebEngineCore diff --git a/src/core/ozone/gl_context_qt.cpp b/src/core/ozone/gl_context_qt.cpp index 8f9093a4e..75f8e8422 100644 --- a/src/core/ozone/gl_context_qt.cpp +++ b/src/core/ozone/gl_context_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 "gl_context_qt.h" @@ -47,7 +11,7 @@ #include "ui/gl/gl_context_egl.h" #include "ui/gl/gl_implementation.h" -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) #include "ui/gl/gl_context_wgl.h" #endif @@ -130,7 +94,7 @@ void* GLContextHelper::getGlXConfig() void* GLContextHelper::getEGLDisplay() { -#ifdef Q_OS_WIN +#if BUILDFLAG(IS_WIN) // Windows QPA plugin does not implement resourceForIntegration for "egldisplay". // Use resourceForContext instead. return resourceForContext(QByteArrayLiteral("egldisplay")); @@ -201,7 +165,7 @@ bool GLContextHelper::isCreateContextRobustnessSupported() QT_END_NAMESPACE -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) namespace gl { namespace init { @@ -228,4 +192,4 @@ scoped_refptr<GLContext> CreateGLContext(GLShareGroup* share_group, } // namespace init } // namespace gl -#endif // defined(OS_WIN) +#endif // BUILDFLAG(IS_WIN) diff --git a/src/core/ozone/gl_context_qt.h b/src/core/ozone/gl_context_qt.h index 612aae3f5..f3ec219e6 100644 --- a/src/core/ozone/gl_context_qt.h +++ b/src/core/ozone/gl_context_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef GL_GL_CONTEXT_QT_H_ #define GL_GL_CONTEXT_QT_H_ diff --git a/src/core/ozone/gl_ozone_egl_qt.cpp b/src/core/ozone/gl_ozone_egl_qt.cpp index 2071dcf81..02c3666b4 100644 --- a/src/core/ozone/gl_ozone_egl_qt.cpp +++ b/src/core/ozone/gl_ozone_egl_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #if defined(USE_OZONE) #include "gl_context_qt.h" diff --git a/src/core/ozone/gl_ozone_egl_qt.h b/src/core/ozone/gl_ozone_egl_qt.h index c2515a416..089e6ba17 100644 --- a/src/core/ozone/gl_ozone_egl_qt.h +++ b/src/core/ozone/gl_ozone_egl_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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) 2017 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 #ifndef GL_OZONE_EGL_QT #define GL_OZONE_EGL_QT diff --git a/src/core/ozone/gl_ozone_glx_qt.cpp b/src/core/ozone/gl_ozone_glx_qt.cpp index 19c24dcb6..4c4822944 100644 --- a/src/core/ozone/gl_ozone_glx_qt.cpp +++ b/src/core/ozone/gl_ozone_glx_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 // Copyright 2016 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be diff --git a/src/core/ozone/gl_ozone_glx_qt.h b/src/core/ozone/gl_ozone_glx_qt.h index 997142842..77d639a88 100644 --- a/src/core/ozone/gl_ozone_glx_qt.h +++ b/src/core/ozone/gl_ozone_glx_qt.h @@ -1,46 +1,9 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 #ifndef UI_OZONE_GLX_QT_H_ #define UI_OZONE_GLX_QT_H_ -#include "base/macros.h" #include "ui/gl/gl_implementation.h" #include "ui/ozone/public/gl_ozone.h" @@ -75,9 +38,6 @@ public: scoped_refptr<gl::GLSurface> CreateOffscreenGLSurface( const gfx::Size& size) override; - -private: - DISALLOW_COPY_AND_ASSIGN(GLOzoneGLXQt); }; } // namespace ui diff --git a/src/core/ozone/gl_share_context_qt.cpp b/src/core/ozone/gl_share_context_qt.cpp index 2eb34e86a..02fc02e5d 100644 --- a/src/core/ozone/gl_share_context_qt.cpp +++ b/src/core/ozone/gl_share_context_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 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) 2020 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 "gl_share_context_qt.h" #include <QtGui/qtgui-config.h> diff --git a/src/core/ozone/gl_share_context_qt.h b/src/core/ozone/gl_share_context_qt.h index b07f5123e..ba66b222c 100644 --- a/src/core/ozone/gl_share_context_qt.h +++ b/src/core/ozone/gl_share_context_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 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) 2020 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 #ifndef GL_SHARE_CONTEXT_QT #define GL_SHARE_CONTEXT_QT diff --git a/src/core/ozone/gl_surface_egl_qt.cpp b/src/core/ozone/gl_surface_egl_qt.cpp index 52ab53c38..bd9ec060e 100644 --- a/src/core/ozone/gl_surface_egl_qt.cpp +++ b/src/core/ozone/gl_surface_egl_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be @@ -44,9 +8,10 @@ #include "gl_context_qt.h" #include "ozone/gl_surface_egl_qt.h" -#if !defined(OS_MAC) +#if !BUILDFLAG(IS_MAC) #include "ui/gl/egl_util.h" #include "ui/gl/gl_bindings.h" +#include "ui/gl/gl_display.h" #include "ui/gl/gl_surface_egl.h" #include "ui/gl/init/gl_factory.h" @@ -67,7 +32,7 @@ bool GLSurfaceEGL::InitializeExtensionSettingsOneOff() EGLDisplay GLSurfaceEGL::GetHardwareDisplay() { - return static_cast<EGLDisplay>(GLSurfaceQt::g_display); + return GLSurfaceQt::g_display ? static_cast<EGLDisplay>(GLSurfaceQt::g_display->GetDisplay()) : EGL_NO_DISPLAY; } bool GLSurfaceEGL::IsCreateContextRobustnessSupported() @@ -138,6 +103,21 @@ bool GLSurfaceEGL::IsRobustnessVideoMemoryPurgeSupported() return false; } +bool GLSurfaceEGL::IsANGLEContextVirtualizationSupported() +{ + return false; +} + +bool GLSurfaceEGL::IsANGLEVulkanImageSupported() +{ + return false; +} + +bool GLSurfaceEGL::IsEGLQueryDeviceSupported() +{ + return false; +} + void GLSurfaceEGL::ShutdownOneOff() { } @@ -162,11 +142,16 @@ bool GLSurfaceEGL::HasEGLExtension(const char *name) return ExtensionsContain(GetEGLExtensions(), name); } -bool GLSurfaceEGL::InitializeOneOff(gl::EGLDisplayPlatform /*native_display*/) +bool GLSurfaceEGL::InitializeOneOff(gl::EGLDisplayPlatform /*native_display*/, uint64_t) { return GLSurfaceEGLQt::InitializeOneOff(); } +bool GLSurfaceEGL::IsEGLNoConfigContextSupported() +{ + return false; +} + bool GLSurfaceEGL::IsAndroidNativeFenceSyncSupported() { return false; @@ -204,8 +189,10 @@ bool GLSurfaceEGLQt::InitializeOneOff() // Must be called before initializing the display. g_driver_egl.InitializeClientExtensionBindings(); - g_display = GLContextHelper::getEGLDisplay(); - if (!g_display) { + auto *egl_display = new GLDisplayEGL(); + g_display = egl_display; + egl_display->SetDisplay(GLContextHelper::getEGLDisplay()); + if (!g_display->GetDisplay()) { LOG(ERROR) << "GLContextHelper::getEGLDisplay() failed."; return false; } @@ -216,13 +203,13 @@ bool GLSurfaceEGLQt::InitializeOneOff() return false; } - if (!eglInitialize(g_display, NULL, NULL)) { + if (!eglInitialize(g_display->GetDisplay(), NULL, NULL)) { LOG(ERROR) << "eglInitialize failed with error " << GetLastEGLErrorString(); return false; } g_client_extensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS); - g_extensions = eglQueryString(g_display, EGL_EXTENSIONS); + g_extensions = eglQueryString(g_display->GetDisplay(), EGL_EXTENSIONS); g_egl_surfaceless_context_supported = ExtensionsContain(g_extensions.c_str(), "EGL_KHR_surfaceless_context"); if (g_egl_surfaceless_context_supported) { scoped_refptr<GLSurface> surface = new GLSurfacelessQtEGL(gfx::Size(1, 1)); @@ -258,7 +245,7 @@ bool GLSurfaceEGLQt::Initialize(GLSurfaceFormat format) Q_ASSERT(!m_surfaceBuffer); m_format = format; - EGLDisplay display = g_display; + EGLDisplay display = g_display->GetDisplay(); if (!display) { LOG(ERROR) << "Trying to create surface with invalid display."; return false; @@ -286,7 +273,7 @@ bool GLSurfaceEGLQt::Initialize(GLSurfaceFormat format) void GLSurfaceEGLQt::Destroy() { if (m_surfaceBuffer) { - if (!eglDestroySurface(g_display, m_surfaceBuffer)) + if (!eglDestroySurface(g_display->GetDisplay(), m_surfaceBuffer)) LOG(ERROR) << "eglDestroySurface failed with error " << GetLastEGLErrorString(); m_surfaceBuffer = 0; @@ -383,4 +370,4 @@ std::string DriverEGL::GetPlatformExtensions() return ""; } } // namespace gl -#endif // !defined(OS_MAC) +#endif // !BUILDFLAG(IS_MAC) diff --git a/src/core/ozone/gl_surface_egl_qt.h b/src/core/ozone/gl_surface_egl_qt.h index dff25e433..8a799b847 100644 --- a/src/core/ozone/gl_surface_egl_qt.h +++ b/src/core/ozone/gl_surface_egl_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 #ifndef GL_SURFACE_EGL_QT_H_ #define GL_SURFACE_EGL_QT_H_ @@ -69,7 +33,6 @@ public: private: EGLSurface m_surfaceBuffer; static bool s_initialized; - DISALLOW_COPY_AND_ASSIGN(GLSurfaceEGLQt); }; // The following comment is cited from chromium/ui/gl/gl_surface_egl.cc: @@ -89,9 +52,6 @@ public: const gfx::ColorSpace &color_space, bool has_alpha) override; EGLSurface GetHandle() override; void* GetShareHandle() override; - -private: - DISALLOW_COPY_AND_ASSIGN(GLSurfacelessQtEGL); }; } diff --git a/src/core/ozone/gl_surface_glx_qt.cpp b/src/core/ozone/gl_surface_glx_qt.cpp index 79a084941..f97f3de1e 100644 --- a/src/core/ozone/gl_surface_glx_qt.cpp +++ b/src/core/ozone/gl_surface_glx_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be @@ -44,6 +8,7 @@ #include "gl_context_qt.h" #include "ozone/gl_surface_glx_qt.h" #include "ui/gl/gl_bindings.h" +#include "ui/gl/gl_display.h" #include "ui/gl/gl_surface_glx.h" namespace gl { @@ -126,8 +91,8 @@ bool GLSurfaceGLXQt::InitializeOneOff() if (s_initialized) return true; - g_display = GLContextHelper::getXDisplay(); - if (!g_display) { + g_display = new GLDisplayX11(); + if (!g_display->GetDisplay()) { LOG(ERROR) << "GLContextHelper::getXDisplay() failed."; return false; } @@ -138,7 +103,7 @@ bool GLSurfaceGLXQt::InitializeOneOff() return false; } - Display* display = static_cast<Display*>(g_display); + Display* display = static_cast<Display*>(g_display->GetDisplay()); int major, minor; if (!glXQueryVersion(display, &major, &minor)) { LOG(ERROR) << "glxQueryVersion failed."; @@ -160,7 +125,7 @@ bool GLSurfaceGLXQt::InitializeExtensionSettingsOneOff() if (!s_initialized) return false; - Display* display = static_cast<Display*>(g_display); + Display* display = static_cast<Display*>(g_display->GetDisplay()); GLSurfaceQt::g_extensions = glXQueryExtensionsString(display, 0); g_driver_glx.InitializeExtensionBindings(g_extensions.c_str()); return true; @@ -175,7 +140,7 @@ bool GLSurfaceGLXQt::Initialize(GLSurfaceFormat format) { Q_ASSERT(!m_surfaceBuffer); - Display* display = static_cast<Display*>(g_display); + Display* display = static_cast<Display*>(g_display->GetDisplay()); const int pbuffer_attributes[] = { GLX_PBUFFER_WIDTH, m_size.width(), GLX_PBUFFER_HEIGHT, m_size.height(), @@ -198,7 +163,7 @@ bool GLSurfaceGLXQt::Initialize(GLSurfaceFormat format) void GLSurfaceGLXQt::Destroy() { if (m_surfaceBuffer) { - glXDestroyPbuffer(static_cast<Display*>(g_display), m_surfaceBuffer); + glXDestroyPbuffer(static_cast<Display*>(g_display->GetDisplay()), m_surfaceBuffer); m_surfaceBuffer = 0; } } diff --git a/src/core/ozone/gl_surface_glx_qt.h b/src/core/ozone/gl_surface_glx_qt.h index fb17c5aca..6312f6b74 100644 --- a/src/core/ozone/gl_surface_glx_qt.h +++ b/src/core/ozone/gl_surface_glx_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 #ifndef GL_SURFACE_GLX_QT_H_ #define GL_SURFACE_GLX_QT_H_ @@ -61,7 +25,6 @@ protected: private: static bool s_initialized; int m_surfaceBuffer; - DISALLOW_COPY_AND_ASSIGN(GLSurfaceGLXQt); }; } diff --git a/src/core/ozone/gl_surface_qt.cpp b/src/core/ozone/gl_surface_qt.cpp index 9bf16c960..0d7f686e8 100644 --- a/src/core/ozone/gl_surface_qt.cpp +++ b/src/core/ozone/gl_surface_qt.cpp @@ -1,54 +1,19 @@ -/**************************************************************************** -** -** 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE.Chromium file. -#if !defined(OS_MAC) +#include "qtwebenginecoreglobal_p.h" + +#if !defined(Q_OS_MACOS) #include "gl_surface_qt.h" -#include "qtwebenginecoreglobal_p.h" #include "base/logging.h" -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) #include "web_engine_context.h" #include "ozone/gl_surface_wgl_qt.h" #include "ozone/gl_surface_egl_qt.h" @@ -62,7 +27,7 @@ namespace gl { -void *GLSurfaceQt::g_display = nullptr; +GLDisplay *GLSurfaceQt::g_display = nullptr; void *GLSurfaceQt::g_config = nullptr; std::string GLSurfaceQt::g_client_extensions; std::string GLSurfaceQt::g_extensions; @@ -111,7 +76,7 @@ GLSurfaceFormat GLSurfaceQt::GetFormat() return m_format; } -void* GLSurfaceQt::GetDisplay() +GLDisplay *GLSurfaceQt::GetGLDisplay() { return g_display; } @@ -121,16 +86,16 @@ void* GLSurfaceQt::GetConfig() return g_config; } -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) namespace init { -bool InitializeGLOneOffPlatform() +bool InitializeGLOneOffPlatform(uint64_t system_device_id) { VSyncProviderWin::InitializeOneOff(); if (GetGLImplementation() == kGLImplementationEGLGLES2 || GetGLImplementation() == kGLImplementationEGLANGLE) return GLSurfaceEGLQt::InitializeOneOff(); - if (GetGLImplementation() == kGLImplementationDesktopGL) + if (GetGLImplementation() == kGLImplementationDesktopGL || GetGLImplementation() == kGLImplementationDesktopGLCoreProfile) return GLSurfaceWGLQt::InitializeOneOff(); return false; @@ -138,7 +103,11 @@ bool InitializeGLOneOffPlatform() bool usingSoftwareDynamicGL() { +#if QT_CONFIG(opengl) return QtWebEngineCore::usingSoftwareDynamicGL(); +#else + return false; +#endif // QT_CONFIG(opengl) } scoped_refptr<GLSurface> @@ -187,10 +156,10 @@ CreateViewGLSurface(gfx::AcceleratedWidget window) } } // namespace init -#endif // defined(OS_WIN) +#endif // BUILDFLAG(IS_WIN) } // namespace gl -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) namespace gpu { class GpuCommandBufferStub; class GpuChannelManager; @@ -242,6 +211,11 @@ void DirectCompositionSurfaceWin::DisableDecodeSwapChain() void DirectCompositionSurfaceWin::DisableSoftwareOverlays() { } + +void DirectCompositionSurfaceWin::ShutdownOneOff() +{ +} + } // namespace gl -#endif -#endif // !defined(OS_MAC) +#endif // BUILDFLAG(IS_WIN) +#endif // !defined(Q_OS_MACOS) diff --git a/src/core/ozone/gl_surface_qt.h b/src/core/ozone/gl_surface_qt.h index 8689c3a19..f9d18a0ae 100644 --- a/src/core/ozone/gl_surface_qt.h +++ b/src/core/ozone/gl_surface_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef GL_SURFACE_QT_H_ #define GL_SURFACE_QT_H_ @@ -54,7 +18,7 @@ public: static bool HasEGLExtension(const char* name); // Implement GLSurface. - void *GetDisplay() override; + GLDisplay *GetGLDisplay() override; void *GetConfig() override; bool IsOffscreen() override; gfx::SwapResult SwapBuffers(PresentationCallback callback) override; @@ -70,14 +34,11 @@ protected: public: static void* g_config; - static void* g_display; + static GLDisplay *g_display; static std::string g_extensions; static std::string g_client_extensions; - -private: - DISALLOW_COPY_AND_ASSIGN(GLSurfaceQt); }; -} +} // namespace gl -#endif +#endif // GL_SURFACE_QT_H_ diff --git a/src/core/ozone/gl_surface_wgl_qt.cpp b/src/core/ozone/gl_surface_wgl_qt.cpp index ac27a9c20..57493c14a 100644 --- a/src/core/ozone/gl_surface_wgl_qt.cpp +++ b/src/core/ozone/gl_surface_wgl_qt.cpp @@ -1,45 +1,9 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 "gl_surface_wgl_qt.h" -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) #include "ui/gl/gl_surface_wgl.h" namespace gl { @@ -77,9 +41,9 @@ void *GLSurfaceWGLQt::GetHandle() return m_surfaceBuffer->GetHandle(); } -void *GLSurfaceWGLQt::GetDisplay() +GLDisplay *GLSurfaceWGLQt::GetGLDisplay() { - return m_surfaceBuffer->GetDisplay(); + return m_surfaceBuffer->GetGLDisplay(); } void *GLSurfaceWGLQt::GetConfig() @@ -89,4 +53,4 @@ void *GLSurfaceWGLQt::GetConfig() } //namespace gl -#endif // defined(OS_WIN) +#endif // BUILDFLAG(IS_WIN) diff --git a/src/core/ozone/gl_surface_wgl_qt.h b/src/core/ozone/gl_surface_wgl_qt.h index 2b562b61b..e1a1253bb 100644 --- a/src/core/ozone/gl_surface_wgl_qt.h +++ b/src/core/ozone/gl_surface_wgl_qt.h @@ -1,48 +1,12 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 #ifndef GL_SURFACE_WGL_QT_H #define GL_SURFACE_WGL_QT_H #include "gl_surface_qt.h" -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) namespace gl { @@ -57,7 +21,7 @@ public: bool Initialize(GLSurfaceFormat format) override; void Destroy() override; void *GetHandle() override; - void *GetDisplay() override; + GLDisplay *GetGLDisplay() override; void *GetConfig() override; protected: @@ -65,10 +29,9 @@ protected: private: scoped_refptr<PbufferGLSurfaceWGL> m_surfaceBuffer; - DISALLOW_COPY_AND_ASSIGN(GLSurfaceWGLQt); }; } -#endif // defined(OS_WIN) +#endif // BUILDFLAG(IS_WIN) #endif // GL_SURFACE_WGL_QT_H diff --git a/src/core/ozone/ozone_platform_qt.cpp b/src/core/ozone/ozone_platform_qt.cpp index b7fd93737..8ab3aa1a7 100644 --- a/src/core/ozone/ozone_platform_qt.cpp +++ b/src/core/ozone/ozone_platform_qt.cpp @@ -1,51 +1,15 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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) 2017 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 "ozone_platform_qt.h" #if defined(USE_OZONE) #include "ui/base/buildflags.h" -#include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h" #include "ui/base/ime/input_method.h" #include "ui/display/types/native_display_delegate.h" #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h" #include "ui/events/ozone/layout/stub/stub_keyboard_layout_engine.h" +#include "ui/ozone/common/bitmap_cursor_factory.h" #include "ui/ozone/common/stub_client_native_pixmap_factory.h" #include "ui/ozone/common/stub_overlay_manager.h" #include "ui/ozone/public/gpu_platform_support_host.h" @@ -89,13 +53,13 @@ public: std::unique_ptr<InputMethod> CreateInputMethod(internal::InputMethodDelegate *delegate, gfx::AcceleratedWidget widget) override; std::unique_ptr<ui::PlatformScreen> CreateScreen() override { return nullptr; } private: - void InitializeUI(const ui::OzonePlatform::InitParams &) override; + bool InitializeUI(const ui::OzonePlatform::InitParams &) override; void InitializeGPU(const ui::OzonePlatform::InitParams &) override; void InitScreen(ui::PlatformScreen *) override {} std::unique_ptr<QtWebEngineCore::SurfaceFactoryQt> surface_factory_ozone_; - std::unique_ptr<CursorFactory> cursor_factory_ozone_; + std::unique_ptr<CursorFactory> cursor_factory_; std::unique_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; std::unique_ptr<InputController> input_controller_; @@ -105,8 +69,6 @@ private: XkbEvdevCodes m_xkbEvdevCodeConverter; #endif std::unique_ptr<KeyboardLayoutEngine> m_keyboardLayoutEngine; - - DISALLOW_COPY_AND_ASSIGN(OzonePlatformQt); }; @@ -121,7 +83,7 @@ ui::SurfaceFactoryOzone* OzonePlatformQt::GetSurfaceFactoryOzone() ui::CursorFactory* OzonePlatformQt::GetCursorFactory() { - return cursor_factory_ozone_.get(); + return cursor_factory_.get(); } GpuPlatformSupportHost* OzonePlatformQt::GetGpuPlatformSupportHost() @@ -200,7 +162,7 @@ static std::string getCurrentKeyboardLayout() } #endif // BUILDFLAG(USE_XKBCOMMON) -void OzonePlatformQt::InitializeUI(const ui::OzonePlatform::InitParams &) +bool OzonePlatformQt::InitializeUI(const ui::OzonePlatform::InitParams &) { #if BUILDFLAG(USE_XKBCOMMON) std::string layout = getCurrentKeyboardLayout(); @@ -218,8 +180,9 @@ void OzonePlatformQt::InitializeUI(const ui::OzonePlatform::InitParams &) overlay_manager_.reset(new StubOverlayManager()); input_controller_ = CreateStubInputController(); - cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone()); + cursor_factory_.reset(new BitmapCursorFactory()); gpu_platform_support_host_.reset(ui::CreateStubGpuPlatformSupportHost()); + return true; } void OzonePlatformQt::InitializeGPU(const ui::OzonePlatform::InitParams &) diff --git a/src/core/ozone/ozone_platform_qt.h b/src/core/ozone/ozone_platform_qt.h index dee66beb3..23629b2eb 100644 --- a/src/core/ozone/ozone_platform_qt.h +++ b/src/core/ozone/ozone_platform_qt.h @@ -1,55 +1,15 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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) 2017 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 #ifndef OZONE_PLATFORM_QT_H #define OZONE_PLATFORM_QT_H -#if defined(USE_OZONE) - -#include "ui/ozone/public/ozone_platform.h" - namespace ui { +class OzonePlatform; // Constructor hook for use in ozone_platform_list.cc -OzonePlatform* CreateOzonePlatformQt(); +OzonePlatform *CreateOzonePlatformQt(); } // namespace ui -#endif // defined(USE_OZONE) #endif // OZONE_PLATFORM_QT_H diff --git a/src/core/ozone/platform_window_qt.cpp b/src/core/ozone/platform_window_qt.cpp index e8ac4d025..01b0ae139 100644 --- a/src/core/ozone/platform_window_qt.cpp +++ b/src/core/ozone/platform_window_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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) 2017 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 #if defined(USE_OZONE) diff --git a/src/core/ozone/platform_window_qt.h b/src/core/ozone/platform_window_qt.h index 6a0984da8..fee4728cf 100644 --- a/src/core/ozone/platform_window_qt.h +++ b/src/core/ozone/platform_window_qt.h @@ -1,47 +1,12 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 #ifndef PLATFORM_WINDOW_QT_H #define PLATFORM_WINDOW_QT_H #if defined(USE_OZONE) +#include "ui/base/cursor/platform_cursor.h" #include "ui/events/platform/platform_event_dispatcher.h" #include "ui/gfx/geometry/point.h" #include "ui/gfx/geometry/rect.h" @@ -92,8 +57,6 @@ public: private: PlatformWindowDelegate* delegate_; gfx::Rect bounds_; - - DISALLOW_COPY_AND_ASSIGN(PlatformWindowQt); }; } diff --git a/src/core/ozone/surface_factory_qt.cpp b/src/core/ozone/surface_factory_qt.cpp index ca3e13e04..33164d076 100644 --- a/src/core/ozone/surface_factory_qt.cpp +++ b/src/core/ozone/surface_factory_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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) 2017 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 #if defined(USE_OZONE) #include "surface_factory_qt.h" diff --git a/src/core/ozone/surface_factory_qt.h b/src/core/ozone/surface_factory_qt.h index da208f8e6..767b69b85 100644 --- a/src/core/ozone/surface_factory_qt.h +++ b/src/core/ozone/surface_factory_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef SURFACE_FACTORY_QT #define SURFACE_FACTORY_QT diff --git a/src/core/permission_manager_qt.cpp b/src/core/permission_manager_qt.cpp index 686e61216..a1727bda3 100644 --- a/src/core/permission_manager_qt.cpp +++ b/src/core/permission_manager_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 "permission_manager_qt.h" @@ -87,9 +51,8 @@ static ProfileAdapter::PermissionType toQt(content::PermissionType type) case content::PermissionType::AR: case content::PermissionType::VR: case content::PermissionType::STORAGE_ACCESS_GRANT: - case content::PermissionType::FONT_ACCESS: + case content::PermissionType::LOCAL_FONTS: case content::PermissionType::DISPLAY_CAPTURE: - case content::PermissionType::FILE_HANDLING: case content::PermissionType::NUM: LOG(INFO) << "Unexpected unsupported permission type: " << static_cast<int>(type); break; @@ -132,8 +95,8 @@ PermissionManagerQt::~PermissionManagerQt() void PermissionManagerQt::permissionRequestReply(const QUrl &url, ProfileAdapter::PermissionType type, ProfileAdapter::PermissionState reply) { - // Normalize the QUrl to GURL origin form. - const GURL gorigin = toGurl(url).GetOrigin(); + // Normalize the QUrl to Chromium origin form. + const GURL gorigin = toGurl(url).DeprecatedGetOriginAsURL(); const QUrl origin = gorigin.is_empty() ? url : toQt(gorigin); if (origin.isEmpty()) return; @@ -323,7 +286,25 @@ blink::mojom::PermissionStatus PermissionManagerQt::GetPermissionStatusForFrame( return GetPermissionStatus( permission, requesting_origin, - content::WebContents::FromRenderFrameHost(render_frame_host)->GetLastCommittedURL().GetOrigin()); + render_frame_host->GetLastCommittedOrigin().GetURL()); +} + +blink::mojom::PermissionStatus PermissionManagerQt::GetPermissionStatusForCurrentDocument( + content::PermissionType permission, + content::RenderFrameHost *render_frame_host) +{ + return GetPermissionStatusForFrame( + permission, + render_frame_host, + render_frame_host->GetLastCommittedOrigin().GetURL()); +} + +blink::mojom::PermissionStatus PermissionManagerQt::GetPermissionStatusForWorker( + content::PermissionType permission, + content::RenderProcessHost *render_process_host, + const GURL &url) +{ + return GetPermissionStatus(permission, url, url); } void PermissionManagerQt::ResetPermission( @@ -341,6 +322,7 @@ void PermissionManagerQt::ResetPermission( content::PermissionControllerDelegate::SubscriptionId PermissionManagerQt::SubscribePermissionStatusChange( content::PermissionType permission, + content::RenderProcessHost * /*render_process_host*/, content::RenderFrameHost * /* render_frame_host */, const GURL& requesting_origin, base::RepeatingCallback<void(blink::mojom::PermissionStatus)> callback) diff --git a/src/core/permission_manager_qt.h b/src/core/permission_manager_qt.h index 8cecfdf7b..566e0839b 100644 --- a/src/core/permission_manager_qt.h +++ b/src/core/permission_manager_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef PERMISSION_MANAGER_QT_H #define PERMISSION_MANAGER_QT_H @@ -76,6 +40,10 @@ public: content::RenderFrameHost *render_frame_host, const GURL& requesting_origin) override; + blink::mojom::PermissionStatus GetPermissionStatusForCurrentDocument(content::PermissionType, content::RenderFrameHost *) override; + + blink::mojom::PermissionStatus GetPermissionStatusForWorker(content::PermissionType, content::RenderProcessHost *, const GURL &) override; + void ResetPermission( content::PermissionType permission, const GURL& requesting_origin, @@ -91,6 +59,7 @@ public: content::PermissionControllerDelegate::SubscriptionId SubscribePermissionStatusChange( content::PermissionType permission, + content::RenderProcessHost* render_process_host, content::RenderFrameHost* render_frame_host, const GURL& requesting_origin, const base::RepeatingCallback<void(blink::mojom::PermissionStatus)> callback) override; diff --git a/src/core/platform_notification_service_qt.cpp b/src/core/platform_notification_service_qt.cpp index 63569ece1..277de55f0 100644 --- a/src/core/platform_notification_service_qt.cpp +++ b/src/core/platform_notification_service_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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) 2017 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 "platform_notification_service_qt.h" @@ -50,7 +14,6 @@ #include "profile_adapter_client.h" #include "profile_qt.h" #include "user_notification_controller.h" -#include "resource_context_qt.h" #include "type_conversion.h" #include <QSharedPointer> diff --git a/src/core/platform_notification_service_qt.h b/src/core/platform_notification_service_qt.h index b55708686..bf8fcca04 100644 --- a/src/core/platform_notification_service_qt.h +++ b/src/core/platform_notification_service_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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) 2017 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 #ifndef PLATFORM_NOTIFICATION_SERVICE_QT_H #define PLATFORM_NOTIFICATION_SERVICE_QT_H diff --git a/src/core/pref_service_adapter.cpp b/src/core/pref_service_adapter.cpp index 59bf2224e..27212f9b2 100644 --- a/src/core/pref_service_adapter.cpp +++ b/src/core/pref_service_adapter.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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) 2019 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 "pref_service_adapter.h" @@ -43,8 +7,10 @@ #include "type_conversion.h" #include "web_engine_context.h" +#include "base/threading/thread_restrictions.h" #include "chrome/browser/prefs/chrome_command_line_pref_store.h" #include "content/public/browser/browser_thread.h" +#include "components/autofill/core/common/autofill_prefs.h" #include "components/language/core/browser/pref_names.h" #include "components/prefs/pref_member.h" #include "components/prefs/in_memory_pref_store.h" @@ -82,15 +48,16 @@ void PrefServiceAdapter::setup(const ProfileAdapter &profileAdapter) DCHECK_CURRENTLY_ON(content::BrowserThread::UI); PrefServiceFactory factory; factory.set_command_line_prefs(base::MakeRefCounted<ChromeCommandLinePrefStore>( - WebEngineContext::commandLine())); + base::CommandLine::ForCurrentProcess())); QString userPrefStorePath = profileAdapter.dataPath(); - if (profileAdapter.isOffTheRecord() || profileAdapter.storageName().isEmpty()) { - factory.set_user_prefs(new InMemoryPrefStore); - } else { + if (!profileAdapter.isOffTheRecord() && !userPrefStorePath.isEmpty() && + const_cast<ProfileAdapter *>(&profileAdapter)->ensureDataPathExists()) { userPrefStorePath += QDir::separator(); userPrefStorePath += QStringLiteral("user_prefs.json"); factory.set_user_prefs(base::MakeRefCounted<JsonPrefStore>(toFilePath(userPrefStorePath))); + } else { + factory.set_user_prefs(new InMemoryPrefStore); } auto registry = base::MakeRefCounted<PrefRegistrySimple>(); @@ -129,7 +96,18 @@ void PrefServiceAdapter::setup(const ProfileAdapter &profileAdapter) // default value will be different. We'll need to initialize it later. registry->RegisterStringPref(kPrefMediaDeviceIDSalt, std::string()); - m_prefService = factory.Create(registry); + registry->RegisterBooleanPref(autofill::prefs::kAutofillEnabledDeprecated, false); + registry->RegisterBooleanPref(autofill::prefs::kAutofillProfileEnabled, false); + registry->RegisterBooleanPref(autofill::prefs::kAutofillCreditCardEnabled, false); + registry->RegisterBooleanPref(autofill::prefs::kAutofillCreditCardFidoAuthEnabled, false); + registry->RegisterBooleanPref(autofill::prefs::kAutofillWalletImportEnabled, false); + registry->RegisterBooleanPref(autofill::prefs::kAutofillJapanCityFieldMigratedDeprecated, + false); + + { + base::ScopedAllowBlocking allowBlock; + m_prefService = factory.Create(registry); + } // Initialize salt value if none was stored before if (m_prefService->GetString(kPrefMediaDeviceIDSalt).empty()) { @@ -183,10 +161,8 @@ QStringList PrefServiceAdapter::spellCheckLanguages() const { QStringList spellcheck_dictionaries; const auto &list = m_prefService->GetList(spellcheck::prefs::kSpellCheckDictionaries); - for (size_t i = 0; i < list->GetSize(); ++i) { - std::string dictionary; - if (list->GetString(i, &dictionary)) - spellcheck_dictionaries.append(QString::fromStdString(dictionary)); + for (const auto &dictionary : list->GetList()) { + spellcheck_dictionaries.append(QString::fromStdString(dictionary.GetString())); } return spellcheck_dictionaries; diff --git a/src/core/pref_service_adapter.h b/src/core/pref_service_adapter.h index 93a61302f..efa83a72c 100644 --- a/src/core/pref_service_adapter.h +++ b/src/core/pref_service_adapter.h @@ -1,42 +1,5 @@ - -/**************************************************************************** -** -** Copyright (C) 2019 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) 2019 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 #ifndef PREF_SERVICE_ADAPTER_H #define PREF_SERVICE_ADAPTER_H diff --git a/src/core/printing/pdf_stream_delegate_qt.cpp b/src/core/printing/pdf_stream_delegate_qt.cpp new file mode 100644 index 000000000..bb7b37532 --- /dev/null +++ b/src/core/printing/pdf_stream_delegate_qt.cpp @@ -0,0 +1,91 @@ +// Copyright (C) 2022 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 + +// based on chrome/browser/pdf/chrome_pdf_stream_delegate.cc: + +#include "pdf_stream_delegate_qt.h" + +#include "base/no_destructor.h" +#include "chrome/grit/pdf_resources.h" +#include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h" +#include "extensions/common/constants.h" +#include "ui/base/resource/resource_bundle.h" + +// Associates a `pdf::PdfStreamDelegate::StreamInfo` with a `WebContents`. +// `PdfStreamDelegateQt::MapToOriginalUrl()` initializes this in +// `PdfNavigationThrottle`, and then `PdfStreamDelegateQt::GetStreamInfo()` +// returns the stashed result to `PdfURLLoaderRequestInterceptor`. +class StreamInfoHelper : public content::WebContentsUserData<StreamInfoHelper> +{ +public: + absl::optional<pdf::PdfStreamDelegate::StreamInfo> TakeStreamInfo() + { return std::move(stream_info_); } + +private: + friend class content::WebContentsUserData<StreamInfoHelper>; + WEB_CONTENTS_USER_DATA_KEY_DECL(); + + StreamInfoHelper(content::WebContents *contents, + pdf::PdfStreamDelegate::StreamInfo stream_info) + : content::WebContentsUserData<StreamInfoHelper>(*contents), + stream_info_(std::move(stream_info)) {} + + absl::optional<pdf::PdfStreamDelegate::StreamInfo> stream_info_; +}; + +WEB_CONTENTS_USER_DATA_KEY_IMPL(StreamInfoHelper); + +PdfStreamDelegateQt::PdfStreamDelegateQt() = default; +PdfStreamDelegateQt::~PdfStreamDelegateQt() = default; + +absl::optional<GURL> PdfStreamDelegateQt::MapToOriginalUrl(content::WebContents *contents, const GURL &stream_url) +{ + StreamInfoHelper *helper = StreamInfoHelper::FromWebContents(contents); + if (helper) { + // PDF viewer and Print Preview only do this once per WebContents. + return absl::nullopt; + } + + GURL original_url; + StreamInfo info; + + extensions::MimeHandlerViewGuest *guest = + extensions::MimeHandlerViewGuest::FromWebContents(contents); + if (guest) { + base::WeakPtr<extensions::StreamContainer> stream = guest->GetStreamWeakPtr(); + if (!stream || stream->extension_id() != extension_misc::kPdfExtensionId || + stream->stream_url() != stream_url || + !stream->pdf_plugin_attributes()) { + return absl::nullopt; + } + + original_url = stream->original_url(); + info.background_color = base::checked_cast<SkColor>(stream->pdf_plugin_attributes()->background_color); + info.full_frame = !stream->embedded(); + info.allow_javascript = stream->pdf_plugin_attributes()->allow_javascript; + } else { + return absl::nullopt; + } + + static const base::NoDestructor<std::string> injected_script( + ui::ResourceBundle::GetSharedInstance().LoadDataResourceString( + IDR_PDF_PDF_INTERNAL_PLUGIN_WRAPPER_ROLLUP_JS)); + + info.stream_url = stream_url; + info.original_url = original_url; + info.injected_script = injected_script.get(); + StreamInfoHelper::CreateForWebContents(contents, std::move(info)); + return original_url; +} + +absl::optional<pdf::PdfStreamDelegate::StreamInfo> +PdfStreamDelegateQt::GetStreamInfo(content::WebContents *contents) +{ + StreamInfoHelper *helper = StreamInfoHelper::FromWebContents(contents); + if (!helper) + return absl::nullopt; + + // Only the call immediately following `MapToOriginalUrl()` requires a valid + // `StreamInfo`; subsequent calls should just get nothing. + return helper->TakeStreamInfo(); +} diff --git a/src/core/printing/pdf_stream_delegate_qt.h b/src/core/printing/pdf_stream_delegate_qt.h new file mode 100644 index 000000000..47621576f --- /dev/null +++ b/src/core/printing/pdf_stream_delegate_qt.h @@ -0,0 +1,23 @@ +// Copyright (C) 2022 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 + +#ifndef PDF_STREAM_DELEGATE_QT_H +#define PDF_STREAM_DELEGATE_QT_H + +#include "components/pdf/browser/pdf_stream_delegate.h" + +// based on chrome/browser/pdf/chrome_pdf_stream_delegate.h: +class PdfStreamDelegateQt : public pdf::PdfStreamDelegate +{ +public: + PdfStreamDelegateQt(); + PdfStreamDelegateQt(const PdfStreamDelegateQt &) = delete; + PdfStreamDelegateQt operator=(const PdfStreamDelegateQt &) = delete; + ~PdfStreamDelegateQt() override; + + // pdf::PdfStreamDelegate: + absl::optional<GURL> MapToOriginalUrl(content::WebContents *contents, const GURL &stream_url) override; + absl::optional<StreamInfo> GetStreamInfo(content::WebContents *contents) override; +}; + +#endif // PDF_STREAM_DELEGATE_QT_H diff --git a/src/core/printing/pdf_web_contents_helper_client_qt.cpp b/src/core/printing/pdf_web_contents_helper_client_qt.cpp new file mode 100644 index 000000000..7c2a46ebf --- /dev/null +++ b/src/core/printing/pdf_web_contents_helper_client_qt.cpp @@ -0,0 +1,56 @@ +// Copyright (C) 2022 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 + +// based on chrome/browser/ui/pdf/chrome_pdf_web_contents_helper_client.cc: + +#include "pdf_web_contents_helper_client_qt.h" + +#include "content/public/browser/render_process_host.h" +#include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h" +#include "extensions/common/constants.h" + +namespace { +bool IsPdfExtensionOrigin(const url::Origin &origin) +{ + return origin.scheme() == extensions::kExtensionScheme && + origin.host() == extension_misc::kPdfExtensionId; +} + +// from chrome/browser/pdf/pdf_frame_util.cc: +content::RenderFrameHost *FindPdfChildFrame(content::RenderFrameHost *rfh) +{ + if (!IsPdfExtensionOrigin(rfh->GetLastCommittedOrigin())) + return nullptr; + + content::RenderFrameHost *pdf_rfh = nullptr; + rfh->ForEachRenderFrameHost( + base::BindRepeating( + [](content::RenderFrameHost *&pdf_rfh, content::RenderFrameHost *rfh) { + if (!rfh->GetProcess()->IsPdf()) + return; + + DCHECK(IsPdfExtensionOrigin(rfh->GetParent()->GetLastCommittedOrigin())); + DCHECK(!pdf_rfh); + pdf_rfh = rfh; + }, std::ref(pdf_rfh))); + + return pdf_rfh; +} +} // namespace + +PDFWebContentsHelperClientQt::PDFWebContentsHelperClientQt() = default; +PDFWebContentsHelperClientQt::~PDFWebContentsHelperClientQt() = default; + +content::RenderFrameHost *PDFWebContentsHelperClientQt::FindPdfFrame(content::WebContents *contents) +{ + content::RenderFrameHost *main_frame = contents->GetMainFrame(); + content::RenderFrameHost *pdf_frame = FindPdfChildFrame(main_frame); + return pdf_frame ? pdf_frame : main_frame; +} + +void PDFWebContentsHelperClientQt::SetPluginCanSave(content::WebContents *contents, bool can_save) +{ + auto *guest_view = extensions::MimeHandlerViewGuest::FromWebContents(contents); + if (guest_view) + guest_view->SetPluginCanSave(can_save); +} diff --git a/src/core/printing/pdf_web_contents_helper_client_qt.h b/src/core/printing/pdf_web_contents_helper_client_qt.h new file mode 100644 index 000000000..ccc552986 --- /dev/null +++ b/src/core/printing/pdf_web_contents_helper_client_qt.h @@ -0,0 +1,27 @@ +// Copyright (C) 2022 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 + +#ifndef PDF_WEB_CONTENTS_HELPER_CLIENT_QT_H +#define PDF_WEB_CONTENTS_HELPER_CLIENT_QT_H + +#include "components/pdf/browser/pdf_web_contents_helper_client.h" + +// based on chrome/browser/ui/pdf/chrome_pdf_web_contents_helper_client.h: +class PDFWebContentsHelperClientQt : public pdf::PDFWebContentsHelperClient +{ +public: + PDFWebContentsHelperClientQt(); + PDFWebContentsHelperClientQt(const PDFWebContentsHelperClientQt&) = delete; + PDFWebContentsHelperClientQt& operator=(const PDFWebContentsHelperClientQt&) = delete; + ~PDFWebContentsHelperClientQt() override; + +private: + // pdf::PDFWebContentsHelperClient: + content::RenderFrameHost* FindPdfFrame(content::WebContents *contents) override; + void UpdateContentRestrictions(content::WebContents *contents, int content_restrictions) override {} + void OnPDFHasUnsupportedFeature(content::WebContents *contents) override {} + void OnSaveURL(content::WebContents *contents) override {} + void SetPluginCanSave(content::WebContents *contents, bool can_save) override; +}; + +#endif // PDF_WEB_CONTENTS_HELPER_CLIENT_QT_H diff --git a/src/core/printing/pdfium_document_wrapper_qt.cpp b/src/core/printing/pdfium_document_wrapper_qt.cpp index dae6ec44b..56588620d 100644 --- a/src/core/printing/pdfium_document_wrapper_qt.cpp +++ b/src/core/printing/pdfium_document_wrapper_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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) 2017 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 "pdfium_document_wrapper_qt.h" #include <QtCore/qhash.h> diff --git a/src/core/printing/pdfium_document_wrapper_qt.h b/src/core/printing/pdfium_document_wrapper_qt.h index e0778c32b..727818a90 100644 --- a/src/core/printing/pdfium_document_wrapper_qt.h +++ b/src/core/printing/pdfium_document_wrapper_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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) 2017 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 // // W A R N I N G diff --git a/src/core/printing/print_view_manager_base_qt.cpp b/src/core/printing/print_view_manager_base_qt.cpp index a170c95ba..3af6ecf44 100644 --- a/src/core/printing/print_view_manager_base_qt.cpp +++ b/src/core/printing/print_view_manager_base_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 // This is based on chrome/browser/printing/print_view_manager_base.cc: // Copyright 2013 The Chromium Authors. All rights reserved. @@ -49,7 +13,6 @@ #include "base/memory/ref_counted_memory.h" #include "base/run_loop.h" -#include "base/single_thread_task_runner.h" #include "base/task/current_thread.h" #include "base/task/post_task.h" #include "base/timer/timer.h" @@ -90,7 +53,7 @@ void GetDefaultPrintSettingsReplyOnIO(scoped_refptr<printing::PrintQueriesQueue> { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); printing::mojom::PrintParamsPtr params = printing::mojom::PrintParams::New(); - if (printer_query && printer_query->last_status() == printing::PrintingContext::OK) { + if (printer_query && printer_query->last_status() == printing::mojom::ResultCode::kSuccess) { RenderParamsFromPrintSettings(printer_query->settings(), params.get()); params->document_cookie = printer_query->cookie(); } @@ -113,22 +76,29 @@ void GetDefaultPrintSettingsReplyOnIO(scoped_refptr<printing::PrintQueriesQueue> void GetDefaultPrintSettingsOnIO(printing::mojom::PrintManagerHost::GetDefaultPrintSettingsCallback callback, scoped_refptr<printing::PrintQueriesQueue> queue, - int process_id, int routing_id) + bool is_modifiable, + content::GlobalRenderFrameHostId rfh_id) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); std::unique_ptr<printing::PrinterQuery> printer_query = queue->PopPrinterQuery(0); if (!printer_query) - printer_query = queue->CreatePrinterQuery(process_id, routing_id); + printer_query = queue->CreatePrinterQuery(rfh_id); // Loads default settings. This is asynchronous, only the mojo message sender // will hang until the settings are retrieved. auto *printer_query_ptr = printer_query.get(); - printer_query_ptr->GetSettings( - printing::PrinterQuery::GetSettingsAskParam::DEFAULTS, 0, false, - printing::mojom::MarginType::kDefaultMargins, false, false, - base::BindOnce(&GetDefaultPrintSettingsReplyOnIO, queue, - std::move(printer_query), std::move(callback))); + printer_query_ptr->GetDefaultSettings( + base::BindOnce(&GetDefaultPrintSettingsReplyOnIO, queue, + std::move(printer_query), std::move(callback)), + is_modifiable); +} + +printing::mojom::PrintPagesParamsPtr CreateEmptyPrintPagesParamsPtr() +{ + auto params = printing::mojom::PrintPagesParams::New(); + params->params = printing::mojom::PrintParams::New(); + return params; } // Runs |callback| with |params| to reply to @@ -137,11 +107,8 @@ void UpdatePrintSettingsReply(printing::mojom::PrintManagerHost::UpdatePrintSett printing::mojom::PrintPagesParamsPtr params, bool canceled) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - if (!params) { - // Fills |params| with initial values. - params = printing::mojom::PrintPagesParams::New(); - params->params = printing::mojom::PrintParams::New(); - } + if (!params) + params = CreateEmptyPrintPagesParamsPtr(); std::move(callback).Run(std::move(params), canceled); } @@ -154,12 +121,12 @@ void UpdatePrintSettingsReplyOnIO(scoped_refptr<printing::PrintQueriesQueue> que DCHECK(printer_query); auto params = printing::mojom::PrintPagesParams::New(); params->params = printing::mojom::PrintParams::New(); - if (printer_query->last_status() == printing::PrintingContext::OK) { + if (printer_query->last_status() == printing::mojom::ResultCode::kSuccess) { RenderParamsFromPrintSettings(printer_query->settings(), params->params.get()); params->params->document_cookie = printer_query->cookie(); params->pages = printing::PageRange::GetPages(printer_query->settings().ranges()); } - bool canceled = printer_query->last_status() == printing::PrintingContext::CANCEL; + bool canceled = printer_query->last_status() == printing::mojom::ResultCode::kAccessDenied; content::GetUIThreadTaskRunner({})->PostTask( FROM_HERE, @@ -175,13 +142,13 @@ void UpdatePrintSettingsReplyOnIO(scoped_refptr<printing::PrintQueriesQueue> que void UpdatePrintSettingsOnIO(int32_t cookie, printing::mojom::PrintManagerHost::UpdatePrintSettingsCallback callback, scoped_refptr<printing::PrintQueriesQueue> queue, - base::Value job_settings, + base::Value::Dict job_settings, int process_id, int routing_id) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); std::unique_ptr<printing::PrinterQuery> printer_query = queue->PopPrinterQuery(cookie); if (!printer_query) - printer_query = queue->CreatePrinterQuery(content::ChildProcessHost::kInvalidUniqueID, MSG_ROUTING_NONE); + printer_query = queue->CreatePrinterQuery(content::GlobalRenderFrameHostId()); auto *printer_query_ptr = printer_query.get(); printer_query_ptr->SetSettings( @@ -191,37 +158,13 @@ void UpdatePrintSettingsOnIO(int32_t cookie, process_id, routing_id)); } -// Runs |callback| with |params| to reply to -// mojom::PrintManagerHost::ScriptedPrint. -void ScriptedPrintReply(printing::mojom::PrintManagerHost::ScriptedPrintCallback callback, - printing::mojom::PrintPagesParamsPtr params, - int process_id) -{ - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - - if (!content::RenderProcessHost::FromID(process_id)) { - // Early return if the renderer is not alive. - return; - } - - if (!params) { - // Fills |params| with initial values. - params = printing::mojom::PrintPagesParams::New(); - params->params = printing::mojom::PrintParams::New(); - } - std::move(callback).Run(std::move(params)); -} - void ScriptedPrintReplyOnIO(scoped_refptr<printing::PrintQueriesQueue> queue, std::unique_ptr<printing::PrinterQuery> printer_query, - printing::mojom::PrintManagerHost::ScriptedPrintCallback callback, - int process_id) + printing::mojom::PrintManagerHost::ScriptedPrintCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); - auto params = printing::mojom::PrintPagesParams::New(); - params->params = printing::mojom::PrintParams::New(); - if (printer_query->last_status() == printing::PrintingContext::OK && - printer_query->settings().dpi()) { + printing::mojom::PrintPagesParamsPtr params = CreateEmptyPrintPagesParamsPtr(); + if (printer_query->last_status() == printing::mojom::ResultCode::kSuccess && printer_query->settings().dpi()) { RenderParamsFromPrintSettings(printer_query->settings(), params->params.get()); params->params->document_cookie = printer_query->cookie(); params->pages = printing::PageRange::GetPages(printer_query->settings().ranges()); @@ -229,8 +172,7 @@ void ScriptedPrintReplyOnIO(scoped_refptr<printing::PrintQueriesQueue> queue, bool has_valid_cookie = params->params->document_cookie; bool has_dpi = !params->params->dpi.IsEmpty(); content::GetUIThreadTaskRunner({})->PostTask( - FROM_HERE, base::BindOnce(&ScriptedPrintReply, std::move(callback), - std::move(params), process_id)); + FROM_HERE, base::BindOnce(std::move(callback), std::move(params))); if (has_dpi && has_valid_cookie) { queue->QueuePrinterQuery(std::move(printer_query)); @@ -242,22 +184,20 @@ void ScriptedPrintReplyOnIO(scoped_refptr<printing::PrintQueriesQueue> queue, void ScriptedPrintOnIO(printing::mojom::ScriptedPrintParamsPtr params, printing::mojom::PrintManagerHost::ScriptedPrintCallback callback, scoped_refptr<printing::PrintQueriesQueue> queue, - int process_id, - int routing_id) + bool is_modifiable, + content::GlobalRenderFrameHostId rfh_id) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); std::unique_ptr<printing::PrinterQuery> printer_query = queue->PopPrinterQuery(params->cookie); if (!printer_query) - printer_query = queue->CreatePrinterQuery(process_id, routing_id); + printer_query = queue->CreatePrinterQuery(rfh_id); auto *printer_query_ptr = printer_query.get(); - printer_query_ptr->GetSettings( - printing::PrinterQuery::GetSettingsAskParam::ASK_USER, params->expected_pages_count, - params->has_selection, params->margin_type, params->is_scripted, - params->is_modifiable, - base::BindOnce(&ScriptedPrintReplyOnIO, queue, std::move(printer_query), - std::move(callback), process_id)); + printer_query_ptr->GetSettingsFromUser( + params->expected_pages_count, params->has_selection, params->margin_type, + params->is_scripted, is_modifiable, + base::BindOnce(&ScriptedPrintReplyOnIO, queue, std::move(printer_query), std::move(callback))); } } // namespace @@ -285,6 +225,25 @@ void PrintViewManagerBaseQt::SetPrintingRFH(content::RenderFrameHost *rfh) m_printingRFH = rfh; } +void PrintViewManagerBaseQt::ScriptedPrintReply(ScriptedPrintCallback callback, + int process_id, + printing::mojom::PrintPagesParamsPtr params) { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + +#if BUILDFLAG(ENABLE_OOP_PRINTING) + // Finished getting all settings (defaults and from user), no further need + // to be registered as a system print client. + UnregisterSystemPrintClient(); +#endif + if (!content::RenderProcessHost::FromID(process_id)) { + // Early return if the renderer is not alive. + return; + } + +// set_cookie(params->params->document_cookie); + std::move(callback).Run(std::move(params)); +} + void PrintViewManagerBaseQt::UpdatePrintingEnabled() { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); @@ -371,14 +330,15 @@ void PrintViewManagerBaseQt::DidPrintDocument(printing::mojom::DidPrintDocumentP void PrintViewManagerBaseQt::GetDefaultPrintSettings(GetDefaultPrintSettingsCallback callback) { - content::RenderFrameHost* render_frame_host = - print_manager_host_receivers_.GetCurrentTargetFrame(); - + content::RenderFrameHost *render_frame_host = + print_manager_host_receivers_.GetCurrentTargetFrame(); + content::RenderProcessHost *render_process_host = + render_frame_host->GetProcess(); content::GetIOThreadTaskRunner({})->PostTask( FROM_HERE, base::BindOnce(&GetDefaultPrintSettingsOnIO, std::move(callback), m_printerQueriesQueue, - render_frame_host->GetProcess()->GetID(), - render_frame_host->GetRoutingID())); + !render_process_host->IsPdf(), + render_frame_host->GetGlobalId())); } void PrintViewManagerBaseQt::PrintingFailed(int32_t cookie) @@ -399,12 +359,16 @@ void PrintViewManagerBaseQt::ScriptedPrint(printing::mojom::ScriptedPrintParamsP DCHECK_CURRENTLY_ON(content::BrowserThread::UI); content::RenderFrameHost *render_frame_host = print_manager_host_receivers_.GetCurrentTargetFrame(); + content::RenderProcessHost *render_process_host = + render_frame_host->GetProcess(); + auto callback_wrapper = base::BindOnce( + &PrintViewManagerBaseQt::ScriptedPrintReply, weak_ptr_factory_.GetWeakPtr(), + std::move(callback), render_process_host->GetID()); content::GetIOThreadTaskRunner({})->PostTask( FROM_HERE, - base::BindOnce(&ScriptedPrintOnIO, std::move(params), std::move(callback), - m_printerQueriesQueue, render_frame_host->GetProcess()->GetID(), - render_frame_host->GetRoutingID())); + base::BindOnce(&ScriptedPrintOnIO, std::move(params), std::move(callback_wrapper), + m_printerQueriesQueue, !render_process_host->IsPdf(), render_frame_host->GetGlobalId())); } void PrintViewManagerBaseQt::ShowInvalidPrinterSettingsError() @@ -464,9 +428,6 @@ void PrintViewManagerBaseQt::OnNotifyPrintJobEvent(const printing::JobEventDetai // break; // } case printing::JobEventDetails::NEW_DOC: -#if defined(OS_WIN) - case printing::JobEventDetails::PAGE_DONE: -#endif case printing::JobEventDetails::DOC_DONE: { // Don't care about the actual printing process. break; @@ -501,8 +462,8 @@ bool PrintViewManagerBaseQt::RenderAllMissingPagesNow() // We can't print if there is no renderer. if (!web_contents() || - !web_contents()->GetRenderViewHost() || - !web_contents()->GetRenderViewHost()->IsRenderViewLive()) { + !web_contents()->GetMainFrame() || + !web_contents()->GetMainFrame()->IsRenderFrameLive()) { return false; } @@ -544,8 +505,8 @@ bool PrintViewManagerBaseQt::CreateNewPrintJob(std::unique_ptr<printing::Printer DisconnectFromCurrentPrintJob(); // We can't print if there is no renderer. - if (!web_contents()->GetRenderViewHost() || - !web_contents()->GetRenderViewHost()->IsRenderViewLive()) { + if (!web_contents()->GetMainFrame() || + !web_contents()->GetMainFrame()->IsRenderFrameLive()) { return false; } @@ -553,7 +514,7 @@ bool PrintViewManagerBaseQt::CreateNewPrintJob(std::unique_ptr<printing::Printer // view and switch to it, initialize the printer and show the print dialog. DCHECK(!m_printJob.get()); - m_printJob = base::MakeRefCounted<printing::PrintJob>(); + m_printJob = base::MakeRefCounted<printing::PrintJob>(nullptr /*g_browser_process->print_job_manager()*/); m_printJob->Initialize(std::move(query), RenderSourceName(), number_pages_); m_registrar.Add(this, chrome::NOTIFICATION_PRINT_JOB_EVENT, content::Source<printing::PrintJob>(m_printJob.get())); @@ -635,7 +596,7 @@ bool PrintViewManagerBaseQt::RunInnerMessageLoop() base::OneShotTimer quit_timer; base::RunLoop run_loop; quit_timer.Start(FROM_HERE, - base::TimeDelta::FromMilliseconds(kPrinterSettingsTimeout), + base::Milliseconds(kPrinterSettingsTimeout), run_loop.QuitWhenIdleClosure()); m_quitInnerLoop = run_loop.QuitClosure(); @@ -718,15 +679,16 @@ void PrintViewManagerBaseQt::StopWorker(int documentCookie) void PrintViewManagerBaseQt::SendPrintingEnabled(bool enabled, content::RenderFrameHost* rfh) { - GetPrintRenderFrame(rfh)->SetPrintingEnabled(enabled); + if (rfh->IsRenderFrameLive()) + GetPrintRenderFrame(rfh)->SetPrintingEnabled(enabled); } -void PrintViewManagerBaseQt::UpdatePrintSettings(int32_t cookie, base::Value job_settings, +void PrintViewManagerBaseQt::UpdatePrintSettings(int32_t cookie, base::Value::Dict job_settings, UpdatePrintSettingsCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - if (!job_settings.FindIntKey(printing::kSettingPrinterType)) { + if (!job_settings.FindInt(printing::kSettingPrinterType)) { UpdatePrintSettingsReply(std::move(callback), nullptr, false); return; } diff --git a/src/core/printing/print_view_manager_base_qt.h b/src/core/printing/print_view_manager_base_qt.h index 96c2d441c..b83a9d286 100644 --- a/src/core/printing/print_view_manager_base_qt.h +++ b/src/core/printing/print_view_manager_base_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 // Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be @@ -83,7 +47,7 @@ public: void DidPrintDocument(printing::mojom::DidPrintDocumentParamsPtr params, DidPrintDocumentCallback callback) override; void GetDefaultPrintSettings(GetDefaultPrintSettingsCallback callback) override; - void UpdatePrintSettings(int32_t cookie, base::Value job_settings, + void UpdatePrintSettings(int32_t cookie, base::Value::Dict job_settings, UpdatePrintSettingsCallback callback) override; void ScriptedPrint(printing::mojom::ScriptedPrintParamsPtr, printing::mojom::PrintManagerHost::ScriptedPrintCallback) override; @@ -130,6 +94,11 @@ private: // been requested to the renderer. bool RenderAllMissingPagesNow(); + // Runs `callback` with `params` to reply to ScriptedPrint(). + void ScriptedPrintReply(ScriptedPrintCallback callback, + int process_id, + printing::mojom::PrintPagesParamsPtr params); + // Checks that synchronization is correct with |print_job_| based on |cookie|. bool PrintJobHasDocument(int cookie); @@ -184,7 +153,7 @@ private: base::OnceClosure m_quitInnerLoop; scoped_refptr<printing::PrintQueriesQueue> m_printerQueriesQueue; - DISALLOW_COPY_AND_ASSIGN(PrintViewManagerBaseQt); + base::WeakPtrFactory<PrintViewManagerBaseQt> weak_ptr_factory_{this}; }; } // namespace QtWebEngineCore diff --git a/src/core/printing/print_view_manager_qt.cpp b/src/core/printing/print_view_manager_qt.cpp index 90b320eb6..6eb3d7419 100644 --- a/src/core/printing/print_view_manager_qt.cpp +++ b/src/core/printing/print_view_manager_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 // Loosely based on print_view_manager.cc and print_preview_message_handler.cc // Copyright 2013 The Chromium Authors. All rights reserved. @@ -286,6 +250,7 @@ bool PrintViewManagerQt::PrintToPDFInternal(const QPageLayout &pageLayout, PrintViewManagerQt::PrintViewManagerQt(content::WebContents *contents) : PrintViewManagerBaseQt(contents) + , content::WebContentsUserData<PrintViewManagerQt>(*contents) , m_printPreviewRfh(nullptr) { @@ -331,9 +296,9 @@ void PrintViewManagerQt::NavigationStopped() PrintViewManagerBaseQt::NavigationStopped(); } -void PrintViewManagerQt::RenderProcessGone(base::TerminationStatus status) +void PrintViewManagerQt::PrimaryMainFrameRenderProcessGone(base::TerminationStatus status) { - PrintViewManagerBaseQt::RenderProcessGone(status); + PrintViewManagerBaseQt::PrimaryMainFrameRenderProcessGone(status); if (!m_pdfPrintCallback.is_null()) { base::PostTask(FROM_HERE, {content::BrowserThread::UI}, base::BindOnce(std::move(m_pdfPrintCallback), QSharedPointer<QByteArray>())); @@ -419,6 +384,6 @@ void PrintViewManagerQt::MetafileReadyForPrinting(printing::mojom::DidPreviewDoc } } -WEB_CONTENTS_USER_DATA_KEY_IMPL(PrintViewManagerQt) +WEB_CONTENTS_USER_DATA_KEY_IMPL(PrintViewManagerQt); } // namespace QtWebEngineCore diff --git a/src/core/printing/print_view_manager_qt.h b/src/core/printing/print_view_manager_qt.h index bc55c57fe..7d0894a0d 100644 --- a/src/core/printing/print_view_manager_qt.h +++ b/src/core/printing/print_view_manager_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 // Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be @@ -98,7 +62,7 @@ protected: void NavigationStopped() override; // Terminates or cancels the print job if one was pending. - void RenderProcessGone(base::TerminationStatus status) override; + void PrimaryMainFrameRenderProcessGone(base::TerminationStatus status) override; void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override; @@ -126,7 +90,6 @@ private: std::unique_ptr<base::DictionaryValue> m_printSettings; friend class content::WebContentsUserData<PrintViewManagerQt>; - DISALLOW_COPY_AND_ASSIGN(PrintViewManagerQt); }; } // namespace QtWebEngineCore diff --git a/src/core/printing/printer_worker.cpp b/src/core/printing/printer_worker.cpp index 411e326c3..9eb82c590 100644 --- a/src/core/printing/printer_worker.cpp +++ b/src/core/printing/printer_worker.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 "printer_worker.h" diff --git a/src/core/printing/printer_worker.h b/src/core/printing/printer_worker.h index 3681312a9..b3ac07ad4 100644 --- a/src/core/printing/printer_worker.h +++ b/src/core/printing/printer_worker.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2022 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 // // W A R N I N G @@ -53,7 +17,8 @@ #include <QtWebEngineCore/private/qtwebenginecoreglobal_p.h> -#include <QSharedPointer> +#include <QtCore/qobject.h> +#include <QtCore/qsharedpointer.h> QT_BEGIN_NAMESPACE class QPagedPaintDevice; diff --git a/src/core/process_main.cpp b/src/core/process_main.cpp index 709f8bd6d..ce92db083 100644 --- a/src/core/process_main.cpp +++ b/src/core/process_main.cpp @@ -1,50 +1,13 @@ -/**************************************************************************** -** -** 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 "qtwebenginecoreglobal_p.h" #include "content_main_delegate_qt.h" #include "content/public/app/content_main.h" -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) #include "sandbox/win/src/sandbox_types.h" #include "content/public/app/sandbox_helper_win.h" -#elif defined(OS_MAC) -#include "base/logging.h" +#elif BUILDFLAG(IS_MAC) #include "sandbox/mac/seatbelt_exec.h" #endif @@ -56,10 +19,10 @@ int processMain(int argc, const char **argv) ContentMainDelegateQt delegate; content::ContentMainParams params(&delegate); -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) HINSTANCE instance_handle = NULL; params.sandbox_info = QtWebEngineSandbox::staticSandboxInterfaceInfo(); - sandbox::SandboxInterfaceInfo sandbox_info = {0}; + sandbox::SandboxInterfaceInfo sandbox_info = {nullptr}; if (!params.sandbox_info) { content::InitializeSandboxInfo(&sandbox_info); params.sandbox_info = &sandbox_info; @@ -68,16 +31,16 @@ int processMain(int argc, const char **argv) #else params.argc = argc; params.argv = argv; -#endif // OS_WIN -#if defined(OS_MAC) +#endif // IS_WIN +#if BUILDFLAG(IS_MAC) sandbox::SeatbeltExecServer::CreateFromArgumentsResult seatbelt = sandbox::SeatbeltExecServer::CreateFromArguments(argv[0], argc, const_cast<char**>(argv)); if (seatbelt.sandbox_required) { CHECK(seatbelt.server->InitializeSandbox()); } -#endif // defined(OS_MAC) +#endif // IS_MAC - return content::ContentMain(params); + return content::ContentMain(std::move(params)); } } // namespace QtWebEngineCore diff --git a/src/core/profile_adapter.cpp b/src/core/profile_adapter.cpp index 8d2138867..e557e69a7 100644 --- a/src/core/profile_adapter.cpp +++ b/src/core/profile_adapter.cpp @@ -1,46 +1,11 @@ -/**************************************************************************** -** -** 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 "profile_adapter.h" #include "base/files/file_util.h" #include "base/task/cancelable_task_tracker.h" +#include "base/threading/thread_restrictions.h" #include "base/time/time_to_iso8601.h" #include "components/favicon/core/favicon_service.h" #include "components/history/content/browser/history_database_helper.h" @@ -74,6 +39,7 @@ #include <QCoreApplication> #include <QDir> +#include <QSet> #include <QString> #include <QStandardPaths> @@ -171,6 +137,26 @@ ProfileQt *ProfileAdapter::profile() return m_profile.data(); } +bool ProfileAdapter::ensureDataPathExists() +{ + Q_ASSERT(!m_offTheRecord); + base::ScopedAllowBlocking allowBlock; + const base::FilePath &path = toFilePath(dataPath()); + if (path.empty()) + return false; + if (base::DirectoryExists(path)) + return true; + + base::File::Error error; + if (base::CreateDirectoryAndGetError(path, &error)) + return true; + + std::string errorstr = base::File::ErrorToString(error); + qWarning("Cannot create directory %s. Error: %s.", path.AsUTF8Unsafe().c_str(), + errorstr.c_str()); + return false; +} + VisitedLinksManagerQt *ProfileAdapter::visitedLinksManager() { if (!m_visitedLinksManager) @@ -663,8 +649,8 @@ void ProfileAdapter::resetVisitedLinksManager() void ProfileAdapter::reinitializeHistoryService() { - Q_ASSERT(!m_profile->IsOffTheRecord()); - if (m_profile->ensureDirectoryExists()) { + Q_ASSERT(!m_offTheRecord); + if (ensureDataPathExists()) { favicon::FaviconService *faviconService = FaviconServiceFactoryQt::GetForBrowserContext(m_profile.data()); history::HistoryService *historyService = static_cast<history::HistoryService *>( @@ -682,7 +668,11 @@ QString ProfileAdapter::determineDownloadPath(const QString &downloadDirectory, QString suggestedFilePath = suggestedFile.absoluteFilePath(); base::FilePath tmpFilePath(toFilePath(suggestedFilePath).NormalizePathSeparatorsTo('/')); - int uniquifier = base::GetUniquePathNumber(tmpFilePath); + int uniquifier = 0; + { + base::ScopedAllowBlocking allowBlock; + uniquifier = base::GetUniquePathNumber(tmpFilePath); + } if (uniquifier > 0) suggestedFilePath = toQt(tmpFilePath.InsertBeforeExtensionASCII(base::StringPrintf(" (%d)", uniquifier)).AsUTF8Unsafe()); else if (uniquifier == -1) { diff --git a/src/core/profile_adapter.h b/src/core/profile_adapter.h index 140891150..46993f5bd 100644 --- a/src/core/profile_adapter.h +++ b/src/core/profile_adapter.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 // // W A R N I N G @@ -110,6 +74,7 @@ public: void removeDownload(quint32 downloadId); ProfileQt *profile(); + bool ensureDataPathExists(); QString storageName() const { return m_name; } void setStorageName(const QString &storageName); diff --git a/src/core/profile_adapter_client.cpp b/src/core/profile_adapter_client.cpp index 9aa084da9..b6a16c21a 100644 --- a/src/core/profile_adapter_client.cpp +++ b/src/core/profile_adapter_client.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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) 2017 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 "profile_adapter_client.h" #include "components/download/public/common/download_item.h" diff --git a/src/core/profile_adapter_client.h b/src/core/profile_adapter_client.h index 9329b504c..846346b81 100644 --- a/src/core/profile_adapter_client.h +++ b/src/core/profile_adapter_client.h @@ -1,41 +1,5 @@ - /**************************************************************************** -** -** 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 // // W A R N I N G @@ -60,6 +24,7 @@ namespace QtWebEngineCore { class WebContentsAdapterClient; +class WebEngineSettings; class UserNotificationController; class Q_WEBENGINECORE_PRIVATE_EXPORT ProfileAdapterClient @@ -144,6 +109,7 @@ public: virtual void addWebContentsAdapterClient(WebContentsAdapterClient *adapter) = 0; virtual void removeWebContentsAdapterClient(WebContentsAdapterClient *adapter) = 0; + virtual WebEngineSettings *coreSettings() const = 0; static QString downloadInterruptReasonToString(DownloadInterruptReason reason); }; diff --git a/src/core/profile_io_data_qt.cpp b/src/core/profile_io_data_qt.cpp index 24917fa81..7fd6163f2 100644 --- a/src/core/profile_io_data_qt.cpp +++ b/src/core/profile_io_data_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 "profile_io_data_qt.h" @@ -45,6 +9,7 @@ #include "content/public/browser/browser_thread.h" #include "content/public/browser/browsing_data_remover.h" #include "content/public/browser/network_service_instance.h" +#include "content/public/browser/resource_context.h" #include "content/public/browser/shared_cors_origin_access_list.h" #include "content/public/common/content_features.h" #include "net/ssl/ssl_config_service_defaults.h" @@ -58,7 +23,6 @@ #include "net/cookie_monster_delegate_qt.h" #include "net/system_network_context_manager.h" #include "profile_qt.h" -#include "resource_context_qt.h" #include "type_conversion.h" #include <QDebug> @@ -138,7 +102,7 @@ void ProfileIODataQt::initializeOnUIThread() { m_profileAdapter = m_profile->profileAdapter(); DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - m_resourceContext.reset(new ResourceContextQt(this)); + m_resourceContext.reset(new content::ResourceContext()); m_cookieDelegate = new CookieMonsterDelegateQt(); m_cookieDelegate->setClient(m_profile->profileAdapter()->cookieStore()); m_proxyConfigMonitor.reset(new ProxyConfigMonitor(m_profile->GetPrefs())); @@ -236,7 +200,6 @@ void ProfileIODataQt::ConfigureNetworkContextParams(bool in_memory, SystemNetworkContextManager::GetInstance()->ConfigureDefaultNetworkContextParams(network_context_params, cert_verifier_creation_params); - network_context_params->context_name = m_storageName.toStdString(); network_context_params->user_agent = m_httpUserAgent.toStdString(); network_context_params->accept_language = m_httpAcceptLanguage.toStdString(); @@ -247,19 +210,21 @@ void ProfileIODataQt::ConfigureNetworkContextParams(bool in_memory, network_context_params->http_cache_enabled = m_httpCacheType != ProfileAdapter::NoCache; network_context_params->http_cache_max_size = m_httpCacheMaxSize; if (m_httpCacheType == ProfileAdapter::DiskHttpCache && !m_httpCachePath.isEmpty() && !m_inMemoryOnly && !in_memory) - network_context_params->http_cache_path = toFilePath(m_httpCachePath); + network_context_params->http_cache_directory = toFilePath(m_httpCachePath); - if (m_persistentCookiesPolicy != ProfileAdapter::NoPersistentCookies && !m_inMemoryOnly && !in_memory) { - base::FilePath cookie_path = toFilePath(m_dataPath); - cookie_path = cookie_path.AppendASCII("Cookies"); - network_context_params->cookie_path = cookie_path; - - network_context_params->restore_old_session_cookies = m_persistentCookiesPolicy == ProfileAdapter::ForcePersistentCookies; - network_context_params->persist_session_cookies = m_persistentCookiesPolicy != ProfileAdapter::NoPersistentCookies; - } + network_context_params->persist_session_cookies = false; if (!m_inMemoryOnly && !in_memory) { - network_context_params->http_server_properties_path = toFilePath(m_dataPath).AppendASCII("Network Persistent State"); - network_context_params->transport_security_persister_file_path = toFilePath(m_dataPath).AppendASCII("TransportSecurity"); + network_context_params->file_paths = + network::mojom::NetworkContextFilePaths::New(); + network_context_params->file_paths->data_directory = toFilePath(m_dataPath); + network_context_params->file_paths->http_server_properties_file_name = base::FilePath::FromASCII("Network Persistent State"); + network_context_params->file_paths->transport_security_persister_file_name = base::FilePath::FromASCII("TransportSecurity"); + network_context_params->file_paths->trust_token_database_name = base::FilePath::FromASCII("Trust Tokens"); + if (m_persistentCookiesPolicy != ProfileAdapter::NoPersistentCookies) { + network_context_params->file_paths->cookie_database_name = base::FilePath::FromASCII("Cookies"); + network_context_params->restore_old_session_cookies = m_persistentCookiesPolicy == ProfileAdapter::ForcePersistentCookies; + network_context_params->persist_session_cookies = m_persistentCookiesPolicy != ProfileAdapter::NoPersistentCookies; + } } network_context_params->enforce_chrome_ct_policy = false; @@ -278,11 +243,4 @@ ProfileIODataQt *ProfileIODataQt::FromBrowserContext(content::BrowserContext *br return static_cast<ProfileQt *>(browser_context)->m_profileIOData.get(); } -// static -ProfileIODataQt *ProfileIODataQt::FromResourceContext(content::ResourceContext *resource_context) -{ - Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); - return static_cast<ResourceContextQt *>(resource_context)->m_io_data; -} - } // namespace QtWebEngineCore diff --git a/src/core/profile_io_data_qt.h b/src/core/profile_io_data_qt.h index 6bd555dbf..430efedb4 100644 --- a/src/core/profile_io_data_qt.h +++ b/src/core/profile_io_data_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 #ifndef PROFILE_IO_DATA_QT_H #define PROFILE_IO_DATA_QT_H @@ -117,7 +81,6 @@ public: #endif std::unique_ptr<net::ClientCertStore> CreateClientCertStore(); static ProfileIODataQt *FromBrowserContext(content::BrowserContext *browser_context); - static ProfileIODataQt *FromResourceContext(content::ResourceContext *resource_context); base::WeakPtr<ProfileIODataQt> getWeakPtrOnIOThread(); @@ -148,7 +111,6 @@ private: QString m_dataPath; bool m_clearHttpCacheInProgress = false; base::WeakPtrFactory<ProfileIODataQt> m_weakPtrFactory; // this should be always the last member - DISALLOW_COPY_AND_ASSIGN(ProfileIODataQt); friend class BrowsingDataRemoverObserverQt; }; diff --git a/src/core/profile_qt.cpp b/src/core/profile_qt.cpp index ae210b6c8..9820ca787 100644 --- a/src/core/profile_qt.cpp +++ b/src/core/profile_qt.cpp @@ -1,47 +1,12 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 "profile_qt.h" #include "profile_adapter.h" #include "browsing_data_remover_delegate_qt.h" #include "download_manager_delegate_qt.h" +#include "file_system_access/file_system_access_permission_context_factory_qt.h" #include "net/ssl_host_state_delegate_qt.h" #include "permission_manager_qt.h" #include "platform_notification_service_qt.h" @@ -68,6 +33,7 @@ #include "components/prefs/pref_service_factory.h" #include "components/prefs/pref_registry_simple.h" #include "components/user_prefs/user_prefs.h" +#include "components/profile_metrics/browser_profile_type.h" #include "components/proxy_config/pref_proxy_config_tracker_impl.h" #include "chrome/common/pref_names.h" #if QT_CONFIG(webengine_spellchecker) @@ -128,6 +94,11 @@ const PrefService* ProfileQt::GetPrefs() const return m_prefServiceAdapter.prefService(); } +bool ProfileQt::IsNewProfile() const +{ + return GetPrefs()->GetInitializationStatus() == PrefService::INITIALIZATION_STATUS_CREATED_NEW_PREF_STORE; +} + base::FilePath ProfileQt::GetPath() { return toFilePath(m_profileAdapter->dataPath()); @@ -240,8 +211,18 @@ std::string ProfileQt::GetMediaDeviceIDSalt() return m_prefServiceAdapter.mediaDeviceIdSalt(); } +content::FileSystemAccessPermissionContext *ProfileQt::GetFileSystemAccessPermissionContext() +{ + return FileSystemAccessPermissionContextFactoryQt::GetForProfile(this); +} + void ProfileQt::setupPrefService() { + profile_metrics::SetBrowserProfileType(this, + IsOffTheRecord() + ? profile_metrics::BrowserProfileType::kIncognito + : profile_metrics::BrowserProfileType::kRegular); + // Remove previous handler before we set a new one or we will assert // TODO: Remove in Qt6 if (m_prefServiceAdapter.prefService() != nullptr) { @@ -262,29 +243,11 @@ const PrefServiceAdapter &ProfileQt::prefServiceAdapter() const return m_prefServiceAdapter; } - -content::PlatformNotificationService *ProfileQt::platformNotificationService() +content::PlatformNotificationService *ProfileQt::GetPlatformNotificationService() { if (!m_platformNotificationService) m_platformNotificationService = std::make_unique<PlatformNotificationServiceQt>(this); return m_platformNotificationService.get(); } -bool ProfileQt::ensureDirectoryExists() -{ - const base::FilePath &path = GetPath(); - - if (base::PathExists(path)) - return true; - - base::File::Error error; - if (base::CreateDirectoryAndGetError(path, &error)) - return true; - - std::string errorstr = base::File::ErrorToString(error); - qWarning("Cannot create directory %s. Error: %s.", path.AsUTF8Unsafe().c_str(), - errorstr.c_str()); - return false; -} - } // namespace QtWebEngineCore diff --git a/src/core/profile_qt.h b/src/core/profile_qt.h index 61453e426..2f8ff3255 100644 --- a/src/core/profile_qt.h +++ b/src/core/profile_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef PROFILE_QT_H #define PROFILE_QT_H @@ -89,17 +53,18 @@ public: content::BrowsingDataRemoverDelegate *GetBrowsingDataRemoverDelegate() override; content::ClientHintsControllerDelegate *GetClientHintsControllerDelegate() override; content::StorageNotificationService *GetStorageNotificationService() override; + content::PlatformNotificationService *GetPlatformNotificationService() override; std::string GetMediaDeviceIDSalt() override; + content::FileSystemAccessPermissionContext *GetFileSystemAccessPermissionContext() override; // Profile implementation: PrefService *GetPrefs() override; const PrefService *GetPrefs() const override; + bool IsNewProfile() const override; void Initialize(); ProfileAdapter *profileAdapter() { return m_profileAdapter; } - content::PlatformNotificationService *platformNotificationService(); - #if QT_CONFIG(webengine_spellchecker) void FailedToLoadDictionary(const std::string &language) override; #endif @@ -114,7 +79,6 @@ public: PrefServiceAdapter &prefServiceAdapter(); const PrefServiceAdapter &prefServiceAdapter() const; - bool ensureDirectoryExists(); private: std::unique_ptr<BrowsingDataRemoverDelegateQt> m_removerDelegate; @@ -131,8 +95,6 @@ private: friend class ProfileAdapter; friend class ProfileIODataQt; - - DISALLOW_COPY_AND_ASSIGN(ProfileQt); }; } // namespace QtWebEngineCore diff --git a/src/core/quota_permission_context_qt.cpp b/src/core/quota_permission_context_qt.cpp index 549414d33..5ace64b62 100644 --- a/src/core/quota_permission_context_qt.cpp +++ b/src/core/quota_permission_context_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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) 2017 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 "quota_permission_context_qt.h" diff --git a/src/core/quota_permission_context_qt.h b/src/core/quota_permission_context_qt.h index 528928c1a..665f046cd 100644 --- a/src/core/quota_permission_context_qt.h +++ b/src/core/quota_permission_context_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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) 2017 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 #ifndef QUOTA_PERMISSION_CONTEXT_QT_H #define QUOTA_PERMISSION_CONTEXT_QT_H diff --git a/src/core/quota_request_controller.h b/src/core/quota_request_controller.h index 0bb0cbff3..d39a209d3 100644 --- a/src/core/quota_request_controller.h +++ b/src/core/quota_request_controller.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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) 2017 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 #ifndef QUOTA_REQUEST_CONTROLLER_H #define QUOTA_REQUEST_CONTROLLER_H diff --git a/src/core/quota_request_controller_impl.cpp b/src/core/quota_request_controller_impl.cpp index ea2526d45..32d7a6d63 100644 --- a/src/core/quota_request_controller_impl.cpp +++ b/src/core/quota_request_controller_impl.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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) 2017 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 "quota_request_controller_impl.h" diff --git a/src/core/quota_request_controller_impl.h b/src/core/quota_request_controller_impl.h index 65e661694..a9a002380 100644 --- a/src/core/quota_request_controller_impl.h +++ b/src/core/quota_request_controller_impl.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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) 2017 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 #ifndef QUOTA_REQUEST_CONTROLLER_IMPL_H #define QUOTA_REQUEST_CONTROLLER_IMPL_H diff --git a/src/core/register_protocol_handler_request_controller.h b/src/core/register_protocol_handler_request_controller.h deleted file mode 100644 index 2f9c9fc49..000000000 --- a/src/core/register_protocol_handler_request_controller.h +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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$ -** -****************************************************************************/ - -#ifndef REGISTER_PROTOCOL_HANDLER_REQUEST_CONTROLLER_H -#define REGISTER_PROTOCOL_HANDLER_REQUEST_CONTROLLER_H - -#include "request_controller.h" - -namespace QtWebEngineCore { - -class RegisterProtocolHandlerRequestController : public RequestController { -public: - RegisterProtocolHandlerRequestController(QUrl origin, QString scheme) - : RequestController(std::move(origin)) - , m_scheme(std::move(scheme)) - {} - - QString scheme() const { return m_scheme; } - -private: - QString m_scheme; -}; - -} // namespace QtWebEngineCore - -#endif // REGISTER_PROTOCOL_HANDLER_REQUEST_CONTROLLER_H diff --git a/src/core/register_protocol_handler_request_controller_impl.cpp b/src/core/register_protocol_handler_request_controller_impl.cpp deleted file mode 100644 index 0f24d8812..000000000 --- a/src/core/register_protocol_handler_request_controller_impl.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 "register_protocol_handler_request_controller_impl.h" - -#include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" -#include "content/public/browser/web_contents.h" -#include "type_conversion.h" - -namespace QtWebEngineCore { - -RegisterProtocolHandlerRequestControllerImpl::RegisterProtocolHandlerRequestControllerImpl( - content::WebContents *webContents, - ProtocolHandler handler) - : RegisterProtocolHandlerRequestController( - toQt(handler.url()), - toQt(handler.protocol())) - , content::WebContentsObserver(webContents) - , m_handler(handler) -{} - -RegisterProtocolHandlerRequestControllerImpl::~RegisterProtocolHandlerRequestControllerImpl() -{ - reject(); -} - -ProtocolHandlerRegistry *RegisterProtocolHandlerRequestControllerImpl::protocolHandlerRegistry() -{ - content::WebContents *webContents = web_contents(); - if (!webContents) - return nullptr; - content::BrowserContext *context = webContents->GetBrowserContext(); - return ProtocolHandlerRegistryFactory::GetForBrowserContext(context); -} - -void RegisterProtocolHandlerRequestControllerImpl::accepted() -{ - if (ProtocolHandlerRegistry *registry = protocolHandlerRegistry()) - registry->OnAcceptRegisterProtocolHandler(m_handler); -} - -void RegisterProtocolHandlerRequestControllerImpl::rejected() -{ - if (ProtocolHandlerRegistry *registry = protocolHandlerRegistry()) - registry->OnIgnoreRegisterProtocolHandler(m_handler); -} - -} // namespace QtWebEngineCore diff --git a/src/core/register_protocol_handler_request_controller_impl.h b/src/core/register_protocol_handler_request_controller_impl.h deleted file mode 100644 index 64f229ac4..000000000 --- a/src/core/register_protocol_handler_request_controller_impl.h +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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$ -** -****************************************************************************/ - -#ifndef REGISTER_PROTOCOL_HANDLER_REQUEST_CONTROLLER_IMPL_H -#define REGISTER_PROTOCOL_HANDLER_REQUEST_CONTROLLER_IMPL_H - -#include "register_protocol_handler_request_controller.h" - -#include "chrome/browser/custom_handlers/protocol_handler_registry.h" -#include "chrome/common/custom_handlers/protocol_handler.h" -#include "content/public/browser/web_contents_observer.h" - -class ProtocolHandlerRegistry; - -namespace QtWebEngineCore { - -class RegisterProtocolHandlerRequestControllerImpl final : public RegisterProtocolHandlerRequestController, - private content::WebContentsObserver { -public: - RegisterProtocolHandlerRequestControllerImpl( - content::WebContents *webContents, - ProtocolHandler handler); - - ~RegisterProtocolHandlerRequestControllerImpl(); - -protected: - void accepted() override; - void rejected() override; - -private: - ProtocolHandlerRegistry *protocolHandlerRegistry(); - ProtocolHandler m_handler; -}; - -} // namespace QtWebEngineCore - -#endif // REGISTER_PROTOCOL_HANDLER_REQUEST_CONTROLLER_IMPL_H diff --git a/src/core/render_view_context_menu_qt.cpp b/src/core/render_view_context_menu_qt.cpp index 47c8a6e32..b7aabfd5b 100644 --- a/src/core/render_view_context_menu_qt.cpp +++ b/src/core/render_view_context_menu_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 <QtCore/QCoreApplication> #include "render_view_context_menu_qt.h" diff --git a/src/core/render_view_context_menu_qt.h b/src/core/render_view_context_menu_qt.h index f818ce200..b7f6744cd 100644 --- a/src/core/render_view_context_menu_qt.h +++ b/src/core/render_view_context_menu_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 // // W A R N I N G diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index f2de01d6d..dfbbe72e7 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -1,42 +1,5 @@ - -/**************************************************************************** -** -** 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 "render_widget_host_view_qt.h" @@ -83,8 +46,8 @@ #endif #if defined(USE_AURA) +#include "ui/aura/cursor/cursors_aura.h" #include "ui/base/cursor/cursor_size.h" -#include "ui/base/cursor/cursors_aura.h" #endif #if defined(Q_OS_MACOS) @@ -129,16 +92,27 @@ static inline ui::GestureProvider::Config QtGestureProviderConfig() { extern display::Display toDisplayDisplay(int id, const QScreen *screen); -static display::ScreenInfo screenInfoFromQScreen(QScreen *screen) +static display::ScreenInfos screenInfosFromQtForUpdate(QScreen *currentScreen) { - display::ScreenInfo r; - if (!screen) - screen = qApp->primaryScreen(); - if (screen) - display::DisplayUtil::DisplayToScreenInfo(&r, toDisplayDisplay(0, screen)); - else - r.device_scale_factor = qGuiApp->devicePixelRatio(); - return r; + display::ScreenInfo screenInfo; + const auto &screens = qApp->screens(); + if (screens.isEmpty()) { + screenInfo.device_scale_factor = qGuiApp->devicePixelRatio(); + return display::ScreenInfos(screenInfo); + } + + Q_ASSERT(qApp->primaryScreen() == screens.first()); + display::ScreenInfos result; + for (int i = 0; i < screens.length(); ++i) { + display::DisplayUtil::DisplayToScreenInfo(&screenInfo, toDisplayDisplay(i, screens.at(i))); + result.screen_infos.push_back(screenInfo); + if (currentScreen == screens.at(i)) + result.current_display_id = i; + } + + Q_ASSERT(result.current_display_id != display::kInvalidDisplayId); + + return result; } // An minimal override to support progressing flings @@ -226,11 +200,7 @@ RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost *widget m_cursorManager.reset(new content::CursorManager(this)); m_touchSelectionControllerClient.reset(new TouchSelectionControllerClientQt(this)); - ui::TouchSelectionController::Config config; - config.max_tap_duration = base::TimeDelta::FromMilliseconds(ui::GestureConfiguration::GetInstance()->long_press_time_in_ms()); - config.tap_slop = ui::GestureConfiguration::GetInstance()->max_touch_move_in_pixels_for_click(); - config.enable_longpress_drag_selection = false; - m_touchSelectionController.reset(new ui::TouchSelectionController(m_touchSelectionControllerClient.get(), config)); + resetTouchSelectionController(); host()->render_frame_metadata_provider()->AddObserver(this); host()->render_frame_metadata_provider()->ReportAllFrameSubmissionsForTesting(true); @@ -275,7 +245,7 @@ void RenderWidgetHostViewQt::setAdapterClient(WebContentsAdapterClient *adapterC m_adapterClient = nullptr; }); } -void RenderWidgetHostViewQt::setGuest(content::RenderWidgetHostImpl *rwh) +void RenderWidgetHostViewQt::addGuest(content::RenderWidgetHost *rwh) { rwh->AddInputEventObserver(m_guestInputEventObserver.get()); } @@ -284,8 +254,9 @@ void RenderWidgetHostViewQt::InitAsChild(gfx::NativeView) { } -void RenderWidgetHostViewQt::InitAsPopup(content::RenderWidgetHostView*, const gfx::Rect& rect) +void RenderWidgetHostViewQt::InitAsPopup(content::RenderWidgetHostView*, const gfx::Rect& rect, const gfx::Rect& anchorRect) { + Q_UNUSED(anchorRect); m_delegate->initAsPopup(toQt(rect)); } @@ -367,8 +338,9 @@ void RenderWidgetHostViewQt::CopyFromSurface(const gfx::Rect &src_rect, m_delegatedFrameHost->CopyFromCompositingSurface(src_rect, output_size, std::move(callback)); } -void RenderWidgetHostViewQt::Show() +void RenderWidgetHostViewQt::ShowWithVisibility(content::PageVisibilityState page_visibility) { + Q_ASSERT(page_visibility != content::PageVisibilityState::kHidden); if (m_delegate) m_delegate->show(); else @@ -441,13 +413,13 @@ bool RenderWidgetHostViewQt::updateCursorFromResource(ui::mojom::CursorType type { int resourceId; // GetCursorDataFor only knows hotspots for 1x and 2x cursor images, in physical pixels. - qreal hotspotDpr = m_screenInfo.device_scale_factor <= 1.0f ? 1.0f : 2.0f; + qreal hotspotDpr = GetScreenInfo().device_scale_factor <= 1.0f ? 1.0f : 2.0f; qreal hotX; qreal hotY; #if defined(USE_AURA) gfx::Point hotspot; - if (!ui::GetCursorDataFor(ui::CursorSize::kNormal, type, hotspotDpr, &resourceId, &hotspot)) + if (!aura::GetCursorDataFor(ui::CursorSize::kNormal, type, hotspotDpr, &resourceId, &hotspot)) return false; hotX = hotspot.x(); hotY = hotspot.y(); @@ -488,7 +460,7 @@ bool RenderWidgetHostViewQt::updateCursorFromResource(ui::mojom::CursorType type if (!imageSkia) return false; - QImage imageQt = toQImage(imageSkia->GetRepresentation(m_screenInfo.device_scale_factor)); + QImage imageQt = toQImage(imageSkia->GetRepresentation(GetScreenInfo().device_scale_factor)); // Convert hotspot coordinates into device-independent pixels. hotX /= hotspotDpr; @@ -680,11 +652,6 @@ void RenderWidgetHostViewQt::UpdateTooltip(const std::u16string &tooltip_text) m_adapterClient->setToolTip(toQt(tooltip_text)); } -void RenderWidgetHostViewQt::GetScreenInfo(display::ScreenInfo *results) -{ - *results = m_screenInfo; -} - gfx::Rect RenderWidgetHostViewQt::GetBoundsInRootWindow() { return toGfx(delegateClient()->windowRectInDips()); @@ -889,11 +856,17 @@ bool RenderWidgetHostViewQt::isPopup() const bool RenderWidgetHostViewQt::updateScreenInfo() { - display::ScreenInfo oldScreenInfo = m_screenInfo; - QScreen *screen = m_delegate->window() ? m_delegate->window()->screen() : nullptr; - m_screenInfo = screenInfoFromQScreen(screen); - return (m_screenInfo != oldScreenInfo); + QWindow *window = m_delegate->Window(); + if (!window) + return false; + + display::ScreenInfos newScreenInfos = screenInfosFromQtForUpdate(window->screen()); + if (screen_infos_ == newScreenInfos) + return false; + + screen_infos_ = std::move(newScreenInfos); + return true; } void RenderWidgetHostViewQt::handleWheelEvent(QWheelEvent *event) @@ -1030,7 +1003,7 @@ void RenderWidgetHostViewQt::OnRenderFrameMetadataChangedAfterActivation(base::T m_touchSelectionControllerClient->UpdateClientSelectionBounds(m_selectionStart, m_selectionEnd); } - gfx::Vector2dF scrollOffset = metadata.root_scroll_offset.value_or(gfx::Vector2dF()); + gfx::PointF scrollOffset = metadata.root_scroll_offset.value_or(gfx::PointF()); gfx::SizeF contentsSize = metadata.root_layer_size; std::swap(m_lastScrollOffset, scrollOffset); std::swap(m_lastContentsSize, contentsSize); @@ -1052,7 +1025,7 @@ void RenderWidgetHostViewQt::synchronizeVisualProperties(const absl::optional<vi m_rootLayer->SetBounds(gfx::Rect(gfx::Point(), viewSizeInPixels)); m_uiCompositorLocalSurfaceIdAllocator.GenerateId(); m_uiCompositor->SetScaleAndSize( - m_screenInfo.device_scale_factor, + GetScreenInfo().device_scale_factor, viewSizeInPixels, m_uiCompositorLocalSurfaceIdAllocator.GetCurrentLocalSurfaceId()); m_delegatedFrameHost->EmbedSurface( @@ -1063,6 +1036,17 @@ void RenderWidgetHostViewQt::synchronizeVisualProperties(const absl::optional<vi host()->SynchronizeVisualProperties(); } +void RenderWidgetHostViewQt::resetTouchSelectionController() +{ + Q_ASSERT(m_touchSelectionControllerClient); + m_touchSelectionControllerClient->resetControls(); + ui::TouchSelectionController::Config config; + config.max_tap_duration = base::Milliseconds(ui::GestureConfiguration::GetInstance()->long_press_time_in_ms()); + config.tap_slop = ui::GestureConfiguration::GetInstance()->max_touch_move_in_pixels_for_click(); + config.enable_longpress_drag_selection = false; + m_touchSelectionController.reset(new ui::TouchSelectionController(m_touchSelectionControllerClient.get(), config)); +} + std::unique_ptr<content::SyntheticGestureTarget> RenderWidgetHostViewQt::CreateSyntheticGestureTarget() { return nullptr; diff --git a/src/core/render_widget_host_view_qt.h b/src/core/render_widget_host_view_qt.h index d3062ee71..bdc0efc24 100644 --- a/src/core/render_widget_host_view_qt.h +++ b/src/core/render_widget_host_view_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef RENDER_WIDGET_HOST_VIEW_QT_H #define RENDER_WIDGET_HOST_VIEW_QT_H @@ -90,10 +54,10 @@ public: WebContentsAdapterClient *adapterClient() { return m_adapterClient; } void setAdapterClient(WebContentsAdapterClient *adapterClient); RenderWidgetHostViewQtDelegateClient *delegateClient() const { return m_delegateClient.get(); } - void setGuest(content::RenderWidgetHostImpl *); + void addGuest(content::RenderWidgetHost *); void InitAsChild(gfx::NativeView) override; - void InitAsPopup(content::RenderWidgetHostView*, const gfx::Rect&) override; + void InitAsPopup(content::RenderWidgetHostView*, const gfx::Rect&, const gfx::Rect&) override; void SetSize(const gfx::Size& size) override; void SetBounds(const gfx::Rect&) override; gfx::NativeView GetNativeView() override; @@ -106,7 +70,7 @@ public: void CopyFromSurface(const gfx::Rect &src_rect, const gfx::Size &output_size, base::OnceCallback<void(const SkBitmap &)> callback) override; - void Show() override; + void ShowWithVisibility(content::PageVisibilityState page_visibility) override; void Hide() override; bool IsShowing() override; gfx::Rect GetViewBounds() override; @@ -136,7 +100,6 @@ public: void OnDidUpdateVisualPropertiesComplete(const cc::RenderFrameMetadata &metadata); // Overridden from RenderWidgetHostViewBase: - void GetScreenInfo(display::ScreenInfo *screen_info) override; gfx::Rect GetBoundsInRootWindow() override; void ProcessAckedTouchEvent(const content::TouchEventWithLatencyInfo &touch, blink::mojom::InputEventResultState ack_result) override; @@ -155,7 +118,7 @@ public: ui::Compositor *GetCompositor() override; absl::optional<content::DisplayFeature> GetDisplayFeature() override; void SetDisplayFeatureForTesting(const content::DisplayFeature*) override; -#if defined(OS_MAC) +#if BUILDFLAG(IS_MAC) void ShowSharePicker( const std::string &title, const std::string &text, @@ -166,7 +129,11 @@ public: void SpeakSelection() override { QT_NOT_YET_IMPLEMENTED } void ShowDefinitionForSelection() override { QT_NOT_YET_IMPLEMENTED } void SetWindowFrameInScreen(const gfx::Rect&) override { QT_NOT_YET_IMPLEMENTED } -#endif // defined(OS_MAC) +#endif // BUILDFLAG(IS_MAC) + void NotifyHostAndDelegateOnWasShown(blink::mojom::RecordContentToVisibleTimeRequestPtr) override { QT_NOT_YET_IMPLEMENTED } + void RequestPresentationTimeFromHostOrDelegate(blink::mojom::RecordContentToVisibleTimeRequestPtr) override { QT_NOT_YET_IMPLEMENTED } + void CancelPresentationTimeRequestForHostAndDelegate() override { QT_NOT_YET_IMPLEMENTED } + // Overridden from ui::GestureProviderClient. void OnGestureEvent(const ui::GestureEventData& gesture) override; @@ -196,7 +163,7 @@ public: // Called from WebContentsAdapter. gfx::SizeF lastContentsSize() const { return m_lastContentsSize; } - gfx::Vector2dF lastScrollOffset() const { return m_lastScrollOffset; } + gfx::PointF lastScrollOffset() const { return m_lastScrollOffset; } ui::TouchSelectionController *getTouchSelectionController() const { return m_touchSelectionController.get(); } TouchSelectionControllerClientQt *getTouchSelectionControllerClient() const { return m_touchSelectionControllerClient.get(); } @@ -206,6 +173,8 @@ public: void synchronizeVisualProperties( const absl::optional<viz::LocalSurfaceId> &childSurfaceId); + void resetTouchSelectionController(); + private: friend class DelegatedFrameHostClientQt; friend class WebContentsAccessibilityQt; @@ -231,12 +200,11 @@ private: bool m_isMouseLocked = false; bool m_visible = false; bool m_deferredShow = false; - gfx::Vector2dF m_lastScrollOffset; + gfx::PointF m_lastScrollOffset; gfx::SizeF m_lastContentsSize; DelegatedFrameHostClientQt m_delegatedFrameHostClient { this }; // VIZ - display::ScreenInfo m_screenInfo; std::unique_ptr<content::DelegatedFrameHost> m_delegatedFrameHost; std::unique_ptr<ui::Layer> m_rootLayer; std::unique_ptr<ui::Compositor> m_uiCompositor; diff --git a/src/core/render_widget_host_view_qt_delegate.h b/src/core/render_widget_host_view_qt_delegate.h index 1df1322c7..649fda77b 100644 --- a/src/core/render_widget_host_view_qt_delegate.h +++ b/src/core/render_widget_host_view_qt_delegate.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 // // W A R N I N G @@ -78,7 +42,7 @@ public: virtual void show() = 0; virtual void hide() = 0; virtual bool isVisible() const = 0; - virtual QWindow* window() const = 0; + virtual QWindow *Window() const = 0; virtual void updateCursor(const QCursor &) = 0; virtual void resize(int width, int height) = 0; virtual void move(const QPoint &) = 0; @@ -86,6 +50,7 @@ public: virtual void setInputMethodHints(Qt::InputMethodHints hints) = 0; virtual void setClearColor(const QColor &color) = 0; virtual void adapterClientChanged(WebContentsAdapterClient *client) = 0; + virtual void updateAdapterClientIfNeeded(WebContentsAdapterClient *client) = 0; virtual void unhandledWheelEvent(QWheelEvent *) {} }; diff --git a/src/core/render_widget_host_view_qt_delegate_client.cpp b/src/core/render_widget_host_view_qt_delegate_client.cpp index 85facb22a..b192caf7f 100644 --- a/src/core/render_widget_host_view_qt_delegate_client.cpp +++ b/src/core/render_widget_host_view_qt_delegate_client.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 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) 2020 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 "render_widget_host_view_qt_delegate_client.h" @@ -53,6 +17,7 @@ #include <QEvent> #include <QInputMethodEvent> #include <QScopeGuard> +#include <QSet> #include <QSGNode> #include <QStyleHints> #include <QTextFormat> @@ -245,7 +210,7 @@ bool RenderWidgetHostViewQtDelegateClient::forwardEvent(QEvent *event) switch (event->type()) { case QEvent::ShortcutOverride: { QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event); - + event->ignore(); auto acceptKeyOutOfInputField = [](QKeyEvent *keyEvent) -> bool { #ifdef Q_OS_MACOS // Check if a shortcut is registered for this key sequence. @@ -511,6 +476,9 @@ void RenderWidgetHostViewQtDelegateClient::handleKeyEvent(QKeyEvent *event) if (event->type() == QEvent::KeyRelease && event->isAutoRepeat()) return; + if (!m_rwhv->GetFocusedWidget()) + return; + content::NativeWebKeyboardEvent webEvent = WebEventFactory::toWebKeyboardEvent(event); if (webEvent.GetType() == blink::WebInputEvent::Type::kRawKeyDown && !m_editCommand.empty()) { ui::LatencyInfo latency; @@ -554,10 +522,10 @@ void RenderWidgetHostViewQtDelegateClient::handleTouchEvent(QTouchEvent *event) // Calculate a delta between event timestamps and Now() on the first received event, and // apply this delta to all successive events. This delta is most likely smaller than it // should by calculating it here but this will hopefully cause less than one frame of delay. - base::TimeTicks eventTimestamp = base::TimeTicks() + base::TimeDelta::FromMilliseconds(event->timestamp()); + base::TimeTicks eventTimestamp = base::TimeTicks() + base::Milliseconds(event->timestamp()); if (m_eventsToNowDelta == 0) m_eventsToNowDelta = (base::TimeTicks::Now() - eventTimestamp).InMicroseconds(); - eventTimestamp += base::TimeDelta::FromMicroseconds(m_eventsToNowDelta); + eventTimestamp += base::Microseconds(m_eventsToNowDelta); auto touchPoints = mapTouchPointIds(event->touchPoints()); // Make sure that POINTER_DOWN action is delivered before MOVE, and MOVE before POINTER_UP diff --git a/src/core/render_widget_host_view_qt_delegate_client.h b/src/core/render_widget_host_view_qt_delegate_client.h index c56acfcfe..0616dbc96 100644 --- a/src/core/render_widget_host_view_qt_delegate_client.h +++ b/src/core/render_widget_host_view_qt_delegate_client.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 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) 2020 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 // // W A R N I N G @@ -53,6 +17,7 @@ #include "compositor/compositor.h" +#include <QMap> #include <QtGui/QCursor> #include <QtGui/QTouchEvent> diff --git a/src/core/render_widget_host_view_qt_delegate_item.cpp b/src/core/render_widget_host_view_qt_delegate_item.cpp new file mode 100644 index 000000000..f6962da14 --- /dev/null +++ b/src/core/render_widget_host_view_qt_delegate_item.cpp @@ -0,0 +1,413 @@ +// 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 "render_widget_host_view_qt_delegate_item.h" + +#include "render_widget_host_view_qt_delegate_client.h" + +#include <QGuiApplication> +#include <QMouseEvent> +#include <QSGImageNode> +#include <QWindow> + +namespace QtWebEngineCore { + +RenderWidgetHostViewQtDelegateItem::RenderWidgetHostViewQtDelegateItem(RenderWidgetHostViewQtDelegateClient *client, bool isPopup) + : m_client(client) + , m_isPopup(isPopup) +{ + setFlag(ItemHasContents); + setAcceptedMouseButtons(Qt::AllButtons); + setAcceptHoverEvents(true); + setAcceptTouchEvents(true); + if (!isPopup) { + setFocus(true); + setActiveFocusOnTab(true); + } + bind(client->compositorId()); +} + +RenderWidgetHostViewQtDelegateItem::~RenderWidgetHostViewQtDelegateItem() +{ + if (m_widgetDelegate) { + m_widgetDelegate->Unbind(); + m_widgetDelegate->Destroy(); + } +} + +void RenderWidgetHostViewQtDelegateItem::initAsPopup(const QRect &screenRect) +{ + Q_ASSERT(m_isPopup); + setSize(screenRect.size()); + if (m_widgetDelegate) + m_widgetDelegate->InitAsPopup(screenRect); +} + +QRectF RenderWidgetHostViewQtDelegateItem::viewGeometry() const +{ + // Transform the entire rect to find the correct top left corner. + const QPointF p1 = mapToGlobal(mapFromScene(QPointF(0, 0))); + const QPointF p2 = mapToGlobal(mapFromScene(QPointF(width(), height()))); + QRectF geometry = QRectF(p1, p2).normalized(); + // But keep the size untransformed to behave like other QQuickItems. + geometry.setSize(size()); + return geometry; +} + +QRect RenderWidgetHostViewQtDelegateItem::windowGeometry() const +{ + if (!Window()) + return QRect(); + return Window()->frameGeometry(); +} + +void RenderWidgetHostViewQtDelegateItem::setKeyboardFocus() +{ + setFocus(true); +} + +bool RenderWidgetHostViewQtDelegateItem::hasKeyboardFocus() +{ + return hasActiveFocus(); +} + +void RenderWidgetHostViewQtDelegateItem::lockMouse() +{ + grabMouse(); +} + +void RenderWidgetHostViewQtDelegateItem::unlockMouse() +{ + ungrabMouse(); +} + +void RenderWidgetHostViewQtDelegateItem::show() +{ + if (isVisible()) + m_client->notifyShown(); + else + setVisible(true); +} + +void RenderWidgetHostViewQtDelegateItem::hide() +{ + if (isVisible()) + setVisible(false); + else + m_client->notifyHidden(); +} + +bool RenderWidgetHostViewQtDelegateItem::isVisible() const +{ + return QQuickItem::isVisible(); +} + +QWindow *RenderWidgetHostViewQtDelegateItem::Window() const +{ + if (m_widgetDelegate) { + if (auto *window = m_widgetDelegate->Window()) + return window; + } + return QQuickItem::window(); +} + +void RenderWidgetHostViewQtDelegateItem::readyToSwap() +{ + // Call update() on UI thread. + QMetaObject::invokeMethod(this, &QQuickItem::update, Qt::QueuedConnection); +} + +void RenderWidgetHostViewQtDelegateItem::updateCursor(const QCursor &cursor) +{ + setCursor(cursor); +} + +void RenderWidgetHostViewQtDelegateItem::resize(int width, int height) +{ + setSize(QSizeF(width, height)); + if (m_widgetDelegate) + m_widgetDelegate->Resize(width, height); +} + +void RenderWidgetHostViewQtDelegateItem::move(const QPoint &point) +{ + if (m_widgetDelegate && m_isPopup) + m_widgetDelegate->MoveWindow(point); +} + +void RenderWidgetHostViewQtDelegateItem::inputMethodStateChanged(bool editorVisible, bool passwordInput) +{ + setFlag(QQuickItem::ItemAcceptsInputMethod, editorVisible && !passwordInput); + + if (parentItem()) + parentItem()->setFlag(QQuickItem::ItemAcceptsInputMethod, editorVisible && !passwordInput); + + if (m_widgetDelegate) + m_widgetDelegate->SetInputMethodEnabled(editorVisible && !passwordInput); + + qApp->inputMethod()->update(Qt::ImQueryInput | Qt::ImEnabled | Qt::ImHints); + if (qApp->inputMethod()->isVisible() != editorVisible) + qApp->inputMethod()->setVisible(editorVisible); +} + +void RenderWidgetHostViewQtDelegateItem::setWidgetDelegate(WidgetDelegate *delegate) +{ + Q_ASSERT(!m_widgetDelegate || !delegate); + m_widgetDelegate = delegate; + if (m_widgetDelegate) { + if (m_inputMethodHints) + m_widgetDelegate->SetInputMethodHints(m_inputMethodHints); + if (m_clearColor.isValid()) + m_widgetDelegate->SetClearColor(m_clearColor); + if (flags().testFlag(QQuickItem::ItemAcceptsInputMethod)) + m_widgetDelegate->SetInputMethodEnabled(true); + if (m_adapterClient) + m_widgetDelegate->Bind(m_adapterClient); + } +} + +void RenderWidgetHostViewQtDelegateItem::setInputMethodHints(Qt::InputMethodHints hints) +{ + m_inputMethodHints = hints; + if (m_widgetDelegate) + m_widgetDelegate->SetInputMethodHints(hints); +} + +void RenderWidgetHostViewQtDelegateItem::setClearColor(const QColor &color) +{ + m_clearColor = color; + if (m_widgetDelegate) + m_widgetDelegate->SetClearColor(color); +} + +bool RenderWidgetHostViewQtDelegateItem::event(QEvent *event) +{ + if (event->type() == QEvent::ShortcutOverride) + return m_client->forwardEvent(event); + +#if QT_CONFIG(gestures) + if (event->type() == QEvent::NativeGesture) + return m_client->forwardEvent(event); +#endif + + return QQuickItem::event(event); +} + +void RenderWidgetHostViewQtDelegateItem::focusInEvent(QFocusEvent *event) +{ +#if QT_CONFIG(accessibility) + if (QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(this)) { + if (auto *focusChild = iface->focusChild()) { + QAccessibleEvent focusEvent(focusChild, QAccessible::Focus); + QAccessible::updateAccessibility(&focusEvent); + } + } +#endif // QT_CONFIG(accessibility) + + m_client->forwardEvent(event); +} + +void RenderWidgetHostViewQtDelegateItem::focusOutEvent(QFocusEvent *event) +{ + m_client->forwardEvent(event); +} + +void RenderWidgetHostViewQtDelegateItem::mousePressEvent(QMouseEvent *event) +{ + if (!m_isPopup && m_widgetDelegate) { + if (m_widgetDelegate->ActiveFocusOnPress()) { + forceActiveFocus(); + } else { + event->ignore(); + return; + } + } + m_client->forwardEvent(event); +} + +void RenderWidgetHostViewQtDelegateItem::mouseMoveEvent(QMouseEvent *event) +{ + if (!m_isPopup && m_widgetDelegate && !m_widgetDelegate->ActiveFocusOnPress()) { + event->ignore(); + return; + } + m_client->forwardEvent(event); +} + +void RenderWidgetHostViewQtDelegateItem::mouseReleaseEvent(QMouseEvent *event) +{ + if (!m_isPopup && m_widgetDelegate && !m_widgetDelegate->ActiveFocusOnPress()) { + event->ignore(); + return; + } + m_client->forwardEvent(event); +} + +void RenderWidgetHostViewQtDelegateItem::keyPressEvent(QKeyEvent *event) +{ + m_client->forwardEvent(event); +} + +void RenderWidgetHostViewQtDelegateItem::keyReleaseEvent(QKeyEvent *event) +{ + m_client->forwardEvent(event); +} + +void RenderWidgetHostViewQtDelegateItem::wheelEvent(QWheelEvent *event) +{ + m_client->forwardEvent(event); +} + +void RenderWidgetHostViewQtDelegateItem::touchEvent(QTouchEvent *event) +{ + if (!m_isPopup && m_widgetDelegate) { + if (event->type() == QEvent::TouchBegin && m_widgetDelegate->ActiveFocusOnPress()) + forceActiveFocus(); + + if (!m_widgetDelegate->ActiveFocusOnPress()) { + event->ignore(); + return; + } + } + m_client->forwardEvent(event); +} + +void RenderWidgetHostViewQtDelegateItem::hoverMoveEvent(QHoverEvent *event) +{ + if ((!m_isPopup && m_widgetDelegate && !m_widgetDelegate->ActiveFocusOnPress()) + || event->position() == event->oldPosF()) { + event->ignore(); + return; + } + m_client->forwardEvent(event); +} + +void RenderWidgetHostViewQtDelegateItem::hoverLeaveEvent(QHoverEvent *event) +{ + m_client->forwardEvent(event); +} + +QVariant RenderWidgetHostViewQtDelegateItem::inputMethodQuery(Qt::InputMethodQuery query) const +{ + return m_client->inputMethodQuery(query); +} + +void RenderWidgetHostViewQtDelegateItem::inputMethodEvent(QInputMethodEvent *event) +{ + m_client->forwardEvent(event); +} + +void RenderWidgetHostViewQtDelegateItem::geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) +{ + QQuickItem::geometryChange(newGeometry, oldGeometry); + m_client->visualPropertiesChanged(); +} + +void RenderWidgetHostViewQtDelegateItem::itemChange(ItemChange change, const ItemChangeData &value) +{ + QQuickItem::itemChange(change, value); + if (change == QQuickItem::ItemSceneChange) { + for (const QMetaObject::Connection &c : qAsConst(m_windowConnections)) + disconnect(c); + m_windowConnections.clear(); + if (value.window) { + m_windowConnections.append(connect(value.window, &QQuickWindow::beforeRendering, + this, &RenderWidgetHostViewQtDelegateItem::onBeforeRendering, Qt::DirectConnection)); + m_windowConnections.append(connect(value.window, SIGNAL(xChanged(int)), SLOT(onWindowPosChanged()))); + m_windowConnections.append(connect(value.window, SIGNAL(yChanged(int)), SLOT(onWindowPosChanged()))); + if (!m_isPopup) + m_windowConnections.append(connect(value.window, SIGNAL(closing(QQuickCloseEvent *)), SLOT(onHide()))); + } + m_client->visualPropertiesChanged(); + } else if (change == QQuickItem::ItemVisibleHasChanged) { + if (value.boolValue) { + m_client->notifyShown(); + } else { + m_client->notifyHidden(); + if (!m_isPopup) + onHide(); + } + } +} + +QSGNode *RenderWidgetHostViewQtDelegateItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) +{ + auto comp = compositor(); + if (!comp) + return nullptr; + + QQuickWindow *win = QQuickItem::window(); + + // Delete old node before swapFrame to decrement refcount of + // QImage in software mode. + delete oldNode; + QSGImageNode *node = win->createImageNode(); + node->setOwnsTexture(true); + + comp->swapFrame(); + + QSize texSize = comp->size(); + QSizeF texSizeInDips = QSizeF(texSize) / comp->devicePixelRatio(); + node->setRect(QRectF(QPointF(0, 0), texSizeInDips)); + + if (comp->type() == Compositor::Type::Software) { + QImage image = comp->image(); + node->setTexture(win->createTextureFromImage(image)); +#if QT_CONFIG(opengl) + } else if (comp->type() == Compositor::Type::OpenGL) { + QQuickWindow::CreateTextureOptions texOpts; + if (comp->hasAlphaChannel()) + texOpts.setFlag(QQuickWindow::TextureHasAlphaChannel); + int texId = comp->textureId(); + node->setTexture(QNativeInterface::QSGOpenGLTexture::fromNative(texId, win, texSize, texOpts)); + node->setTextureCoordinatesTransform(QSGImageNode::MirrorVertically); +#endif + } else { + Q_UNREACHABLE(); + } + + return node; +} + +void RenderWidgetHostViewQtDelegateItem::onBeforeRendering() +{ + auto comp = compositor(); + if (!comp || comp->type() != Compositor::Type::OpenGL) + return; + comp->waitForTexture(); +} + +void RenderWidgetHostViewQtDelegateItem::onWindowPosChanged() +{ + m_client->visualPropertiesChanged(); +} + +void RenderWidgetHostViewQtDelegateItem::onHide() +{ + QFocusEvent event(QEvent::FocusOut, Qt::OtherFocusReason); + m_client->forwardEvent(&event); +} + +void RenderWidgetHostViewQtDelegateItem::adapterClientChanged(WebContentsAdapterClient *client) +{ + m_adapterClient = client; + if (m_widgetDelegate) + m_widgetDelegate->Bind(client); +} + +void RenderWidgetHostViewQtDelegateItem::updateAdapterClientIfNeeded(WebContentsAdapterClient *client) +{ + if (client == m_adapterClient) + return; + adapterClientChanged(client); +} + +void RenderWidgetHostViewQtDelegateItem::unhandledWheelEvent(QWheelEvent *ev) +{ + if (QWindow *w = Window()) { + if (QWindow *p = w->parent()) + qApp->sendEvent(p, ev); + } +} + +} // namespace QtWebEngineCore diff --git a/src/core/render_widget_host_view_qt_delegate_item.h b/src/core/render_widget_host_view_qt_delegate_item.h new file mode 100644 index 000000000..e057d37d9 --- /dev/null +++ b/src/core/render_widget_host_view_qt_delegate_item.h @@ -0,0 +1,122 @@ +// 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 + +#ifndef RENDER_WIDGET_HOST_VIEW_QT_DELEGATE_ITEM_H +#define RENDER_WIDGET_HOST_VIEW_QT_DELEGATE_ITEM_H + +#include "compositor/compositor.h" +#include "render_widget_host_view_qt_delegate.h" + +#include <QtQuick/QQuickItem> + +QT_BEGIN_NAMESPACE +class QQuickWebEngineViewPrivate; +class QWebEngineViewPrivate; +QT_END_NAMESPACE + +namespace QtWebEngineCore { + +class RenderWidgetHostViewQtDelegateClient; +class WebContentsAdapterClient; +class WebEngineQuickWidget; + +class WidgetDelegate +{ +public: + virtual ~WidgetDelegate() = default; + virtual void InitAsPopup(const QRect &screenRect) = 0; + virtual void SetInputMethodEnabled(bool) { } + virtual void SetInputMethodHints(Qt::InputMethodHints) { } + virtual void SetClearColor(const QColor &) { } + virtual bool ActiveFocusOnPress() = 0; + virtual void MoveWindow(const QPoint & ) { } + virtual void Bind(WebContentsAdapterClient *) = 0; + virtual void Unbind() = 0; + virtual void Destroy() = 0; + virtual void Resize(int, int) { } + virtual QWindow *Window() { return nullptr; } +}; + +// Useful information keyboard and mouse QEvent propagation. +// A RenderWidgetHostViewQtDelegateItem instance initialized as a popup will receive +// no keyboard focus (so all keyboard QEvents will be sent to the parent RWHVQD instance), +// but will still receive mouse input (all mouse QEvent moves and clicks will be given to the popup +// RWHVQD instance, and the mouse interaction area covers the surface of the whole parent +// QWebEngineView, and not only the smaller surface that an HTML select popup would occupy). +class Q_WEBENGINECORE_PRIVATE_EXPORT RenderWidgetHostViewQtDelegateItem + : public QQuickItem + , public RenderWidgetHostViewQtDelegate + , public Compositor::Observer +{ + Q_OBJECT +public: + RenderWidgetHostViewQtDelegateItem(RenderWidgetHostViewQtDelegateClient *client, bool isPopup); + ~RenderWidgetHostViewQtDelegateItem(); + + void initAsPopup(const QRect&) override; + QRectF viewGeometry() const override; + QRect windowGeometry() const override; + void setKeyboardFocus() override; + bool hasKeyboardFocus() override; + void lockMouse() override; + void unlockMouse() override; + void show() override; + void hide() override; + bool isVisible() const override; + QWindow *Window() const override; + void updateCursor(const QCursor &) override; + void resize(int width, int height) override; + void move(const QPoint &screenPos) override; + void inputMethodStateChanged(bool editorVisible, bool passwordInput) override; + void setInputMethodHints(Qt::InputMethodHints) override; + void setClearColor(const QColor &color) override; + void unhandledWheelEvent(QWheelEvent *ev) override; + + void readyToSwap() override; + + void setWidgetDelegate(WidgetDelegate *delegate); + +protected: + bool event(QEvent *event) override; + void focusInEvent(QFocusEvent *event) override; + void focusOutEvent(QFocusEvent *event) override; + void mousePressEvent(QMouseEvent *event) override; + void mouseMoveEvent(QMouseEvent *event) override; + void mouseReleaseEvent(QMouseEvent *event) override; + void keyPressEvent(QKeyEvent *event) override; + void keyReleaseEvent(QKeyEvent *event) override; + void wheelEvent(QWheelEvent *event) override; + void touchEvent(QTouchEvent *event) override; + void hoverMoveEvent(QHoverEvent *event) override; + void hoverLeaveEvent(QHoverEvent *event) override; + QVariant inputMethodQuery(Qt::InputMethodQuery query) const override; + void inputMethodEvent(QInputMethodEvent *event) override; + void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override; + void itemChange(ItemChange change, const ItemChangeData &value) override; + QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) override; + + void adapterClientChanged(WebContentsAdapterClient *client) override; + void updateAdapterClientIfNeeded(WebContentsAdapterClient *client) override; + +private Q_SLOTS: + void onBeforeRendering(); + void onWindowPosChanged(); + void onHide(); + +private: + friend QWebEngineViewPrivate; + friend QQuickWebEngineViewPrivate; + friend WebEngineQuickWidget; + + RenderWidgetHostViewQtDelegateClient *m_client; + bool m_isPopup; + QColor m_clearColor; + Qt::InputMethodHints m_inputMethodHints = {}; + QList<QMetaObject::Connection> m_windowConnections; + WebContentsAdapterClient *m_adapterClient = nullptr; + WidgetDelegate *m_widgetDelegate = nullptr; +}; + +} // namespace QtWebEngineCore + +#endif // RENDER_WIDGET_HOST_VIEW_QT_DELEGATE_ITEM_H diff --git a/src/core/renderer/content_renderer_client_qt.cpp b/src/core/renderer/content_renderer_client_qt.cpp index e407c4f2c..5544b08df 100644 --- a/src/core/renderer/content_renderer_client_qt.cpp +++ b/src/core/renderer/content_renderer_client_qt.cpp @@ -1,52 +1,21 @@ -/**************************************************************************** -** -** 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 "renderer/content_renderer_client_qt.h" #include "extensions/buildflags/buildflags.h" #include "printing/buildflags/buildflags.h" #include "renderer/content_settings_observer_qt.h" +#include "base/i18n/rtl.h" #include "base/strings/string_split.h" #if QT_CONFIG(webengine_spellchecker) #include "components/spellcheck/renderer/spellcheck.h" #include "components/spellcheck/renderer/spellcheck_provider.h" #endif +#include "components/autofill/content/renderer/autofill_agent.h" +#include "components/autofill/content/renderer/autofill_assistant_agent.h" +#include "components/autofill/content/renderer/password_autofill_agent.h" +#include "components/autofill/content/renderer/password_generation_agent.h" #include "components/cdm/renderer/external_clear_key_key_system_properties.h" #include "components/cdm/renderer/widevine_key_system_properties.h" #include "components/error_page/common/error.h" @@ -66,6 +35,7 @@ #include "media/media_buildflags.h" #include "mojo/public/cpp/bindings/binder_map.h" #include "net/base/net_errors.h" +#include "ppapi/buildflags/buildflags.h" #include "services/service_manager/public/cpp/connector.h" #include "services/service_manager/public/cpp/interface_provider.h" #include "third_party/blink/public/platform/web_url_error.h" @@ -75,6 +45,8 @@ #include "ui/base/webui/jstemplate_builder.h" #if QT_CONFIG(webengine_printing_and_pdf) +#include "components/pdf/renderer/internal_plugin_renderer_helpers.h" +#include "components/pdf/renderer/pdf_internal_plugin_delegate.h" #include "renderer/print_web_view_helper_delegate_qt.h" #endif @@ -88,6 +60,7 @@ #if BUILDFLAG(ENABLE_EXTENSIONS) #include "common/extensions/extensions_client_qt.h" +#include "extensions/common/constants.h" #include "extensions/extensions_renderer_client_qt.h" #include "extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container_manager.h" #include "mojo/public/cpp/bindings/associated_remote.h" @@ -210,8 +183,10 @@ void ContentRendererClientQt::RenderFrameCreated(content::RenderFrame *render_fr #if QT_CONFIG(webengine_printing_and_pdf) new printing::PrintRenderFrameHelper(render_frame, base::WrapUnique(new PrintWebViewHelperDelegateQt())); #endif // QT_CONFIG(webengine_printing_and_pdf) -#if BUILDFLAG(ENABLE_EXTENSIONS) + blink::AssociatedInterfaceRegistry *associated_interfaces = render_frame_observer->associatedInterfaces(); + +#if BUILDFLAG(ENABLE_EXTENSIONS) associated_interfaces->AddInterface(base::BindRepeating( &extensions::MimeHandlerViewContainerManager::BindReceiver, render_frame->GetRoutingID())); @@ -219,6 +194,17 @@ void ContentRendererClientQt::RenderFrameCreated(content::RenderFrame *render_fr auto registry = std::make_unique<service_manager::BinderRegistry>(); ExtensionsRendererClientQt::GetInstance()->RenderFrameCreated(render_frame, render_frame_observer->registry()); #endif + + autofill::AutofillAssistantAgent *autofill_assistant_agent = + new autofill::AutofillAssistantAgent(render_frame); + autofill::PasswordAutofillAgent *password_autofill_agent = + new autofill::PasswordAutofillAgent(render_frame, associated_interfaces); + autofill::PasswordGenerationAgent *password_generation_agent = + new autofill::PasswordGenerationAgent(render_frame, password_autofill_agent, + associated_interfaces); + + new autofill::AutofillAgent(render_frame, password_autofill_agent, password_generation_agent, + autofill_assistant_agent, associated_interfaces); } void ContentRendererClientQt::RunScriptsAtDocumentStart(content::RenderFrame *render_frame) @@ -256,6 +242,7 @@ void ContentRendererClientQt::RunScriptsAtDocumentIdle(content::RenderFrame *ren void ContentRendererClientQt::PrepareErrorPage(content::RenderFrame *renderFrame, const blink::WebURLError &web_error, const std::string &httpMethod, + content::mojom::AlternativeErrorPageOverrideInfoPtr alternative_error_page_info, std::string *errorHtml) { GetNavigationErrorStringsInternal( @@ -269,6 +256,7 @@ void ContentRendererClientQt::PrepareErrorPageForHttpStatusError(content::Render const blink::WebURLError &error, const std::string &httpMethod, int http_status, + content::mojom::AlternativeErrorPageOverrideInfoPtr alternative_error_page_info, std::string *errorHtml) { GetNavigationErrorStringsInternal(renderFrame, httpMethod, @@ -324,6 +312,66 @@ std::unique_ptr<blink::WebPrescientNetworking> ContentRendererClientQt::CreatePr return std::make_unique<network_hints::WebPrescientNetworkingImpl>(render_frame); } +namespace { +bool IsPdfExtensionOrigin(const url::Origin &origin) +{ +#if BUILDFLAG(ENABLE_EXTENSIONS) + return origin.scheme() == extensions::kExtensionScheme && + origin.host() == extension_misc::kPdfExtensionId; +#else + return false; +#endif +} + +#if BUILDFLAG(ENABLE_PLUGINS) +void AppendParams(const std::vector<content::WebPluginMimeType::Param> &additional_params, + blink::WebVector<blink::WebString> *existing_names, + blink::WebVector<blink::WebString> *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<blink::WebString> names(total_size); + blink::WebVector<blink::WebString> values(total_size); + + for (size_t i = 0; i < existing_size; ++i) { + names[i] = (*existing_names)[i]; + values[i] = (*existing_values)[i]; + } + + for (size_t i = 0; i < additional_params.size(); ++i) { + names[existing_size + i] = blink::WebString::FromUTF16(additional_params[i].name); + values[existing_size + i] = blink::WebString::FromUTF16(additional_params[i].value); + } + + existing_names->Swap(names); + existing_values->Swap(values); +} +#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 +{ +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); +} +#endif +} // namespace + bool ContentRendererClientQt::IsPluginHandledExternally(content::RenderFrame *render_frame, const blink::WebElement &plugin_element, const GURL &original_url, @@ -335,10 +383,11 @@ bool ContentRendererClientQt::IsPluginHandledExternally(content::RenderFrame *re std::string mime_type; static_cast<content::RenderFrameImpl *>(render_frame)->GetPepperHost()->GetPluginInfo( - original_url, render_frame->GetWebFrame()->Top()->GetSecurityOrigin(), - original_mime_type, &found, &plugin_info, &mime_type); + original_url, original_mime_type, &found, &plugin_info, &mime_type); if (!found) return false; + if (IsPdfExtensionOrigin(render_frame->GetWebFrame()->GetSecurityOrigin())) + return true; return extensions::MimeHandlerViewContainerManager::Get( content::RenderFrame::FromWebFrame( plugin_element.GetDocument().GetFrame()), @@ -364,12 +413,25 @@ bool ContentRendererClientQt::OverrideCreatePlugin(content::RenderFrame *render_ bool found = false; static_cast<content::RenderFrameImpl *>(render_frame)->GetPepperHost()->GetPluginInfo( - params.url, render_frame->GetWebFrame()->Top()->GetSecurityOrigin(), - params.mime_type.Utf8(), &found, &info, &mime_type); - if (!found) + params.url, params.mime_type.Utf8(), &found, &info, &mime_type); + if (!found) { *plugin = LoadablePluginPlaceholderQt::CreateLoadableMissingPlugin(render_frame, params)->plugin(); - else - *plugin = render_frame->CreatePlugin(info, params); + return true; + } + if (info.name == u"Chromium PDF Viewer") { + blink::WebPluginParams new_params(params); + for (const auto& mime_type : info.mime_types) { + if (mime_type.mime_type == params.mime_type.Utf8()) { + AppendParams(mime_type.additional_params, &new_params.attribute_names, + &new_params.attribute_values); + break; + } + } + + *plugin = pdf::CreateInternalPlugin(std::move(new_params), render_frame, std::make_unique<PdfInternalPluginDelegateQt>()); + return true; + } + *plugin = render_frame->CreatePlugin(info, params); #endif // BUILDFLAG(ENABLE_PLUGINS) return true; } @@ -401,90 +463,20 @@ void ContentRendererClientQt::GetInterface(const std::string &interface_name, mo // found in the LICENSE.Chromium file. #if BUILDFLAG(ENABLE_LIBRARY_CDMS) +static const char kExternalClearKeyKeySystem[] = "org.chromium.externalclearkey"; + // External Clear Key (used for testing). -static void AddExternalClearKey(std::vector<std::unique_ptr<media::KeySystemProperties>> *concrete_key_systems) +static void AddExternalClearKey(const media::mojom::KeySystemCapabilityPtr &capability, + media::KeySystemPropertiesVector *key_systems) { - // TODO(xhwang): Move these into an array so we can use a for loop to add - // supported key systems below. - static const char kExternalClearKeyKeySystem[] = - "org.chromium.externalclearkey"; - static const char kExternalClearKeyDecryptOnlyKeySystem[] = - "org.chromium.externalclearkey.decryptonly"; - static const char kExternalClearKeyMessageTypeTestKeySystem[] = - "org.chromium.externalclearkey.messagetypetest"; - static const char kExternalClearKeyFileIOTestKeySystem[] = - "org.chromium.externalclearkey.fileiotest"; - static const char kExternalClearKeyOutputProtectionTestKeySystem[] = - "org.chromium.externalclearkey.outputprotectiontest"; - static const char kExternalClearKeyPlatformVerificationTestKeySystem[] = - "org.chromium.externalclearkey.platformverificationtest"; - static const char kExternalClearKeyInitializeFailKeySystem[] = - "org.chromium.externalclearkey.initializefail"; - static const char kExternalClearKeyCrashKeySystem[] = - "org.chromium.externalclearkey.crash"; - static const char kExternalClearKeyVerifyCdmHostTestKeySystem[] = - "org.chromium.externalclearkey.verifycdmhosttest"; - static const char kExternalClearKeyStorageIdTestKeySystem[] = - "org.chromium.externalclearkey.storageidtest"; - static const char kExternalClearKeyDifferentGuidTestKeySystem[] = - "org.chromium.externalclearkey.differentguid"; - static const char kExternalClearKeyCdmProxyTestKeySystem[] = - "org.chromium.externalclearkey.cdmproxytest"; - - media::mojom::KeySystemCapabilityPtr capability; - if (!content::IsKeySystemSupported(kExternalClearKeyKeySystem, &capability)) { - DVLOG(1) << "External Clear Key not supported"; + Q_UNUSED(capability); + if (!base::FeatureList::IsEnabled(media::kExternalClearKeyForTesting)) { + DLOG(ERROR) << "ExternalClearKey supported despite not enabled."; return; } - concrete_key_systems->emplace_back( - new cdm::ExternalClearKeyProperties(kExternalClearKeyKeySystem)); - - // Add support of decrypt-only mode in ClearKeyCdm. - concrete_key_systems->emplace_back( - new cdm::ExternalClearKeyProperties(kExternalClearKeyDecryptOnlyKeySystem)); - - // A key system that triggers various types of messages in ClearKeyCdm. - concrete_key_systems->emplace_back( - new cdm::ExternalClearKeyProperties(kExternalClearKeyMessageTypeTestKeySystem)); - - // A key system that triggers the FileIO test in ClearKeyCdm. - concrete_key_systems->emplace_back( - new cdm::ExternalClearKeyProperties(kExternalClearKeyFileIOTestKeySystem)); - - // A key system that triggers the output protection test in ClearKeyCdm. - concrete_key_systems->emplace_back( - new cdm::ExternalClearKeyProperties(kExternalClearKeyOutputProtectionTestKeySystem)); - - // A key system that triggers the platform verification test in ClearKeyCdm. - concrete_key_systems->emplace_back( - new cdm::ExternalClearKeyProperties(kExternalClearKeyPlatformVerificationTestKeySystem)); - - // A key system that Chrome thinks is supported by ClearKeyCdm, but actually - // will be refused by ClearKeyCdm. This is to test the CDM initialization - // failure case. - concrete_key_systems->emplace_back( - new cdm::ExternalClearKeyProperties(kExternalClearKeyInitializeFailKeySystem)); - - // A key system that triggers a crash in ClearKeyCdm. - concrete_key_systems->emplace_back( - new cdm::ExternalClearKeyProperties(kExternalClearKeyCrashKeySystem)); - - // A key system that triggers the verify host files test in ClearKeyCdm. - concrete_key_systems->emplace_back( - new cdm::ExternalClearKeyProperties(kExternalClearKeyVerifyCdmHostTestKeySystem)); - - // A key system that fetches the Storage ID in ClearKeyCdm. - concrete_key_systems->emplace_back( - new cdm::ExternalClearKeyProperties(kExternalClearKeyStorageIdTestKeySystem)); - - // A key system that is registered with a different CDM GUID. - concrete_key_systems->emplace_back( - new cdm::ExternalClearKeyProperties(kExternalClearKeyDifferentGuidTestKeySystem)); - - // A key system that triggers CDM Proxy test in ClearKeyCdm. - concrete_key_systems->emplace_back( - new cdm::ExternalClearKeyProperties(kExternalClearKeyCdmProxyTestKeySystem)); + // TODO(xhwang): Actually use `capability` to determine capabilities. + key_systems->push_back(std::make_unique<cdm::ExternalClearKeyProperties>()); } #if BUILDFLAG(ENABLE_WIDEVINE) @@ -505,8 +497,8 @@ media::SupportedCodecs GetVP9Codecs(const std::vector<media::VideoCodecProfile> supported_vp9_codecs |= media::EME_CODEC_VP9_PROFILE2; break; default: - DVLOG(1) << "Unexpected " << GetCodecName(media::VideoCodec::kCodecVP9) - << " profile: " << GetProfileName(profile); + DVLOG(1) << "Unexpected " << media::GetCodecName(media::VideoCodec::kVP9) + << " profile: " << media::GetProfileName(profile); break; } } @@ -514,6 +506,35 @@ media::SupportedCodecs GetVP9Codecs(const std::vector<media::VideoCodecProfile> return supported_vp9_codecs; } +#if BUILDFLAG(ENABLE_PLATFORM_HEVC) +SupportedCodecs GetHevcCodecs(const std::vector<media::VideoCodecProfile> &profiles) +{ + // If no profiles are specified, then all are supported. + if (profiles.empty()) { + return media::EME_CODEC_HEVC_PROFILE_MAIN | + media::EME_CODEC_HEVC_PROFILE_MAIN10; + } + + media::SupportedCodecs supported_hevc_codecs = media::EME_CODEC_NONE; + for (const auto& profile : profiles) { + switch (profile) { + case media::HEVCPROFILE_MAIN: + supported_hevc_codecs |= media::EME_CODEC_HEVC_PROFILE_MAIN; + break; + case media::HEVCPROFILE_MAIN10: + supported_hevc_codecs |= media::EME_CODEC_HEVC_PROFILE_MAIN10; + break; + default: + DVLOG(1) << "Unexpected " << media::GetCodecName(media::VideoCodec::kHEVC) + << " profile: " << media::GetProfileName(profile); + break; + } + } + + return supported_hevc_codecs; +} +#endif // BUILDFLAG(ENABLE_PLATFORM_HEVC) + static media::SupportedCodecs GetSupportedCodecs(const media::CdmCapability& capability, bool is_secure) { @@ -521,17 +542,17 @@ static media::SupportedCodecs GetSupportedCodecs(const media::CdmCapability& cap for (const auto& codec : capability.audio_codecs) { switch (codec) { - case media::AudioCodec::kCodecOpus: + case media::AudioCodec::kOpus: supported_codecs |= media::EME_CODEC_OPUS; break; - case media::AudioCodec::kCodecVorbis: + case media::AudioCodec::kVorbis: supported_codecs |= media::EME_CODEC_VORBIS; break; - case media::AudioCodec::kCodecFLAC: + case media::AudioCodec::kFLAC: supported_codecs |= media::EME_CODEC_FLAC; break; #if BUILDFLAG(USE_PROPRIETARY_CODECS) - case media::AudioCodec::kCodecAAC: + case media::AudioCodec::kAAC: supported_codecs |= media::EME_CODEC_AAC; break; #endif // BUILDFLAG(USE_PROPRIETARY_CODECS) @@ -543,20 +564,25 @@ static media::SupportedCodecs GetSupportedCodecs(const media::CdmCapability& cap for (const auto &codec : capability.video_codecs) { switch (codec.first) { - case media::VideoCodec::kCodecVP8: + case media::VideoCodec::kVP8: supported_codecs |= media::EME_CODEC_VP8; break; - case media::VideoCodec::kCodecVP9: + case media::VideoCodec::kVP9: supported_codecs |= GetVP9Codecs(codec.second); break; - case media::VideoCodec::kCodecAV1: + case media::VideoCodec::kAV1: supported_codecs |= media::EME_CODEC_AV1; break; #if BUILDFLAG(USE_PROPRIETARY_CODECS) - case media::VideoCodec::kCodecH264: + case media::VideoCodec::kH264: supported_codecs |= media::EME_CODEC_AVC1; break; #endif // BUILDFLAG(USE_PROPRIETARY_CODECS) +#if BUILDFLAG(ENABLE_PLATFORM_HEVC) + case media::VideoCodec::kHEVC: + supported_codecs |= GetHevcCodecs(codec.second); + break; +#endif // BUILDFLAG(ENABLE_PLATFORM_HEVC) default: DVLOG(1) << "Unexpected supported codec: " << GetCodecName(codec.first); break; @@ -566,14 +592,9 @@ static media::SupportedCodecs GetSupportedCodecs(const media::CdmCapability& cap return supported_codecs; } -static void AddWidevine(std::vector<std::unique_ptr<media::KeySystemProperties>> *concrete_key_systems) +static void AddWidevine(const media::mojom::KeySystemCapabilityPtr &capability, + media::KeySystemPropertiesVector *key_systems) { - media::mojom::KeySystemCapabilityPtr capability; - if (!content::IsKeySystemSupported(kWidevineKeySystem, &capability)) { - DVLOG(1) << "Widevine CDM is not currently available."; - return; - } - // Codecs and encryption schemes. media::SupportedCodecs codecs = media::EME_CODEC_NONE; media::SupportedCodecs hw_secure_codecs = media::EME_CODEC_NONE; @@ -613,26 +634,44 @@ static void AddWidevine(std::vector<std::unique_ptr<media::KeySystemProperties>> auto persistent_state_support = media::EmeFeatureSupport::REQUESTABLE; auto distinctive_identifier_support = media::EmeFeatureSupport::NOT_SUPPORTED; - concrete_key_systems->emplace_back(new cdm::WidevineKeySystemProperties( - codecs, encryption_schemes, hw_secure_codecs, - hw_secure_encryption_schemes, max_audio_robustness, max_video_robustness, - persistent_license_support, persistent_state_support, - distinctive_identifier_support)); + key_systems->emplace_back(new cdm::WidevineKeySystemProperties( + codecs, encryption_schemes, hw_secure_codecs, + hw_secure_encryption_schemes, max_audio_robustness, max_video_robustness, + persistent_license_support, persistent_state_support, + distinctive_identifier_support)); } #endif // BUILDFLAG(ENABLE_WIDEVINE) #endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) -void ContentRendererClientQt::AddSupportedKeySystems(std::vector<std::unique_ptr<media::KeySystemProperties>> *key_systems) +void OnKeySystemSupportUpdated(media::GetSupportedKeySystemsCB cb, + content::KeySystemCapabilityPtrMap key_system_capabilities) { -#if BUILDFLAG(ENABLE_LIBRARY_CDMS) - if (base::FeatureList::IsEnabled(media::kExternalClearKeyForTesting)) - AddExternalClearKey(key_systems); - + media::KeySystemPropertiesVector key_systems; + for (const auto &entry : key_system_capabilities) { + const auto &key_system = entry.first; + const auto &capability = entry.second; #if BUILDFLAG(ENABLE_WIDEVINE) - AddWidevine(key_systems); -#endif // BUILDFLAG(ENABLE_WIDEVINE) + if (key_system == kWidevineKeySystem) { + AddWidevine(capability, &key_systems); + continue; + } +#endif // BUILDFLAG(ENABLE_WIDEVINE) -#endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) + if (key_system == kExternalClearKeyKeySystem) { + AddExternalClearKey(capability, &key_systems); + continue; + } + + DLOG(ERROR) << "Unrecognized key system: " << key_system; + } + + cb.Run(std::move(key_systems)); +} + +void ContentRendererClientQt::GetSupportedKeySystems(media::GetSupportedKeySystemsCB cb) +{ + content::ObserveKeySystemSupportUpdate( + base::BindRepeating(&OnKeySystemSupportUpdated, std::move(cb))); } #if QT_CONFIG(webengine_spellchecker) diff --git a/src/core/renderer/content_renderer_client_qt.h b/src/core/renderer/content_renderer_client_qt.h index 4e1759759..6c4cdf0ee 100644 --- a/src/core/renderer/content_renderer_client_qt.h +++ b/src/core/renderer/content_renderer_client_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef CONTENT_RENDERER_CLIENT_QT_H #define CONTENT_RENDERER_CLIENT_QT_H @@ -44,14 +8,14 @@ #include "components/spellcheck/spellcheck_buildflags.h" #include "services/service_manager/public/cpp/binder_registry.h" #include "services/service_manager/public/cpp/local_interface_provider.h" -#include "ppapi/buildflags/buildflags.h" - -#if BUILDFLAG(ENABLE_PLUGINS) -#include "third_party/blink/public/web/web_plugin_params.h" -#endif #include <QScopedPointer> +namespace blink { +class WebPlugin; +struct WebPluginParams; +} + namespace chrome { class WebRtcLoggingAgentImpl; } @@ -72,10 +36,6 @@ class WebCacheImpl; class SpellCheck; #endif -namespace content { -struct WebPluginInfo; -} - namespace QtWebEngineCore { class UserResourceController; @@ -96,18 +56,18 @@ public: void PrepareErrorPage(content::RenderFrame *render_frame, const blink::WebURLError &error, const std::string &http_method, + content::mojom::AlternativeErrorPageOverrideInfoPtr alternative_error_page_info, std::string *error_html) override; void PrepareErrorPageForHttpStatusError(content::RenderFrame *render_frame, const blink::WebURLError &error, const std::string &http_method, int http_status, + content::mojom::AlternativeErrorPageOverrideInfoPtr alternative_error_page_info, std::string *error_html) override; - uint64_t VisitedLinkHash(const char *canonical_url, size_t length) override; bool IsLinkVisited(uint64_t linkHash) override; std::unique_ptr<blink::WebPrescientNetworking> CreatePrescientNetworking(content::RenderFrame *render_frame) override; - void AddSupportedKeySystems(std::vector<std::unique_ptr<media::KeySystemProperties>> *key_systems) override; - + void GetSupportedKeySystems(media::GetSupportedKeySystemsCB cb) override; void RunScriptsAtDocumentStart(content::RenderFrame *render_frame) override; void RunScriptsAtDocumentEnd(content::RenderFrame *render_frame) override; void RunScriptsAtDocumentIdle(content::RenderFrame *render_frame) override; @@ -152,8 +112,6 @@ private: #if QT_CONFIG(webengine_webrtc) && QT_CONFIG(webengine_extensions) std::unique_ptr<chrome::WebRtcLoggingAgentImpl> m_webrtcLoggingAgentImpl; #endif - - DISALLOW_COPY_AND_ASSIGN(ContentRendererClientQt); }; } // namespace diff --git a/src/core/renderer/content_settings_observer_qt.cpp b/src/core/renderer/content_settings_observer_qt.cpp index 18d52b50a..3a45f28e6 100644 --- a/src/core/renderer/content_settings_observer_qt.cpp +++ b/src/core/renderer/content_settings_observer_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 // Based on chrome/renderer/content_settings_observer.cc: // Copyright (c) 2012 The Chromium Authors. All rights reserved. diff --git a/src/core/renderer/content_settings_observer_qt.h b/src/core/renderer/content_settings_observer_qt.h index 9268b4982..89dcbad08 100644 --- a/src/core/renderer/content_settings_observer_qt.h +++ b/src/core/renderer/content_settings_observer_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be @@ -89,8 +53,6 @@ private: int m_currentRequestId; base::flat_map<int, base::OnceCallback<void(bool)>> m_permissionRequests; - - DISALLOW_COPY_AND_ASSIGN(ContentSettingsObserverQt); }; } // namespace QtWebEngineCore diff --git a/src/core/renderer/extensions/extensions_dispatcher_delegate_qt.cpp b/src/core/renderer/extensions/extensions_dispatcher_delegate_qt.cpp index d49845f55..191e36d04 100644 --- a/src/core/renderer/extensions/extensions_dispatcher_delegate_qt.cpp +++ b/src/core/renderer/extensions/extensions_dispatcher_delegate_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 "extensions_dispatcher_delegate_qt.h" diff --git a/src/core/renderer/extensions/extensions_dispatcher_delegate_qt.h b/src/core/renderer/extensions/extensions_dispatcher_delegate_qt.h index 1a19bcbbb..42ae165d1 100644 --- a/src/core/renderer/extensions/extensions_dispatcher_delegate_qt.h +++ b/src/core/renderer/extensions/extensions_dispatcher_delegate_qt.h @@ -1,46 +1,9 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 #ifndef EXTENSIONSDISPATCHERDELEGATEQT_H #define EXTENSIONSDISPATCHERDELEGATEQT_H -#include "base/macros.h" #include "extensions/renderer/dispatcher_delegate.h" namespace QtWebEngineCore { @@ -54,8 +17,6 @@ public: private: // extensions::DispatcherDelegate implementation. void PopulateSourceMap(extensions::ResourceBundleSourceMap *source_map) override; - - DISALLOW_COPY_AND_ASSIGN(ExtensionsDispatcherDelegateQt); }; } // namespace QtWebEngineCore diff --git a/src/core/renderer/extensions/extensions_renderer_client_qt.cpp b/src/core/renderer/extensions/extensions_renderer_client_qt.cpp index 0506be876..b29892b68 100644 --- a/src/core/renderer/extensions/extensions_renderer_client_qt.cpp +++ b/src/core/renderer/extensions/extensions_renderer_client_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 // based on chrome/renderer/extensions/chrome_extensions_renderer_client.cc: // Copyright (c) 2014 The Chromium Authors. All rights reserved. @@ -63,7 +27,6 @@ #include "extensions/renderer/dispatcher.h" #include "extensions/renderer/extension_frame_helper.h" #include "extensions/renderer/extensions_render_frame_observer.h" -#include "extensions/renderer/guest_view/extensions_guest_view_container_dispatcher.h" #include "extensions/renderer/renderer_extension_registry.h" #include "extensions/renderer/script_context.h" #include "third_party/blink/public/platform/web_url.h" @@ -147,10 +110,8 @@ void ExtensionsRendererClientQt::RenderThreadStarted() extension_dispatcher_->OnRenderThreadStarted(thread); permissions_policy_delegate_.reset(new RendererPermissionsPolicyDelegateQt(extension_dispatcher_.get())); resource_request_policy_.reset(new extensions::ResourceRequestPolicyQt(extension_dispatcher_.get())); - guest_view_container_dispatcher_.reset(new extensions::ExtensionsGuestViewContainerDispatcher()); thread->AddObserver(extension_dispatcher_.get()); - thread->AddObserver(guest_view_container_dispatcher_.get()); } void ExtensionsRendererClientQt::RenderFrameCreated(content::RenderFrame *render_frame, diff --git a/src/core/renderer/extensions/extensions_renderer_client_qt.h b/src/core/renderer/extensions/extensions_renderer_client_qt.h index d73456643..f9cac443c 100644 --- a/src/core/renderer/extensions/extensions_renderer_client_qt.h +++ b/src/core/renderer/extensions/extensions_renderer_client_qt.h @@ -1,49 +1,11 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 #ifndef EXTENSIONSRENDERERCLIENTQT_H #define EXTENSIONSRENDERERCLIENTQT_H #include <memory> -#include <string> -#include "base/macros.h" #include "extensions/renderer/extensions_renderer_client.h" #include "services/service_manager/public/cpp/binder_registry.h" #include "ui/base/page_transition_types.h" @@ -57,10 +19,7 @@ class WebURL; } namespace content { -class BrowserPluginDelegate; class RenderFrame; -class RenderView; -struct WebPluginInfo; } namespace net { @@ -73,7 +32,6 @@ class Origin; namespace extensions { class Dispatcher; -class ExtensionsGuestViewContainerDispatcher; class ResourceRequestPolicyQt; } @@ -128,7 +86,6 @@ private: std::unique_ptr<ExtensionsDispatcherDelegateQt> extension_dispatcher_delegate_; std::unique_ptr<RendererPermissionsPolicyDelegateQt> permissions_policy_delegate_; std::unique_ptr<extensions::Dispatcher> extension_dispatcher_; - std::unique_ptr<extensions::ExtensionsGuestViewContainerDispatcher> guest_view_container_dispatcher_; std::unique_ptr<extensions::ResourceRequestPolicyQt> resource_request_policy_; }; diff --git a/src/core/renderer/extensions/renderer_permissions_policy_delegate_qt.cpp b/src/core/renderer/extensions/renderer_permissions_policy_delegate_qt.cpp index aef4903b7..fdfbe463b 100644 --- a/src/core/renderer/extensions/renderer_permissions_policy_delegate_qt.cpp +++ b/src/core/renderer/extensions/renderer_permissions_policy_delegate_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 "renderer_permissions_policy_delegate_qt.h" diff --git a/src/core/renderer/extensions/renderer_permissions_policy_delegate_qt.h b/src/core/renderer/extensions/renderer_permissions_policy_delegate_qt.h index 385b7a4b0..23bfa8c88 100644 --- a/src/core/renderer/extensions/renderer_permissions_policy_delegate_qt.h +++ b/src/core/renderer/extensions/renderer_permissions_policy_delegate_qt.h @@ -1,46 +1,9 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 #ifndef RENDERERPERMISSIONSPOLICYDELEGATEQT_H #define RENDERERPERMISSIONSPOLICYDELEGATEQT_H -#include "base/macros.h" #include "extensions/common/permissions/permissions_data.h" namespace extensions { @@ -56,9 +19,6 @@ public: ~RendererPermissionsPolicyDelegateQt() override; bool IsRestrictedUrl(const GURL &, std::string *) override; - -private: - DISALLOW_COPY_AND_ASSIGN(RendererPermissionsPolicyDelegateQt); }; } // namespace QtWebEngineCore diff --git a/src/core/renderer/extensions/resource_request_policy_qt.cpp b/src/core/renderer/extensions/resource_request_policy_qt.cpp index ad66ec4ab..21b7be4b6 100644 --- a/src/core/renderer/extensions/resource_request_policy_qt.cpp +++ b/src/core/renderer/extensions/resource_request_policy_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 // based on chrome/renderer/extensions/resource_request_policy.cc: // Copyright (c) 2012 The Chromium Authors. All rights reserved. @@ -97,7 +61,7 @@ bool ResourceRequestPolicyQt::CanRequestResource(const GURL &resource_url, // current extension or has a devtools scheme. GURL page_origin = url::Origin(frame->Top()->GetSecurityOrigin()).GetURL(); - GURL extension_origin = resource_url.GetOrigin(); + GURL extension_origin = resource_url.DeprecatedGetOriginAsURL(); // We always allow loads in the following cases, regardless of web accessible // resources: @@ -113,7 +77,7 @@ bool ResourceRequestPolicyQt::CanRequestResource(const GURL &resource_url, // of the frame, to account for about:blank subframes being scripted by an // extension parent (though we'll still need the frame origin check for // sandboxed frames). - if (frame_url.GetOrigin() == extension_origin || page_origin == extension_origin) + if (frame_url.DeprecatedGetOriginAsURL() == extension_origin || page_origin == extension_origin) return true; if (!ui::PageTransitionIsWebTriggerable(transition_type)) diff --git a/src/core/renderer/extensions/resource_request_policy_qt.h b/src/core/renderer/extensions/resource_request_policy_qt.h index f3c718c54..ec108519f 100644 --- a/src/core/renderer/extensions/resource_request_policy_qt.h +++ b/src/core/renderer/extensions/resource_request_policy_qt.h @@ -1,48 +1,11 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 #ifndef RESOURCEREQUESTPOLICYQT_H #define RESOURCEREQUESTPOLICYQT_H #include <set> -#include "base/macros.h" #include "extensions/common/extension_id.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "ui/base/page_transition_types.h" @@ -84,8 +47,6 @@ private: // The set of extension IDs with any potentially web- or webview-accessible // resources. std::set<ExtensionId> m_web_accessible_ids; - - DISALLOW_COPY_AND_ASSIGN(ResourceRequestPolicyQt); }; } // namespace extensions diff --git a/src/core/renderer/pepper/pepper_renderer_host_factory_qt.cpp b/src/core/renderer/pepper/pepper_renderer_host_factory_qt.cpp index 83dcf8157..d0daea8c2 100644 --- a/src/core/renderer/pepper/pepper_renderer_host_factory_qt.cpp +++ b/src/core/renderer/pepper/pepper_renderer_host_factory_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 // This is based on chrome/renderer/pepper/chrome_renderer_pepper_host_factory.cc: // Copyright (c) 2012 The Chromium Authors. All rights reserved. @@ -45,18 +9,10 @@ #include "pepper_renderer_host_factory_qt.h" #include "qtwebenginecoreglobal_p.h" -#include "base/memory/ptr_util.h" -#include "chrome/renderer/pepper/pepper_flash_font_file_host.h" -#include "chrome/renderer/pepper/pepper_uma_host.h" -#if QT_CONFIG(webengine_printing_and_pdf) -#include "components/pdf/renderer/pepper_pdf_host.h" -#endif // QT_CONFIG(webengine_printing_and_pdf) #include "content/public/renderer/renderer_ppapi_host.h" #include "ppapi/host/ppapi_host.h" #include "ppapi/host/resource_host.h" #include "ppapi/proxy/ppapi_messages.h" -#include "ppapi/proxy/ppapi_message_utils.h" -#include "ppapi/shared_impl/ppapi_permissions.h" namespace QtWebEngineCore { @@ -81,31 +37,6 @@ std::unique_ptr<ppapi::host::ResourceHost> PepperRendererHostFactoryQt::CreateRe if (!host_->IsValidInstance(instance)) return nullptr; - // TODO(raymes): PDF also needs access to the FlashFontFileHost currently. - // We should either rename PPB_FlashFont_File to PPB_FontFile_Private or get - // rid of its use in PDF if possible. - if (host_->GetPpapiHost()->permissions().HasPermission(ppapi::PERMISSION_FLASH) - || host_->GetPpapiHost()->permissions().HasPermission(ppapi::PERMISSION_PDF)) { - switch (message.type()) { - case PpapiHostMsg_FlashFontFile_Create::ID: { - ppapi::proxy::SerializedFontDescription description; - PP_PrivateFontCharset charset; - if (ppapi::UnpackMessage<PpapiHostMsg_FlashFontFile_Create>(message, &description, &charset)) - return base::WrapUnique(new PepperFlashFontFileHost(host_, instance, resource, description, charset)); - break; - } - } - } - -#if QT_CONFIG(webengine_printing_and_pdf) - if (host_->GetPpapiHost()->permissions().HasPermission(ppapi::PERMISSION_PDF)) { - switch (message.type()) { - case PpapiHostMsg_PDF_Create::ID: - return std::make_unique<pdf::PepperPDFHost>(host_, instance, resource); - } - } -#endif // QT_CONFIG(webengine_printing_and_pdf) - // Create a default ResourceHost for this message type to suppress // "Failed to create PPAPI resource host" console error message. switch (message.type()) { diff --git a/src/core/renderer/pepper/pepper_renderer_host_factory_qt.h b/src/core/renderer/pepper/pepper_renderer_host_factory_qt.h index ec3440a08..c31aa23d7 100644 --- a/src/core/renderer/pepper/pepper_renderer_host_factory_qt.h +++ b/src/core/renderer/pepper/pepper_renderer_host_factory_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef PEPPER_RENDERER_HOST_FACTORY_QT_H #define PEPPER_RENDERER_HOST_FACTORY_QT_H @@ -65,8 +29,6 @@ public: private: // Not owned by this object. content::RendererPpapiHost* host_; - - DISALLOW_COPY_AND_ASSIGN(PepperRendererHostFactoryQt); }; } // namespace QtWebEngineCore diff --git a/src/core/renderer/plugins/loadable_plugin_placeholder_qt.cpp b/src/core/renderer/plugins/loadable_plugin_placeholder_qt.cpp index 15f3e9eff..70fd791fd 100644 --- a/src/core/renderer/plugins/loadable_plugin_placeholder_qt.cpp +++ b/src/core/renderer/plugins/loadable_plugin_placeholder_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 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) 2020 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 // Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be diff --git a/src/core/renderer/plugins/loadable_plugin_placeholder_qt.h b/src/core/renderer/plugins/loadable_plugin_placeholder_qt.h index f612cb8ec..fd808f766 100644 --- a/src/core/renderer/plugins/loadable_plugin_placeholder_qt.h +++ b/src/core/renderer/plugins/loadable_plugin_placeholder_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 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) 2020 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 // Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be @@ -44,7 +8,6 @@ #ifndef LOADALBLE_PLUGIN_PLACEHOLDER_QT_H #define LOADALBLE_PLUGIN_PLACEHOLDER_QT_H -#include "base/macros.h" #include "components/plugins/renderer/loadable_plugin_placeholder.h" namespace QtWebEngineCore { @@ -73,8 +36,6 @@ private: // WebViewPlugin::Delegate (via PluginPlaceholder) methods: v8::Local<v8::Value> GetV8Handle(v8::Isolate* isolate) override; - - DISALLOW_COPY_AND_ASSIGN(LoadablePluginPlaceholderQt); }; } // namespace QtWebEngineCore diff --git a/src/core/renderer/print_web_view_helper_delegate_qt.cpp b/src/core/renderer/print_web_view_helper_delegate_qt.cpp index 5dcfaafd6..9891c654d 100644 --- a/src/core/renderer/print_web_view_helper_delegate_qt.cpp +++ b/src/core/renderer/print_web_view_helper_delegate_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 // Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be @@ -60,13 +24,23 @@ namespace QtWebEngineCore { PrintWebViewHelperDelegateQt::~PrintWebViewHelperDelegateQt() {} +bool IsPdfExtensionOrigin(const url::Origin& origin) +{ +#if BUILDFLAG(ENABLE_EXTENSIONS) + return origin.scheme() == extensions::kExtensionScheme + && origin.host() == extension_misc::kPdfExtensionId; +#else + Q_UNUSED(origin); + return false; +#endif +} + blink::WebElement PrintWebViewHelperDelegateQt::GetPdfElement(blink::WebLocalFrame *frame) { #if BUILDFLAG(ENABLE_EXTENSIONS) - GURL url = frame->GetDocument().Url(); - bool inside_print_preview = url.GetOrigin() == chrome::kChromeUIPrintURL; - bool inside_pdf_extension = url.SchemeIs(extensions::kExtensionScheme) && - url.host_piece() == extension_misc::kPdfExtensionId; + const url::Origin origin = frame->GetDocument().GetSecurityOrigin(); + bool inside_print_preview = origin == url::Origin::Create(GURL(chrome::kChromeUIPrintURL)); + bool inside_pdf_extension = IsPdfExtensionOrigin(origin); if (inside_print_preview || inside_pdf_extension) { // <object> with id="plugin" is created in // chrome/browser/resources/pdf/pdf_viewer_base.js. diff --git a/src/core/renderer/print_web_view_helper_delegate_qt.h b/src/core/renderer/print_web_view_helper_delegate_qt.h index 2cbc171a6..0cca02022 100644 --- a/src/core/renderer/print_web_view_helper_delegate_qt.h +++ b/src/core/renderer/print_web_view_helper_delegate_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 // Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be diff --git a/src/core/renderer/render_configuration.cpp b/src/core/renderer/render_configuration.cpp index 7870e80d5..3bf8186dc 100644 --- a/src/core/renderer/render_configuration.cpp +++ b/src/core/renderer/render_configuration.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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) 2019 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 // based on chrome/renderer/chrome_render_thread_observer.cc: // Copyright (c) 2012 The Chromium Authors. All rights reserved. diff --git a/src/core/renderer/render_configuration.h b/src/core/renderer/render_configuration.h index 138a85bdc..d9c867e02 100644 --- a/src/core/renderer/render_configuration.h +++ b/src/core/renderer/render_configuration.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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) 2019 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 #ifndef RENDER_CONFIGURATION_H #define RENDER_CONFIGURATION_H @@ -71,8 +35,6 @@ private: mojo::AssociatedReceiverSet<qtwebengine::mojom::RendererConfiguration> m_rendererConfigurationReceivers; - - DISALLOW_COPY_AND_ASSIGN(RenderConfiguration); }; } // namespace QtWebEngineCore diff --git a/src/core/renderer/render_frame_observer_qt.cpp b/src/core/renderer/render_frame_observer_qt.cpp index 77d325f3c..b8163f6eb 100644 --- a/src/core/renderer/render_frame_observer_qt.cpp +++ b/src/core/renderer/render_frame_observer_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 // This is based on chrome/renderer/pepper/pepper_helper.cc: // Copyright (c) 2012 The Chromium Authors. All rights reserved. @@ -44,14 +8,17 @@ #include "render_frame_observer_qt.h" -#include "base/memory/ptr_util.h" -#include "chrome/renderer/pepper/pepper_shared_memory_message_filter.h" #include "components/web_cache/renderer/web_cache_impl.h" #include "content/public/renderer/render_frame.h" + +#if QT_CONFIG(webengine_pepper_plugins) +#include "base/memory/ptr_util.h" +#include "chrome/renderer/pepper/pepper_shared_memory_message_filter.h" #include "content/public/renderer/renderer_ppapi_host.h" #include "ppapi/host/ppapi_host.h" #include "renderer/pepper/pepper_renderer_host_factory_qt.h" +#endif namespace QtWebEngineCore { diff --git a/src/core/renderer/render_frame_observer_qt.h b/src/core/renderer/render_frame_observer_qt.h index 8803dde89..8cab3bd9a 100644 --- a/src/core/renderer/render_frame_observer_qt.h +++ b/src/core/renderer/render_frame_observer_qt.h @@ -1,50 +1,12 @@ -/**************************************************************************** -** -** 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 #ifndef RENDER_FRAME_OBSERVER_QT_H #define RENDER_FRAME_OBSERVER_QT_H #include "qtwebenginecoreglobal_p.h" -#include "base/compiler_specific.h" #include "content/public/renderer/render_frame_observer.h" #include "content/public/renderer/render_frame_observer_tracker.h" -#include "ppapi/buildflags/buildflags.h" #include "services/service_manager/public/cpp/binder_registry.h" #include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h" @@ -82,8 +44,6 @@ public: } private: - DISALLOW_COPY_AND_ASSIGN(RenderFrameObserverQt); - void ReadyToCommitNavigation(blink::WebDocumentLoader *) override; bool m_isFrameDetached; diff --git a/src/core/renderer/user_resource_controller.cpp b/src/core/renderer/user_resource_controller.cpp index daefb1f1a..4a0ba9e43 100644 --- a/src/core/renderer/user_resource_controller.cpp +++ b/src/core/renderer/user_resource_controller.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 "user_resource_controller.h" @@ -149,7 +113,7 @@ public: private: // RenderFrameObserver implementation. void DidCommitProvisionalLoad(ui::PageTransition transition) override; - void DidFinishDocumentLoad() override; + void DidDispatchDOMContentLoadedEvent() override; void DidFinishLoad() override; void WillDetach() override; void OnDestruct() override; @@ -251,7 +215,7 @@ void UserResourceController::RenderFrameObserverHelper::DidCommitProvisionalLoad QtWebEngineCore::UserScriptData::DocumentElementCreation)); } -void UserResourceController::RenderFrameObserverHelper::DidFinishDocumentLoad() +void UserResourceController::RenderFrameObserverHelper::DidDispatchDOMContentLoadedEvent() { // Don't run scripts if provisional load failed (DidFailProvisionalLoad // called instead of DidCommitProvisionalLoad). @@ -260,7 +224,7 @@ void UserResourceController::RenderFrameObserverHelper::DidFinishDocumentLoad() FROM_HERE, base::BindOnce(&Runner::run, m_runner->AsWeakPtr(), QtWebEngineCore::UserScriptData::AfterLoad), - base::TimeDelta::FromMilliseconds(afterLoadTimeout)); + base::Milliseconds(afterLoadTimeout)); } void UserResourceController::RenderFrameObserverHelper::DidFinishLoad() diff --git a/src/core/renderer/user_resource_controller.h b/src/core/renderer/user_resource_controller.h index 37e7175a4..ba2ca000d 100644 --- a/src/core/renderer/user_resource_controller.h +++ b/src/core/renderer/user_resource_controller.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef USER_RESOURCE_CONTROLLER_H #define USER_RESOURCE_CONTROLLER_H diff --git a/src/core/renderer/web_channel_ipc_transport.cpp b/src/core/renderer/web_channel_ipc_transport.cpp index ef3fbeaaf..584c509a1 100644 --- a/src/core/renderer/web_channel_ipc_transport.cpp +++ b/src/core/renderer/web_channel_ipc_transport.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE.Chromium file. @@ -74,7 +38,6 @@ private: gin::ObjectTemplateBuilder GetObjectTemplateBuilder(v8::Isolate *isolate) override; mojo::AssociatedRemote<qtwebchannel::mojom::WebChannelTransportHost> m_remote; content::RenderFrame *m_renderFrame = nullptr; - DISALLOW_COPY_AND_ASSIGN(WebChannelTransport); }; gin::WrapperInfo WebChannelTransport::kWrapperInfo = { gin::kEmbedderNativeGin }; diff --git a/src/core/renderer/web_channel_ipc_transport.h b/src/core/renderer/web_channel_ipc_transport.h index f048a26d8..ded5ef26c 100644 --- a/src/core/renderer/web_channel_ipc_transport.h +++ b/src/core/renderer/web_channel_ipc_transport.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef WEB_CHANNEL_IPC_TRANSPORT_H #define WEB_CHANNEL_IPC_TRANSPORT_H diff --git a/src/core/renderer/web_engine_page_render_frame.cpp b/src/core/renderer/web_engine_page_render_frame.cpp index 524a8d364..87c2cee7f 100644 --- a/src/core/renderer/web_engine_page_render_frame.cpp +++ b/src/core/renderer/web_engine_page_render_frame.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 "renderer/web_engine_page_render_frame.h" #include "content/public/renderer/render_frame.h" diff --git a/src/core/renderer/web_engine_page_render_frame.h b/src/core/renderer/web_engine_page_render_frame.h index b91c5cb52..2d47d46f3 100644 --- a/src/core/renderer/web_engine_page_render_frame.h +++ b/src/core/renderer/web_engine_page_render_frame.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 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) 2020 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 #ifndef WEB_ENGINE_PAGE_RENDER_FRAME_H #define WEB_ENGINE_PAGE_RENDER_FRAME_H diff --git a/src/core/renderer_host/pepper/pepper_host_factory_qt.cpp b/src/core/renderer_host/pepper/pepper_host_factory_qt.cpp deleted file mode 100644 index 6686f8b12..000000000 --- a/src/core/renderer_host/pepper/pepper_host_factory_qt.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -// This is based on chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.cc: -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE.Chromium file. - -#include "pepper_host_factory_qt.h" - -#include "base/memory/ptr_util.h" -#include "build/build_config.h" -#include "content/public/browser/browser_ppapi_host.h" -#include "ppapi/host/message_filter_host.h" -#include "ppapi/host/ppapi_host.h" -#include "ppapi/host/resource_host.h" -#include "ppapi/proxy/ppapi_messages.h" -#include "ppapi/shared_impl/ppapi_permissions.h" - -#include "pepper_isolated_file_system_message_filter.h" - -using ppapi::host::MessageFilterHost; -using ppapi::host::ResourceMessageFilter; - -namespace QtWebEngineCore { - -PepperHostFactoryQt::PepperHostFactoryQt(content::BrowserPpapiHost* host) - : host_(host) -{ -} - -PepperHostFactoryQt::~PepperHostFactoryQt() {} - -std::unique_ptr<ppapi::host::ResourceHost> PepperHostFactoryQt::CreateResourceHost(ppapi::host::PpapiHost* host, - PP_Resource resource, - PP_Instance instance, - const IPC::Message& message) -{ - DCHECK(host == host_->GetPpapiHost()); - - - if (!host_->IsValidInstance(instance)) - return nullptr; - - // Permissions for the following interfaces will be checked at the - // time of the corresponding instance's methods calls (because - // permission check can be performed only on the UI - // thread). Currently these interfaces are available only for - // whitelisted apps which may not have access to the other private - // interfaces. - if (message.type() == PpapiHostMsg_IsolatedFileSystem_Create::ID) { - PepperIsolatedFileSystemMessageFilter* isolated_fs_filter = PepperIsolatedFileSystemMessageFilter::Create(instance, host_); - if (!isolated_fs_filter) - return nullptr; - return base::WrapUnique( - new MessageFilterHost(host_->GetPpapiHost(), instance, resource, isolated_fs_filter)); - } - - return nullptr; -} - -} // namespace QtWebEngineCore diff --git a/src/core/renderer_host/pepper/pepper_host_factory_qt.h b/src/core/renderer_host/pepper/pepper_host_factory_qt.h deleted file mode 100644 index 0446cf9e3..000000000 --- a/src/core/renderer_host/pepper/pepper_host_factory_qt.h +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -#ifndef PEPPER_HOST_FACTORY_QT_H -#define PEPPER_HOST_FACTORY_QT_H - -#include "base/compiler_specific.h" -#include "ppapi/host/host_factory.h" -#include "ppapi/host/resource_host.h" -#include "ppapi/host/ppapi_host.h" - -namespace content { -class BrowserPpapiHost; -} // namespace content - -namespace QtWebEngineCore { - -class PepperHostFactoryQt final : public ppapi::host::HostFactory { -public: - // Non-owning pointer to the filter must outlive this class. - explicit PepperHostFactoryQt(content::BrowserPpapiHost* host); - ~PepperHostFactoryQt() override; - - virtual std::unique_ptr<ppapi::host::ResourceHost> CreateResourceHost( - ppapi::host::PpapiHost* host, - PP_Resource resource, - PP_Instance instance, - const IPC::Message& message) override; -private: - // Non-owning pointer. - content::BrowserPpapiHost* host_; - - DISALLOW_COPY_AND_ASSIGN(PepperHostFactoryQt); -}; -} // namespace QtWebEngineCore - -#endif // PEPPER_HOST_FACTORY_QT_H diff --git a/src/core/renderer_host/pepper/pepper_isolated_file_system_message_filter.cpp b/src/core/renderer_host/pepper/pepper_isolated_file_system_message_filter.cpp deleted file mode 100644 index f61c06ea9..000000000 --- a/src/core/renderer_host/pepper/pepper_isolated_file_system_message_filter.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -// This is based on chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc: -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE.Chromium file. - -#include "pepper_isolated_file_system_message_filter.h" - -#include "base/macros.h" -#include "base/task/post_task.h" -#include "chrome/common/chrome_switches.h" -#include "content/public/browser/browser_ppapi_host.h" -#include "content/public/browser/browser_task_traits.h" -#include "content/public/browser/browser_thread.h" -#include "content/public/browser/child_process_security_policy.h" -#include "content/public/browser/render_view_host.h" -#include "ppapi/c/pp_errors.h" -#include "ppapi/host/dispatch_host_message.h" -#include "ppapi/host/host_message_context.h" -#include "ppapi/host/ppapi_host.h" -#include "ppapi/proxy/ppapi_messages.h" -#include "ppapi/shared_impl/file_system_util.h" -#include "storage/browser/file_system/isolated_context.h" - -namespace QtWebEngineCore { - -// static -PepperIsolatedFileSystemMessageFilter* PepperIsolatedFileSystemMessageFilter::Create(PP_Instance instance, content::BrowserPpapiHost *host) -{ - int render_process_id; - int unused_render_frame_id; - if (!host->GetRenderFrameIDsForInstance(instance, &render_process_id, &unused_render_frame_id)) - return nullptr; - return new PepperIsolatedFileSystemMessageFilter(render_process_id, host->GetPpapiHost()); -} - -PepperIsolatedFileSystemMessageFilter::PepperIsolatedFileSystemMessageFilter(int render_process_id, - ppapi::host::PpapiHost *ppapi_host) - : m_render_process_id(render_process_id), - m_ppapi_host(ppapi_host) -{} - -PepperIsolatedFileSystemMessageFilter::~PepperIsolatedFileSystemMessageFilter() -{} - -scoped_refptr<base::SequencedTaskRunner> PepperIsolatedFileSystemMessageFilter::OverrideTaskRunnerForMessage(const IPC::Message &) -{ - // In order to reach ExtensionSystem, we need to get ProfileManager first. - // ProfileManager lives in UI thread, so we need to do this in UI thread. - return base::CreateSingleThreadTaskRunner({content::BrowserThread::UI}); -} - -int32_t PepperIsolatedFileSystemMessageFilter::OnResourceMessageReceived(const IPC::Message& msg, ppapi::host::HostMessageContext *context) -{ - PPAPI_BEGIN_MESSAGE_MAP(PepperIsolatedFileSystemMessageFilter, msg) - PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_IsolatedFileSystem_BrowserOpen, OnOpenFileSystem) - PPAPI_END_MESSAGE_MAP() - return PP_ERROR_FAILED; -} - -int32_t PepperIsolatedFileSystemMessageFilter::OnOpenFileSystem(ppapi::host::HostMessageContext *context, - PP_IsolatedFileSystemType_Private type) -{ - switch (type) { - case PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_INVALID: - break; - case PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_CRX: - return PP_ERROR_NOTSUPPORTED; - case PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_PLUGINPRIVATE: - return OpenPluginPrivateFileSystem(context); - } - NOTREACHED(); - context->reply_msg = PpapiPluginMsg_IsolatedFileSystem_BrowserOpenReply(std::string()); - return PP_ERROR_FAILED; -} - -int32_t PepperIsolatedFileSystemMessageFilter::OpenPluginPrivateFileSystem(ppapi::host::HostMessageContext *context) -{ - DCHECK(m_ppapi_host); - // Only plugins with private permission can open the filesystem. - if (!m_ppapi_host->permissions().HasPermission(ppapi::PERMISSION_PRIVATE)) - return PP_ERROR_NOACCESS; - - const std::string& root_name = ppapi::IsolatedFileSystemTypeToRootName(PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_PLUGINPRIVATE); - const std::string& fsid = - storage::IsolatedContext::GetInstance()->RegisterFileSystemForVirtualPath( - storage::kFileSystemTypePluginPrivate, root_name, base::FilePath()); - - // Grant full access of isolated filesystem to renderer process. - content::ChildProcessSecurityPolicy* policy = content::ChildProcessSecurityPolicy::GetInstance(); - policy->GrantCreateReadWriteFileSystem(m_render_process_id, fsid); - - context->reply_msg = PpapiPluginMsg_IsolatedFileSystem_BrowserOpenReply(fsid); - return PP_OK; -} - -} // namespace chrome diff --git a/src/core/renderer_host/pepper/pepper_isolated_file_system_message_filter.h b/src/core/renderer_host/pepper/pepper_isolated_file_system_message_filter.h deleted file mode 100644 index 27c23d8e0..000000000 --- a/src/core/renderer_host/pepper/pepper_isolated_file_system_message_filter.h +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -#ifndef PEPPER_ISOLATED_FILE_SYSTEM_MESSAGE_FILTER_H -#define PEPPER_ISOLATED_FILE_SYSTEM_MESSAGE_FILTER_H - -#include "base/macros.h" -#include "ppapi/c/pp_instance.h" -#include "ppapi/c/pp_resource.h" -#include "ppapi/c/private/ppb_isolated_file_system_private.h" -#include "ppapi/host/resource_host.h" -#include "ppapi/host/resource_message_filter.h" - -namespace content { -class BrowserPpapiHost; -} - -namespace ppapi { -namespace host { -struct HostMessageContext; -} // namespace host -} // namespace ppapi - -namespace QtWebEngineCore { - -class PepperIsolatedFileSystemMessageFilter : public ppapi::host::ResourceMessageFilter { -public: - static PepperIsolatedFileSystemMessageFilter *Create(PP_Instance instance, content::BrowserPpapiHost *host); - - // ppapi::host::ResourceMessageFilter implementation. - scoped_refptr<base::SequencedTaskRunner> OverrideTaskRunnerForMessage(const IPC::Message &msg) override; - int32_t OnResourceMessageReceived(const IPC::Message &msg, ppapi::host::HostMessageContext *context) override; - -private: - PepperIsolatedFileSystemMessageFilter(int render_process_id, ppapi::host::PpapiHost *ppapi_host); - - ~PepperIsolatedFileSystemMessageFilter() override; - - - int32_t OnOpenFileSystem(ppapi::host::HostMessageContext *context, PP_IsolatedFileSystemType_Private type); - int32_t OpenPluginPrivateFileSystem(ppapi::host::HostMessageContext *context); - - const int m_render_process_id; - - // Not owned by this object. - ppapi::host::PpapiHost* m_ppapi_host; - - DISALLOW_COPY_AND_ASSIGN(PepperIsolatedFileSystemMessageFilter); -}; - -} // namespace QtWebEngineCore - -#endif // PEPPER_ISOLATED_FILE_SYSTEM_MESSAGE_FILTER_H diff --git a/src/core/renderer_host/user_resource_controller_host.cpp b/src/core/renderer_host/user_resource_controller_host.cpp index 387df9452..b24e87e8b 100644 --- a/src/core/renderer_host/user_resource_controller_host.cpp +++ b/src/core/renderer_host/user_resource_controller_host.cpp @@ -1,52 +1,18 @@ -/**************************************************************************** -** -** 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 "user_resource_controller_host.h" #include "type_conversion.h" #include "web_contents_adapter.h" + #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_process_host_observer.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_observer.h" +#include "ipc/ipc_channel_proxy.h" #include "qtwebengine/userscript/userscript.mojom.h" #include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h" @@ -151,7 +117,7 @@ void UserResourceControllerHost::addUserScript(const UserScript &script, WebCont m_perContentsScripts.insert(contents, currentScripts); } } - GetUserResourceControllerRenderFrame(contents->GetRenderViewHost()->GetMainFrame()) + GetUserResourceControllerRenderFrame(contents->GetMainFrame()) ->AddScript(script.data()); } } @@ -174,7 +140,7 @@ bool UserResourceControllerHost::removeUserScript(const UserScript &script, WebC QList<UserScript>::iterator it = std::find(list.begin(), list.end(), script); if (it == list.end()) return false; - GetUserResourceControllerRenderFrame(contents->GetRenderViewHost()->GetMainFrame()) + GetUserResourceControllerRenderFrame(contents->GetMainFrame()) ->RemoveScript((*it).data()); list.erase(it); } @@ -193,7 +159,7 @@ void UserResourceControllerHost::clearAllScripts(WebContentsAdapter *adapter) m_perContentsScripts.remove(contents); mojo::AssociatedRemote<qtwebengine::mojom::UserResourceControllerRenderFrame> userResourceController; - GetUserResourceControllerRenderFrame(contents->GetRenderViewHost()->GetMainFrame()) + GetUserResourceControllerRenderFrame(contents->GetMainFrame()) ->ClearScripts(); } } diff --git a/src/core/renderer_host/user_resource_controller_host.h b/src/core/renderer_host/user_resource_controller_host.h index a88264f2d..e92deb900 100644 --- a/src/core/renderer_host/user_resource_controller_host.h +++ b/src/core/renderer_host/user_resource_controller_host.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 // // W A R N I N G 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 fbf4cb9dd..d234fb141 100644 --- a/src/core/renderer_host/web_channel_ipc_transport_host.cpp +++ b/src/core/renderer_host/web_channel_ipc_transport_host.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 "web_channel_ipc_transport_host.h" @@ -66,8 +30,10 @@ WebChannelIPCTransportHost::WebChannelIPCTransportHost(content::WebContents *con , m_worldId(worldId) , m_receiver(contents, this) { - for (content::RenderFrameHost *frame : contents->GetAllFrames()) - setWorldId(frame, worldId); + contents->ForEachFrame(base::BindRepeating([](WebChannelIPCTransportHost *that, uint32_t worldId, content::RenderFrameHost *frame) { + that->setWorldId(frame, worldId); + }, + base::Unretained(this), worldId)); } WebChannelIPCTransportHost::~WebChannelIPCTransportHost() @@ -94,8 +60,10 @@ void WebChannelIPCTransportHost::setWorldId(uint32_t worldId) { if (m_worldId == worldId) return; - for (content::RenderFrameHost *frame : web_contents()->GetAllFrames()) - setWorldId(frame, worldId); + web_contents()->ForEachFrame(base::BindRepeating([](WebChannelIPCTransportHost *that, uint32_t worldId, content::RenderFrameHost *frame) { + that->setWorldId(frame, worldId); + }, + base::Unretained(this), worldId)); m_worldId = worldId; } @@ -109,11 +77,11 @@ void WebChannelIPCTransportHost::setWorldId(content::RenderFrameHost *frame, uin void WebChannelIPCTransportHost::resetWorldId() { - for (content::RenderFrameHost *frame : web_contents()->GetAllFrames()) { + web_contents()->ForEachFrame(base::BindRepeating([](WebChannelIPCTransportHost *that, content::RenderFrameHost *frame) { if (!frame->IsRenderFrameLive()) return; - GetWebChannelIPCTransportRemote(frame)->ResetWorldId(); - } + that->GetWebChannelIPCTransportRemote(frame)->ResetWorldId(); + }, this)); } void WebChannelIPCTransportHost::DispatchWebChannelMessage(const std::vector<uint8_t> &json) diff --git a/src/core/renderer_host/web_channel_ipc_transport_host.h b/src/core/renderer_host/web_channel_ipc_transport_host.h index 846a4da3d..9e003c222 100644 --- a/src/core/renderer_host/web_channel_ipc_transport_host.h +++ b/src/core/renderer_host/web_channel_ipc_transport_host.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 #ifndef WEB_CHANNEL_IPC_TRANSPORT_H #define WEB_CHANNEL_IPC_TRANSPORT_H diff --git a/src/core/renderer_host/web_engine_page_host.cpp b/src/core/renderer_host/web_engine_page_host.cpp index 36907ef5a..1b9b9863a 100644 --- a/src/core/renderer_host/web_engine_page_host.cpp +++ b/src/core/renderer_host/web_engine_page_host.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 "web_engine_page_host.h" diff --git a/src/core/renderer_host/web_engine_page_host.h b/src/core/renderer_host/web_engine_page_host.h index f305d22ea..20b9145b2 100644 --- a/src/core/renderer_host/web_engine_page_host.h +++ b/src/core/renderer_host/web_engine_page_host.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef WEB_ENGINE_PAGE_HOST_H #define WEB_ENGINE_PAGE_HOST_H diff --git a/src/core/request_controller.h b/src/core/request_controller.h index ffcf9edac..8008b2edb 100644 --- a/src/core/request_controller.h +++ b/src/core/request_controller.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 #ifndef REQUEST_CONTROLLER_H #define REQUEST_CONTROLLER_H diff --git a/src/core/resource_bundle_qt.cpp b/src/core/resource_bundle_qt.cpp index 4e814a806..693d1291f 100644 --- a/src/core/resource_bundle_qt.cpp +++ b/src/core/resource_bundle_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 "base/command_line.h" #include "base/files/file_util.h" @@ -51,7 +15,7 @@ #include "web_engine_library_info.h" -#if defined(OS_LINUX) +#if BUILDFLAG(IS_LINUX) #include "base/posix/global_descriptors.h" #include "global_descriptors_qt.h" #endif @@ -61,10 +25,10 @@ namespace ui { void ResourceBundle::LoadCommonResources() { // We repacked the resources we need and installed them. now let chromium mmap that file. - AddDataPackFromPath(WebEngineLibraryInfo::getPath(QT_RESOURCES_100P_PAK), SCALE_FACTOR_100P); - AddDataPackFromPath(WebEngineLibraryInfo::getPath(QT_RESOURCES_200P_PAK), SCALE_FACTOR_200P); - AddDataPackFromPath(WebEngineLibraryInfo::getPath(QT_RESOURCES_PAK), SCALE_FACTOR_NONE); - AddOptionalDataPackFromPath(WebEngineLibraryInfo::getPath(QT_RESOURCES_DEVTOOLS_PAK), SCALE_FACTOR_NONE); + AddDataPackFromPath(WebEngineLibraryInfo::getPath(QT_RESOURCES_100P_PAK), ui::k100Percent); + AddDataPackFromPath(WebEngineLibraryInfo::getPath(QT_RESOURCES_200P_PAK), ui::k200Percent); + AddDataPackFromPath(WebEngineLibraryInfo::getPath(QT_RESOURCES_PAK), ui::kScaleFactorNone); + AddOptionalDataPackFromPath(WebEngineLibraryInfo::getPath(QT_RESOURCES_DEVTOOLS_PAK), ui::kScaleFactorNone); } gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id) @@ -75,7 +39,7 @@ gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id) // static bool ResourceBundle::LocaleDataPakExists(const std::string& locale) { -#if defined(OS_LINUX) +#if BUILDFLAG(IS_LINUX) base::CommandLine *parsed_command_line = base::CommandLine::ForCurrentProcess(); std::string process_type = parsed_command_line->GetSwitchValueASCII(switches::kProcessType); bool no_sandbox = parsed_command_line->HasSwitch(sandbox::policy::switches::kNoSandbox); @@ -100,12 +64,12 @@ std::string ResourceBundle::LoadLocaleResources(const std::string &pref_locale, std::string app_locale = l10n_util::GetApplicationLocale(pref_locale, false /* set_icu_locale */); -#if defined(OS_LINUX) +#if BUILDFLAG(IS_LINUX) int locale_fd = base::GlobalDescriptors::GetInstance()->MaybeGet(kWebEngineLocale); if (locale_fd > -1) { - std::unique_ptr<DataPack> data_pack(new DataPack(SCALE_FACTOR_100P)); + std::unique_ptr<DataPack> data_pack(new DataPack(ui::k100Percent)); data_pack->LoadFromFile(base::File(locale_fd)); - locale_resources_data_.reset(data_pack.release()); + locale_resources_data_ = std::move(data_pack); return app_locale; } #endif @@ -120,7 +84,7 @@ std::string ResourceBundle::LoadLocaleResources(const std::string &pref_locale, return std::string(); } - std::unique_ptr<DataPack> data_pack(new DataPack(SCALE_FACTOR_100P)); + std::unique_ptr<DataPack> data_pack(new DataPack(ui::k100Percent)); if (!data_pack->LoadFromPath(locale_file_path)) { UMA_HISTOGRAM_ENUMERATION("ResourceBundle.LoadLocaleResourcesError", logging::GetLastSystemErrorCode(), 16000); @@ -129,7 +93,7 @@ std::string ResourceBundle::LoadLocaleResources(const std::string &pref_locale, return std::string(); } - locale_resources_data_.reset(data_pack.release()); + locale_resources_data_ = std::move(data_pack); return app_locale; } diff --git a/src/core/resource_context_qt.cpp b/src/core/resource_context_qt.cpp deleted file mode 100644 index 79c105956..000000000 --- a/src/core/resource_context_qt.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** -** -** 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 "resource_context_qt.h" - -namespace QtWebEngineCore { - -ResourceContextQt::ResourceContextQt(ProfileIODataQt *io_data) - : m_io_data(io_data) -{ -} - -} // namespace QtWebEngineCore diff --git a/src/core/resource_context_qt.h b/src/core/resource_context_qt.h deleted file mode 100644 index efd3d2e7e..000000000 --- a/src/core/resource_context_qt.h +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -#ifndef RESOURCE_CONTEXT_QT_H -#define RESOURCE_CONTEXT_QT_H - -#include "content/public/browser/resource_context.h" - -namespace QtWebEngineCore { - -class ProfileIODataQt; - -class ResourceContextQt : public content::ResourceContext -{ -public: - ResourceContextQt(ProfileIODataQt *io_data); -private: - friend class ProfileIODataQt; - ProfileIODataQt* m_io_data; - DISALLOW_COPY_AND_ASSIGN(ResourceContextQt); -}; - -} // namespace QtWebEngineCore - -#endif // RESOURCE_CONTEXT_QT_H diff --git a/src/core/sandbox_win.cpp b/src/core/sandbox_win.cpp index 01538d318..81fecc62c 100644 --- a/src/core/sandbox_win.cpp +++ b/src/core/sandbox_win.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 "qtwebenginecoreglobal_p.h" #include "sandbox/win/src/process_mitigations.h" diff --git a/src/core/select_file_dialog_factory_qt.cpp b/src/core/select_file_dialog_factory_qt.cpp index 8fe0a0be5..1bf20918d 100644 --- a/src/core/select_file_dialog_factory_qt.cpp +++ b/src/core/select_file_dialog_factory_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 "select_file_dialog_factory_qt.h" @@ -107,8 +71,6 @@ public: private: WebContentsAdapterClient *m_client; QSharedPointer<FilePickerController> m_filePickerController; - - DISALLOW_COPY_AND_ASSIGN(SelectFileDialogQt); }; SelectFileDialogQt::SelectFileDialogQt(Listener *listener, diff --git a/src/core/select_file_dialog_factory_qt.h b/src/core/select_file_dialog_factory_qt.h index 572bf217f..8036995f1 100644 --- a/src/core/select_file_dialog_factory_qt.h +++ b/src/core/select_file_dialog_factory_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 #ifndef SELECT_FILE_DIALOG_FACTORY_QT_H_ #define SELECT_FILE_DIALOG_FACTORY_QT_H_ @@ -63,8 +27,6 @@ public: private: content::WebContents *m_webContents; - - DISALLOW_COPY_AND_ASSIGN(SelectFilePolicyQt); }; // Implements a file Open / Save dialog for File System Access API. @@ -77,9 +39,6 @@ public: // Overridden from ui::SelectFileDialogFactory: ui::SelectFileDialog *Create(ui::SelectFileDialog::Listener *listener, std::unique_ptr<ui::SelectFilePolicy> policy) override; - -private: - DISALLOW_COPY_AND_ASSIGN(SelectFileDialogFactoryQt); }; } // namespace QtWebEngineCore diff --git a/src/core/tools/main.cpp b/src/core/tools/main.cpp index 1721f71d3..4b6c82997 100644 --- a/src/core/tools/main.cpp +++ b/src/core/tools/main.cpp @@ -7,8 +7,7 @@ ** Modified work: ** Copyright (C) 2016 The Qt Company Ltd. ** -** Use of this source code is governed by a BSD-style license that can be -** found in the LICENSE.Chromium file. +** SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause ** ** This tool converts Hunspell .aff/.dic pairs to a combined binary dictionary ** format (.bdic). This format is more compact, and can be more efficiently @@ -129,7 +128,7 @@ inline bool VerifyWords(const convert_dict::DicReader::WordList& org_words, return true; } -#if defined(OS_MAC) && defined(QT_MAC_FRAMEWORK_BUILD) +#if defined(Q_OS_DARWIN) && defined(QT_MAC_FRAMEWORK_BUILD) QString frameworkIcuDataPath() { return QLibraryInfo::location(QLibraryInfo::LibrariesPath) + @@ -169,7 +168,7 @@ int main(int argc, char *argv[]) icuDataDir = icuPossibleEnvDataDir; icuDataDirFound = true; } -#if defined(OS_MAC) && defined(QT_MAC_FRAMEWORK_BUILD) +#if defined(Q_OS_DARWIN) && defined(QT_MAC_FRAMEWORK_BUILD) // In a macOS Qt framework build, the resources are inside the QtWebEngineCore framework // Resources directory, rather than in the Qt install location. else if (QFileInfo::exists(frameworkIcuDataPath())) { diff --git a/src/core/touch_handle_drawable_client.h b/src/core/touch_handle_drawable_client.h index d7db78f02..3e1812a35 100644 --- a/src/core/touch_handle_drawable_client.h +++ b/src/core/touch_handle_drawable_client.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 #ifndef TOUCH_HANDLE_DRAWABLE_CLIENT_H #define TOUCH_HANDLE_DRAWABLE_CLIENT_H @@ -45,9 +9,9 @@ namespace QtWebEngineCore { -class Q_WEBENGINECORE_PRIVATE_EXPORT TouchHandleDrawableClient { +class Q_WEBENGINECORE_PRIVATE_EXPORT TouchHandleDrawableDelegate { public: - virtual ~TouchHandleDrawableClient() { } + virtual ~TouchHandleDrawableDelegate() { } virtual void setImage(int orientation) = 0; virtual void setBounds(const QRect &bounds) = 0; diff --git a/src/core/touch_handle_drawable_qt.cpp b/src/core/touch_handle_drawable_qt.cpp index 66b1cf40e..1e979fa03 100644 --- a/src/core/touch_handle_drawable_qt.cpp +++ b/src/core/touch_handle_drawable_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 // Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be @@ -49,7 +13,6 @@ #include "type_conversion.h" #include "web_contents_adapter_client.h" -#include "ui/gfx/image/image.h" #include "ui/base/resource/resource_bundle.h" #include "ui/resources/grit/ui_resources.h" @@ -68,27 +31,6 @@ const int kSelectionHandlePadding = 0; // Epsilon value used to compare float values to zero. const float kEpsilon = 1e-8f; -// Returns the appropriate handle image based on the handle orientation. -gfx::Image* GetHandleImage(ui::TouchHandleOrientation orientation) -{ - int resource_id = 0; - switch (orientation) { - case ui::TouchHandleOrientation::LEFT: - resource_id = IDR_TEXT_SELECTION_HANDLE_LEFT; - break; - case ui::TouchHandleOrientation::CENTER: - resource_id = IDR_TEXT_SELECTION_HANDLE_CENTER; - break; - case ui::TouchHandleOrientation::RIGHT: - resource_id = IDR_TEXT_SELECTION_HANDLE_RIGHT; - break; - case ui::TouchHandleOrientation::UNDEFINED: - NOTREACHED() << "Invalid touch handle bound type."; - return nullptr; - }; - return &ui::ResourceBundle::GetSharedInstance().GetImageNamed(resource_id); -} - bool IsNearlyZero(float value) { return std::abs(value) < kEpsilon; @@ -96,21 +38,12 @@ bool IsNearlyZero(float value) } // namespace -TouchHandleDrawableQt::TouchHandleDrawableQt(RenderWidgetHostViewQt *rwhv) - : m_rwhv(rwhv) +TouchHandleDrawableQt::TouchHandleDrawableQt(TouchHandleDrawableDelegate *delegate) + : m_delegate(delegate) , m_enabled(false) , m_alpha(0) , m_orientation(ui::TouchHandleOrientation::UNDEFINED) { - QMap<int, QImage> images; - for (int orientation = 0; orientation < static_cast<int>(ui::TouchHandleOrientation::UNDEFINED); ++orientation) { - gfx::Image* image = GetHandleImage(static_cast<ui::TouchHandleOrientation>(orientation)); - images.insert(orientation, toQImage(image->AsBitmap())); - } - - Q_ASSERT(m_rwhv); - Q_ASSERT(m_rwhv->adapterClient()); - m_client.reset(m_rwhv->adapterClient()->createTouchHandle(images)); } TouchHandleDrawableQt::~TouchHandleDrawableQt() @@ -119,12 +52,12 @@ TouchHandleDrawableQt::~TouchHandleDrawableQt() void TouchHandleDrawableQt::UpdateBounds() { - if (!m_client) + if (!m_delegate) return; gfx::RectF newBounds = m_relativeBounds; newBounds.Offset(m_originPosition.x(), m_originPosition.y()); - m_client->setBounds(toQt(gfx::ToEnclosingRect(newBounds))); + m_delegate->setBounds(toQt(gfx::ToEnclosingRect(newBounds))); } bool TouchHandleDrawableQt::IsVisible() const @@ -134,19 +67,19 @@ bool TouchHandleDrawableQt::IsVisible() const void TouchHandleDrawableQt::SetEnabled(bool enabled) { - if (!m_client) + if (!m_delegate) return; if (enabled == m_enabled) return; m_enabled = enabled; - m_client->setVisible(enabled); + m_delegate->setVisible(enabled); } void TouchHandleDrawableQt::SetOrientation(ui::TouchHandleOrientation orientation, bool mirror_vertical, bool mirror_horizontal) { - if (!m_client) + if (!m_delegate) return; // TODO: Implement adaptive handle orientation logic @@ -157,7 +90,7 @@ void TouchHandleDrawableQt::SetOrientation(ui::TouchHandleOrientation orientatio return; m_orientation = orientation; gfx::Image* image = GetHandleImage(orientation); - m_client->setImage(static_cast<int>(orientation)); + m_delegate->setImage(static_cast<int>(orientation)); // Calculate the relative bounds. gfx::Size image_size = image->Size(); @@ -178,15 +111,15 @@ void TouchHandleDrawableQt::SetOrigin(const gfx::PointF& position) void TouchHandleDrawableQt::SetAlpha(float alpha) { - if (!m_client) + if (!m_delegate) return; if (alpha == m_alpha) return; m_alpha = alpha; - m_client->setOpacity(m_alpha); - m_client->setVisible(IsVisible()); + m_delegate->setOpacity(m_alpha); + m_delegate->setVisible(IsVisible()); } gfx::RectF TouchHandleDrawableQt::GetVisibleBounds() const @@ -195,10 +128,11 @@ gfx::RectF TouchHandleDrawableQt::GetVisibleBounds() const bounds.Offset(m_originPosition.x(), m_originPosition.y()); gfx::RectF visibleBounds(bounds); - visibleBounds.Inset(kSelectionHandlePadding, - kSelectionHandlePadding + kSelectionHandleVerticalVisualOffset, - kSelectionHandlePadding, - kSelectionHandlePadding); + visibleBounds.Inset(gfx::InsetsF::TLBR( + kSelectionHandlePadding, + kSelectionHandlePadding + kSelectionHandleVerticalVisualOffset, + kSelectionHandlePadding, + kSelectionHandlePadding)); return visibleBounds; } @@ -208,4 +142,25 @@ 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; + switch (orientation) { + case ui::TouchHandleOrientation::LEFT: + resource_id = IDR_TEXT_SELECTION_HANDLE_LEFT; + break; + case ui::TouchHandleOrientation::CENTER: + resource_id = IDR_TEXT_SELECTION_HANDLE_CENTER; + break; + case ui::TouchHandleOrientation::RIGHT: + resource_id = IDR_TEXT_SELECTION_HANDLE_RIGHT; + break; + case ui::TouchHandleOrientation::UNDEFINED: + NOTREACHED() << "Invalid touch handle bound type."; + return nullptr; + }; + return &ui::ResourceBundle::GetSharedInstance().GetImageNamed(resource_id); +} + } // namespace QtWebEngineCore diff --git a/src/core/touch_handle_drawable_qt.h b/src/core/touch_handle_drawable_qt.h index 46fa217b7..1738e68e9 100644 --- a/src/core/touch_handle_drawable_qt.h +++ b/src/core/touch_handle_drawable_qt.h @@ -1,60 +1,25 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 #ifndef TOUCH_HANDLE_DRAWABLE_QT_H #define TOUCH_HANDLE_DRAWABLE_QT_H #include "ui/touch_selection/touch_handle.h" #include "ui/touch_selection/touch_handle_orientation.h" +#include "ui/gfx/image/image.h" #include <QtCore/QScopedPointer> namespace QtWebEngineCore { -class RenderWidgetHostViewQt; -class TouchHandleDrawableClient; +class TouchHandleDrawableDelegate; class TouchHandleDrawableQt : public ui::TouchHandleDrawable { public: - explicit TouchHandleDrawableQt(RenderWidgetHostViewQt *rwhv); + explicit TouchHandleDrawableQt(TouchHandleDrawableDelegate *delegate); ~TouchHandleDrawableQt() override; + static gfx::Image *GetHandleImage(ui::TouchHandleOrientation orientation); private: void UpdateBounds(); @@ -71,15 +36,13 @@ private: float GetDrawableHorizontalPaddingRatio() const override; RenderWidgetHostViewQt *m_rwhv; - QScopedPointer<TouchHandleDrawableClient> m_client; + QScopedPointer<TouchHandleDrawableDelegate> m_delegate; bool m_enabled; float m_alpha; ui::TouchHandleOrientation m_orientation; gfx::RectF m_relativeBounds; gfx::PointF m_originPosition; - - DISALLOW_COPY_AND_ASSIGN(TouchHandleDrawableQt); }; } // namespace QtWebEngineCore diff --git a/src/core/touch_selection_controller_client_qt.cpp b/src/core/touch_selection_controller_client_qt.cpp index 2e9f56a5f..befee6aaf 100644 --- a/src/core/touch_selection_controller_client_qt.cpp +++ b/src/core/touch_selection_controller_client_qt.cpp @@ -1,44 +1,9 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 "render_widget_host_view_qt.h" #include "touch_handle_drawable_qt.h" +#include "touch_handle_drawable_client.h" #include "touch_selection_controller_client_qt.h" #include "touch_selection_menu_controller.h" #include "type_conversion.h" @@ -293,13 +258,31 @@ void TouchSelectionControllerClientQt::OnDragUpdate(const ui::TouchSelectionDrag std::unique_ptr<ui::TouchHandleDrawable> TouchSelectionControllerClientQt::CreateDrawable() { - return std::unique_ptr<ui::TouchHandleDrawable>(new TouchHandleDrawableQt(m_rwhv)); + Q_ASSERT(m_rwhv); + Q_ASSERT(m_rwhv->adapterClient()); + QMap<int, QImage> images; + for (int orientation = 0; orientation < static_cast<int>(ui::TouchHandleOrientation::UNDEFINED); + ++orientation) { + gfx::Image *image = TouchHandleDrawableQt::GetHandleImage( + static_cast<ui::TouchHandleOrientation>(orientation)); + images.insert(orientation, toQImage(image->AsBitmap())); + } + auto delegate = m_rwhv->adapterClient()->createTouchHandleDelegate(images); + return std::unique_ptr<ui::TouchHandleDrawable>(new TouchHandleDrawableQt(delegate)); } void TouchSelectionControllerClientQt::DidScroll() { } +void TouchSelectionControllerClientQt::resetControls() +{ + if (m_menuShowing) { + hideMenu(); + GetTouchSelectionController()->HideAndDisallowShowingAutomatically(); + } +} + void TouchSelectionControllerClientQt::showMenu() { gfx::RectF rect = GetTouchSelectionController()->GetRectBetweenBounds(); diff --git a/src/core/touch_selection_controller_client_qt.h b/src/core/touch_selection_controller_client_qt.h index e3e86a336..df693a0e1 100644 --- a/src/core/touch_selection_controller_client_qt.h +++ b/src/core/touch_selection_controller_client_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 #ifndef TOUCH_SELECTION_CONTROLLER_CLIENT_QT_H #define TOUCH_SELECTION_CONTROLLER_CLIENT_QT_H @@ -51,6 +15,7 @@ namespace QtWebEngineCore { class RenderWidgetHostViewQt; class TouchSelectionMenuController; +class TouchHandleDrawableDelegate; class TouchSelectionControllerClientQt : public ui::TouchSelectionControllerClient @@ -75,7 +40,6 @@ public: void RunContextMenu() override; bool ShouldShowQuickMenu() override { return false; } std::u16string GetSelectedText() override { return std::u16string(); } - const char *GetType() override { return nullptr; } //FIXME? // content::TouchSelectionControllerClientManager overrides void DidStopFlinging() override; @@ -99,6 +63,8 @@ public: std::unique_ptr<ui::TouchHandleDrawable> CreateDrawable() override; void DidScroll() override; + void resetControls(); + private: void showMenu(); void hideMenu(); diff --git a/src/core/touch_selection_menu_controller.cpp b/src/core/touch_selection_menu_controller.cpp index 3a6d49160..98481baf0 100644 --- a/src/core/touch_selection_menu_controller.cpp +++ b/src/core/touch_selection_menu_controller.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 "touch_selection_controller_client_qt.h" #include "touch_selection_menu_controller.h" diff --git a/src/core/touch_selection_menu_controller.h b/src/core/touch_selection_menu_controller.h index 1167d8bc9..184ac039b 100644 --- a/src/core/touch_selection_menu_controller.h +++ b/src/core/touch_selection_menu_controller.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 #ifndef TOUCH_SELECTION_MENU_CONTROLLER_H #define TOUCH_SELECTION_MENU_CONTROLLER_H diff --git a/src/core/type_conversion.cpp b/src/core/type_conversion.cpp index af22aa2d9..54f6e2e4f 100644 --- a/src/core/type_conversion.cpp +++ b/src/core/type_conversion.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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" @@ -44,8 +8,9 @@ #include <net/cert/x509_certificate.h> #include <net/cert/x509_util.h> #include <ui/events/event_constants.h> -#include <ui/gfx/image/image.h> -#include <ui/gfx/image/image_skia.h> +#include "ui/gfx/image/image.h" +#include "ui/gfx/image/image_skia.h" +#include "ui/gfx/image/image_skia_rep.h" #include "third_party/blink/public/mojom/favicon/favicon_url.mojom.h" #include <QtCore/qcoreapplication.h> @@ -66,6 +31,7 @@ QImage toQImage(const SkBitmap &bitmap) case kA16_unorm_SkColorType: case kR16G16_float_SkColorType: case kR16G16_unorm_SkColorType: + case kR8_unorm_SkColorType: qWarning("Unknown or unsupported skia image format"); break; case kAlpha_8_SkColorType: @@ -88,6 +54,7 @@ QImage toQImage(const SkBitmap &bitmap) break; } break; + case kSRGBA_8888_SkColorType: case kRGB_888x_SkColorType: case kRGBA_8888_SkColorType: switch (bitmap.alphaType()) { diff --git a/src/core/type_conversion.h b/src/core/type_conversion.h index 7f378457b..92304a7b8 100644 --- a/src/core/type_conversion.h +++ b/src/core/type_conversion.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef TYPE_CONVERSION_H #define TYPE_CONVERSION_H @@ -60,6 +24,7 @@ #include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect_f.h" #include "url/gurl.h" +#include "url/origin.h" QT_FORWARD_DECLARE_CLASS(QSslCertificate) @@ -74,7 +39,7 @@ class X509Certificate; namespace QtWebEngineCore { -#if defined(OS_WIN) +#if defined(Q_OS_WIN) inline QString toQt(const std::wstring &string) { return QString::fromStdWString(string); @@ -134,11 +99,26 @@ inline GURL toGurl(const QUrl& url) return GURL(url.toEncoded().toStdString()); } +inline QUrl toQt(const url::Origin &origin) +{ + return QUrl::fromEncoded(toQByteArray(origin.Serialize())); +} + +inline url::Origin toOrigin(const QUrl &url) +{ + return url::Origin::Create(toGurl(url)); +} + inline QPoint toQt(const gfx::Point &point) { return QPoint(point.x(), point.y()); } +inline QPointF toQt(const gfx::PointF &point) +{ + return QPointF(point.x(), point.y()); +} + inline QPointF toQt(const gfx::Vector2dF &point) { return QPointF(point.x(), point.y()); @@ -189,6 +169,11 @@ inline QSizeF toQt(const gfx::SizeF &size) return QSizeF(size.width(), size.height()); } +inline QSize toQt(const SkISize &size) +{ + return QSize(size.width(), size.height()); +} + inline QColor toQt(const SkColor &c) { return QColor(SkColorGetR(c), SkColorGetG(c), SkColorGetB(c), SkColorGetA(c)); @@ -235,7 +220,7 @@ inline QNetworkCookie toQt(const net::CanonicalCookie & cookie) inline base::FilePath::StringType toFilePathString(const QString &str) { -#if defined(OS_WIN) +#if defined(Q_OS_WIN) return QDir::toNativeSeparators(str).toStdWString(); #else return str.toStdString(); diff --git a/src/core/user_notification_controller.cpp b/src/core/user_notification_controller.cpp index f94605a55..9c1122cca 100644 --- a/src/core/user_notification_controller.cpp +++ b/src/core/user_notification_controller.cpp @@ -1,48 +1,10 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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) 2017 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 "user_notification_controller.h" #include "type_conversion.h" -#include "base/callback.h" -#include "content/public/browser/notification_event_dispatcher.h" #include "third_party/blink/public/mojom/notifications/notification.mojom-shared.h" #include "third_party/blink/public/common/notifications/notification_resources.h" #include "third_party/blink/public/common/notifications/platform_notification_data.h" diff --git a/src/core/user_notification_controller.h b/src/core/user_notification_controller.h index b710641d0..21d9fc653 100644 --- a/src/core/user_notification_controller.h +++ b/src/core/user_notification_controller.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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) 2017 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 #ifndef DESKTOP_NOTIFICATION_CONTROLLER_H #define DESKTOP_NOTIFICATION_CONTROLLER_H diff --git a/src/core/user_script.cpp b/src/core/user_script.cpp index c66d0bddf..47c4fd528 100644 --- a/src/core/user_script.cpp +++ b/src/core/user_script.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 "base/strings/string_util.h" diff --git a/src/core/user_script.h b/src/core/user_script.h index 2be1b4ed0..fdc7782b8 100644 --- a/src/core/user_script.h +++ b/src/core/user_script.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 // // W A R N I N G diff --git a/src/core/visited_links_manager_qt.cpp b/src/core/visited_links_manager_qt.cpp index 7b98da8a3..9e1bd7a32 100644 --- a/src/core/visited_links_manager_qt.cpp +++ b/src/core/visited_links_manager_qt.cpp @@ -1,45 +1,10 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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) 2017 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 "visited_links_manager_qt.h" #include "content_browser_client_qt.h" +#include "profile_adapter.h" #include "profile_qt.h" #include "type_conversion.h" @@ -95,7 +60,7 @@ VisitedLinksManagerQt::VisitedLinksManagerQt(ProfileQt *profile, bool persistVis { Q_ASSERT(profile); if (persistVisitedLinks) - profile->ensureDirectoryExists(); + profile->profileAdapter()->ensureDataPathExists(); m_visitedLinkWriter.reset(new visitedlink::VisitedLinkWriter(profile, m_delegate.data(), persistVisitedLinks)); m_visitedLinkWriter->Init(); } diff --git a/src/core/visited_links_manager_qt.h b/src/core/visited_links_manager_qt.h index 27d46f8ff..eff124bfd 100644 --- a/src/core/visited_links_manager_qt.h +++ b/src/core/visited_links_manager_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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) 2017 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 // // W A R N I N G diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 0bebf539d..7dc96967f 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 // Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be @@ -43,10 +7,12 @@ #include "web_contents_adapter.h" +#include "autofill_client_qt.h" #include "devtools_frontend_qt.h" #include "download_manager_delegate_qt.h" #include "favicon_driver_qt.h" #include "favicon_service_factory_qt.h" +#include "find_text_helper.h" #include "media_capture_devices_dispatcher.h" #include "profile_adapter.h" #include "profile_qt.h" @@ -66,6 +32,8 @@ #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/content/browser/content_autofill_driver_factory.h" #include "components/favicon/core/favicon_service.h" #include "content/browser/renderer_host/render_view_host_impl.h" #include "content/browser/renderer_host/text_input_manager.h" @@ -93,6 +61,8 @@ #include "qtwebengine/browser/qtwebenginepage.mojom.h" #if QT_CONFIG(webengine_printing_and_pdf) +#include "components/pdf/browser/pdf_web_contents_helper.h" +#include "printing/pdf_web_contents_helper_client_qt.h" #include "printing/print_view_manager_qt.h" #endif @@ -127,8 +97,8 @@ namespace QtWebEngineCore { if (!isInitialized()) \ return return_value -#define CHECK_VALID_RENDER_WIDGET_HOST_VIEW(render_view_host) \ - if (!render_view_host->IsRenderViewLive() && render_view_host->GetWidget()->GetView()) { \ +#define CHECK_VALID_RENDER_WIDGET_HOST_VIEW(render_frame_host) \ + if (!render_frame_host->IsRenderFrameLive() && render_frame_host->GetView()) { \ LOG(WARNING) << "Ignore navigation due to terminated render process with invalid RenderWidgetHostView."; \ return; \ } @@ -143,9 +113,8 @@ static QVariant fromJSValue(const base::Value *result) break; case base::Value::Type::BOOLEAN: { - bool out; - if (result->GetAsBoolean(&out)) - ret.setValue(out); + if (auto out = result->GetIfBool()) + ret.setValue(*out); break; } case base::Value::Type::INTEGER: @@ -162,21 +131,19 @@ static QVariant fromJSValue(const base::Value *result) } case base::Value::Type::STRING: { - std::u16string out; - if (result->GetAsString(&out)) - ret.setValue(toQt(out)); + if (auto out = result->GetIfString()) + ret.setValue(toQt(*out)); break; } case base::Value::Type::LIST: { - const base::ListValue *out; - if (result->GetAsList(&out)) { + if (const auto out = result->GetIfList()) { + size_t size = out->size(); QVariantList list; - list.reserve(out->GetSize()); - for (size_t i = 0; i < out->GetSize(); ++i) { - const base::Value *outVal = 0; - if (out->Get(i, &outVal) && outVal) - list.insert(i, fromJSValue(outVal)); + list.reserve(size); + for (size_t i = 0; i < size; ++i) { + auto &outVal = (*out)[i]; + list.insert(i, fromJSValue(&outVal)); } ret.setValue(list); } @@ -517,6 +484,16 @@ void WebContentsAdapter::initialize(content::SiteInstance *site) FaviconDriverQt::CreateForWebContents( webContents(), FaviconServiceFactoryQt::GetForBrowserContext(context), m_adapterClient); + AutofillClientQt::CreateForWebContents(webContents()); + autofill::ContentAutofillDriverFactory::CreateForWebContentsAndDelegate( + webContents(), AutofillClientQt::FromWebContents(webContents()), + /* app_locale = */ "", autofill::AutofillManager::DISABLE_AUTOFILL_DOWNLOAD_MANAGER); + +#if QT_CONFIG(webengine_printing_and_pdf) + pdf::PDFWebContentsHelper::CreateForWebContentsWithClient( + webContents(), std::make_unique<PDFWebContentsHelperClientQt>()); +#endif + // Create an instance of WebEngineVisitedLinksManager to catch the first // content::NOTIFICATION_RENDERER_PROCESS_CREATED event. This event will // force to initialize visited links in VisitedLinkSlave. @@ -526,7 +503,7 @@ void WebContentsAdapter::initialize(content::SiteInstance *site) // Create a RenderView with the initial empty document content::RenderViewHost *rvh = m_webContents->GetRenderViewHost(); Q_ASSERT(rvh); - if (!rvh->IsRenderViewLive()) + if (!m_webContents->GetMainFrame()->IsRenderFrameLive()) static_cast<content::WebContentsImpl*>(m_webContents.get())->CreateRenderViewForRenderManager( rvh, absl::nullopt, nullptr); @@ -543,7 +520,7 @@ void WebContentsAdapter::initializeRenderPrefs() // seconds const int qtCursorFlashTime = QGuiApplication::styleHints()->cursorFlashTime(); rendererPrefs->caret_blink_interval = - base::TimeDelta::FromMillisecondsD(0.5 * static_cast<double>(qtCursorFlashTime)); + base::Milliseconds(0.5 * static_cast<double>(qtCursorFlashTime)); rendererPrefs->user_agent_override = blink::UserAgentOverride::UserAgentOnly(m_profileAdapter->httpUserAgent().toStdString()); rendererPrefs->accept_languages = m_profileAdapter->httpAcceptLanguageWithoutQualities().toStdString(); #if QT_CONFIG(webengine_webrtc) @@ -609,7 +586,7 @@ void WebContentsAdapter::reload() bool wasDiscarded = (m_lifecycleState == LifecycleState::Discarded); setLifecycleState(LifecycleState::Active); - CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetRenderViewHost()); + CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetMainFrame()); WebEngineSettings *settings = WebEngineSettings::get(m_adapterClient->webEngineSettings()); settings->doApply(); if (!wasDiscarded) // undiscard() already triggers a reload @@ -624,7 +601,7 @@ void WebContentsAdapter::reloadAndBypassCache() bool wasDiscarded = (m_lifecycleState == LifecycleState::Discarded); setLifecycleState(LifecycleState::Active); - CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetRenderViewHost()); + CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetMainFrame()); WebEngineSettings *settings = WebEngineSettings::get(m_adapterClient->webEngineSettings()); settings->doApply(); if (!wasDiscarded) // undiscard() already triggers a reload @@ -656,7 +633,7 @@ void WebContentsAdapter::load(const QWebEngineHttpRequest &request) setLifecycleState(LifecycleState::Active); } - CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetRenderViewHost()); + CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetMainFrame()); WebEngineSettings::get(m_adapterClient->webEngineSettings())->doApply(); @@ -744,7 +721,7 @@ void WebContentsAdapter::setContent(const QByteArray &data, const QString &mimeT else setLifecycleState(LifecycleState::Active); - CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetRenderViewHost()); + CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetMainFrame()); WebEngineSettings::get(m_adapterClient->webEngineSettings())->doApply(); @@ -895,7 +872,7 @@ void WebContentsAdapter::navigateBack() { CHECK_INITIALIZED(); base::RecordAction(base::UserMetricsAction("Back")); - CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetRenderViewHost()); + CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetMainFrame()); if (!m_webContents->GetController().CanGoBack()) return; m_webContents->GetController().GoBack(); @@ -906,7 +883,7 @@ void WebContentsAdapter::navigateForward() { CHECK_INITIALIZED(); base::RecordAction(base::UserMetricsAction("Forward")); - CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetRenderViewHost()); + CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetMainFrame()); if (!m_webContents->GetController().CanGoForward()) return; m_webContents->GetController().GoForward(); @@ -916,7 +893,7 @@ void WebContentsAdapter::navigateForward() void WebContentsAdapter::navigateToIndex(int offset) { CHECK_INITIALIZED(); - CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetRenderViewHost()); + CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetMainFrame()); m_webContents->GetController().GoToIndex(offset); focusIfNecessary(); } @@ -924,7 +901,7 @@ void WebContentsAdapter::navigateToIndex(int offset) void WebContentsAdapter::navigateToOffset(int offset) { CHECK_INITIALIZED(); - CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetRenderViewHost()); + CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetMainFrame()); m_webContents->GetController().GoToOffset(offset); focusIfNecessary(); } @@ -1040,9 +1017,7 @@ QWebEngineUrlRequestInterceptor* WebContentsAdapter::requestInterceptor() const QAccessibleInterface *WebContentsAdapter::browserAccessible() { CHECK_INITIALIZED(nullptr); - content::RenderViewHost *rvh = m_webContents->GetRenderViewHost(); - Q_ASSERT(rvh); - content::RenderFrameHostImpl *rfh = static_cast<content::RenderFrameHostImpl *>(rvh->GetMainFrame()); + content::RenderFrameHostImpl *rfh = static_cast<content::RenderFrameHostImpl *>(m_webContents->GetMainFrame()); if (!rfh) return nullptr; content::BrowserAccessibilityManager *manager = rfh->GetOrCreateBrowserAccessibilityManager(); @@ -1057,26 +1032,24 @@ QAccessibleInterface *WebContentsAdapter::browserAccessible() void WebContentsAdapter::runJavaScript(const QString &javaScript, quint32 worldId) { CHECK_INITIALIZED(); - content::RenderViewHost *rvh = m_webContents->GetRenderViewHost(); - Q_ASSERT(rvh); -// static_cast<content::RenderFrameHostImpl *>(rvh->GetMainFrame())->NotifyUserActivation(); + content::RenderFrameHost *rfh = m_webContents->GetMainFrame(); + Q_ASSERT(rfh); if (worldId == 0) - rvh->GetMainFrame()->ExecuteJavaScript(toString16(javaScript), base::NullCallback()); + rfh->ExecuteJavaScript(toString16(javaScript), base::NullCallback()); else - rvh->GetMainFrame()->ExecuteJavaScriptInIsolatedWorld(toString16(javaScript), base::NullCallback(), worldId); + rfh->ExecuteJavaScriptInIsolatedWorld(toString16(javaScript), base::NullCallback(), worldId); } quint64 WebContentsAdapter::runJavaScriptCallbackResult(const QString &javaScript, quint32 worldId) { CHECK_INITIALIZED(0); - content::RenderViewHost *rvh = m_webContents->GetRenderViewHost(); - Q_ASSERT(rvh); -// static_cast<content::RenderFrameHostImpl *>(rvh->GetMainFrame())->NotifyUserActivation(); + content::RenderFrameHost *rfh = m_webContents->GetMainFrame(); + Q_ASSERT(rfh); content::RenderFrameHost::JavaScriptResultCallback callback = base::BindOnce(&callbackOnEvaluateJS, m_adapterClient, m_nextRequestId); if (worldId == 0) - rvh->GetMainFrame()->ExecuteJavaScript(toString16(javaScript), std::move(callback)); + rfh->ExecuteJavaScript(toString16(javaScript), std::move(callback)); else - rvh->GetMainFrame()->ExecuteJavaScriptInIsolatedWorld(toString16(javaScript), std::move(callback), worldId); + rfh->ExecuteJavaScriptInIsolatedWorld(toString16(javaScript), std::move(callback), worldId); return m_nextRequestId++; } @@ -1101,7 +1074,9 @@ void WebContentsAdapter::updateWebPreferences(const blink::web_pref::WebPreferen // In case of updating preferences during navigation, there might be a pending RVH what will // be active on successful navigation. - content::RenderFrameHost *pendingRFH = (static_cast<content::WebContentsImpl*>(m_webContents.get()))->GetFrameTree()->root()->render_manager()->speculative_frame_host(); + content::RenderFrameHost *pendingRFH = + (static_cast<content::WebContentsImpl*>(m_webContents.get())) + ->GetPrimaryFrameTree().root()->render_manager()->speculative_frame_host(); if (pendingRFH) { content::RenderViewHost *pendingRVH = pendingRFH->GetRenderViewHost(); Q_ASSERT(pendingRVH); @@ -1190,7 +1165,7 @@ qint64 WebContentsAdapter::renderProcessPid() const void WebContentsAdapter::copyImageAt(const QPoint &location) { CHECK_INITIALIZED(); - m_webContents->GetRenderViewHost()->GetMainFrame()->CopyImageAt(location.x(), location.y()); + m_webContents->GetMainFrame()->CopyImageAt(location.x(), location.y()); } static blink::mojom::MediaPlayerActionType toBlinkMediaPlayerActionType(WebContentsAdapter::MediaPlayerAction action) @@ -1217,7 +1192,7 @@ void WebContentsAdapter::executeMediaPlayerActionAt(const QPoint &location, Medi if (action == MediaPlayerNoAction) return; blink::mojom::MediaPlayerAction blinkAction(toBlinkMediaPlayerActionType(action), enable); - m_webContents->GetRenderViewHost()->GetMainFrame()->ExecuteMediaPlayerActionAtLocation(toGfx(location), blinkAction); + m_webContents->GetMainFrame()->ExecuteMediaPlayerActionAtLocation(toGfx(location), blinkAction); } void WebContentsAdapter::inspectElementAt(const QPoint &location) @@ -1394,7 +1369,7 @@ void WebContentsAdapter::grantFeaturePermission(const QUrl &securityOrigin, Prof void WebContentsAdapter::grantMouseLockPermission(const QUrl &securityOrigin, bool granted) { CHECK_INITIALIZED(); - if (securityOrigin != toQt(m_webContents->GetLastCommittedURL().GetOrigin())) + if (securityOrigin != toQt(m_webContents->GetLastCommittedURL().DeprecatedGetOriginAsURL())) return; if (granted) { @@ -1419,7 +1394,7 @@ void WebContentsAdapter::grantMouseLockPermission(const QUrl &securityOrigin, bo void WebContentsAdapter::handlePendingMouseLockPermission() { CHECK_INITIALIZED(); - auto it = m_pendingMouseLockPermissions.find(toQt(m_webContents->GetLastCommittedURL().GetOrigin())); + auto it = m_pendingMouseLockPermissions.find(toQt(m_webContents->GetLastCommittedURL().DeprecatedGetOriginAsURL())); if (it != m_pendingMouseLockPermissions.end()) { m_webContents->GotResponseToLockMouseRequest(it.value() ? blink::mojom::PointerLockResult::kSuccess : blink::mojom::PointerLockResult::kPermissionDenied); @@ -1722,7 +1697,7 @@ void WebContentsAdapter::waitForUpdateDragActionCalled() static_cast<int>(timeout)); return; } - base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(1)); + base::PlatformThread::Sleep(base::Milliseconds(1)); } } @@ -1789,6 +1764,14 @@ void WebContentsAdapter::resetSelection() } } +void WebContentsAdapter::resetTouchSelectionController() +{ + CHECK_INITIALIZED(); + unselect(); + if (auto rwhv = static_cast<RenderWidgetHostViewQt *>(m_webContents->GetRenderWidgetHostView())) + rwhv->resetTouchSelectionController(); +} + WebContentsAdapterClient::RenderProcessTerminationStatus WebContentsAdapterClient::renderProcessExitStatus(int terminationStatus) { auto status = WebContentsAdapterClient::RenderProcessTerminationStatus(-1); @@ -1800,13 +1783,10 @@ WebContentsAdapterClient::renderProcessExitStatus(int terminationStatus) { status = WebContentsAdapterClient::AbnormalTerminationStatus; break; case base::TERMINATION_STATUS_PROCESS_WAS_KILLED: -#if defined(OS_CHROMEOS) - case base::TERMINATION_STATUS_PROCESS_WAS_KILLED_BY_OOM: -#endif status = WebContentsAdapterClient::KilledTerminationStatus; break; case base::TERMINATION_STATUS_PROCESS_CRASHED: -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) case base::TERMINATION_STATUS_OOM_PROTECTED: #endif status = WebContentsAdapterClient::CrashedTerminationStatus; @@ -2054,7 +2034,7 @@ void WebContentsAdapter::undiscard() // Create a RenderView with the initial empty document content::RenderViewHost *rvh = m_webContents->GetRenderViewHost(); Q_ASSERT(rvh); - if (!rvh->IsRenderViewLive()) + if (!m_webContents->GetMainFrame()->IsRenderFrameLive()) static_cast<content::WebContentsImpl *>(m_webContents.get()) ->CreateRenderViewForRenderManager(rvh, absl::nullopt, nullptr); m_webContentsDelegate->RenderViewHostChanged(nullptr, rvh); diff --git a/src/core/web_contents_adapter.h b/src/core/web_contents_adapter.h index 9066e7a72..1f2f08d73 100644 --- a/src/core/web_contents_adapter.h +++ b/src/core/web_contents_adapter.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 // // W A R N I N G @@ -236,6 +200,7 @@ public: bool isFindTextInProgress() const; bool hasFocusedFrame() const; void resetSelection(); + void resetTouchSelectionController(); // meant to be used within WebEngineCore only void initialize(content::SiteInstance *site); diff --git a/src/core/web_contents_adapter_client.h b/src/core/web_contents_adapter_client.h index def7b015e..8d6ae5636 100644 --- a/src/core/web_contents_adapter_client.h +++ b/src/core/web_contents_adapter_client.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 // // W A R N I N G @@ -63,6 +27,7 @@ QT_FORWARD_DECLARE_CLASS(QKeyEvent) QT_FORWARD_DECLARE_CLASS(QVariant) +QT_FORWARD_DECLARE_CLASS(QWebEngineFileSystemAccessRequest) QT_FORWARD_DECLARE_CLASS(QWebEngineFindTextResult) QT_FORWARD_DECLARE_CLASS(QWebEngineLoadingInfo) QT_FORWARD_DECLARE_CLASS(QWebEngineQuotaRequest) @@ -79,6 +44,7 @@ struct DropData; namespace QtWebEngineCore { +class AutofillPopupController; class CertificateErrorController; class ClientCertSelectController; class AuthenticationDialogController; @@ -88,7 +54,7 @@ class JavaScriptDialogController; class RenderWidgetHostViewQt; class RenderWidgetHostViewQtDelegate; class RenderWidgetHostViewQtDelegateClient; -class TouchHandleDrawableClient; +class TouchHandleDrawableDelegate; class TouchSelectionMenuController; class WebContentsAdapter; class WebContentsDelegateQt; @@ -223,6 +189,7 @@ public: virtual void runMouseLockPermissionRequest(const QUrl &securityOrigin) = 0; virtual void runQuotaRequest(QWebEngineQuotaRequest) = 0; virtual void runRegisterProtocolHandlerRequest(QWebEngineRegisterProtocolHandlerRequest) = 0; + virtual void runFileSystemAccessRequest(QWebEngineFileSystemAccessRequest) = 0; virtual QWebEngineSettings *webEngineSettings() const = 0; RenderProcessTerminationStatus renderProcessExitStatus(int); virtual void renderProcessTerminated(RenderProcessTerminationStatus terminationStatus, int exitCode) = 0; @@ -239,10 +206,13 @@ public: virtual void setToolTip(const QString& toolTipText) = 0; virtual ClientType clientType() = 0; virtual void printRequested() = 0; - virtual TouchHandleDrawableClient *createTouchHandle(const QMap<int, QImage> &images) = 0; + virtual TouchHandleDrawableDelegate * createTouchHandleDelegate(const QMap<int, QImage> &images) = 0; virtual void showTouchSelectionMenu(TouchSelectionMenuController *menuController, const QRect &bounds, const QSize &handleSize) = 0; virtual void hideTouchSelectionMenu() = 0; virtual void findTextFinished(const QWebEngineFindTextResult &result) = 0; + virtual void showAutofillPopup(AutofillPopupController *controller, const QRect &bounds, + bool autoselectFirstSuggestion) = 0; + virtual void hideAutofillPopup() = 0; virtual ProfileAdapter *profileAdapter() = 0; virtual WebContentsAdapter* webContentsAdapter() = 0; diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index b4a34c300..66598203e 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 // Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be @@ -43,15 +7,19 @@ #include "web_contents_delegate_qt.h" -#include "profile_adapter.h" +#include "certificate_error_controller.h" #include "color_chooser_controller.h" #include "color_chooser_qt.h" +#include "custom_handlers/protocol_handler_registry_factory.h" +#include "custom_handlers/register_protocol_handler_request_controller_impl.h" #include "file_picker_controller.h" +#include "find_text_helper.h" +#include "javascript_dialog_manager_qt.h" #include "media_capture_devices_dispatcher.h" +#include "profile_adapter.h" #include "profile_qt.h" #include "qwebengineloadinginfo.h" #include "qwebengineregisterprotocolhandlerrequest.h" -#include "register_protocol_handler_request_controller_impl.h" #include "render_widget_host_view_qt.h" #include "type_conversion.h" #include "visited_links_manager_qt.h" @@ -62,14 +30,15 @@ #include "web_engine_error.h" #include "web_engine_settings.h" #include "certificate_error_controller.h" -#include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" + +#include "components/custom_handlers/protocol_handler_registry.h" #include "components/web_cache/browser/web_cache_manager.h" #include "content/browser/renderer_host/render_frame_host_impl.h" -#include "content/browser/renderer_host/render_widget_host_impl.h" #include "content/browser/web_contents/web_contents_impl.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/file_select_listener.h" #include "content/public/browser/invalidate_type.h" +#include "content/public/browser/media_stream_request.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/navigation_handle.h" #include "content/public/browser/render_view_host.h" @@ -103,7 +72,6 @@ WebContentsDelegateQt::WebContentsDelegateQt(content::WebContents *webContents, : m_viewClient(adapterClient) , m_findTextHelper(new FindTextHelper(webContents, adapterClient)) , m_loadingState(determineLoadingState(webContents)) - , m_didStartLoadingSeen(m_loadingState == LoadingState::Loading) , m_frameFocusedObserver(adapterClient) { webContents->SetDelegate(this); @@ -288,7 +256,7 @@ void WebContentsDelegateQt::RenderFrameCreated(content::RenderFrameHost *render_ m_frameFocusedObserver.addNode(node); } -void WebContentsDelegateQt::RenderProcessGone(base::TerminationStatus status) +void WebContentsDelegateQt::PrimaryMainFrameRenderProcessGone(base::TerminationStatus status) { // RenderProcessHost::FastShutdownIfPossible results in TERMINATION_STATUS_STILL_RUNNING if (status != base::TERMINATION_STATUS_STILL_RUNNING) { @@ -319,7 +287,7 @@ void WebContentsDelegateQt::RenderFrameHostChanged(content::RenderFrameHost *old m_frameFocusedObserver.addNode(new_node); // Is this a main frame? - if (new_host->GetFrameOwnerElementType() == blink::mojom::FrameOwnerElementType::kNone) { + if (new_host->GetFrameOwnerElementType() == blink::FrameOwnerElementType::kNone) { content::RenderProcessHost *renderProcessHost = new_host->GetProcess(); const base::Process &process = renderProcessHost->GetProcess(); if (process.IsValid()) { @@ -340,6 +308,17 @@ void WebContentsDelegateQt::RenderViewHostChanged(content::RenderViewHost *, con } } +void WebContentsDelegateQt::RenderViewReady() +{ + // The render view might have returned after a crash without us getting a RenderViewHostChanged call + content::RenderWidgetHostView *newHostView = web_contents()->GetRenderWidgetHostView(); + if (newHostView) { + auto *rwhv = static_cast<RenderWidgetHostViewQt *>(newHostView); + Q_ASSERT(rwhv->delegate()); + rwhv->delegate()->updateAdapterClientIfNeeded(m_viewClient); + } +} + void WebContentsDelegateQt::emitLoadStarted(bool isErrorPage) { for (auto &&wc : m_certificateErrorControllers) @@ -396,9 +375,9 @@ void WebContentsDelegateQt::emitLoadFinished(bool isErrorPage) ? QWebEngineLoadingInfo::LoadSucceededStatus : (m_loadingInfo.errorCode == WebEngineError::UserAbortedError ? QWebEngineLoadingInfo::LoadStoppedStatus : QWebEngineLoadingInfo::LoadFailedStatus); - auto errorDomain = static_cast<QWebEngineLoadingInfo::ErrorDomain>(WebEngineError::toQtErrorDomain(m_loadingInfo.errorCode)); QWebEngineLoadingInfo info(m_loadingInfo.url, loadStatus, m_loadingInfo.isErrorPage, - m_loadingInfo.errorDescription, m_loadingInfo.errorCode, errorDomain); + m_loadingInfo.errorDescription, m_loadingInfo.errorCode, + QWebEngineLoadingInfo::ErrorDomain(m_loadingInfo.errorDomain)); m_viewClient->loadFinished(std::move(info)); m_viewClient->updateNavigationActions(); } @@ -447,34 +426,18 @@ void WebContentsDelegateQt::DidFinishNavigation(content::NavigationHandle *navig } } -void WebContentsDelegateQt::DidStartLoading() +void WebContentsDelegateQt::PrimaryPageChanged(content::Page &) { - // Based on TabLoadTracker::DidStartLoading + // Based on TabLoadTracker::PrimaryPageChanged - if (!web_contents()->IsLoadingToDifferentDocument()) + if (!web_contents()->ShouldShowLoadingUI()) return; - if (m_loadingState == LoadingState::Loading) { - DCHECK(m_didStartLoadingSeen); - return; - } - m_didStartLoadingSeen = true; -} - -void WebContentsDelegateQt::DidReceiveResponse() -{ - // Based on TabLoadTracker::DidReceiveResponse - - if (m_loadingState == LoadingState::Loading) { - DCHECK(m_didStartLoadingSeen); - return; - } // A transition to loading requires both DidStartLoading (navigation // committed) and DidReceiveResponse (data has been transmitted over the // network) events to occur. This is because NavigationThrottles can block // actual network requests, but not the rest of the state machinery. - if (m_didStartLoadingSeen) - setLoadingState(LoadingState::Loading); + setLoadingState(LoadingState::Loading); } void WebContentsDelegateQt::DidStopLoading() @@ -483,8 +446,7 @@ void WebContentsDelegateQt::DidStopLoading() // NOTE: PageAlmostIdle feature not implemented - if (m_loadingState == LoadingState::Loading) - setLoadingState(LoadingState::Loaded); + setLoadingState(LoadingState::Loaded); emitLoadFinished(); m_loadingInfo.clear(); @@ -500,14 +462,14 @@ void WebContentsDelegateQt::didFailLoad(const QUrl &url, int errorCode, const QS m_loadingInfo.success = false; m_loadingInfo.url = url; m_loadingInfo.errorCode = errorCode; + m_loadingInfo.errorDomain = WebEngineError::toQtErrorDomain(errorCode); m_loadingInfo.errorDescription = errorDescription; m_loadingInfo.triggersErrorPage = errorPageEnabled && !aborted; } void WebContentsDelegateQt::DidFailLoad(content::RenderFrameHost* render_frame_host, const GURL& validated_url, int error_code) { - if (m_loadingState == LoadingState::Loading) - setLoadingState(LoadingState::Loaded); + setLoadingState(LoadingState::Loaded); if (render_frame_host != web_contents()->GetMainFrame()) return; @@ -548,6 +510,7 @@ void WebContentsDelegateQt::DidFinishLoad(content::RenderFrameHost* render_frame m_loadingInfo.success = http_statuscode < 400; m_loadingInfo.url = toQt(validated_url); m_loadingInfo.errorCode = http_statuscode; + m_loadingInfo.errorDomain = WebEngineError::toQtErrorDomain(http_statuscode); m_loadingInfo.errorDescription = WebEngineError::toQtErrorDescription(http_statuscode); m_loadingInfo.triggersErrorPage = triggersErrorPage; } @@ -578,13 +541,13 @@ void WebContentsDelegateQt::EnterFullscreenModeForTab(content::RenderFrameHost * { Q_UNUSED(options); if (!m_viewClient->isFullScreenMode()) - m_viewClient->requestFullScreenMode(toQt(requesting_frame->GetLastCommittedURL()), true); + m_viewClient->requestFullScreenMode(toQt(requesting_frame->GetLastCommittedURL().DeprecatedGetOriginAsURL()), true); } void WebContentsDelegateQt::ExitFullscreenModeForTab(content::WebContents *web_contents) { if (m_viewClient->isFullScreenMode()) - m_viewClient->requestFullScreenMode(toQt(web_contents->GetLastCommittedURL().GetOrigin()), false); + m_viewClient->requestFullScreenMode(toQt(web_contents->GetLastCommittedURL().DeprecatedGetOriginAsURL()), false); } bool WebContentsDelegateQt::IsFullscreenForTabOrPending(const content::WebContents* web_contents) @@ -644,8 +607,8 @@ void WebContentsDelegateQt::SetContentsBounds(content::WebContents *source, cons QRect frameGeometry(toQt(bounds)); QRect geometry; if (RenderWidgetHostViewQt *rwhv = static_cast<RenderWidgetHostViewQt*>(web_contents()->GetRenderWidgetHostView())) { - if (rwhv->delegate() && rwhv->delegate()->window()) - geometry = frameGeometry.marginsRemoved(rwhv->delegate()->window()->frameMargins()); + if (rwhv->delegate() && rwhv->delegate()->Window()) + geometry = frameGeometry.marginsRemoved(rwhv->delegate()->Window()->frameMargins()); } m_viewClient->requestGeometryChange(geometry, frameGeometry); } @@ -676,7 +639,7 @@ void WebContentsDelegateQt::RequestToLockMouse(content::WebContents *web_content if (last_unlocked_by_target) web_contents->GotResponseToLockMouseRequest(blink::mojom::PointerLockResult::kSuccess); else - m_viewClient->runMouseLockPermissionRequest(toQt(web_contents->GetLastCommittedURL().GetOrigin())); + m_viewClient->runMouseLockPermissionRequest(toQt(web_contents->GetLastCommittedURL().DeprecatedGetOriginAsURL())); } void WebContentsDelegateQt::overrideWebPreferences(content::WebContents *webContents, blink::web_pref::WebPreferences *webPreferences) @@ -741,7 +704,7 @@ void WebContentsDelegateQt::launchExternalURL(const QUrl &url, ui::PageTransitio if (navigationAllowedByPolicy) { m_viewClient->navigationRequested(pageTransitionToNavigationType(page_transition), url, navigationRequestAccepted, is_main_frame); -#ifndef QT_NO_DESKTOPSERVICES +#if QT_CONFIG(desktopservices) if (navigationRequestAccepted) QDesktopServices::openUrl(url); #endif @@ -790,10 +753,10 @@ void WebContentsDelegateQt::RegisterProtocolHandler(content::RenderFrameHost *fr { content::BrowserContext *context = frameHost->GetBrowserContext(); - ProtocolHandler handler = - ProtocolHandler::CreateProtocolHandler(protocol, url); + custom_handlers::ProtocolHandler handler = + custom_handlers::ProtocolHandler::CreateProtocolHandler(protocol, url); - ProtocolHandlerRegistry *registry = + custom_handlers::ProtocolHandlerRegistry *registry = ProtocolHandlerRegistryFactory::GetForBrowserContext(context); if (registry->SilentlyHandleRegisterHandlerRequest(handler)) return; @@ -807,10 +770,10 @@ void WebContentsDelegateQt::UnregisterProtocolHandler(content::RenderFrameHost * { content::BrowserContext* context = frameHost->GetBrowserContext(); - ProtocolHandler handler = - ProtocolHandler::CreateProtocolHandler(protocol, url); + custom_handlers::ProtocolHandler handler = + custom_handlers::ProtocolHandler::CreateProtocolHandler(protocol, url); - ProtocolHandlerRegistry* registry = + custom_handlers::ProtocolHandlerRegistry* registry = ProtocolHandlerRegistryFactory::GetForBrowserContext(context); registry->RemoveHandler(handler); } @@ -866,7 +829,7 @@ WebContentsDelegateQt::LoadingState WebContentsDelegateQt::determineLoadingState { // Based on TabLoadTracker::DetermineLoadingState - if (contents->IsLoadingToDifferentDocument() && !contents->IsWaitingForResponse()) + if (contents->ShouldShowLoadingUI() && !contents->IsWaitingForResponse()) return LoadingState::Loading; content::NavigationController &controller = contents->GetController(); diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h index f32dc797b..37ab7ef5d 100644 --- a/src/core/web_contents_delegate_qt.h +++ b/src/core/web_contents_delegate_qt.h @@ -1,58 +1,17 @@ -/**************************************************************************** -** -** 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 #ifndef WEB_CONTENTS_DELEGATE_QT_H #define WEB_CONTENTS_DELEGATE_QT_H #include "content/browser/renderer_host/frame_tree_node.h" -#include "content/public/browser/media_capture_devices.h" #include "content/public/browser/web_contents_delegate.h" #include "content/public/browser/web_contents_observer.h" #include "third_party/skia/include/core/SkColor.h" -#include "base/callback.h" +#include "web_contents_adapter_client.h" -#include "color_chooser_controller.h" -#include "find_text_helper.h" -#include "javascript_dialog_manager_qt.h" #include <QtCore/qlist.h> -#include <QWebEngineCertificateError> namespace blink { namespace web_pref { @@ -61,15 +20,15 @@ namespace blink { } namespace content { - class ColorChooser; - class SiteInstance; - class JavaScriptDialogManager; - class WebContents; - struct ColorSuggestion; +class ColorChooser; +class JavaScriptDialogManager; +class WebContents; +struct MediaStreamRequest; } namespace QtWebEngineCore { +class FindTextHelper; class WebContentsAdapter; class WebContentsAdapterClient; class WebEngineSettings; @@ -154,13 +113,13 @@ public: // WebContentsObserver overrides void RenderFrameCreated(content::RenderFrameHost *render_frame_host) override; - void RenderProcessGone(base::TerminationStatus status) override; + void PrimaryMainFrameRenderProcessGone(base::TerminationStatus status) override; void RenderFrameHostChanged(content::RenderFrameHost *old_host, content::RenderFrameHost *new_host) override; void RenderViewHostChanged(content::RenderViewHost *old_host, content::RenderViewHost *new_host) override; + void RenderViewReady() override; void DidStartNavigation(content::NavigationHandle *navigation_handle) override; void DidFinishNavigation(content::NavigationHandle *navigation_handle) override; - void DidStartLoading() override; - void DidReceiveResponse() override; + void PrimaryPageChanged(content::Page &page) override; void DidStopLoading() override; 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; @@ -221,7 +180,6 @@ private: SavePageInfo m_savePageInfo; QSharedPointer<FilePickerController> m_filePickerController; LoadingState m_loadingState; - bool m_didStartLoadingSeen; FrameFocusedObserver m_frameFocusedObserver; QString m_title; @@ -237,7 +195,7 @@ private: bool isLoading() const { return progress >= 0; } QUrl url; bool isErrorPage = false; - int errorCode = 0; + int errorCode = 0, errorDomain = 0; QString errorDescription; bool triggersErrorPage = false; void clear() { *this = LoadingInfo(); } diff --git a/src/core/web_contents_view_qt.cpp b/src/core/web_contents_view_qt.cpp index 4b1db2cb0..286fc198c 100644 --- a/src/core/web_contents_view_qt.cpp +++ b/src/core/web_contents_view_qt.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 "web_contents_view_qt.h" @@ -237,7 +201,7 @@ void WebContentsViewQt::update(QWebEngineContextMenuRequest *request, #endif } -void WebContentsViewQt::ShowContextMenu(content::RenderFrameHost *, +void WebContentsViewQt::ShowContextMenu(content::RenderFrameHost &, const content::ContextMenuParams ¶ms) { if (auto rwhv = diff --git a/src/core/web_contents_view_qt.h b/src/core/web_contents_view_qt.h index 32fcef69a..2e236f2b2 100644 --- a/src/core/web_contents_view_qt.h +++ b/src/core/web_contents_view_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef WEB_CONTENTS_VIEW_QT_H #define WEB_CONTENTS_VIEW_QT_H @@ -107,10 +71,11 @@ public: gfx::Rect GetViewBounds() const override { return gfx::Rect(); } void FocusThroughTabTraversal(bool reverse) override; + void OnCapturerCountChanged() override { QT_NOT_YET_IMPLEMENTED } -#if defined(OS_MAC) +#if BUILDFLAG(IS_MAC) bool CloseTabAfterEventTrackingIfNeeded() override { QT_NOT_YET_IMPLEMENTED return false; } -#endif // defined(OS_MAC) +#endif // content::RenderViewHostDelegateView overrides: void StartDragging(const content::DropData& drop_data, blink::DragOperationsMask allowed_ops, @@ -120,7 +85,7 @@ public: void UpdateDragCursor(ui::mojom::DragOperation dragOperation) override; - void ShowContextMenu(content::RenderFrameHost *, const content::ContextMenuParams ¶ms) override; + void ShowContextMenu(content::RenderFrameHost &, const content::ContextMenuParams ¶ms) override; void GotFocus(content::RenderWidgetHostImpl *render_widget_host) override; void LostFocus(content::RenderWidgetHostImpl *render_widget_host) override; diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index d40926dc8..94ff5f7b2 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 "web_engine_context.h" @@ -95,7 +59,6 @@ #include "media/base/media_switches.h" #include "mojo/core/embedder/embedder.h" #include "net/base/port_util.h" -#include "ppapi/buildflags/buildflags.h" #include "sandbox/policy/switches.h" #include "services/network/public/cpp/features.h" #include "services/network/public/cpp/network_switches.h" @@ -107,10 +70,10 @@ #include "ui/events/event_switches.h" #include "ui/native_theme/native_theme_features.h" #include "ui/gl/gl_switches.h" -#if defined(OS_WIN) +#if defined(Q_OS_WIN) #include "sandbox/win/src/sandbox_types.h" #include "content/public/app/sandbox_helper_win.h" -#endif // OS_WIN +#endif // Q_OS_WIN #if defined(Q_OS_MACOS) #include "base/mac/foundation_util.h" @@ -185,14 +148,21 @@ static bool usingSupportedSGBackend() bool usingSoftwareDynamicGL() { + const char openGlVar[] = "QT_OPENGL"; if (QCoreApplication::testAttribute(Qt::AA_UseSoftwareOpenGL)) return true; + + if (qEnvironmentVariableIsSet(openGlVar)) { + const QByteArray requested = qgetenv(openGlVar); + if (requested == "software") + return true; + } #if defined(Q_OS_WIN) HMODULE handle = QNativeInterface::QWGLContext::openGLModuleHandle(); wchar_t path[MAX_PATH]; DWORD size = GetModuleFileName(handle, path, MAX_PATH); QFileInfo openGLModule(QString::fromWCharArray(path, size)); - return !openGLModule.fileName().compare(QLatin1String("opengl32sw.dll"),Qt::CaseInsensitive); + return openGLModule.fileName().contains(QLatin1String("opengl32sw"),Qt::CaseInsensitive); #else return false; #endif @@ -476,7 +446,6 @@ void WebEngineContext::destroy() GLContextHelper::destroy(); // These would normally be in the content-runner, but we allocated them separately: - m_startupData.reset(); m_mojoIpcSupport.reset(); m_discardableSharedMemoryManager.reset(); @@ -662,16 +631,11 @@ WebEngineContext::WebEngineContext() // Allow us to inject javascript like any webview toolkit. content::RenderFrameHost::AllowInjectingJavaScript(); - QStringList appArgs = QCoreApplication::arguments(); - bool useEmbeddedSwitches = false; -#if defined(QTWEBENGINE_EMBEDDED_SWITCHES) - useEmbeddedSwitches = !appArgs.contains(QStringLiteral("--disable-embedded-switches")); -#else - useEmbeddedSwitches = appArgs.contains(QStringLiteral("--enable-embedded-switches")); -#endif + bool enableGLSoftwareRendering = false; + base::CommandLine *parsedCommandLine = + initCommandLine(useEmbeddedSwitches, enableGLSoftwareRendering); - base::CommandLine* parsedCommandLine = commandLine(); setupProxyPac(parsedCommandLine); parsedCommandLine->AppendSwitchPath(switches::kBrowserSubprocessPath, WebEngineLibraryInfo::getPath(content::CHILD_PROCESS_EXE)); @@ -687,8 +651,6 @@ WebEngineContext::WebEngineContext() parsedCommandLine->AppendSwitch(sandbox::policy::switches::kNoSandbox); qInfo() << "Sandboxing disabled by user."; } - // Do not try to be clever with device-scale-factor, it messes up scaling in accessibility for us - parsedCommandLine->AppendSwitchASCII(switches::kEnableUseZoomForDSF, "false"); parsedCommandLine->AppendSwitch(switches::kEnableThreadedCompositing); @@ -718,7 +680,6 @@ WebEngineContext::WebEngineContext() // embedded switches are based on the switches for Android, see content/browser/android/content_startup_flags.cc enableFeatures.push_back(features::kOverlayScrollbar.name); parsedCommandLine->AppendSwitch(switches::kEnableViewport); - parsedCommandLine->AppendSwitch(switches::kMainFrameResizesAreOrientationChanges); parsedCommandLine->AppendSwitch(cc::switches::kDisableCompositedAntialiasing); } @@ -730,7 +691,6 @@ WebEngineContext::WebEngineContext() // bitmaps, use software rendering via software OpenGL. This might be less // performant, but at least provides WebGL support. // TODO(miklocek), check if this still works with latest chromium - const bool enableGLSoftwareRendering = appArgs.contains(QStringLiteral("--enable-webgl-software-rendering")); const bool disableGpu = parsedCommandLine->HasSwitch(switches::kDisableGpu); const char *glType = getGLType(enableGLSoftwareRendering, disableGpu); @@ -767,15 +727,15 @@ WebEngineContext::WebEngineContext() content::ContentMainParams contentMainParams(m_mainDelegate.get()); contentMainParams.setup_signal_handlers = false; -#if defined(OS_WIN) +#if defined(Q_OS_WIN) contentMainParams.sandbox_info = QtWebEngineSandbox::staticSandboxInterfaceInfo(); - sandbox::SandboxInterfaceInfo sandbox_info = {0}; + sandbox::SandboxInterfaceInfo sandbox_info = {nullptr}; if (!contentMainParams.sandbox_info) { content::InitializeSandboxInfo(&sandbox_info); contentMainParams.sandbox_info = &sandbox_info; } #endif - m_contentRunner->Initialize(contentMainParams); + m_contentRunner->Initialize(std::move(contentMainParams)); mojo::core::Configuration mojoConfiguration; mojoConfiguration.is_broker_process = true; @@ -788,21 +748,21 @@ WebEngineContext::WebEngineContext() m_mainDelegate->PostEarlyInitialization(false); content::StartBrowserThreadPool(); content::BrowserTaskExecutor::PostFeatureListSetup(); - tracing::InitTracingPostThreadPoolStartAndFeatureList(); + tracing::InitTracingPostThreadPoolStartAndFeatureList(false); m_discardableSharedMemoryManager = std::make_unique<discardable_memory::DiscardableSharedMemoryManager>(); base::PowerMonitor::Initialize(std::make_unique<base::PowerMonitorDeviceSource>()); m_mojoIpcSupport = std::make_unique<content::MojoIpcSupport>(content::BrowserTaskExecutor::CreateIOThread()); download::SetIOTaskRunner(m_mojoIpcSupport->io_thread()->task_runner()); - m_startupData = m_mojoIpcSupport->CreateBrowserStartupData(); + std::unique_ptr<content::StartupData> startupData = m_mojoIpcSupport->CreateBrowserStartupData(); // Once the MessageLoop has been created, attach a top-level RunLoop. m_runLoop.reset(new base::RunLoop); m_runLoop->BeforeRun(); - content::MainFunctionParams mainParams(*base::CommandLine::ForCurrentProcess()); - mainParams.startup_data = m_startupData.get(); - m_browserRunner->Initialize(mainParams); + content::MainFunctionParams mainParams(base::CommandLine::ForCurrentProcess()); + mainParams.startup_data = std::move(startupData); + m_browserRunner->Initialize(std::move(mainParams)); m_devtoolsServer.reset(new DevToolsServerQt()); m_devtoolsServer->start(); @@ -814,9 +774,7 @@ WebEngineContext::WebEngineContext() // Initialize WebCacheManager here to ensure its subscription to render process creation events. web_cache::WebCacheManager::GetInstance(); - base::ThreadRestrictions::SetIOAllowed(true); - -#if defined(OS_LINUX) +#if defined(Q_OS_LINUX) media::AudioManager::SetGlobalAppName(QCoreApplication::applicationName().toStdString()); #endif @@ -871,17 +829,30 @@ gpu::SyncPointManager *WebEngineContext::syncPointManager() return s_syncPointManager.loadRelaxed(); } -base::CommandLine* WebEngineContext::commandLine() { +base::CommandLine *WebEngineContext::initCommandLine(bool &useEmbeddedSwitches, + bool &enableGLSoftwareRendering) +{ if (base::CommandLine::CreateEmpty()) { base::CommandLine* parsedCommandLine = base::CommandLine::ForCurrentProcess(); QStringList appArgs = QCoreApplication::arguments(); if (qEnvironmentVariableIsSet(kChromiumFlagsEnv)) { appArgs = appArgs.mid(0, 1); // Take application name and drop the rest appArgs.append(parseEnvCommandLine(qEnvironmentVariable(kChromiumFlagsEnv))); + } else { + int index = appArgs.indexOf(QLatin1String("--webEngineArgs")); + if (index > -1) { + appArgs.erase(appArgs.begin() + 1, appArgs.begin() + index + 1); + } else { + appArgs = appArgs.mid(0, 1); + } } -#ifdef Q_OS_WIN - appArgs.removeAll(QStringLiteral("--enable-webgl-software-rendering")); +#if defined(QTWEBENGINE_EMBEDDED_SWITCHES) + useEmbeddedSwitches = !appArgs.contains(QStringLiteral("--disable-embedded-switches")); +#else + useEmbeddedSwitches = appArgs.contains(QStringLiteral("--enable-embedded-switches")); #endif + enableGLSoftwareRendering = + appArgs.removeAll(QStringLiteral("--enable-webgl-software-rendering")); appArgs.removeAll(QStringLiteral("--disable-embedded-switches")); appArgs.removeAll(QStringLiteral("--enable-embedded-switches")); @@ -920,7 +891,7 @@ const char *qWebEngineChromiumVersion() noexcept } const char *qWebEngineChromiumSecurityPatchVersion() noexcept { - return "104.0.5112.81"; // FIXME: Remember to update + return "107.0.5304.88"; // FIXME: Remember to update } QT_END_NAMESPACE diff --git a/src/core/web_engine_context.h b/src/core/web_engine_context.h index 27eae95bf..f7dbd1e53 100644 --- a/src/core/web_engine_context.h +++ b/src/core/web_engine_context.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef WEB_ENGINE_CONTEXT_H #define WEB_ENGINE_CONTEXT_H @@ -61,7 +25,6 @@ class GpuProcess; class GpuThreadController; class InProcessChildThreadParams; class MojoIpcSupport; -struct StartupData; } namespace discardable_memory { @@ -120,7 +83,8 @@ public: void addProfileAdapter(ProfileAdapter *profileAdapter); void removeProfileAdapter(ProfileAdapter *profileAdapter); void destroy(); - static base::CommandLine* commandLine(); + static base::CommandLine *initCommandLine(bool &useEmbeddedSwitches, + bool &enableGLSoftwareRendering); static gpu::SyncPointManager *syncPointManager(); @@ -140,7 +104,6 @@ private: std::unique_ptr<content::ContentMainRunner> m_contentRunner; std::unique_ptr<content::BrowserMainRunner> m_browserRunner; std::unique_ptr<discardable_memory::DiscardableSharedMemoryManager> m_discardableSharedMemoryManager; - std::unique_ptr<content::StartupData> m_startupData; std::unique_ptr<content::MojoIpcSupport> m_mojoIpcSupport; std::unique_ptr<QObject> m_globalQObject; std::unique_ptr<ProfileAdapter> m_defaultProfileAdapter; diff --git a/src/core/web_engine_context_threads.cpp b/src/core/web_engine_context_threads.cpp index 5aa4c3e1e..2d0f8a90c 100644 --- a/src/core/web_engine_context_threads.cpp +++ b/src/core/web_engine_context_threads.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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) 2018 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 "web_engine_context.h" diff --git a/src/core/web_engine_error.cpp b/src/core/web_engine_error.cpp index a6580d76b..c18dfef8c 100644 --- a/src/core/web_engine_error.cpp +++ b/src/core/web_engine_error.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 "web_engine_error.h" @@ -65,6 +29,10 @@ const int endErrors = -900; WebEngineError::ErrorDomain WebEngineError::toQtErrorDomain(int error_code) { + // net errors are always negative values, and https response codes are positive + if (error_code > 0) + return HttpStatusCodeDomain; + // Chromium's ranges from net/base/net_error_list.h: // 0 No error // 1- 99 System related errors diff --git a/src/core/web_engine_error.h b/src/core/web_engine_error.h index 0ef0950ae..88766f9c0 100644 --- a/src/core/web_engine_error.h +++ b/src/core/web_engine_error.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 // // W A R N I N G @@ -64,7 +28,8 @@ public: CertificateErrorDomain, HttpErrorDomain, FtpErrorDomain, - DnsErrorDomain + DnsErrorDomain, + HttpStatusCodeDomain }; static const int UserAbortedError; diff --git a/src/core/web_engine_library_info.cpp b/src/core/web_engine_library_info.cpp index 151918bd7..151365693 100644 --- a/src/core/web_engine_library_info.cpp +++ b/src/core/web_engine_library_info.cpp @@ -1,42 +1,6 @@ -/**************************************************************************** -** -** Copyright (C) 2013 BlackBerry Limited. All rights reserved. -** 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) 2013 BlackBerry Limited. All rights reserved. +// 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 "qtwebenginecoreglobal_p.h" #include "web_engine_library_info.h" @@ -62,9 +26,9 @@ #include <QLoggingCategory> #include <QStandardPaths> -#if defined(OS_WIN) +#if defined(Q_OS_WIN) #include <windows.h> -#endif // OS_WIN +#endif #ifndef QTWEBENGINEPROCESS_NAME #error "No name defined for QtWebEngine's process" @@ -81,7 +45,7 @@ QString fallbackDir() { return directory; } -#if defined(OS_MAC) && defined(QT_MAC_FRAMEWORK_BUILD) +#if defined(Q_OS_DARWIN) && defined(QT_MAC_FRAMEWORK_BUILD) static inline CFBundleRef frameworkBundle() { return CFBundleGetBundleWithIdentifier(CFSTR("org.qt-project.QtWebEngineCore")); @@ -124,7 +88,7 @@ static QString getResourcesPath(CFBundleRef frameworkBundle) } #endif -#if defined(OS_MAC) +#if defined(Q_OS_DARWIN) static QString getMainApplicationResourcesPath() { QString resourcesPath; @@ -156,7 +120,7 @@ QString subProcessPath() { static QString processPath; if (processPath.isEmpty()) { -#if defined(OS_WIN) +#if defined(Q_OS_WIN) const QString processBinary = QLatin1String(QTWEBENGINEPROCESS_NAME) % QLatin1String(".exe"); #else const QString processBinary = QLatin1String(QTWEBENGINEPROCESS_NAME); @@ -168,7 +132,7 @@ QString subProcessPath() // Only search in QTWEBENGINEPROCESS_PATH if set candidatePaths << fromEnv; } else { -#if defined(OS_MAC) && defined(QT_MAC_FRAMEWORK_BUILD) +#if defined(Q_OS_DARWIN) && defined(QT_MAC_FRAMEWORK_BUILD) candidatePaths << getBundlePath(frameworkBundle()) % QStringLiteral("/Helpers/" QTWEBENGINEPROCESS_NAME ".app/Contents/MacOS/" QTWEBENGINEPROCESS_NAME); #else @@ -204,7 +168,7 @@ QString subProcessPath() qFatal("%s", qPrintable(errorMessage.join('\n'))); } -#if defined(OS_WIN) +#if defined(Q_OS_WIN) base::CommandLine *parsedCommandLine = base::CommandLine::ForCurrentProcess(); if (!parsedCommandLine->HasSwitch(sandbox::policy::switches::kNoSandbox)) { if (WebEngineLibraryInfo::isUNCPath(processPath) || WebEngineLibraryInfo::isRemoteDrivePath(processPath)) @@ -234,7 +198,7 @@ QString localesPath() // Only search in QTWEBENGINE_LOCALES_PATH if set candidatePaths << fromEnv; } else { -#if defined(OS_MAC) && defined(QT_MAC_FRAMEWORK_BUILD) +#if defined(Q_OS_DARWIN) && defined(QT_MAC_FRAMEWORK_BUILD) candidatePaths << getResourcesPath(frameworkBundle()) % QDir::separator() % QLatin1String("qtwebengine_locales"); #endif @@ -290,7 +254,7 @@ QString dictionariesPath() candidatePaths << fromEnv; } else { // First try to find dictionaries near the application. -#ifdef OS_MAC +#ifdef Q_OS_DARWIN QString resourcesDictionariesPath = getMainApplicationResourcesPath() % QDir::separator() % QLatin1String("qtwebengine_dictionaries"); candidatePaths << resourcesDictionariesPath; @@ -300,7 +264,7 @@ QString dictionariesPath() candidatePaths << applicationDictionariesPath; // Then try to find dictionaries near the installed library. -#if defined(OS_MAC) && defined(QT_MAC_FRAMEWORK_BUILD) +#if defined(Q_OS_DARWIN) && defined(QT_MAC_FRAMEWORK_BUILD) QString frameworkDictionariesPath = getResourcesPath(frameworkBundle()) % QLatin1String("/qtwebengine_dictionaries"); candidatePaths << frameworkDictionariesPath; @@ -336,7 +300,7 @@ QString resourcesPath() // Only search in QTWEBENGINE_RESOURCES_PATH if set candidatePaths << fromEnv; } else { -#if defined(OS_MAC) && defined(QT_MAC_FRAMEWORK_BUILD) +#if defined(Q_OS_DARWIN) && defined(QT_MAC_FRAMEWORK_BUILD) candidatePaths << getResourcesPath(frameworkBundle()); #endif candidatePaths << QLibraryInfo::path(QLibraryInfo::DataPath) % QDir::separator() @@ -387,14 +351,14 @@ base::FilePath WebEngineLibraryInfo::getPath(int key) return toFilePath(resourcesPath() % QLatin1String("/qtwebengine_resources_200p.pak")); case QT_RESOURCES_DEVTOOLS_PAK: return toFilePath(resourcesPath() % QLatin1String("/qtwebengine_devtools_resources.pak")); -#if defined(OS_MAC) && defined(QT_MAC_FRAMEWORK_BUILD) +#if defined(Q_OS_DARWIN) && defined(QT_MAC_FRAMEWORK_BUILD) case QT_FRAMEWORK_BUNDLE: return toFilePath(getBundlePath(frameworkBundle())); #endif case base::FILE_EXE: case content::CHILD_PROCESS_EXE: return toFilePath(subProcessPath()); -#if defined(OS_POSIX) +#if BUILDFLAG(IS_POSIX) case base::DIR_CACHE: directory = QStandardPaths::writableLocation(QStandardPaths::CacheLocation); break; @@ -452,7 +416,7 @@ std::string WebEngineLibraryInfo::getApplicationLocale() : QLocale().bcp47Name().toStdString(); } -#if defined(OS_WIN) +#if defined(Q_OS_WIN) bool WebEngineLibraryInfo::isRemoteDrivePath(const QString &path) { WCHAR wDriveLetter[4] = { 0 }; diff --git a/src/core/web_engine_library_info.h b/src/core/web_engine_library_info.h index 10542a99e..b7503f2df 100644 --- a/src/core/web_engine_library_info.h +++ b/src/core/web_engine_library_info.h @@ -1,42 +1,6 @@ -/**************************************************************************** -** -** Copyright (C) 2013 BlackBerry Limited. All rights reserved. -** 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) 2013 BlackBerry Limited. All rights reserved. +// 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 #ifndef WEB_ENGINE_LIBRARY_INFO_H #define WEB_ENGINE_LIBRARY_INFO_H @@ -59,7 +23,7 @@ public: static std::u16string getApplicationName(); static std::string getResolvedLocale(); static std::string getApplicationLocale(); -#if defined(OS_WIN) +#if defined(Q_OS_WIN) static bool isRemoteDrivePath(const QString &path); static bool isUNCPath(const QString &path); #endif diff --git a/src/core/web_engine_settings.cpp b/src/core/web_engine_settings.cpp index a04efdd1f..e7cc57ba4 100644 --- a/src/core/web_engine_settings.cpp +++ b/src/core/web_engine_settings.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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) 2022 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 "web_engine_settings.h" @@ -297,6 +261,7 @@ void WebEngineSettings::initDefaults() #else s_defaultAttributes.insert(QWebEngineSettings::PdfViewerEnabled, false); #endif + s_defaultAttributes.insert(QWebEngineSettings::NavigateOnDropEnabled, true); } if (s_defaultFontFamilies.isEmpty()) { @@ -367,6 +332,7 @@ void WebEngineSettings::applySettingsToWebPreferences(blink::web_pref::WebPrefer // to enable them separately. With viewport-enabled we match Android defaults. prefs->viewport_meta_enabled = true; prefs->shrinks_viewport_contents_to_fit = true; + prefs->main_frame_resizes_are_orientation_changes = true; } // Attributes mapping. @@ -403,6 +369,7 @@ void WebEngineSettings::applySettingsToWebPreferences(blink::web_pref::WebPrefer } prefs->dom_paste_enabled = testAttribute(QWebEngineSettings::JavascriptCanPaste); prefs->dns_prefetching_enabled = testAttribute(QWebEngineSettings::DnsPrefetchEnabled); + prefs->navigate_on_drag_drop = testAttribute(QWebEngineSettings::NavigateOnDropEnabled); // Fonts settings. prefs->standard_font_family_map[blink::web_pref::kCommonScript] = @@ -417,8 +384,6 @@ void WebEngineSettings::applySettingsToWebPreferences(blink::web_pref::WebPrefer toString16(fontFamily(QWebEngineSettings::CursiveFont)); prefs->fantasy_font_family_map[blink::web_pref::kCommonScript] = toString16(fontFamily(QWebEngineSettings::FantasyFont)); - prefs->pictograph_font_family_map[blink::web_pref::kCommonScript] = - toString16(fontFamily(QWebEngineSettings::PictographFont)); prefs->default_font_size = fontSize(QWebEngineSettings::DefaultFontSize); prefs->default_fixed_font_size = fontSize(QWebEngineSettings::DefaultFixedFontSize); prefs->minimum_font_size = fontSize(QWebEngineSettings::MinimumFontSize); diff --git a/src/core/web_engine_settings.h b/src/core/web_engine_settings.h index a2366e2f6..51f511155 100644 --- a/src/core/web_engine_settings.h +++ b/src/core/web_engine_settings.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 // // W A R N I N G diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp index d7dceb30c..007492843 100644 --- a/src/core/web_event_factory.cpp +++ b/src/core/web_event_factory.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 /* * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> @@ -1516,7 +1480,7 @@ WebMouseEvent WebEventFactory::toWebMouseEvent(QEvent *ev) return webKitEvent; } -#ifndef QT_NO_GESTURES +#if QT_CONFIG(gestures) WebGestureEvent WebEventFactory::toWebGestureEvent(QNativeGestureEvent *ev) { WebGestureEvent webKitEvent; diff --git a/src/core/web_event_factory.h b/src/core/web_event_factory.h index df2f26694..dfd50369e 100644 --- a/src/core/web_event_factory.h +++ b/src/core/web_event_factory.h @@ -1,64 +1,28 @@ -/**************************************************************************** -** -** 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 #ifndef WEB_EVENT_FACTORY_H #define WEB_EVENT_FACTORY_H +#include "QtGui/qtguiglobal.h" + #include "content/public/browser/native_web_keyboard_event.h" -#ifndef QT_NO_GESTURES +#if QT_CONFIG(gestures) #include "third_party/blink/public/common/input/web_gesture_event.h" #endif #include "third_party/blink/public/common/input/web_mouse_event.h" #include "third_party/blink/public/common/input/web_mouse_wheel_event.h" -#include <QtGlobal> - QT_BEGIN_NAMESPACE class QEvent; class QHoverEvent; class QKeyEvent; class QMouseEvent; -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) class QTabletEvent; #endif class QWheelEvent; -#ifndef QT_NO_GESTURES +#if QT_CONFIG(gestures) class QNativeGestureEvent; #endif QT_END_NAMESPACE @@ -72,11 +36,11 @@ class WebEventFactory { public: static blink::WebMouseEvent toWebMouseEvent(QMouseEvent *); static blink::WebMouseEvent toWebMouseEvent(QHoverEvent *); -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) static blink::WebMouseEvent toWebMouseEvent(QTabletEvent *); #endif static blink::WebMouseEvent toWebMouseEvent(QEvent *); -#ifndef QT_NO_GESTURES +#if QT_CONFIG(gestures) static blink::WebGestureEvent toWebGestureEvent(QNativeGestureEvent *); #endif static blink::WebMouseWheelEvent toWebWheelEvent(QWheelEvent *); diff --git a/src/core/web_usb_detector_qt.cpp b/src/core/web_usb_detector_qt.cpp index 5ae155a2e..511ac6801 100644 --- a/src/core/web_usb_detector_qt.cpp +++ b/src/core/web_usb_detector_qt.cpp @@ -1,41 +1,10 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 + +// based on chrome/browser/usb/web_usb_detector.cc +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #include "web_usb_detector_qt.h" @@ -51,22 +20,12 @@ WebUsbDetectorQt::~WebUsbDetectorQt() = default; void WebUsbDetectorQt::Initialize() { -#if defined(OS_WIN) - // The WebUSB device detector is disabled on Windows due to jank and hangs - // caused by enumerating devices. The new USB backend is designed to resolve - // these issues so enable it for testing. https://crbug.com/656702 - if (!base::FeatureList::IsEnabled(device::kNewUsbBackend)) - return; -#endif // defined(OS_WIN) - if (!m_deviceManager) { // Receive mojo::Remote<UsbDeviceManager> from DeviceService. content::GetDeviceService().BindUsbDeviceManager( m_deviceManager.BindNewPipeAndPassReceiver()); } DCHECK(m_deviceManager); - m_deviceManager.set_disconnect_handler(base::BindOnce( - &WebUsbDetectorQt::OnDeviceManagerConnectionError, base::Unretained(this))); // Listen for added/removed device events. DCHECK(!m_clientReceiver.is_bound()); @@ -84,12 +43,3 @@ void WebUsbDetectorQt::OnDeviceRemoved(device::mojom::UsbDeviceInfoPtr device_in Q_UNUSED(device_info); QT_NOT_YET_IMPLEMENTED } - -void WebUsbDetectorQt::OnDeviceManagerConnectionError() -{ - m_deviceManager.reset(); - m_clientReceiver.reset(); - - // Try to reconnect the device manager. - Initialize(); -} diff --git a/src/core/web_usb_detector_qt.h b/src/core/web_usb_detector_qt.h index b1d7279bf..b9ab5e4bb 100644 --- a/src/core/web_usb_detector_qt.h +++ b/src/core/web_usb_detector_qt.h @@ -1,46 +1,9 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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) 2021 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 #ifndef WEB_USB_DETECTOR_QT_H #define WEB_USB_DETECTOR_QT_H -#include "base/macros.h" #include "mojo/public/cpp/bindings/associated_receiver.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/remote.h" @@ -61,15 +24,11 @@ private: void OnDeviceAdded(device::mojom::UsbDeviceInfoPtr device_info) override; void OnDeviceRemoved(device::mojom::UsbDeviceInfoPtr device_info) override; - void OnDeviceManagerConnectionError(); - // Connection to |device_manager_instance_|. mojo::Remote<device::mojom::UsbDeviceManager> m_deviceManager; mojo::AssociatedReceiver<device::mojom::UsbDeviceManagerClient> m_clientReceiver { this }; base::WeakPtrFactory<WebUsbDetectorQt> m_weakFactory { this }; - - DISALLOW_COPY_AND_ASSIGN(WebUsbDetectorQt); }; #endif // WEB_USB_DETECTOR_QT_H |