summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.qmake.conf2
-rw-r--r--coin/product_dependencies.yaml3
-rw-r--r--coin/qt-installer-package-config.json2
-rw-r--r--configure.pri50
-rw-r--r--dependencies.yaml19
-rw-r--r--dist/changes-5.12.1091
-rw-r--r--dist/changes-5.15.286
-rw-r--r--examples/examples.pro2
-rw-r--r--examples/pdf/multipage/main.cpp4
-rw-r--r--examples/pdf/multipage/multipage.pro2
-rw-r--r--examples/pdf/pdf.pro2
-rw-r--r--examples/pdf/pdfviewer/main.cpp4
-rw-r--r--examples/pdf/pdfviewer/pdfviewer.pro2
-rw-r--r--examples/pdfwidgets/pdfviewer/zoomselector.cpp2
-rw-r--r--examples/webenginewidgets/cookiebrowser/mainwindow.cpp2
-rw-r--r--examples/webenginewidgets/cookiebrowser/mainwindow.h2
-rw-r--r--examples/webenginewidgets/printme/main.cpp6
-rw-r--r--examples/webenginewidgets/printme/printhandler.cpp18
-rw-r--r--examples/webenginewidgets/printme/printhandler.h6
-rw-r--r--examples/webenginewidgets/simplebrowser/browser.h6
-rw-r--r--examples/webenginewidgets/simplebrowser/browserwindow.cpp22
-rw-r--r--examples/webenginewidgets/simplebrowser/browserwindow.h2
-rw-r--r--examples/webenginewidgets/simplebrowser/doc/src/simplebrowser.qdoc8
-rw-r--r--examples/webenginewidgets/simplebrowser/downloadmanagerwidget.cpp14
-rw-r--r--examples/webenginewidgets/simplebrowser/downloadmanagerwidget.h6
-rw-r--r--examples/webenginewidgets/simplebrowser/downloadwidget.cpp26
-rw-r--r--examples/webenginewidgets/simplebrowser/downloadwidget.h10
-rw-r--r--examples/webenginewidgets/simplebrowser/main.cpp6
-rw-r--r--examples/webenginewidgets/simplebrowser/tabwidget.cpp4
-rw-r--r--examples/webenginewidgets/simplebrowser/tabwidget.h3
-rw-r--r--examples/webenginewidgets/simplebrowser/webpage.cpp142
-rw-r--r--examples/webenginewidgets/simplebrowser/webpage.h12
-rw-r--r--examples/webenginewidgets/simplebrowser/webview.cpp152
-rw-r--r--examples/webenginewidgets/simplebrowser/webview.h11
-rw-r--r--examples/webenginewidgets/spellchecker/webview.cpp10
-rw-r--r--examples/webenginewidgets/stylesheetbrowser/main.cpp2
-rw-r--r--examples/webenginewidgets/stylesheetbrowser/mainwindow.cpp9
-rw-r--r--mkspecs/features/functions.prf11
-rw-r--r--mkspecs/features/gn_generator.prf13
m---------src/3rdparty0
-rw-r--r--src/buildtools/config/common.pri15
-rw-r--r--src/buildtools/config/linux.pri2
-rw-r--r--src/buildtools/config/support.pri11
-rw-r--r--src/buildtools/config/windows.pri1
-rw-r--r--src/buildtools/configure.json115
-rw-r--r--src/buildtools/gn.pro4
-rw-r--r--src/core/accessibility_tree_formatter_qt.cpp53
-rw-r--r--src/core/api/core_api.pro41
-rw-r--r--src/core/api/qtbug-60565.cpp138
-rw-r--r--src/core/api/qtbug-61521.cpp120
-rw-r--r--src/core/api/qtwebenginecoreglobal.cpp179
-rw-r--r--src/core/api/qwebenginecallback_p.h2
-rw-r--r--src/core/api/qwebenginecertificateerror.cpp (renamed from src/webenginewidgets/api/qwebenginecertificateerror.cpp)118
-rw-r--r--src/core/api/qwebenginecertificateerror.h (renamed from src/webenginewidgets/api/qwebenginecertificateerror.h)51
-rw-r--r--src/core/api/qwebengineclientcertificateselection.cpp (renamed from src/webenginewidgets/api/qwebengineclientcertificateselection.cpp)11
-rw-r--r--src/core/api/qwebengineclientcertificateselection.h (renamed from src/webenginewidgets/api/qwebengineclientcertificateselection.h)23
-rw-r--r--src/core/api/qwebengineclientcertificatestore.cpp4
-rw-r--r--src/core/api/qwebengineclientcertificatestore.h11
-rw-r--r--src/core/api/qwebenginecontextmenurequest.cpp296
-rw-r--r--src/core/api/qwebenginecontextmenurequest.h (renamed from src/webengine/api/qquickwebenginecontextmenurequest_p.h)74
-rw-r--r--src/core/api/qwebenginecontextmenurequest_p.h (renamed from src/webengine/api/qquickwebenginescript_p.h)64
-rw-r--r--src/core/api/qwebenginecookiestore_p.h4
-rw-r--r--src/core/api/qwebenginedownloadrequest.cpp (renamed from src/webenginewidgets/api/qwebenginedownloaditem.cpp)410
-rw-r--r--src/core/api/qwebenginedownloadrequest.h (renamed from src/webengine/api/qquickwebenginedownloaditem_p.h)142
-rw-r--r--src/core/api/qwebenginedownloadrequest_p.h (renamed from src/webenginewidgets/api/qwebenginedownloaditem_p.h)50
-rw-r--r--src/core/api/qwebenginefullscreenrequest.cpp (renamed from src/webenginewidgets/api/qwebenginefullscreenrequest.cpp)71
-rw-r--r--src/core/api/qwebenginefullscreenrequest.h (renamed from src/webenginewidgets/api/qwebenginefullscreenrequest.h)32
-rw-r--r--src/core/api/qwebenginehistory.cpp (renamed from src/webenginewidgets/api/qwebenginehistory.cpp)102
-rw-r--r--src/core/api/qwebenginehistory.h (renamed from src/webenginewidgets/api/qwebenginehistory.h)15
-rw-r--r--src/core/api/qwebenginehistory_p.h (renamed from src/webenginewidgets/api/qwebenginehistory_p.h)18
-rw-r--r--src/core/api/qwebenginehttprequest.cpp10
-rw-r--r--src/core/api/qwebenginehttprequest.h6
-rw-r--r--src/core/api/qwebenginepage.cpp (renamed from src/webenginewidgets/api/qwebenginepage.cpp)794
-rw-r--r--src/core/api/qwebenginepage.h (renamed from src/webenginewidgets/api/qwebenginepage.h)39
-rw-r--r--src/core/api/qwebenginepage_p.h (renamed from src/webenginewidgets/api/qwebenginepage_p.h)74
-rw-r--r--src/core/api/qwebengineprofile.cpp (renamed from src/webenginewidgets/api/qwebengineprofile.cpp)102
-rw-r--r--src/core/api/qwebengineprofile.h (renamed from src/webenginewidgets/api/qwebengineprofile.h)11
-rw-r--r--src/core/api/qwebengineprofile_p.h (renamed from src/webenginewidgets/api/qwebengineprofile_p.h)4
-rw-r--r--src/core/api/qwebenginescript.cpp (renamed from src/webenginewidgets/api/qwebenginescript.cpp)49
-rw-r--r--src/core/api/qwebenginescript.h (renamed from src/webenginewidgets/api/qwebenginescript.h)35
-rw-r--r--src/core/api/qwebenginescriptcollection.cpp (renamed from src/webenginewidgets/api/qwebenginescriptcollection.cpp)29
-rw-r--r--src/core/api/qwebenginescriptcollection.h (renamed from src/webenginewidgets/api/qwebenginescriptcollection.h)19
-rw-r--r--src/core/api/qwebenginescriptcollection_p.h (renamed from src/webenginewidgets/api/qwebenginescriptcollection_p.h)11
-rw-r--r--src/core/api/qwebenginesettings.cpp142
-rw-r--r--src/core/api/qwebenginesettings.h (renamed from src/webenginewidgets/api/qwebenginesettings.h)26
-rw-r--r--src/core/browser_accessibility_manager_qt.cpp10
-rw-r--r--src/core/browser_accessibility_manager_qt.h11
-rw-r--r--src/core/browser_accessibility_qt.cpp34
-rw-r--r--src/core/browser_accessibility_qt.h4
-rw-r--r--src/core/browser_main_parts_qt.cpp11
-rw-r--r--src/core/browser_message_filter_qt.cpp99
-rw-r--r--src/core/browser_message_filter_qt.h57
-rw-r--r--src/core/browsing_data_remover_delegate_qt.cpp15
-rw-r--r--src/core/browsing_data_remover_delegate_qt.h7
-rw-r--r--src/core/certificate_error_controller.cpp201
-rw-r--r--src/core/certificate_error_controller.h89
-rw-r--r--src/core/certificate_error_controller_p.h79
-rw-r--r--src/core/chromium_overrides.cpp9
-rw-r--r--src/core/client_cert_select_controller.cpp12
-rw-r--r--src/core/client_cert_select_controller.h14
-rw-r--r--src/core/clipboard_qt.cpp91
-rw-r--r--src/core/clipboard_qt.h48
-rw-r--r--src/core/common/extensions/api/qtwebengine_extensions_features.gni4
-rw-r--r--src/core/common/extensions/extensions_api_provider_qt.cpp21
-rw-r--r--src/core/common/extensions/extensions_client_qt.cpp12
-rw-r--r--src/core/common/extensions/extensions_client_qt.h10
-rw-r--r--src/core/common/qt_messages.h80
-rw-r--r--src/core/common/user_script_data.h74
-rw-r--r--src/core/compositor/compositor.cpp197
-rw-r--r--src/core/compositor/compositor.h195
-rw-r--r--src/core/compositor/display_frame_sink.cpp140
-rw-r--r--src/core/compositor/display_frame_sink.h77
-rw-r--r--src/core/compositor/display_gl_output_surface.cpp56
-rw-r--r--src/core/compositor/display_gl_output_surface.h18
-rw-r--r--src/core/compositor/display_gl_output_surface_qsg.cpp122
-rw-r--r--src/core/compositor/display_software_output_surface.cpp103
-rw-r--r--src/core/config/common.pri16
-rw-r--r--src/core/config/linux.pri5
-rw-r--r--src/core/config/windows.pri3
-rw-r--r--src/core/configure.json15
-rw-r--r--src/core/content_browser_client_qt.cpp319
-rw-r--r--src/core/content_browser_client_qt.h62
-rw-r--r--src/core/content_client_qt.cpp7
-rw-r--r--src/core/content_main_delegate_qt.cpp14
-rw-r--r--src/core/core_chromium.pri33
-rw-r--r--src/core/core_common.pri1
-rw-r--r--src/core/core_module.pro6
-rw-r--r--src/core/desktop_screen_qt.cpp68
-rw-r--r--src/core/desktop_screen_qt.h23
-rw-r--r--src/core/devtools_frontend_qt.cpp4
-rw-r--r--src/core/doc/src/qwebenginesettings_lgpl.qdoc (renamed from src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc)11
-rw-r--r--src/core/download_manager_delegate_qt.cpp19
-rw-r--r--src/core/download_manager_delegate_qt.h3
-rw-r--r--src/core/extensions/component_extension_resource_manager_qt.h1
-rw-r--r--src/core/extensions/extension_host_delegate_qt.cpp125
-rw-r--r--src/core/extensions/extension_host_delegate_qt.h (renamed from src/core/compositor/display_producer.h)52
-rw-r--r--src/core/extensions/extension_system_qt.cpp69
-rw-r--r--src/core/extensions/extension_system_qt.h16
-rw-r--r--src/core/extensions/extensions_api_client_qt.cpp11
-rw-r--r--src/core/extensions/extensions_api_client_qt.h6
-rw-r--r--src/core/extensions/extensions_browser_client_qt.cpp92
-rw-r--r--src/core/extensions/extensions_browser_client_qt.h3
-rw-r--r--src/core/extensions/messaging_delegate_qt.cpp (renamed from src/core/common/user_script_data.cpp)23
-rw-r--r--src/core/extensions/messaging_delegate_qt.h (renamed from src/core/compositor/display_consumer.h)34
-rw-r--r--src/core/favicon_manager.cpp10
-rw-r--r--src/core/file_picker_controller.cpp42
-rw-r--r--src/core/file_picker_controller.h18
-rw-r--r--src/core/find_text_helper.cpp2
-rw-r--r--src/core/gn_run.pro6
-rw-r--r--src/core/location_provider_qt.cpp1
-rw-r--r--src/core/location_provider_qt.h4
-rw-r--r--src/core/macos_context_type_helper.h1
-rw-r--r--src/core/macos_context_type_helper.mm5
-rw-r--r--src/core/media_capture_devices_dispatcher.cpp104
-rw-r--r--src/core/media_capture_devices_dispatcher.h4
-rw-r--r--src/core/native_web_keyboard_event_qt.cpp6
-rw-r--r--src/core/net/client_cert_override.cpp6
-rw-r--r--src/core/net/client_cert_store_data.h4
-rw-r--r--src/core/net/cookie_monster_delegate_qt.cpp9
-rw-r--r--src/core/net/cookie_monster_delegate_qt.h8
-rw-r--r--src/core/net/custom_url_loader_factory.cpp29
-rw-r--r--src/core/net/custom_url_loader_factory.h4
-rw-r--r--src/core/net/plugin_response_interceptor_url_loader_throttle.cpp4
-rw-r--r--src/core/net/proxying_restricted_cookie_manager_qt.cpp2
-rw-r--r--src/core/net/proxying_url_loader_factory_qt.cpp63
-rw-r--r--src/core/net/system_network_context_manager.cpp37
-rw-r--r--src/core/net/system_network_context_manager.h4
-rw-r--r--src/core/ozone/gl_context_qt.cpp18
-rw-r--r--src/core/ozone/gl_context_qt.h2
-rw-r--r--src/core/ozone/gl_ozone_egl_qt.cpp20
-rw-r--r--src/core/ozone/gl_share_context_qt.cpp110
-rw-r--r--src/core/ozone/gl_share_context_qt.h99
-rw-r--r--src/core/ozone/gl_surface_egl_qt.cpp19
-rw-r--r--src/core/ozone/gl_surface_glx_qt.cpp14
-rw-r--r--src/core/ozone/gl_surface_glx_qt.h4
-rw-r--r--src/core/ozone/gl_surface_qt.cpp8
-rw-r--r--src/core/ozone/ozone_platform_qt.cpp10
-rw-r--r--src/core/ozone/surface_factory_qt.cpp10
-rw-r--r--src/core/ozone/surface_factory_qt.h2
-rw-r--r--src/core/permission_manager_qt.cpp21
-rw-r--r--src/core/pref_service_adapter.cpp6
-rw-r--r--src/core/pref_service_adapter.h6
-rw-r--r--src/core/printing/print_view_manager_base_qt.cpp185
-rw-r--r--src/core/printing/print_view_manager_base_qt.h107
-rw-r--r--src/core/printing/print_view_manager_qt.cpp41
-rw-r--r--src/core/printing/print_view_manager_qt.h29
-rw-r--r--src/core/printing/printer_worker.cpp (renamed from src/webenginewidgets/printer_worker.cpp)24
-rw-r--r--src/core/printing/printer_worker.h (renamed from src/webenginewidgets/printer_worker.h)4
-rw-r--r--src/core/printing/printing_message_filter_qt.cpp101
-rw-r--r--src/core/printing/printing_message_filter_qt.h39
-rw-r--r--src/core/process_main.cpp6
-rw-r--r--src/core/profile_adapter.cpp3
-rw-r--r--src/core/profile_adapter.h3
-rw-r--r--src/core/profile_adapter_client.h9
-rw-r--r--src/core/profile_io_data_qt.cpp24
-rw-r--r--src/core/profile_io_data_qt.h8
-rw-r--r--src/core/profile_qt.h3
-rw-r--r--src/core/qtwebengine.gni3
-rw-r--r--src/core/qtwebengine_sources.gni18
-rw-r--r--src/core/quota_permission_context_qt.cpp18
-rw-r--r--src/core/quota_permission_context_qt.h2
-rw-r--r--src/core/quota_request_controller_impl.cpp7
-rw-r--r--src/core/render_view_context_menu_qt.cpp45
-rw-r--r--src/core/render_view_context_menu_qt.h6
-rw-r--r--src/core/render_widget_host_view_qt.cpp1112
-rw-r--r--src/core/render_widget_host_view_qt.h199
-rw-r--r--src/core/render_widget_host_view_qt_delegate.h37
-rw-r--r--src/core/render_widget_host_view_qt_delegate_client.cpp1003
-rw-r--r--src/core/render_widget_host_view_qt_delegate_client.h168
-rw-r--r--src/core/renderer/content_renderer_client_qt.cpp69
-rw-r--r--src/core/renderer/content_renderer_client_qt.h16
-rw-r--r--src/core/renderer/content_settings_observer_qt.cpp66
-rw-r--r--src/core/renderer/content_settings_observer_qt.h13
-rw-r--r--src/core/renderer/extensions/extensions_dispatcher_delegate_qt.cpp9
-rw-r--r--src/core/renderer/extensions/extensions_dispatcher_delegate_qt.h3
-rw-r--r--src/core/renderer/extensions/extensions_renderer_client_qt.cpp16
-rw-r--r--src/core/renderer/extensions/extensions_renderer_client_qt.h4
-rw-r--r--src/core/renderer/render_configuration.cpp (renamed from src/core/renderer/render_thread_observer_qt.cpp)19
-rw-r--r--src/core/renderer/render_configuration.h (renamed from src/core/renderer/render_thread_observer_qt.h)20
-rw-r--r--src/core/renderer/render_frame_observer_qt.cpp2
-rw-r--r--src/core/renderer/render_frame_observer_qt.h2
-rw-r--r--src/core/renderer/user_resource_controller.cpp240
-rw-r--r--src/core/renderer/user_resource_controller.h47
-rw-r--r--src/core/renderer/web_channel_ipc_transport.cpp43
-rw-r--r--src/core/renderer/web_channel_ipc_transport.h4
-rw-r--r--src/core/renderer/web_engine_page_render_frame.cpp (renamed from src/core/renderer/render_view_observer_qt.cpp)62
-rw-r--r--src/core/renderer/web_engine_page_render_frame.h (renamed from src/core/renderer/render_view_observer_qt.h)42
-rw-r--r--src/core/renderer_host/pepper/pepper_flash_browser_host_qt.cpp4
-rw-r--r--src/core/renderer_host/user_resource_controller_host.cpp82
-rw-r--r--src/core/renderer_host/user_resource_controller_host.h24
-rw-r--r--src/core/renderer_host/web_channel_ipc_transport_host.cpp42
-rw-r--r--src/core/renderer_host/web_channel_ipc_transport_host.h11
-rw-r--r--src/core/renderer_host/web_engine_page_host.cpp (renamed from src/core/renderer_host/render_view_observer_host_qt.cpp)73
-rw-r--r--src/core/renderer_host/web_engine_page_host.h (renamed from src/core/renderer_host/render_view_observer_host_qt.h)38
-rw-r--r--src/core/resource_bundle_qt.cpp12
-rw-r--r--src/core/touch_selection_controller_client_qt.cpp20
-rw-r--r--src/core/type_conversion.cpp51
-rw-r--r--src/core/type_conversion.h63
-rw-r--r--src/core/user_script.cpp122
-rw-r--r--src/core/user_script.h23
-rw-r--r--src/core/visited_links_manager_qt.h4
-rw-r--r--src/core/web_contents_adapter.cpp144
-rw-r--r--src/core/web_contents_adapter.h14
-rw-r--r--src/core/web_contents_adapter_client.h294
-rw-r--r--src/core/web_contents_delegate_qt.cpp158
-rw-r--r--src/core/web_contents_delegate_qt.h40
-rw-r--r--src/core/web_contents_view_qt.cpp195
-rw-r--r--src/core/web_contents_view_qt.h29
-rw-r--r--src/core/web_engine_context.cpp293
-rw-r--r--src/core/web_engine_context.h4
-rw-r--r--src/core/web_engine_library_info.cpp59
-rw-r--r--src/core/web_engine_library_info.h6
-rw-r--r--src/core/web_engine_settings.cpp259
-rw-r--r--src/core/web_engine_settings.h122
-rw-r--r--src/core/web_event_factory.cpp94
-rw-r--r--src/pdf/api/qpdfdocument_p.h4
-rw-r--r--src/pdf/api/qpdflinkmodel_p_p.h2
-rw-r--r--src/pdf/api/qpdfpagenavigation.h2
-rw-r--r--src/pdf/api/qpdfpagerenderer.h4
-rw-r--r--src/pdf/api/qpdfsearchmodel.h2
-rw-r--r--src/pdf/api/qpdfsearchmodel_p.h4
-rw-r--r--src/pdf/api/qpdfsearchresult.h8
-rw-r--r--src/pdf/api/qpdfsearchresult_p.h4
-rw-r--r--src/pdf/api/qpdfselection.h6
-rw-r--r--src/pdf/api/qpdfselection_p.h6
-rw-r--r--src/pdf/config/common.pri29
-rw-r--r--src/pdf/config/ios.pri3
-rw-r--r--src/pdf/configure.json2
-rw-r--r--src/pdf/pdfcore.pro7
-rw-r--r--src/pdf/qpdfbookmarkmodel.cpp4
-rw-r--r--src/pdf/qpdfdocument.cpp50
-rw-r--r--src/pdf/qpdflinkmodel.cpp7
-rw-r--r--src/pdf/qpdfpagenavigation.cpp90
-rw-r--r--src/pdf/qpdfpagerenderer.cpp87
-rw-r--r--src/pdf/qpdfsearchmodel.cpp18
-rw-r--r--src/pdf/qpdfsearchresult.cpp4
-rw-r--r--src/pdf/qpdfselection.cpp4
-rw-r--r--src/pdf/quick/qquickpdfdocument.cpp2
-rw-r--r--src/pdf/quick/qquickpdflinkmodel_p.h2
-rw-r--r--src/pdf/quick/qquickpdfnavigationstack_p.h2
-rw-r--r--src/pdf/quick/qquickpdfsearchmodel.cpp10
-rw-r--r--src/pdf/quick/qquickpdfsearchmodel_p.h10
-rw-r--r--src/pdf/quick/qquickpdfselection.cpp2
-rw-r--r--src/pdf/quick/qquickpdfselection_p.h10
-rw-r--r--src/pdf/quick/qquicktableviewextra.cpp1
-rw-r--r--src/pdf/quick/qquicktableviewextra_p.h3
-rw-r--r--src/pdfwidgets/qpdfview.cpp21
-rw-r--r--src/pdfwidgets/qpdfview.h3
-rw-r--r--src/pdfwidgets/qpdfview_p.h9
-rw-r--r--src/process/process.pro8
-rw-r--r--src/process/support_win.cpp1
-rw-r--r--src/src.pro1
-rw-r--r--src/tools/qwebengine_convert_dict/main.cpp10
-rw-r--r--src/webengine/api/qquickwebenginecertificateerror_p.h115
-rw-r--r--src/webengine/api/qquickwebengineclientcertificateselection.cpp11
-rw-r--r--src/webengine/api/qquickwebengineclientcertificateselection_p.h18
-rw-r--r--src/webengine/api/qquickwebenginecontextmenurequest.cpp383
-rw-r--r--src/webengine/api/qquickwebenginedownloaditem.cpp789
-rw-r--r--src/webengine/api/qquickwebenginedownloaditem_p_p.h99
-rw-r--r--src/webengine/api/qquickwebengineprofile.cpp150
-rw-r--r--src/webengine/api/qquickwebengineprofile.h24
-rw-r--r--src/webengine/api/qquickwebengineprofile_p.h13
-rw-r--r--src/webengine/api/qquickwebenginescript.cpp446
-rw-r--r--src/webengine/api/qquickwebenginescript.h114
-rw-r--r--src/webengine/api/qquickwebenginescriptcollection.cpp157
-rw-r--r--src/webengine/api/qquickwebenginescriptcollection.h86
-rw-r--r--src/webengine/api/qquickwebenginesettings.cpp189
-rw-r--r--src/webengine/api/qquickwebenginesettings_p.h3
-rw-r--r--src/webengine/api/qquickwebenginesingleton.cpp8
-rw-r--r--src/webengine/api/qquickwebenginesingleton_p.h9
-rw-r--r--src/webengine/api/qquickwebenginetouchhandleprovider.cpp2
-rw-r--r--src/webengine/api/qquickwebengineview.cpp380
-rw-r--r--src/webengine/api/qquickwebengineview_p.h49
-rw-r--r--src/webengine/api/qquickwebengineview_p_p.h42
-rw-r--r--src/webengine/api/qtwebengineglobal.cpp12
-rw-r--r--src/webengine/doc/src/context_menu_request.qdoc218
-rw-r--r--src/webengine/doc/src/fullscreen_request.qdoc82
-rw-r--r--src/webengine/doc/src/qtwebengine-overview.qdoc2
-rw-r--r--src/webengine/doc/src/qtwebengine-platform-notes.qdoc5
-rw-r--r--src/webengine/doc/src/quota_request.qdoc74
-rw-r--r--src/webengine/doc/src/register_protocol_handler_request.qdoc66
-rw-r--r--src/webengine/doc/src/webengine_certificate_error.qdoc (renamed from src/webengine/api/qquickwebenginecertificateerror.cpp)146
-rw-r--r--src/webengine/doc/src/webengine_download_request.qdoc302
-rw-r--r--src/webengine/doc/src/webengineview_lgpl.qdoc142
-rw-r--r--src/webengine/module.pro14
-rw-r--r--src/webengine/plugin/plugin.cpp43
-rw-r--r--src/webengine/plugin/plugins.qmltypes5
-rw-r--r--src/webengine/render_widget_host_view_qt_delegate_quick.cpp131
-rw-r--r--src/webengine/render_widget_host_view_qt_delegate_quick.h18
-rw-r--r--src/webengine/render_widget_host_view_qt_delegate_quickwindow.cpp29
-rw-r--r--src/webengine/render_widget_host_view_qt_delegate_quickwindow.h8
-rw-r--r--src/webenginewidgets/api/qtwebenginewidgetsglobal.cpp75
-rw-r--r--src/webenginewidgets/api/qwebenginecontextmenudata.cpp306
-rw-r--r--src/webenginewidgets/api/qwebenginecontextmenudata.h133
-rw-r--r--src/webenginewidgets/api/qwebenginedownloaditem.h174
-rw-r--r--src/webenginewidgets/api/qwebenginesettings.cpp254
-rw-r--r--src/webenginewidgets/api/qwebengineview.cpp591
-rw-r--r--src/webenginewidgets/api/qwebengineview.h8
-rw-r--r--src/webenginewidgets/api/qwebengineview_p.h52
-rw-r--r--src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc9
-rw-r--r--src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp180
-rw-r--r--src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h11
-rw-r--r--src/webenginewidgets/webenginewidgets.pro33
-rw-r--r--tests/auto/core/qwebengineclientcertificatestore/tst_qwebengineclientcertificatestore.cpp2
-rw-r--r--tests/auto/core/qwebenginecookiestore/tst_qwebenginecookiestore.cpp4
-rw-r--r--tests/auto/core/qwebengineurlrequestinterceptor/resources/content.html3
-rw-r--r--tests/auto/core/qwebengineurlrequestinterceptor/resources/content2.html6
-rw-r--r--tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp229
-rw-r--r--tests/auto/pdf/qpdfsearchmodel/tst_qpdfsearchmodel.cpp2
-rw-r--r--tests/auto/quick/certificateerror/WebView.qml64
-rw-r--r--tests/auto/quick/certificateerror/certificateerror.pro7
-rw-r--r--tests/auto/quick/certificateerror/certificateerror.qrc5
-rw-r--r--tests/auto/quick/certificateerror/testhandler.cpp63
-rw-r--r--tests/auto/quick/certificateerror/testhandler.h59
-rw-r--r--tests/auto/quick/certificateerror/tst_certificateerror.cpp125
-rw-r--r--tests/auto/quick/dialogs/testhandler.cpp2
-rw-r--r--tests/auto/quick/dialogs/tst_dialogs.cpp81
-rw-r--r--tests/auto/quick/inspectorserver/tst_inspectorserver.cpp11
-rw-r--r--tests/auto/quick/publicapi/tst_publicapi.cpp344
-rw-r--r--tests/auto/quick/qmltests/BLACKLIST2
-rw-r--r--tests/auto/quick/qmltests/data/TestWebEngineView.qml6
-rw-r--r--tests/auto/quick/qmltests/data/accepttypes.html (renamed from tests/auto/quick/qmltests2/data/accepttypes.html)0
-rw-r--r--tests/auto/quick/qmltests/data/alert.html (renamed from tests/auto/quick/qmltests2/data/alert.html)0
-rw-r--r--tests/auto/quick/qmltests/data/confirm.html (renamed from tests/auto/quick/qmltests2/data/confirm.html)0
-rw-r--r--tests/auto/quick/qmltests/data/confirmclose.html (renamed from tests/auto/quick/qmltests2/data/confirmclose.html)0
-rw-r--r--tests/auto/quick/qmltests/data/directoryupload.html (renamed from tests/auto/quick/qmltests2/data/directoryupload.html)0
-rw-r--r--tests/auto/quick/qmltests/data/favicon-candidates-gray.html (renamed from tests/auto/quick/qmltests2/data/favicon-candidates-gray.html)0
-rw-r--r--tests/auto/quick/qmltests/data/favicon-misc.html (renamed from tests/auto/quick/qmltests2/data/favicon-misc.html)0
-rw-r--r--tests/auto/quick/qmltests/data/favicon-multi-gray.html (renamed from tests/auto/quick/qmltests2/data/favicon-multi-gray.html)0
-rw-r--r--tests/auto/quick/qmltests/data/favicon-multi.html (renamed from tests/auto/quick/qmltests2/data/favicon-multi.html)0
-rw-r--r--tests/auto/quick/qmltests/data/favicon-shortcut.html (renamed from tests/auto/quick/qmltests2/data/favicon-shortcut.html)0
-rw-r--r--tests/auto/quick/qmltests/data/favicon-single.html (renamed from tests/auto/quick/qmltests2/data/favicon-single.html)0
-rw-r--r--tests/auto/quick/qmltests/data/favicon-touch.html (renamed from tests/auto/quick/qmltests2/data/favicon-touch.html)0
-rw-r--r--tests/auto/quick/qmltests/data/favicon-unavailable.html (renamed from tests/auto/quick/qmltests2/data/favicon-unavailable.html)0
-rw-r--r--tests/auto/quick/qmltests/data/favicon2.html (renamed from tests/auto/quick/qmltests2/data/favicon2.html)0
-rw-r--r--tests/auto/quick/qmltests/data/icons/gray128.png (renamed from tests/auto/quick/qmltests2/data/icons/gray128.png)bin146 -> 146 bytes
-rw-r--r--tests/auto/quick/qmltests/data/icons/gray16.png (renamed from tests/auto/quick/qmltests2/data/icons/gray16.png)bin72 -> 72 bytes
-rw-r--r--tests/auto/quick/qmltests/data/icons/gray255.png (renamed from tests/auto/quick/qmltests2/data/icons/gray255.png)bin335 -> 335 bytes
-rw-r--r--tests/auto/quick/qmltests/data/icons/gray32.png (renamed from tests/auto/quick/qmltests2/data/icons/gray32.png)bin79 -> 79 bytes
-rw-r--r--tests/auto/quick/qmltests/data/icons/gray64.png (renamed from tests/auto/quick/qmltests2/data/icons/gray64.png)bin99 -> 99 bytes
-rw-r--r--tests/auto/quick/qmltests/data/icons/grayicons.ico (renamed from tests/auto/quick/qmltests2/data/icons/grayicons.ico)bin22150 -> 22150 bytes
-rw-r--r--tests/auto/quick/qmltests/data/icons/qt144.png (renamed from tests/auto/quick/qmltests2/data/icons/qt144.png)bin8315 -> 8315 bytes
-rw-r--r--tests/auto/quick/qmltests/data/icons/qt32.ico (renamed from tests/auto/quick/qmltests2/data/icons/qt32.ico)bin4286 -> 4286 bytes
-rw-r--r--tests/auto/quick/qmltests/data/icons/qtmulti.ico (renamed from tests/auto/quick/qmltests2/data/icons/qtmulti.ico)bin22382 -> 22382 bytes
-rw-r--r--tests/auto/quick/qmltests/data/icons/small-favicon.png (renamed from tests/auto/quick/qmltests2/data/icons/small-favicon.png)bin878 -> 878 bytes
-rw-r--r--tests/auto/quick/qmltests/data/multifileupload.html (renamed from tests/auto/quick/qmltests2/data/multifileupload.html)0
-rw-r--r--tests/auto/quick/qmltests/data/prompt.html (renamed from tests/auto/quick/qmltests2/data/prompt.html)0
-rw-r--r--tests/auto/quick/qmltests/data/singlefileupload.html (renamed from tests/auto/quick/qmltests2/data/singlefileupload.html)0
-rw-r--r--tests/auto/quick/qmltests/data/test2.html2
-rw-r--r--tests/auto/quick/qmltests/data/titleupdate.js (renamed from tests/auto/quick/qmltests2/data/titleupdate.js)0
-rw-r--r--tests/auto/quick/qmltests/data/tst_certificateError.qml (renamed from tests/auto/quick/qmltests_ssl/data/tst_certificateError.qml)4
-rw-r--r--tests/auto/quick/qmltests/data/tst_download.qml42
-rw-r--r--tests/auto/quick/qmltests/data/tst_favicon.qml (renamed from tests/auto/quick/qmltests2/data/tst_favicon.qml)0
-rw-r--r--tests/auto/quick/qmltests/data/tst_faviconDownload.qml (renamed from tests/auto/quick/qmltests2/data/tst_faviconDownload.qml)0
-rw-r--r--tests/auto/quick/qmltests/data/tst_filePicker.qml (renamed from tests/auto/quick/qmltests2/data/tst_filePicker.qml)0
-rw-r--r--tests/auto/quick/qmltests/data/tst_inputMethod.qml (renamed from tests/auto/quick/qmltests2/data/tst_inputMethod.qml)0
-rw-r--r--tests/auto/quick/qmltests/data/tst_javaScriptDialogs.qml (renamed from tests/auto/quick/qmltests2/data/tst_javaScriptDialogs.qml)15
-rw-r--r--tests/auto/quick/qmltests/data/tst_linkHovered.qml (renamed from tests/auto/quick/qmltests2/data/tst_linkHovered.qml)0
-rw-r--r--tests/auto/quick/qmltests/data/tst_loadFail.qml (renamed from tests/auto/quick/qmltests2/data/tst_loadFail.qml)0
-rw-r--r--tests/auto/quick/qmltests/data/tst_loadUrl.qml2
-rw-r--r--tests/auto/quick/qmltests/data/tst_mouseClick.qml (renamed from tests/auto/quick/qmltests2/data/tst_mouseClick.qml)0
-rw-r--r--tests/auto/quick/qmltests/data/tst_newViewRequest.qml25
-rw-r--r--tests/auto/quick/qmltests/data/tst_userScripts.qml85
-rw-r--r--tests/auto/quick/qmltests/data/tst_viewSource.qml30
-rw-r--r--tests/auto/quick/qmltests/data/tst_viewSoure.qml133
-rw-r--r--tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/AlertDialog.qml (renamed from tests/auto/quick/qmltests2/mock-delegates/QtWebEngine/Controls1Delegates/AlertDialog.qml)0
-rw-r--r--tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/ConfirmDialog.qml (renamed from tests/auto/quick/qmltests2/mock-delegates/QtWebEngine/Controls1Delegates/ConfirmDialog.qml)0
-rw-r--r--tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/FilePicker.qml (renamed from tests/auto/quick/qmltests2/mock-delegates/QtWebEngine/Controls1Delegates/FilePicker.qml)0
-rw-r--r--tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/Menu.qml (renamed from tests/auto/quick/qmltests2/mock-delegates/QtWebEngine/Controls1Delegates/Menu.qml)0
-rw-r--r--tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/MenuItem.qml (renamed from tests/auto/quick/qmltests2/mock-delegates/QtWebEngine/Controls1Delegates/MenuItem.qml)0
-rw-r--r--tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/PromptDialog.qml (renamed from tests/auto/quick/qmltests2/mock-delegates/QtWebEngine/Controls1Delegates/PromptDialog.qml)0
-rw-r--r--tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/qmldir (renamed from tests/auto/quick/qmltests2/mock-delegates/QtWebEngine/Controls1Delegates/qmldir)0
-rw-r--r--tests/auto/quick/qmltests/mock-delegates/TestParams/FilePickerParams.qml (renamed from tests/auto/quick/qmltests2/mock-delegates/TestParams/FilePickerParams.qml)0
-rw-r--r--tests/auto/quick/qmltests/mock-delegates/TestParams/JSDialogParams.qml (renamed from tests/auto/quick/qmltests2/mock-delegates/TestParams/JSDialogParams.qml)0
-rw-r--r--tests/auto/quick/qmltests/mock-delegates/TestParams/qmldir (renamed from tests/auto/quick/qmltests2/mock-delegates/TestParams/qmldir)0
-rw-r--r--tests/auto/quick/qmltests/qmltests.pro159
-rw-r--r--tests/auto/quick/qmltests/tst_qmltests.cpp12
-rw-r--r--tests/auto/quick/qmltests2/data/favicon.html10
-rw-r--r--tests/auto/quick/qmltests2/data/icons/favicon.pngbin3961 -> 0 bytes
-rw-r--r--tests/auto/quick/qmltests2/data/test1.html6
-rw-r--r--tests/auto/quick/qmltests2/data/test2.html6
-rw-r--r--tests/auto/quick/qmltests2/qmltests2.pro78
-rw-r--r--tests/auto/quick/qmltests2/tst_qmltests2.cpp127
-rw-r--r--tests/auto/quick/qmltests_ssl/data/TestWebEngineView.qml122
-rw-r--r--tests/auto/quick/qmltests_ssl/qmltests_ssl.pro10
-rw-r--r--tests/auto/quick/qmltests_ssl/tst_qmltests_ssl.cpp160
-rw-r--r--tests/auto/quick/qquickwebengineview/BLACKLIST2
-rw-r--r--tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp61
-rw-r--r--tests/auto/quick/quick.pro12
-rw-r--r--tests/auto/quick/shared/util.h2
-rw-r--r--tests/auto/shared/httpserver.cpp10
-rw-r--r--tests/auto/shared/httpserver.h1
-rw-r--r--tests/auto/shared/httpsserver.h2
-rw-r--r--tests/auto/widgets/accessibility/BLACKLIST2
-rw-r--r--tests/auto/widgets/accessibility/tst_accessibility.cpp13
-rw-r--r--tests/auto/widgets/certificateerror/tst_certificateerror.cpp18
-rw-r--r--tests/auto/widgets/loadsignals/tst_loadsignals.cpp50
-rw-r--r--tests/auto/widgets/origins/origins.pro1
-rw-r--r--tests/auto/widgets/origins/tst_origins.cpp41
-rw-r--r--tests/auto/widgets/proxy/proxy_server.cpp2
-rw-r--r--tests/auto/widgets/qwebenginedownloadrequest/qwebenginedownloadrequest.pro (renamed from tests/auto/widgets/qwebenginedownloaditem/qwebenginedownloaditem.pro)0
-rw-r--r--tests/auto/widgets/qwebenginedownloadrequest/tst_qwebenginedownloadrequest.cpp (renamed from tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp)387
-rw-r--r--tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp3
-rw-r--r--tests/auto/widgets/qwebenginepage/BLACKLIST6
-rw-r--r--tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp123
-rw-r--r--tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp26
-rw-r--r--tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp6
-rw-r--r--tests/auto/widgets/qwebenginesettings/BLACKLIST2
-rw-r--r--tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp2
-rw-r--r--tests/auto/widgets/qwebengineview/BLACKLIST6
-rw-r--r--tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp285
-rw-r--r--tests/auto/widgets/spellchecking/tst_spellchecking.cpp24
-rw-r--r--tests/auto/widgets/touchinput/touchinput.pro2
-rw-r--r--tests/auto/widgets/touchinput/tst_touchinput.cpp349
-rw-r--r--tests/auto/widgets/util.h39
-rw-r--r--tests/auto/widgets/widgets.pro7
-rw-r--r--tests/manual/quick/quick.pro3
-rw-r--r--tests/manual/quick/touchbrowser/AddressBar.qml102
-rw-r--r--tests/manual/quick/touchbrowser/main.cpp100
-rw-r--r--tests/manual/quick/touchbrowser/main.qml65
-rw-r--r--tests/manual/quick/touchbrowser/qml.qrc6
-rw-r--r--tests/manual/quick/touchbrowser/touchbrowser.pro19
-rw-r--r--tests/manual/quick/touchbrowser/touchmockingapplication.cpp287
-rw-r--r--tests/manual/quick/touchbrowser/touchmockingapplication.h72
-rw-r--r--tests/manual/quick/touchbrowser/utils.h49
-rw-r--r--tests/manual/widgets/inputmethods/colorpicker.cpp1
-rw-r--r--tools/scripts/git_submodule.py5
-rwxr-xr-xtools/scripts/take_snapshot.py182
-rw-r--r--tools/scripts/version_resolver.py6
469 files changed, 12287 insertions, 12915 deletions
diff --git a/.qmake.conf b/.qmake.conf
index 8de72145c..b9d228cf5 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -5,4 +5,4 @@ QTWEBENGINE_OUT_ROOT = $$shadowed($$PWD)
load(qt_build_config)
CONFIG += warning_clean
-MODULE_VERSION = 5.15.2
+MODULE_VERSION = 6.0.0
diff --git a/coin/product_dependencies.yaml b/coin/product_dependencies.yaml
new file mode 100644
index 000000000..c248d7b6b
--- /dev/null
+++ b/coin/product_dependencies.yaml
@@ -0,0 +1,3 @@
+dependencies:
+ ../qt5.git:
+ ref: "6.0"
diff --git a/coin/qt-installer-package-config.json b/coin/qt-installer-package-config.json
index 8507c9ec9..0ba69adac 100644
--- a/coin/qt-installer-package-config.json
+++ b/coin/qt-installer-package-config.json
@@ -9,7 +9,9 @@
"**/lib/pkgconfig/Qt5Pdf*",
"**/lib/libQt5Pdf*",
"**/lib/static_chrome/*",
+ "**/lib/QtPdf.framework/*",
"**/mkspecs/modules/qt_lib_pdf*",
+ "**/mkspecs/modules/qt_plugin_qpdf.pri",
"**/plugins/imageformats/*",
"**/qml/QtQuick/**/*"
]
diff --git a/configure.pri b/configure.pri
index d3ba9b147..87dc4d8d0 100644
--- a/configure.pri
+++ b/configure.pri
@@ -158,27 +158,23 @@ defineTest(qtConfTest_detectFlex) {
}
defineTest(qtConfTest_detectNinja) {
- ninja = $$qtConfFindInPath("ninja$$EXE_SUFFIX")
+ ninja = $$qtConfFindInPath($$(NINJA) "ninja$$EXE_SUFFIX")
!isEmpty(ninja) {
qtLog("Found ninja from path: $$ninja")
qtRunLoggedCommand("$$ninja --version", version)|return(false)
- contains(version, "1\.([7-9]|1[0-9])\..*"): return(true)
+ contains(version, "1\.([7-9]|1[0-9])\..*") {
+ $${1}.path = $$ninja
+ export($${1}.path)
+ $${1}.cache += path
+ export($${1}.cache)
+ return(true)
+ }
qtLog("Ninja version too old")
}
qtLog("Building own ninja")
return(false)
}
-defineTest(qtConfTest_detectProtoc) {
- protoc = $$qtConfFindInPath("protoc")
- isEmpty(protoc) {
- qtLog("Optional protoc could not be found.")
- return(false)
- }
- qtLog("Found protoc from path: $$protoc")
- return(true)
-}
-
defineTest(qtConfTest_detectGn) {
gn = $$qtConfFindInPath("gn$$EXE_SUFFIX")
!isEmpty(gn) {
@@ -201,6 +197,19 @@ defineTest(qtConfTest_detectNodeJS) {
return(false)
}
}
+ nodejs = $$system_quote($$system_path($$nodejs))
+ !qtRunLoggedCommand("$$nodejs --version", version) {
+ qtLog("'$$nodejs' didn't run.")
+ return(false)
+ }
+ # at least version 10
+ version10 = false
+ contains(version, "v([1-9][0-9])\..*"): version10 = true
+
+ $${1}.version10 = $$version10
+ export($${1}.version10)
+ $${1}.cache += version10
+ export($${1}.cache)
return(true)
}
@@ -430,8 +439,8 @@ defineTest(qtwebengine_isWindowsPlatformSupported) {
qtwebengine_platformError("requires MSVC or Clang (MSVC mode).")
return(false)
}
- !qtwebengine_isMinWinSDKVersion(10, 18362): {
- qtwebengine_platformError("requires a Windows SDK version 10.0.18362 or newer.")
+ !qtwebengine_isMinWinSDKVersion(10, 19041): {
+ qtwebengine_platformError("requires a Windows SDK version 10.0.19041 or newer.")
return(false)
}
return(true)
@@ -461,10 +470,17 @@ defineTest(qtwebengine_isMacOsPlatformSupported) {
defineTest(qtwebengine_isGCCVersionSupported) {
# Keep in sync with src/webengine/doc/src/qtwebengine-platform-notes.qdoc
- greaterThan(QMAKE_GCC_MAJOR_VERSION, 4):return(true)
+ lessThan(QMAKE_GCC_MAJOR_VERSION, 5) {
+ qtwebengine_platformError("requires at least gcc version 5, but using gcc version $${QMAKE_GCC_MAJOR_VERSION}.$${QMAKE_GCC_MINOR_VERSION}.")
+ return(false)
+ }
- qtwebengine_platformError("requires at least gcc version 5, but using gcc version $${QMAKE_GCC_MAJOR_VERSION}.$${QMAKE_GCC_MINOR_VERSION}.")
- return(false)
+ equals(QMAKE_GCC_MAJOR_VERSION, 5): equals(QMAKE_GCC_MINOR_VERSION, 4): equals(QMAKE_GCC_PATCH_VERSION, 0) {
+ qtwebengine_platformError("gcc version 5.4.0 is blacklisted due to internal compiler errors.")
+ return(false)
+ }
+
+ return(true)
}
defineTest(qtwebengine_isBuildingOnWin32) {
diff --git a/dependencies.yaml b/dependencies.yaml
new file mode 100644
index 000000000..43ad31057
--- /dev/null
+++ b/dependencies.yaml
@@ -0,0 +1,19 @@
+dependencies:
+ ../qtdeclarative:
+ ref: fa87052d56526e1529e694fb1c69c69eec38f2fd
+ required: true
+# ../qtlocation:
+# ref: a8793c6d9695498b3a53793f21859421262b4541
+# required: false
+# ../qtquickcontrols:
+# ref: 59749d56d666a6687fcedc2f7892080467db8574
+# required: false
+ ../qtquickcontrols2:
+ ref: 9a19ec26f45e7382431f52136f03887cfaa04b66
+ required: false
+ ../qttools:
+ ref: 3fd594493c3ba31639a7515b901554456a90b4c7
+ required: false
+ ../qtwebchannel:
+ ref: 0e13bd10bc7f31b1540987faeb0e3c83668daa3e
+ required: false
diff --git a/dist/changes-5.12.10 b/dist/changes-5.12.10
new file mode 100644
index 000000000..3f706d6b1
--- /dev/null
+++ b/dist/changes-5.12.10
@@ -0,0 +1,91 @@
+Qt 5.12.10 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.12.9.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+ https://doc.qt.io/qt-5.12/index.html
+
+The Qt version 5.12 series is binary compatible with the 5.11.x series.
+Applications compiled for 5.11 will continue to run with 5.12.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+ https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* Library *
+****************************************************************************
+
+General
+-------
+
+ - [QTBUG-75391] Fix pasting Unicode characters copied from WebEngine on macOS
+ - [QTBUG-83710] Fix input of keys requiring AltGr on Windows
+ - [QTBUG-84337] Fixed GPU switching with CoreProfile on macOS (for e.g. AirPlay)
+ - [QTBUG-86018] Fixed build with Bison 3.7
+ - Fixed build with the linux-clang 10 spec
+
+Chromium
+--------
+
+ - Security fixes from Chromium up to version 86.0.4240.111, including:
+
+ - CVE-2020-6459
+ - CVE-2020-6462: Use after free in task scheduling
+ - CVE-2020-6470
+ - CVE-2020-6474
+ - CVE-2020-6481
+ - CVE-2020-6489
+ - CVE-2020-6490
+ - CVE-2020-6511: Side-channel information leakage in CSP
+ - CVE-2020-6512: Type Confusion in V8
+ - CVE-2020-6513: Heap buffer overflow in PDFium
+ - CVE-2020-6514: Inappropriate implementation in WebRTC
+ - CVE-2020-6518: Use after free in developer tools
+ - CVE-2020-6523: Out of bounds write in Skia
+ - CVE-2020-6524: Heap buffer overflow in WebAudio
+ - CVE-2020-6529: Inappropriate implementation in WebRTC
+ - CVE-2020-6532: Use after free in SCTP
+ - CVE-2020-6535: Insufficient data validation in WebUI
+ - CVE-2020-6534: Heap buffer overflow in WebRTC
+ - CVE-2020-6540: Heap buffer overflow in Skia
+ - CVE-2020-6541: Use after free in WebUSB
+ - CVE-2020-6542: Use after free in ANGLE
+ - CVE-2020-6543: Use after free in task scheduling
+ - CVE-2020-6544: Use after free in media
+ - CVE-2020-6545: Use after free in audio
+ - CVE-2020-6548: Heap buffer overflow in Skia
+ - CVE-2020-6549: Use after free in media
+ - CVE-2020-6559: Use after free in presentation API
+ - CVE-2020-6561: Inappropriate implementation in Content Security Policy
+ - CVE-2020-6562: Insufficient policy enforcement in Blink
+ - CVE-2020-6569: Integer overflow in WebUSB
+ - CVE-2020-6571: Incorrect security UI in Omnibox
+ - CVE-2020-6573: Use after free in video
+ - CVE-2020-15962: Insufficient policy enforcement in serial
+ - CVE-2020-15964: Insufficient data validation in media
+ - CVE-2020-15965: Out of bounds write in V8
+ - CVE-2020-15968: Use after free in Blink
+ - CVE-2020-15969: Use after free in WebRTC.
+ - CVE-2020-15999: Heap buffer overflow in freetype
+ - CVE-2020-16001: Use after free in media.
+ - CVE-2020-16002: Use after free in PDFium.
+ - CVE-2020-16003: Use after free in printing.
+ - Security Bug 1051439
+ - Security bug 1052492
+ - Security bug 1054229
+ - Security Bug 1057369
+ - Security Bug 1058515
+ - Security bug 1065122
+ - Security bug 1065731
+ - Security bugs 1087629 and 1029569
+ - Security issue 1098860
+ - Security issue 1102137
+ - Security bug 1102408
+ - Security bug 1111149
+
diff --git a/dist/changes-5.15.2 b/dist/changes-5.15.2
new file mode 100644
index 000000000..792b9afd6
--- /dev/null
+++ b/dist/changes-5.15.2
@@ -0,0 +1,86 @@
+Qt 5.15.2 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.15.1.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+ https://doc.qt.io/qt-5.15/index.html
+
+The Qt version 5.15 series is binary compatible with the 5.14.x series.
+Applications compiled for 5.14 will continue to run with 5.15.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+ https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* Library *
+****************************************************************************
+
+General
+-------
+ - [QTBUG-84632] Warn about QtWebengineProcess launching from network share
+ on Windows.
+ - [QTBUG-85363] Handle non-ASCII names for PulseAudio
+ - [QTBUG-85494] Fix regression crash when not handling QQuickWebEngineNewViewRequest
+ - [QTBUG-85817] Fix crashes on resize
+ - [QTBUG-86672] Fix remapped menu key being mapped back to menu key
+ - [QTBUG-86945] Fix crash when opening a PDF in debug build on windows.
+ - [QTBUG-87129] Mention node.js build-time dependency
+ - The QtWebEngineProcess now has a version number
+ - The old compositor has been removed and can no longer be restored using
+ command line argument.
+
+Chromium
+--------
+
+ - The Chromium version has been updated to 83.0.4103.122
+ - Security fixes from Chromium up to version 86.0.4240.183, including:
+ - CVE-2020-6540: Heap buffer overflow in Skia
+ - CVE-2020-6557: Inappropriate implementation in networking
+ - CVE-2020-6561: Inappropriate implementation in Content Security Policy
+ - CVE-2020-6562: Insufficient policy enforcement in Blink
+ - CVE-2020-6569: Integer overflow in WebUSB
+ - CVE-2020-6570: Side-channel information leakage in WebRTC
+ - CVE-2020-6573: Use after free in video
+ - CVE-2020-6571: Incorrect security UI in Omnibox
+ - CVE-2020-6575: Race in Mojo
+ - CVE-2020-6576: Use after free in offscreen canvas
+ - CVE-2020-15959: Insufficient policy enforcement in networking
+ - CVE-2020-15960: Out of bounds read in storage
+ - CVE-2020-15961: Insufficient policy enforcement in extensions
+ - CVE-2020-15962: Insufficient policy enforcement in serial
+ - CVE-2020-15963
+ - CVE-2020-15964: Insufficient data validation in media
+ - CVE-2020-15965: Out of bounds write in V8
+ - CVE-2020-15966
+ - CVE-2020-15968: Use after free in Blink
+ - CVE-2020-15969: Use after free in WebRTC.
+ - CVE-2020-15972: Use after free in audio.
+ - CVE-2020—15973: Insufficient policy enforcement in extensions
+ - CVE-2020-15974: Integer overflow in Blink
+ - CVE-2020-15976: Use after free in WebXR
+ - CVE-2020-15977: Insufficient data validation in dialogs.
+ - CVE-2020-15978: Insufficient data validation in navigation
+ - CVE-2020-15979: Inappropriate implementation in V8.
+ - CVE-2020-15985: Inappropriate implementation in Blink.
+ - CVE-2020-15987: Use after free in WebRTC
+ - CVE-2020-15989: Uninitialized Use in PDFium
+ - CVE-2020-15992: Insufficient policy enforcement in networking
+ - CVE-2020-15999: Heap buffer overflow in freetype
+ - CVE-2020-16001: Use after free in media.
+ - CVE-2020-16002: Use after free in PDFium
+ - CVE-2020-16003: Use after free in printing
+ - CVE-2020-16005: Insufficient policy enforcement in ANGLE
+ - CVE-2020-16008: Stack buffer overflow in WebRTC
+ - CVE-2020-16009: Inappropriate implementation in V8
+ - CVE-2020-16011: Heap buffer overflow in UI on Windows.
+ - Security bug 1106091
+ - Security bug 1107824
+ - Security bug 1111149
+ - Security bug 1125199
+ - Security bug 1137608
diff --git a/examples/examples.pro b/examples/examples.pro
index c62d7c04d..a0245a869 100644
--- a/examples/examples.pro
+++ b/examples/examples.pro
@@ -20,6 +20,6 @@ qtConfig(build-qtwebengine-core):qtConfig(webengine-core-support) {
}
qtConfig(build-qtpdf):qtConfig(webengine-qtpdf-support) {
- SUDIRS += pdf
+ SUBDIRS += pdf
qtConfig(pdf-widgets): SUBDIRS += pdfwidgets
}
diff --git a/examples/pdf/multipage/main.cpp b/examples/pdf/multipage/main.cpp
index 35aaa8c64..446b2999b 100644
--- a/examples/pdf/multipage/main.cpp
+++ b/examples/pdf/multipage/main.cpp
@@ -48,7 +48,7 @@
**
****************************************************************************/
-#include <QApplication>
+#include <QGuiApplication>
#include <QQmlApplicationEngine>
int main(int argc, char* argv[])
@@ -57,7 +57,7 @@ int main(int argc, char* argv[])
QCoreApplication::setOrganizationName("QtProject");
QCoreApplication::setApplicationVersion(QT_VERSION_STR);
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
- QApplication app(argc, argv);
+ QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:///pdfviewer/viewer.qml")));
diff --git a/examples/pdf/multipage/multipage.pro b/examples/pdf/multipage/multipage.pro
index 5df9e653d..bd08ba0de 100644
--- a/examples/pdf/multipage/multipage.pro
+++ b/examples/pdf/multipage/multipage.pro
@@ -1,6 +1,6 @@
TEMPLATE = app
-QT += qml quick pdf widgets svg
+QT += qml quick pdf svg
SOURCES += main.cpp
diff --git a/examples/pdf/pdf.pro b/examples/pdf/pdf.pro
index 7130f3560..0ae198ee7 100644
--- a/examples/pdf/pdf.pro
+++ b/examples/pdf/pdf.pro
@@ -1,3 +1,3 @@
TEMPLATE=subdirs
-SUBDIRS += pdfviewer multipage
+qtHaveModule(svg): SUBDIRS += pdfviewer multipage
diff --git a/examples/pdf/pdfviewer/main.cpp b/examples/pdf/pdfviewer/main.cpp
index 5f65e3061..13db2b88a 100644
--- a/examples/pdf/pdfviewer/main.cpp
+++ b/examples/pdf/pdfviewer/main.cpp
@@ -48,7 +48,7 @@
**
****************************************************************************/
-#include <QApplication>
+#include <QGuiApplication>
#include <QQmlApplicationEngine>
int main(int argc, char* argv[])
@@ -57,7 +57,7 @@ int main(int argc, char* argv[])
QCoreApplication::setOrganizationName("QtProject");
QCoreApplication::setApplicationVersion(QT_VERSION_STR);
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
- QApplication app(argc, argv);
+ QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:///pdfviewer/viewer.qml")));
diff --git a/examples/pdf/pdfviewer/pdfviewer.pro b/examples/pdf/pdfviewer/pdfviewer.pro
index b8817c9be..a1c578efc 100644
--- a/examples/pdf/pdfviewer/pdfviewer.pro
+++ b/examples/pdf/pdfviewer/pdfviewer.pro
@@ -1,6 +1,6 @@
TEMPLATE = app
-QT += qml quick pdf widgets svg
+QT += qml quick pdf svg
SOURCES += main.cpp
diff --git a/examples/pdfwidgets/pdfviewer/zoomselector.cpp b/examples/pdfwidgets/pdfviewer/zoomselector.cpp
index 0205489aa..a4d596ab7 100644
--- a/examples/pdfwidgets/pdfviewer/zoomselector.cpp
+++ b/examples/pdfwidgets/pdfviewer/zoomselector.cpp
@@ -57,7 +57,7 @@ ZoomSelector::ZoomSelector(QWidget *parent)
addItem(QLatin1String("200%"));
addItem(QLatin1String("400%"));
- connect(this, static_cast<void(QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
+ connect(this, &QComboBox::currentTextChanged,
this, &ZoomSelector::onCurrentTextChanged);
connect(lineEdit(), &QLineEdit::editingFinished,
diff --git a/examples/webenginewidgets/cookiebrowser/mainwindow.cpp b/examples/webenginewidgets/cookiebrowser/mainwindow.cpp
index 970381d4d..66e6988d8 100644
--- a/examples/webenginewidgets/cookiebrowser/mainwindow.cpp
+++ b/examples/webenginewidgets/cookiebrowser/mainwindow.cpp
@@ -87,7 +87,7 @@ QNetworkCookie CookieDialog::cookie()
cookie.setDomain(m_domainLineEdit->text());
cookie.setName(m_nameLineEdit->text().toLatin1());
cookie.setValue(m_valueLineEdit->text().toLatin1());
- cookie.setExpirationDate(QDateTime(m_dateEdit->date()));
+ cookie.setExpirationDate(QDateTime(m_dateEdit->date(), QTime::currentTime()));
cookie.setPath(m_pathLineEdit->text());
cookie.setSecure(m_isSecureComboBox->currentText() == tr("yes"));
cookie.setHttpOnly(m_isHttpOnlyComboBox->currentText() == tr("yes"));
diff --git a/examples/webenginewidgets/cookiebrowser/mainwindow.h b/examples/webenginewidgets/cookiebrowser/mainwindow.h
index 643ff9322..b6aee1c24 100644
--- a/examples/webenginewidgets/cookiebrowser/mainwindow.h
+++ b/examples/webenginewidgets/cookiebrowser/mainwindow.h
@@ -98,7 +98,7 @@ private slots:
private:
QWebEngineCookieStore *m_store;
- QVector<QNetworkCookie> m_cookies;
+ QList<QNetworkCookie> m_cookies;
QVBoxLayout *m_layout;
};
diff --git a/examples/webenginewidgets/printme/main.cpp b/examples/webenginewidgets/printme/main.cpp
index e4d6d9dc8..3993c6740 100644
--- a/examples/webenginewidgets/printme/main.cpp
+++ b/examples/webenginewidgets/printme/main.cpp
@@ -64,10 +64,10 @@ int main(int argc, char *argv[])
view.show();
PrintHandler handler;
- handler.setPage(view.page());
+ handler.setView(&view);
- auto printPreviewShortCut = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_P), &view);
- auto printShortCut = new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_P), &view);
+ auto printPreviewShortCut = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_P), &view);
+ auto printShortCut = new QShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_P), &view);
QObject::connect(printPreviewShortCut, &QShortcut::activated, &handler, &PrintHandler::printPreview);
QObject::connect(printShortCut, &QShortcut::activated, &handler, &PrintHandler::print);
diff --git a/examples/webenginewidgets/printme/printhandler.cpp b/examples/webenginewidgets/printme/printhandler.cpp
index d8c4fc177..9d23c5b1f 100644
--- a/examples/webenginewidgets/printme/printhandler.cpp
+++ b/examples/webenginewidgets/printme/printhandler.cpp
@@ -54,7 +54,7 @@
#include <QPrinter>
#include <QPainter>
#include <QPrintPreviewDialog>
-#include <QWebEnginePage>
+#include <QWebEngineView>
PrintHandler::PrintHandler(QObject *parent)
: QObject(parent)
@@ -62,17 +62,17 @@ PrintHandler::PrintHandler(QObject *parent)
}
-void PrintHandler::setPage(QWebEnginePage *page)
+void PrintHandler::setView(QWebEngineView *view)
{
- Q_ASSERT(!m_page);
- m_page = page;
- connect(m_page, &QWebEnginePage::printRequested, this, &PrintHandler::printPreview);
+ Q_ASSERT(!m_view);
+ m_view = view;
+ connect(view->page(), &QWebEnginePage::printRequested, this, &PrintHandler::printPreview);
}
void PrintHandler::print()
{
QPrinter printer(QPrinter::HighResolution);
- QPrintDialog dialog(&printer, m_page->view());
+ QPrintDialog dialog(&printer, m_view);
if (dialog.exec() != QDialog::Accepted)
return;
printDocument(&printer);
@@ -83,7 +83,7 @@ void PrintHandler::printDocument(QPrinter *printer)
QEventLoop loop;
bool result;
auto printPreview = [&](bool success) { result = success; loop.quit(); };
- m_page->print(printer, std::move(printPreview));
+ m_view->page()->print(printer, std::move(printPreview));
loop.exec();
if (!result) {
QPainter painter;
@@ -101,13 +101,13 @@ void PrintHandler::printDocument(QPrinter *printer)
void PrintHandler::printPreview()
{
- if (!m_page)
+ if (!m_view)
return;
if (m_inPrintPreview)
return;
m_inPrintPreview = true;
QPrinter printer;
- QPrintPreviewDialog preview(&printer, m_page->view());
+ QPrintPreviewDialog preview(&printer, m_view);
connect(&preview, &QPrintPreviewDialog::paintRequested,
this, &PrintHandler::printDocument);
preview.exec();
diff --git a/examples/webenginewidgets/printme/printhandler.h b/examples/webenginewidgets/printme/printhandler.h
index 69b71f4a8..663fd73d6 100644
--- a/examples/webenginewidgets/printme/printhandler.h
+++ b/examples/webenginewidgets/printme/printhandler.h
@@ -56,7 +56,7 @@
QT_BEGIN_NAMESPACE
class QPainter;
class QPrinter;
-class QWebEnginePage;
+class QWebEngineView;
QT_END_NAMESPACE
class PrintHandler : public QObject
@@ -64,7 +64,7 @@ class PrintHandler : public QObject
Q_OBJECT
public:
PrintHandler(QObject *parent = nullptr);
- void setPage(QWebEnginePage *page);
+ void setView(QWebEngineView *view);
public slots:
void print();
@@ -72,7 +72,7 @@ public slots:
void printDocument(QPrinter *printer);
private:
- QWebEnginePage *m_page = nullptr;
+ QWebEngineView *m_view = nullptr;
bool m_inPrintPreview = false;
};
diff --git a/examples/webenginewidgets/simplebrowser/browser.h b/examples/webenginewidgets/simplebrowser/browser.h
index 4c17121df..cb84ea670 100644
--- a/examples/webenginewidgets/simplebrowser/browser.h
+++ b/examples/webenginewidgets/simplebrowser/browser.h
@@ -53,7 +53,7 @@
#include "downloadmanagerwidget.h"
-#include <QVector>
+#include <QList>
#include <QWebEngineProfile>
class BrowserWindow;
@@ -63,7 +63,7 @@ class Browser
public:
Browser();
- QVector<BrowserWindow*> windows() { return m_windows; }
+ QList<BrowserWindow*> windows() { return m_windows; }
BrowserWindow *createWindow(bool offTheRecord = false);
BrowserWindow *createDevToolsWindow();
@@ -71,7 +71,7 @@ public:
DownloadManagerWidget &downloadManagerWidget() { return m_downloadManagerWidget; }
private:
- QVector<BrowserWindow*> m_windows;
+ QList<BrowserWindow*> m_windows;
DownloadManagerWidget m_downloadManagerWidget;
QScopedPointer<QWebEngineProfile> m_otrProfile;
};
diff --git a/examples/webenginewidgets/simplebrowser/browserwindow.cpp b/examples/webenginewidgets/simplebrowser/browserwindow.cpp
index 12a1e6844..26639117c 100644
--- a/examples/webenginewidgets/simplebrowser/browserwindow.cpp
+++ b/examples/webenginewidgets/simplebrowser/browserwindow.cpp
@@ -55,7 +55,6 @@
#include "webview.h"
#include <QApplication>
#include <QCloseEvent>
-#include <QDesktopWidget>
#include <QEvent>
#include <QFileDialog>
#include <QInputDialog>
@@ -66,9 +65,7 @@
#include <QStatusBar>
#include <QToolBar>
#include <QVBoxLayout>
-#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
#include <QWebEngineFindTextResult>
-#endif
#include <QWebEngineProfile>
BrowserWindow::BrowserWindow(Browser *browser, QWebEngineProfile *profile, bool forDevTools)
@@ -132,9 +129,7 @@ BrowserWindow::BrowserWindow(Browser *browser, QWebEngineProfile *profile, bool
connect(m_urlLineEdit, &QLineEdit::returnPressed, [this]() {
m_tabWidget->setUrl(QUrl::fromUserInput(m_urlLineEdit->text()));
});
-#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
connect(m_tabWidget, &TabWidget::findTextFinished, this, &BrowserWindow::handleFindTextFinished);
-#endif
QAction *focusUrlLineEditAction = new QAction(this);
addAction(focusUrlLineEditAction);
@@ -316,7 +311,7 @@ QMenu *BrowserWindow::createWindowMenu(TabWidget *tabWidget)
menu->addAction(previousTabAction);
menu->addSeparator();
- QVector<BrowserWindow*> windows = m_browser->windows();
+ QList<BrowserWindow*> windows = m_browser->windows();
int index(-1);
for (auto window : windows) {
QAction *action = menu->addAction(window->windowTitle(), this, &BrowserWindow::handleShowWindowTriggered);
@@ -346,7 +341,7 @@ QToolBar *BrowserWindow::createToolBar()
QList<QKeySequence> backShortcuts = QKeySequence::keyBindings(QKeySequence::Back);
for (auto it = backShortcuts.begin(); it != backShortcuts.end();) {
// Chromium already handles navigate on backspace when appropriate.
- if ((*it)[0] == Qt::Key_Backspace)
+ if ((*it)[0].key() == Qt::Key_Backspace)
it = backShortcuts.erase(it);
else
++it;
@@ -365,7 +360,7 @@ QToolBar *BrowserWindow::createToolBar()
m_historyForwardAction = new QAction(this);
QList<QKeySequence> fwdShortcuts = QKeySequence::keyBindings(QKeySequence::Forward);
for (auto it = fwdShortcuts.begin(); it != fwdShortcuts.end();) {
- if (((*it)[0] & Qt::Key_unknown) == Qt::Key_Backspace)
+ if (((*it)[0].key() & Qt::Key_unknown) == Qt::Key_Backspace)
it = fwdShortcuts.erase(it);
else
++it;
@@ -466,14 +461,7 @@ void BrowserWindow::handleFindActionTriggered()
m_lastSearch, &ok);
if (ok && !search.isEmpty()) {
m_lastSearch = search;
-#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
currentTab()->findText(m_lastSearch);
-#else
- currentTab()->findText(m_lastSearch, 0, [this](bool found) {
- if (!found)
- statusBar()->showMessage(tr("\"%1\" not found.").arg(m_lastSearch));
- });
-#endif
}
}
@@ -525,7 +513,7 @@ void BrowserWindow::handleShowWindowTriggered()
{
if (QAction *action = qobject_cast<QAction*>(sender())) {
int offset = action->data().toInt();
- QVector<BrowserWindow*> windows = m_browser->windows();
+ QList<BrowserWindow*> windows = m_browser->windows();
windows.at(offset)->activateWindow();
windows.at(offset)->currentTab()->setFocus();
}
@@ -537,7 +525,6 @@ void BrowserWindow::handleDevToolsRequested(QWebEnginePage *source)
source->triggerAction(QWebEnginePage::InspectElement);
}
-#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
void BrowserWindow::handleFindTextFinished(const QWebEngineFindTextResult &result)
{
if (result.numberOfMatches() == 0) {
@@ -548,4 +535,3 @@ void BrowserWindow::handleFindTextFinished(const QWebEngineFindTextResult &resul
QString::number(result.numberOfMatches())));
}
}
-#endif
diff --git a/examples/webenginewidgets/simplebrowser/browserwindow.h b/examples/webenginewidgets/simplebrowser/browserwindow.h
index ea12ad9df..11a655469 100644
--- a/examples/webenginewidgets/simplebrowser/browserwindow.h
+++ b/examples/webenginewidgets/simplebrowser/browserwindow.h
@@ -88,9 +88,7 @@ private slots:
void handleWebViewTitleChanged(const QString &title);
void handleWebActionEnabledChanged(QWebEnginePage::WebAction action, bool enabled);
void handleDevToolsRequested(QWebEnginePage *source);
-#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
void handleFindTextFinished(const QWebEngineFindTextResult &result);
-#endif
private:
QMenu *createFileMenu(TabWidget *tabWidget);
diff --git a/examples/webenginewidgets/simplebrowser/doc/src/simplebrowser.qdoc b/examples/webenginewidgets/simplebrowser/doc/src/simplebrowser.qdoc
index 251ca5ad8..2bbe3fe33 100644
--- a/examples/webenginewidgets/simplebrowser/doc/src/simplebrowser.qdoc
+++ b/examples/webenginewidgets/simplebrowser/doc/src/simplebrowser.qdoc
@@ -314,7 +314,7 @@
Downloads are associated with a \l QWebEngineProfile. Whenever a download is
triggered on a web page the \l QWebEngineProfile::downloadRequested signal is
- emitted with a \l QWebEngineDownloadItem, which in this example is forwarded
+ emitted with a \l QWebEngineDownloadRequest, which in this example is forwarded
to \c DownloadManagerWidget::downloadRequested:
\quotefromfile webenginewidgets/simplebrowser/browser.cpp
@@ -329,10 +329,10 @@
\skipto DownloadManagerWidget::downloadRequested
\printuntil /^\}/
- The \l QWebEngineDownloadItem object will periodically emit the \l
- {QWebEngineDownloadItem::}{downloadProgress} signal to notify potential
+ The \l QWebEngineDownloadRequest object will periodically emit the \l
+ {QWebEngineDownloadRequest::}{downloadProgress} signal to notify potential
observers of the download progress and the \l
- {QWebEngineDownloadItem::}{stateChanged} signal when the download is
+ {QWebEngineDownloadRequest::}{stateChanged} signal when the download is
finished or when an error occurs. See \c downloadmanagerwidget.cpp for an
example of how these signals can be handled.
diff --git a/examples/webenginewidgets/simplebrowser/downloadmanagerwidget.cpp b/examples/webenginewidgets/simplebrowser/downloadmanagerwidget.cpp
index 2c8831429..cdd3a414a 100644
--- a/examples/webenginewidgets/simplebrowser/downloadmanagerwidget.cpp
+++ b/examples/webenginewidgets/simplebrowser/downloadmanagerwidget.cpp
@@ -56,7 +56,7 @@
#include <QFileDialog>
#include <QDir>
-#include <QWebEngineDownloadItem>
+#include <QWebEngineDownloadRequest>
DownloadManagerWidget::DownloadManagerWidget(QWidget *parent)
: QWidget(parent)
@@ -65,24 +65,16 @@ DownloadManagerWidget::DownloadManagerWidget(QWidget *parent)
setupUi(this);
}
-void DownloadManagerWidget::downloadRequested(QWebEngineDownloadItem *download)
+void DownloadManagerWidget::downloadRequested(QWebEngineDownloadRequest *download)
{
- Q_ASSERT(download && download->state() == QWebEngineDownloadItem::DownloadRequested);
+ Q_ASSERT(download && download->state() == QWebEngineDownloadRequest::DownloadRequested);
-#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QString path = QFileDialog::getSaveFileName(this, tr("Save as"), QDir(download->downloadDirectory()).filePath(download->downloadFileName()));
-#else
- QString path = QFileDialog::getSaveFileName(this, tr("Save as"), download->path());
-#endif
if (path.isEmpty())
return;
-#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
download->setDownloadDirectory(QFileInfo(path).path());
download->setDownloadFileName(QFileInfo(path).fileName());
-#else
- download->setPath(path);
-#endif
download->accept();
add(new DownloadWidget(download));
diff --git a/examples/webenginewidgets/simplebrowser/downloadmanagerwidget.h b/examples/webenginewidgets/simplebrowser/downloadmanagerwidget.h
index 7be9d8102..221cd261f 100644
--- a/examples/webenginewidgets/simplebrowser/downloadmanagerwidget.h
+++ b/examples/webenginewidgets/simplebrowser/downloadmanagerwidget.h
@@ -56,7 +56,7 @@
#include <QWidget>
QT_BEGIN_NAMESPACE
-class QWebEngineDownloadItem;
+class QWebEngineDownloadRequest;
QT_END_NAMESPACE
class DownloadWidget;
@@ -69,9 +69,9 @@ public:
explicit DownloadManagerWidget(QWidget *parent = nullptr);
// Prompts user with a "Save As" dialog. If the user doesn't cancel it, then
- // the QWebEngineDownloadItem will be accepted and the DownloadManagerWidget
+ // the QWebEngineDownloadRequest will be accepted and the DownloadManagerWidget
// will be shown on the screen.
- void downloadRequested(QWebEngineDownloadItem *webItem);
+ void downloadRequested(QWebEngineDownloadRequest *webItem);
private:
void add(DownloadWidget *downloadWidget);
diff --git a/examples/webenginewidgets/simplebrowser/downloadwidget.cpp b/examples/webenginewidgets/simplebrowser/downloadwidget.cpp
index c4e3cd805..e9caa8658 100644
--- a/examples/webenginewidgets/simplebrowser/downloadwidget.cpp
+++ b/examples/webenginewidgets/simplebrowser/downloadwidget.cpp
@@ -52,34 +52,30 @@
#include <QFileInfo>
#include <QUrl>
-#include <QWebEngineDownloadItem>
+#include <QWebEngineDownloadRequest>
-DownloadWidget::DownloadWidget(QWebEngineDownloadItem *download, QWidget *parent)
+DownloadWidget::DownloadWidget(QWebEngineDownloadRequest *download, QWidget *parent)
: QFrame(parent)
, m_download(download)
, m_timeAdded()
{
m_timeAdded.start();
setupUi(this);
-#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
m_dstName->setText(m_download->downloadFileName());
-#else
- m_dstName->setText(QFileInfo(m_download->path()).fileName());
-#endif
m_srcUrl->setText(m_download->url().toDisplayString());
connect(m_cancelButton, &QPushButton::clicked,
[this](bool) {
- if (m_download->state() == QWebEngineDownloadItem::DownloadInProgress)
+ if (m_download->state() == QWebEngineDownloadRequest::DownloadInProgress)
m_download->cancel();
else
emit removeClicked(this);
});
- connect(m_download, &QWebEngineDownloadItem::downloadProgress,
+ connect(m_download, &QWebEngineDownloadRequest::downloadProgress,
this, &DownloadWidget::updateWidget);
- connect(m_download, &QWebEngineDownloadItem::stateChanged,
+ connect(m_download, &QWebEngineDownloadRequest::stateChanged,
this, &DownloadWidget::updateWidget);
updateWidget();
@@ -105,10 +101,10 @@ void DownloadWidget::updateWidget()
auto state = m_download->state();
switch (state) {
- case QWebEngineDownloadItem::DownloadRequested:
+ case QWebEngineDownloadRequest::DownloadRequested:
Q_UNREACHABLE();
break;
- case QWebEngineDownloadItem::DownloadInProgress:
+ case QWebEngineDownloadRequest::DownloadInProgress:
if (totalBytes >= 0) {
m_progressBar->setValue(qRound(100 * receivedBytes / totalBytes));
m_progressBar->setDisabled(false);
@@ -126,7 +122,7 @@ void DownloadWidget::updateWidget()
.arg(withUnit(bytesPerSecond)));
}
break;
- case QWebEngineDownloadItem::DownloadCompleted:
+ case QWebEngineDownloadRequest::DownloadCompleted:
m_progressBar->setValue(100);
m_progressBar->setDisabled(true);
m_progressBar->setFormat(
@@ -134,7 +130,7 @@ void DownloadWidget::updateWidget()
.arg(withUnit(receivedBytes))
.arg(withUnit(bytesPerSecond)));
break;
- case QWebEngineDownloadItem::DownloadCancelled:
+ case QWebEngineDownloadRequest::DownloadCancelled:
m_progressBar->setValue(0);
m_progressBar->setDisabled(true);
m_progressBar->setFormat(
@@ -142,7 +138,7 @@ void DownloadWidget::updateWidget()
.arg(withUnit(receivedBytes))
.arg(withUnit(bytesPerSecond)));
break;
- case QWebEngineDownloadItem::DownloadInterrupted:
+ case QWebEngineDownloadRequest::DownloadInterrupted:
m_progressBar->setValue(0);
m_progressBar->setDisabled(true);
m_progressBar->setFormat(
@@ -151,7 +147,7 @@ void DownloadWidget::updateWidget()
break;
}
- if (state == QWebEngineDownloadItem::DownloadInProgress) {
+ if (state == QWebEngineDownloadRequest::DownloadInProgress) {
static QIcon cancelIcon(QStringLiteral(":process-stop.png"));
m_cancelButton->setIcon(cancelIcon);
m_cancelButton->setToolTip(tr("Stop downloading"));
diff --git a/examples/webenginewidgets/simplebrowser/downloadwidget.h b/examples/webenginewidgets/simplebrowser/downloadwidget.h
index c20676aa6..c59b1b4b7 100644
--- a/examples/webenginewidgets/simplebrowser/downloadwidget.h
+++ b/examples/webenginewidgets/simplebrowser/downloadwidget.h
@@ -57,16 +57,16 @@
#include <QElapsedTimer>
QT_BEGIN_NAMESPACE
-class QWebEngineDownloadItem;
+class QWebEngineDownloadRequest;
QT_END_NAMESPACE
-// Displays one ongoing or finished download (QWebEngineDownloadItem).
+// Displays one ongoing or finished download (QWebEngineDownloadRequest).
class DownloadWidget final : public QFrame, public Ui::DownloadWidget
{
Q_OBJECT
public:
- // Precondition: The QWebEngineDownloadItem has been accepted.
- explicit DownloadWidget(QWebEngineDownloadItem *download, QWidget *parent = nullptr);
+ // Precondition: The QWebEngineDownloadRequest has been accepted.
+ explicit DownloadWidget(QWebEngineDownloadRequest *download, QWidget *parent = nullptr);
signals:
// This signal is emitted when the user indicates that they want to remove
@@ -79,7 +79,7 @@ private slots:
private:
QString withUnit(qreal bytes);
- QWebEngineDownloadItem *m_download;
+ QWebEngineDownloadRequest *m_download;
QElapsedTimer m_timeAdded;
};
diff --git a/examples/webenginewidgets/simplebrowser/main.cpp b/examples/webenginewidgets/simplebrowser/main.cpp
index ddc8b4d01..543742b33 100644
--- a/examples/webenginewidgets/simplebrowser/main.cpp
+++ b/examples/webenginewidgets/simplebrowser/main.cpp
@@ -74,11 +74,9 @@ int main(int argc, char **argv)
QApplication app(argc, argv);
app.setWindowIcon(QIcon(QStringLiteral(":AppLogoColor.png")));
- QWebEngineSettings::defaultSettings()->setAttribute(QWebEngineSettings::PluginsEnabled, true);
-#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
- QWebEngineSettings::defaultSettings()->setAttribute(QWebEngineSettings::DnsPrefetchEnabled, true);
+ QWebEngineProfile::defaultProfile()->settings()->setAttribute(QWebEngineSettings::PluginsEnabled, true);
+ QWebEngineProfile::defaultProfile()->settings()->setAttribute(QWebEngineSettings::DnsPrefetchEnabled, true);
QWebEngineProfile::defaultProfile()->setUseForGlobalCertificateVerification();
-#endif
QUrl url = commandLineUrlArgument();
diff --git a/examples/webenginewidgets/simplebrowser/tabwidget.cpp b/examples/webenginewidgets/simplebrowser/tabwidget.cpp
index d7a69e61f..e5a3d4d28 100644
--- a/examples/webenginewidgets/simplebrowser/tabwidget.cpp
+++ b/examples/webenginewidgets/simplebrowser/tabwidget.cpp
@@ -82,7 +82,7 @@ TabWidget::TabWidget(QWebEngineProfile *profile, QWidget *parent)
QPixmap pixmap(QStringLiteral(":ninja.png"));
icon->setPixmap(pixmap.scaledToHeight(tabBar->height()));
setStyleSheet(QStringLiteral("QTabWidget::tab-bar { left: %1px; }").
- arg(icon->pixmap()->width()));
+ arg(icon->pixmap().width()));
}
}
@@ -200,12 +200,10 @@ void TabWidget::setupView(WebView *webView)
closeTab(index);
});
connect(webView, &WebView::devToolsRequested, this, &TabWidget::devToolsRequested);
-#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
connect(webPage, &QWebEnginePage::findTextFinished, [this, webView](const QWebEngineFindTextResult &result) {
if (currentIndex() == indexOf(webView))
emit findTextFinished(result);
});
-#endif
}
WebView *TabWidget::createTab()
diff --git a/examples/webenginewidgets/simplebrowser/tabwidget.h b/examples/webenginewidgets/simplebrowser/tabwidget.h
index bf65c9505..06f3db829 100644
--- a/examples/webenginewidgets/simplebrowser/tabwidget.h
+++ b/examples/webenginewidgets/simplebrowser/tabwidget.h
@@ -52,6 +52,7 @@
#define TABWIDGET_H
#include <QTabWidget>
+#include <QWebEngineFindTextResult>
#include <QWebEnginePage>
QT_BEGIN_NAMESPACE
@@ -78,9 +79,7 @@ signals:
void favIconChanged(const QIcon &icon);
void webActionEnabledChanged(QWebEnginePage::WebAction action, bool enabled);
void devToolsRequested(QWebEnginePage *source);
-#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
void findTextFinished(const QWebEngineFindTextResult &result);
-#endif
public slots:
// current tab/page slots
diff --git a/examples/webenginewidgets/simplebrowser/webpage.cpp b/examples/webenginewidgets/simplebrowser/webpage.cpp
index 9f7038cdb..4db147526 100644
--- a/examples/webenginewidgets/simplebrowser/webpage.cpp
+++ b/examples/webenginewidgets/simplebrowser/webpage.cpp
@@ -50,98 +50,22 @@
#include "browserwindow.h"
#include "tabwidget.h"
-#include "ui_certificateerrordialog.h"
-#include "ui_passworddialog.h"
+
#include "webpage.h"
#include "webview.h"
-#include <QAuthenticator>
-#include <QMessageBox>
-#include <QStyle>
#include <QTimer>
-#include <QWebEngineCertificateError>
WebPage::WebPage(QWebEngineProfile *profile, QObject *parent)
: QWebEnginePage(profile, parent)
{
- connect(this, &QWebEnginePage::authenticationRequired, this, &WebPage::handleAuthenticationRequired);
- connect(this, &QWebEnginePage::featurePermissionRequested, this, &WebPage::handleFeaturePermissionRequested);
- connect(this, &QWebEnginePage::proxyAuthenticationRequired, this, &WebPage::handleProxyAuthenticationRequired);
- connect(this, &QWebEnginePage::registerProtocolHandlerRequested, this, &WebPage::handleRegisterProtocolHandlerRequested);
-#if !defined(QT_NO_SSL) || QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
connect(this, &QWebEnginePage::selectClientCertificate, this, &WebPage::handleSelectClientCertificate);
-#endif
}
-bool WebPage::certificateError(const QWebEngineCertificateError &error)
+void WebPage::certificateError(QWebEngineCertificateError error)
{
- QWidget *mainWindow = view()->window();
-
-#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
- QWebEngineCertificateError deferredError = error;
- deferredError.defer();
-
- QTimer::singleShot(0, mainWindow, [mainWindow, error = std::move(deferredError)] () mutable {
- if (!error.deferred()) {
- QMessageBox::critical(mainWindow, tr("Certificate Error"), error.errorDescription());
- } else {
-#else
- if (error.isOverridable()) {
-#endif
- QDialog dialog(mainWindow);
- dialog.setModal(true);
- dialog.setWindowFlags(dialog.windowFlags() & ~Qt::WindowContextHelpButtonHint);
-
- Ui::CertificateErrorDialog certificateDialog;
- certificateDialog.setupUi(&dialog);
- certificateDialog.m_iconLabel->setText(QString());
- QIcon icon(mainWindow->style()->standardIcon(QStyle::SP_MessageBoxWarning, 0, mainWindow));
- certificateDialog.m_iconLabel->setPixmap(icon.pixmap(32, 32));
- certificateDialog.m_errorLabel->setText(error.errorDescription());
- dialog.setWindowTitle(tr("Certificate Error"));
-
-#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
- if (dialog.exec() == QDialog::Accepted)
- error.ignoreCertificateError();
- else
- error.rejectCertificate();
- }
- });
- return true;
-#else
- return dialog.exec() == QDialog::Accepted;
- }
-
- QMessageBox::critical(mainWindow, tr("Certificate Error"), error.errorDescription());
- return false;
-#endif
-}
-
-void WebPage::handleAuthenticationRequired(const QUrl &requestUrl, QAuthenticator *auth)
-{
- QWidget *mainWindow = view()->window();
- QDialog dialog(mainWindow);
- dialog.setModal(true);
- dialog.setWindowFlags(dialog.windowFlags() & ~Qt::WindowContextHelpButtonHint);
-
- Ui::PasswordDialog passwordDialog;
- passwordDialog.setupUi(&dialog);
-
- passwordDialog.m_iconLabel->setText(QString());
- QIcon icon(mainWindow->style()->standardIcon(QStyle::SP_MessageBoxQuestion, 0, mainWindow));
- passwordDialog.m_iconLabel->setPixmap(icon.pixmap(32, 32));
-
- QString introMessage(tr("Enter username and password for \"%1\" at %2")
- .arg(auth->realm()).arg(requestUrl.toString().toHtmlEscaped()));
- passwordDialog.m_infoLabel->setText(introMessage);
- passwordDialog.m_infoLabel->setWordWrap(true);
-
- if (dialog.exec() == QDialog::Accepted) {
- auth->setUser(passwordDialog.m_userNameLineEdit->text());
- auth->setPassword(passwordDialog.m_passwordLineEdit->text());
- } else {
- // Set authenticator null if dialog is cancelled
- *auth = QAuthenticator();
- }
+ error.defer();
+ QTimer::singleShot(0, this,
+ [this, error]() mutable { emit createCertificateErrorDialog(error); });
}
inline QString questionForFeature(QWebEnginePage::Feature feature)
@@ -167,64 +91,8 @@ inline QString questionForFeature(QWebEnginePage::Feature feature)
return QString();
}
-void WebPage::handleFeaturePermissionRequested(const QUrl &securityOrigin, Feature feature)
-{
- QString title = tr("Permission Request");
- QString question = questionForFeature(feature).arg(securityOrigin.host());
- if (!question.isEmpty() && QMessageBox::question(view()->window(), title, question) == QMessageBox::Yes)
- setFeaturePermission(securityOrigin, feature, PermissionGrantedByUser);
- else
- setFeaturePermission(securityOrigin, feature, PermissionDeniedByUser);
-}
-
-void WebPage::handleProxyAuthenticationRequired(const QUrl &, QAuthenticator *auth, const QString &proxyHost)
-{
- QWidget *mainWindow = view()->window();
- QDialog dialog(mainWindow);
- dialog.setModal(true);
- dialog.setWindowFlags(dialog.windowFlags() & ~Qt::WindowContextHelpButtonHint);
-
- Ui::PasswordDialog passwordDialog;
- passwordDialog.setupUi(&dialog);
-
- passwordDialog.m_iconLabel->setText(QString());
- QIcon icon(mainWindow->style()->standardIcon(QStyle::SP_MessageBoxQuestion, 0, mainWindow));
- passwordDialog.m_iconLabel->setPixmap(icon.pixmap(32, 32));
-
- QString introMessage = tr("Connect to proxy \"%1\" using:");
- introMessage = introMessage.arg(proxyHost.toHtmlEscaped());
- passwordDialog.m_infoLabel->setText(introMessage);
- passwordDialog.m_infoLabel->setWordWrap(true);
-
- if (dialog.exec() == QDialog::Accepted) {
- auth->setUser(passwordDialog.m_userNameLineEdit->text());
- auth->setPassword(passwordDialog.m_passwordLineEdit->text());
- } else {
- // Set authenticator null if dialog is cancelled
- *auth = QAuthenticator();
- }
-}
-
-//! [registerProtocolHandlerRequested]
-void WebPage::handleRegisterProtocolHandlerRequested(QWebEngineRegisterProtocolHandlerRequest request)
-{
- auto answer = QMessageBox::question(
- view()->window(),
- tr("Permission Request"),
- tr("Allow %1 to open all %2 links?")
- .arg(request.origin().host())
- .arg(request.scheme()));
- if (answer == QMessageBox::Yes)
- request.accept();
- else
- request.reject();
-}
-//! [registerProtocolHandlerRequested]
-
-#if !defined(QT_NO_SSL) || QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
void WebPage::handleSelectClientCertificate(QWebEngineClientCertificateSelection selection)
{
// Just select one.
selection.select(selection.certificates().at(0));
}
-#endif
diff --git a/examples/webenginewidgets/simplebrowser/webpage.h b/examples/webenginewidgets/simplebrowser/webpage.h
index 908295894..00eb48156 100644
--- a/examples/webenginewidgets/simplebrowser/webpage.h
+++ b/examples/webenginewidgets/simplebrowser/webpage.h
@@ -53,6 +53,7 @@
#include <QWebEnginePage>
#include <QWebEngineRegisterProtocolHandlerRequest>
+#include <QWebEngineCertificateError>
class WebPage : public QWebEnginePage
{
@@ -61,17 +62,14 @@ class WebPage : public QWebEnginePage
public:
WebPage(QWebEngineProfile *profile, QObject *parent = nullptr);
+signals:
+ void createCertificateErrorDialog(QWebEngineCertificateError error);
+
protected:
- bool certificateError(const QWebEngineCertificateError &error) override;
+ void certificateError(QWebEngineCertificateError error) override;
private slots:
- void handleAuthenticationRequired(const QUrl &requestUrl, QAuthenticator *auth);
- void handleFeaturePermissionRequested(const QUrl &securityOrigin, Feature feature);
- void handleProxyAuthenticationRequired(const QUrl &requestUrl, QAuthenticator *auth, const QString &proxyHost);
- void handleRegisterProtocolHandlerRequested(QWebEngineRegisterProtocolHandlerRequest request);
-#if !defined(QT_NO_SSL) || QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
void handleSelectClientCertificate(QWebEngineClientCertificateSelection clientCertSelection);
-#endif
};
#endif // WEBPAGE_H
diff --git a/examples/webenginewidgets/simplebrowser/webview.cpp b/examples/webenginewidgets/simplebrowser/webview.cpp
index fcbb543f2..5bd0a5ef4 100644
--- a/examples/webenginewidgets/simplebrowser/webview.cpp
+++ b/examples/webenginewidgets/simplebrowser/webview.cpp
@@ -54,11 +54,15 @@
#include "webpage.h"
#include "webpopupwindow.h"
#include "webview.h"
+#include "ui_certificateerrordialog.h"
+#include "ui_passworddialog.h"
#include <QContextMenuEvent>
#include <QDebug>
#include <QMenu>
#include <QMessageBox>
+#include <QAuthenticator>
#include <QTimer>
+#include <QStyle>
WebView::WebView(QWidget *parent)
: QWebEngineView(parent)
@@ -104,13 +108,56 @@ WebView::WebView(QWidget *parent)
});
}
+inline QString questionForFeature(QWebEnginePage::Feature feature)
+{
+ switch (feature) {
+ case QWebEnginePage::Geolocation:
+ return QObject::tr("Allow %1 to access your location information?");
+ case QWebEnginePage::MediaAudioCapture:
+ return QObject::tr("Allow %1 to access your microphone?");
+ case QWebEnginePage::MediaVideoCapture:
+ return QObject::tr("Allow %1 to access your webcam?");
+ case QWebEnginePage::MediaAudioVideoCapture:
+ return QObject::tr("Allow %1 to access your microphone and webcam?");
+ case QWebEnginePage::MouseLock:
+ return QObject::tr("Allow %1 to lock your mouse cursor?");
+ case QWebEnginePage::DesktopVideoCapture:
+ return QObject::tr("Allow %1 to capture video of your desktop?");
+ case QWebEnginePage::DesktopAudioVideoCapture:
+ return QObject::tr("Allow %1 to capture audio and video of your desktop?");
+ case QWebEnginePage::Notifications:
+ return QObject::tr("Allow %1 to show notification on your desktop?");
+ }
+ return QString();
+}
+
void WebView::setPage(WebPage *page)
{
+ WebPage *oldPage = qobject_cast<WebPage *>(QWebEngineView::page());
+ disconnect(oldPage, &WebPage::createCertificateErrorDialog, this,
+ &WebView::handleCertificateError);
+ disconnect(oldPage, &QWebEnginePage::authenticationRequired, this,
+ &WebView::handleAuthenticationRequired);
+ disconnect(oldPage, &QWebEnginePage::featurePermissionRequested, this,
+ &WebView::handleFeaturePermissionRequested);
+ disconnect(oldPage, &QWebEnginePage::proxyAuthenticationRequired, this,
+ &WebView::handleProxyAuthenticationRequired);
+ disconnect(oldPage, &QWebEnginePage::registerProtocolHandlerRequested, this,
+ &WebView::handleRegisterProtocolHandlerRequested);
createWebActionTrigger(page,QWebEnginePage::Forward);
createWebActionTrigger(page,QWebEnginePage::Back);
createWebActionTrigger(page,QWebEnginePage::Reload);
createWebActionTrigger(page,QWebEnginePage::Stop);
QWebEngineView::setPage(page);
+ connect(page, &WebPage::createCertificateErrorDialog, this, &WebView::handleCertificateError);
+ connect(page, &QWebEnginePage::authenticationRequired, this,
+ &WebView::handleAuthenticationRequired);
+ connect(page, &QWebEnginePage::featurePermissionRequested, this,
+ &WebView::handleFeaturePermissionRequested);
+ connect(page, &QWebEnginePage::proxyAuthenticationRequired, this,
+ &WebView::handleProxyAuthenticationRequired);
+ connect(page, &QWebEnginePage::registerProtocolHandlerRequested, this,
+ &WebView::handleRegisterProtocolHandlerRequested);
}
int WebView::loadProgress() const
@@ -176,7 +223,7 @@ QWebEngineView *WebView::createWindow(QWebEnginePage::WebWindowType type)
void WebView::contextMenuEvent(QContextMenuEvent *event)
{
- QMenu *menu = page()->createStandardContextMenu();
+ QMenu *menu = createStandardContextMenu();
const QList<QAction *> actions = menu->actions();
auto inspectElement = std::find(actions.cbegin(), actions.cend(), page()->action(QWebEnginePage::InspectElement));
if (inspectElement == actions.cend()) {
@@ -196,3 +243,106 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
menu->popup(event->globalPos());
}
+void WebView::handleCertificateError(QWebEngineCertificateError error)
+{
+ QDialog dialog(window());
+ dialog.setModal(true);
+ dialog.setWindowFlags(dialog.windowFlags() & ~Qt::WindowContextHelpButtonHint);
+
+ Ui::CertificateErrorDialog certificateDialog;
+ certificateDialog.setupUi(&dialog);
+ certificateDialog.m_iconLabel->setText(QString());
+ QIcon icon(window()->style()->standardIcon(QStyle::SP_MessageBoxWarning, 0, window()));
+ certificateDialog.m_iconLabel->setPixmap(icon.pixmap(32, 32));
+ certificateDialog.m_errorLabel->setText(error.description());
+ dialog.setWindowTitle(tr("Certificate Error"));
+
+ if (dialog.exec() == QDialog::Accepted)
+ error.acceptCertificate();
+ else
+ error.rejectCertificate();
+}
+
+void WebView::handleAuthenticationRequired(const QUrl &requestUrl, QAuthenticator *auth)
+{
+ QDialog dialog(window());
+ dialog.setModal(true);
+ dialog.setWindowFlags(dialog.windowFlags() & ~Qt::WindowContextHelpButtonHint);
+
+ Ui::PasswordDialog passwordDialog;
+ passwordDialog.setupUi(&dialog);
+
+ passwordDialog.m_iconLabel->setText(QString());
+ QIcon icon(window()->style()->standardIcon(QStyle::SP_MessageBoxQuestion, 0, window()));
+ passwordDialog.m_iconLabel->setPixmap(icon.pixmap(32, 32));
+
+ QString introMessage(tr("Enter username and password for \"%1\" at %2")
+ .arg(auth->realm())
+ .arg(requestUrl.toString().toHtmlEscaped()));
+ passwordDialog.m_infoLabel->setText(introMessage);
+ passwordDialog.m_infoLabel->setWordWrap(true);
+
+ if (dialog.exec() == QDialog::Accepted) {
+ auth->setUser(passwordDialog.m_userNameLineEdit->text());
+ auth->setPassword(passwordDialog.m_passwordLineEdit->text());
+ } else {
+ // Set authenticator null if dialog is cancelled
+ *auth = QAuthenticator();
+ }
+}
+
+void WebView::handleFeaturePermissionRequested(const QUrl &securityOrigin,
+ QWebEnginePage::Feature feature)
+{
+ QString title = tr("Permission Request");
+ QString question = questionForFeature(feature).arg(securityOrigin.host());
+ if (!question.isEmpty() && QMessageBox::question(window(), title, question) == QMessageBox::Yes)
+ page()->setFeaturePermission(securityOrigin, feature,
+ QWebEnginePage::PermissionGrantedByUser);
+ else
+ page()->setFeaturePermission(securityOrigin, feature,
+ QWebEnginePage::PermissionDeniedByUser);
+}
+
+void WebView::handleProxyAuthenticationRequired(const QUrl &, QAuthenticator *auth,
+ const QString &proxyHost)
+{
+ QDialog dialog(window());
+ dialog.setModal(true);
+ dialog.setWindowFlags(dialog.windowFlags() & ~Qt::WindowContextHelpButtonHint);
+
+ Ui::PasswordDialog passwordDialog;
+ passwordDialog.setupUi(&dialog);
+
+ passwordDialog.m_iconLabel->setText(QString());
+ QIcon icon(window()->style()->standardIcon(QStyle::SP_MessageBoxQuestion, 0, window()));
+ passwordDialog.m_iconLabel->setPixmap(icon.pixmap(32, 32));
+
+ QString introMessage = tr("Connect to proxy \"%1\" using:");
+ introMessage = introMessage.arg(proxyHost.toHtmlEscaped());
+ passwordDialog.m_infoLabel->setText(introMessage);
+ passwordDialog.m_infoLabel->setWordWrap(true);
+
+ if (dialog.exec() == QDialog::Accepted) {
+ auth->setUser(passwordDialog.m_userNameLineEdit->text());
+ auth->setPassword(passwordDialog.m_passwordLineEdit->text());
+ } else {
+ // Set authenticator null if dialog is cancelled
+ *auth = QAuthenticator();
+ }
+}
+
+//! [registerProtocolHandlerRequested]
+void WebView::handleRegisterProtocolHandlerRequested(
+ QWebEngineRegisterProtocolHandlerRequest request)
+{
+ auto answer = QMessageBox::question(window(), tr("Permission Request"),
+ tr("Allow %1 to open all %2 links?")
+ .arg(request.origin().host())
+ .arg(request.scheme()));
+ if (answer == QMessageBox::Yes)
+ request.accept();
+ else
+ request.reject();
+}
+//! [registerProtocolHandlerRequested]
diff --git a/examples/webenginewidgets/simplebrowser/webview.h b/examples/webenginewidgets/simplebrowser/webview.h
index 8559a68b8..0dc7c33ad 100644
--- a/examples/webenginewidgets/simplebrowser/webview.h
+++ b/examples/webenginewidgets/simplebrowser/webview.h
@@ -53,6 +53,9 @@
#include <QIcon>
#include <QWebEngineView>
+#include <QWebEngineCertificateError>
+#include <QWebEnginePage>
+#include <QWebEngineRegisterProtocolHandlerRequest>
class WebPage;
@@ -76,6 +79,14 @@ signals:
void webActionEnabledChanged(QWebEnginePage::WebAction webAction, bool enabled);
void favIconChanged(const QIcon &icon);
void devToolsRequested(QWebEnginePage *source);
+private slots:
+ void handleCertificateError(QWebEngineCertificateError error);
+ void handleAuthenticationRequired(const QUrl &requestUrl, QAuthenticator *auth);
+ void handleFeaturePermissionRequested(const QUrl &securityOrigin,
+ QWebEnginePage::Feature feature);
+ void handleProxyAuthenticationRequired(const QUrl &requestUrl, QAuthenticator *auth,
+ const QString &proxyHost);
+ void handleRegisterProtocolHandlerRequested(QWebEngineRegisterProtocolHandlerRequest request);
private:
void createWebActionTrigger(QWebEnginePage *page, QWebEnginePage::WebAction);
diff --git a/examples/webenginewidgets/spellchecker/webview.cpp b/examples/webenginewidgets/spellchecker/webview.cpp
index a65fb1a1a..b532dd417 100644
--- a/examples/webenginewidgets/spellchecker/webview.cpp
+++ b/examples/webenginewidgets/spellchecker/webview.cpp
@@ -52,7 +52,7 @@
#include <QContextMenuEvent>
#include <QMenu>
#include <QWebEngineProfile>
-#include <QWebEngineContextMenuData>
+#include <QWebEngineContextMenuRequest>
WebView::WebView(QWidget *parent)
: QWebEngineView(parent)
@@ -66,17 +66,17 @@ WebView::WebView(QWidget *parent)
void WebView::contextMenuEvent(QContextMenuEvent *event)
{
- const QWebEngineContextMenuData &data = page()->contextMenuData();
- Q_ASSERT(data.isValid());
+ QWebEngineContextMenuRequest *data = lastContextMenuRequest();
+ Q_ASSERT(data);
- if (!data.isContentEditable()) {
+ if (!data->isContentEditable()) {
QWebEngineView::contextMenuEvent(event);
return;
}
QWebEngineProfile *profile = page()->profile();
const QStringList &languages = profile->spellCheckLanguages();
- QMenu *menu = page()->createStandardContextMenu();
+ QMenu *menu = createStandardContextMenu();
menu->addSeparator();
QAction *spellcheckAction = new QAction(tr("Check Spelling"), nullptr);
diff --git a/examples/webenginewidgets/stylesheetbrowser/main.cpp b/examples/webenginewidgets/stylesheetbrowser/main.cpp
index 833ea6bb0..9cd294d48 100644
--- a/examples/webenginewidgets/stylesheetbrowser/main.cpp
+++ b/examples/webenginewidgets/stylesheetbrowser/main.cpp
@@ -55,7 +55,7 @@
int main(int argc, char *argv[])
{
- qRegisterMetaTypeStreamOperators<StyleSheet>("StyleSheet");
+ qRegisterMetaType<StyleSheet>("StyleSheet");
QCoreApplication::setOrganizationName("QtExamples");
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
diff --git a/examples/webenginewidgets/stylesheetbrowser/mainwindow.cpp b/examples/webenginewidgets/stylesheetbrowser/mainwindow.cpp
index c93205b18..bdf3c56bf 100644
--- a/examples/webenginewidgets/stylesheetbrowser/mainwindow.cpp
+++ b/examples/webenginewidgets/stylesheetbrowser/mainwindow.cpp
@@ -121,14 +121,15 @@ void MainWindow::removeStyleSheet(const QString &name, bool immediately)
if (immediately)
ui->webEngineView->page()->runJavaScript(s, QWebEngineScript::ApplicationWorld);
- QWebEngineScript script = ui->webEngineView->page()->scripts().findScript(name);
- ui->webEngineView->page()->scripts().remove(script);
+ const QList<QWebEngineScript> scripts = ui->webEngineView->page()->scripts().find(name);
+ if (!scripts.isEmpty())
+ ui->webEngineView->page()->scripts().remove(scripts.first());
}
bool MainWindow::hasStyleSheet(const QString &name)
{
- QWebEngineScript script = ui->webEngineView->page()->scripts().findScript(name);
- return !script.isNull();
+ const QList<QWebEngineScript> scripts = ui->webEngineView->page()->scripts().find(name);
+ return !scripts.isEmpty();
}
void MainWindow::loadDefaultStyleSheets()
diff --git a/mkspecs/features/functions.prf b/mkspecs/features/functions.prf
index d3ceb4c5e..b7509d4d0 100644
--- a/mkspecs/features/functions.prf
+++ b/mkspecs/features/functions.prf
@@ -57,10 +57,13 @@ defineReplace(pythonPathForSystem) {
}
defineReplace(ninjaPath) {
- src_3rd_party_dir = $$absolute_path("$${getChromiumSrcDir()}/../", "$$QTWEBENGINE_ROOT")
- out = $$shadowed($$absolute_path(ninja/ninja, $$src_3rd_party_dir))
- win32: out = $${out}.exe
- return($$out)
+ isEmpty(QMAKE_NINJA) {
+ src_3rd_party_dir = $$absolute_path("$${getChromiumSrcDir()}/../", "$$QTWEBENGINE_ROOT")
+ out = $$shadowed($$absolute_path(ninja/ninja, $$src_3rd_party_dir))
+ win32: out = $${out}.exe
+ QMAKE_NINJA = $$out
+ }
+ return($$QMAKE_NINJA)
}
defineReplace(gnPath) {
diff --git a/mkspecs/features/gn_generator.prf b/mkspecs/features/gn_generator.prf
index a83b59847..bbaed2331 100644
--- a/mkspecs/features/gn_generator.prf
+++ b/mkspecs/features/gn_generator.prf
@@ -109,6 +109,11 @@ CLEAN_QMAKE_RCC = $$clean_path($$QMAKE_RCC)
# CONFIG SETUP
+# Chromium already enables warnings, so enabling them again will just
+# re-enable all the warnings disabled by Chromium.
+QMAKE_CFLAGS -= $$QMAKE_CFLAGS_WARN_ON
+QMAKE_CXXFLAGS -= $$QMAKE_CXXFLAGS_WARN_ON
+
GN_CONTENTS += "config(\"$${TARGET}_config\") {"
!isEmpty(QMAKE_CFLAGS) {
GN_CONTENTS += " cflags = ["
@@ -122,14 +127,6 @@ GN_CONTENTS += "config(\"$${TARGET}_config\") {"
GN_CONTENTS += " ]"
}
-# Stop the barrage of unused variables warnings.
-gcc|clang|clang_cl {
- QMAKE_CXXFLAGS += "-Wno-unused-parameter"
- QMAKE_CXXFLAGS += "-Wno-unused-variable"
-} else:msvc {
- QMAKE_CXXFLAGS += /wd4100 /wd4101
-}
-
# Chromium activates this, but we need it off to be able to compile QFlags
clang_cl {
QMAKE_CXXFLAGS += "-fno-complete-member-pointers"
diff --git a/src/3rdparty b/src/3rdparty
-Subproject c5637fa9071bb6d53b5d21ac713f2a5191f8c16
+Subproject 3b1e8320c3e93dc41211ccd66cfd26fa7eec18c
diff --git a/src/buildtools/config/common.pri b/src/buildtools/config/common.pri
index 85781d251..cf990c79b 100644
--- a/src/buildtools/config/common.pri
+++ b/src/buildtools/config/common.pri
@@ -14,25 +14,28 @@ gn_args += \
enable_nacl=false \
enable_remoting=false \
enable_reporting=false \
- enable_resource_whitelist_generation=false \
+ enable_resource_allowlist_generation=false \
enable_swiftshader=false \
+ enable_swiftshader_vulkan=false \
angle_enable_swiftshader=false \
- enable_web_auth=true \
enable_web_speech=false \
enable_widevine=true \
forbid_non_component_debug_builds=false \
has_native_accessibility=false \
safe_browsing_mode=0 \
+ skia_use_dawn=false \
toolkit_views=false \
treat_warnings_as_errors=false \
use_allocator_shim=false \
use_allocator=\"none\" \
- use_custom_libcxx=false
+ use_custom_libcxx=false \
+ chrome_pgo_phase=0 \
+ enable_hangout_services_extension=true
-# No closure compile supported at this time
+# Closure compile requires Java
gn_args += \
- closure_compile=false \
- optimize_webui=false
+ optimize_webui=false \
+ enable_js_type_check=false
# We always embed v8 startup data currently
gn_args += \
diff --git a/src/buildtools/config/linux.pri b/src/buildtools/config/linux.pri
index 56c18bdb5..7507d51ef 100644
--- a/src/buildtools/config/linux.pri
+++ b/src/buildtools/config/linux.pri
@@ -11,13 +11,13 @@ gn_args += \
use_cups=false \
use_gio=false \
use_gnome_keyring=false \
- linux_use_bundled_binutils=false \
use_udev=true \
use_bundled_fontconfig=false \
use_sysroot=false \
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 \
diff --git a/src/buildtools/config/support.pri b/src/buildtools/config/support.pri
index e192f8777..4ba387fc2 100644
--- a/src/buildtools/config/support.pri
+++ b/src/buildtools/config/support.pri
@@ -21,7 +21,7 @@ defineReplace(qtwebengine_checkWebEngineCoreError) {
!qtwebengine_checkForGperf(QtWebEngine):return(false)
!qtwebengine_checkForBison(QtWebEngine):return(false)
!qtwebengine_checkForFlex(QtWebEngine):return(false)
- !qtwebengine_checkForPython2(QtWebengine):return(false)
+ !qtwebengine_checkForPython2(QtWebEngine):return(false)
!qtwebengine_checkForSanitizer(QtWebEngine):return(false)
linux:!qtwebengine_checkForPkgCfg(QtWebEngine):return(false)
linux:!qtwebengine_checkForHostPkgCfg(QtWebEngine):return(false)
@@ -151,6 +151,15 @@ defineTest(qtwebengine_checkForPython2) {
return(true)
}
+defineTest(qtwebengine_checkForNodejs) {
+ module = $$1
+ !qtConfig(webengine-nodejs) {
+ qtwebengine_skipBuild("Nodejs is required to build $${module}.")
+ return(false)
+ }
+ return(true)
+}
+
defineTest(qtwebengine_checkForSanitizer) {
module = $$1
sanitizer:!qtConfig(webengine-sanitizer) {
diff --git a/src/buildtools/config/windows.pri b/src/buildtools/config/windows.pri
index bd236e1a5..843d6f2b1 100644
--- a/src/buildtools/config/windows.pri
+++ b/src/buildtools/config/windows.pri
@@ -4,7 +4,6 @@ gn_args += \
use_sysroot=false \
enable_session_service=false \
ninja_use_custom_environment_files=false \
- is_multi_dll_chrome=false \
win_linker_timing=true \
com_init_check_hook_disabled=true \
heterogeneous_executables=true \
diff --git a/src/buildtools/configure.json b/src/buildtools/configure.json
index 1ca6214a0..5819fb860 100644
--- a/src/buildtools/configure.json
+++ b/src/buildtools/configure.json
@@ -68,6 +68,12 @@
{ "type": "pkgConfig", "args": "x11" }
]
},
+ "webengine-xproto-gl": {
+ "label": "xproto (glproto)",
+ "sources": [
+ { "type": "pkgConfig", "args": "glproto" }
+ ]
+ },
"webengine-glib": {
"label": "glib-2.0 >= 2.32.0",
"sources": [
@@ -75,9 +81,9 @@
]
},
"webengine-harfbuzz": {
- "label": "harfbuzz >= 2.2.0",
+ "label": "harfbuzz >= 2.4.0",
"sources": [
- { "type": "pkgConfig", "args": "harfbuzz >= 2.2.0" }
+ { "type": "pkgConfig", "args": "harfbuzz >= 2.4.0 harfbuzz-subset >= 2.4.0" }
]
},
"webengine-jpeglib": {
@@ -102,12 +108,6 @@
"-ljpeg"
]
},
- "webengine-jsoncpp": {
- "label": "jsoncpp",
- "sources": [
- { "type": "pkgConfig", "args": "jsoncpp" }
- ]
- },
"webengine-libevent": {
"label": "libevent",
"sources": [
@@ -126,12 +126,6 @@
{ "type": "pkgConfig", "args": "libpng >= 1.6.0" }
]
},
- "webengine-protobuf": {
- "label": "protobuf",
- "sources": [
- { "type": "pkgConfig", "args": "protobuf" }
- ]
- },
"webengine-zlib": {
"label": "zlib",
"sources": [
@@ -155,9 +149,9 @@
]
},
"webengine-icu": {
- "label": "icu >= 64",
+ "label": "icu >= 65",
"sources": [
- { "type": "pkgConfig", "args": "icu-uc >= 64 icu-i18n >= 64" }
+ { "type": "pkgConfig", "args": "icu-uc >= 65 icu-i18n >= 65" }
]
},
"webengine-webp": {
@@ -238,10 +232,11 @@
"vpx_codec_cx_pkt pkt;",
"pkt.data.frame.width[0] = 0u;",
"pkt.data.frame.height[0] = 0u;",
- "auto a = CONSTRAINED_FROM_ABOVE_DROP;"
+ "auto a = CONSTRAINED_FROM_ABOVE_DROP;",
+ "auto b = VPX_IMG_FMT_NV12;"
]
},
- "headers": [ "vpx/vpx_encoder.h", "vpx/vp8cx.h" ],
+ "headers": [ "vpx/vpx_encoder.h", "vpx/vp8cx.h", "vpx/vpx_image.h" ],
"sources": [
{ "type": "pkgConfig", "args": "vpx" },
"-lvpx"
@@ -292,7 +287,8 @@
},
"webengine-ninja": {
"label": "system ninja",
- "type": "detectNinja"
+ "type": "detectNinja",
+ "log": "path"
},
"webengine-python2": {
"label": "python2",
@@ -320,10 +316,6 @@
"type": "detectJumboBuild",
"log": "merge_limit"
},
- "webengine-protoc": {
- "label": "protoc",
- "type": "detectProtoc"
- },
"webengine-win-compiler64": {
"label": "64bit compiler",
"type": "isWindowsHostCompiler64"
@@ -357,6 +349,11 @@
"label": "linker supports -z noexecstack",
"type": "linkerSupportsFlag",
"flag": "-z,noexecstack"
+ },
+ "webengine-nodejs": {
+ "label": "node.js",
+ "type": "detectNodeJS",
+ "log": "version10"
}
},
"features": {
@@ -373,6 +370,7 @@
&& features.webengine-bison
&& features.webengine-flex
&& features.webengine-python2
+ && features.webengine-nodejs
&& (!config.sanitizer || features.webengine-sanitizer)
&& (!config.linux || features.pkg-config)
&& (!config.linux || features.webengine-host-pkg-config)
@@ -443,10 +441,23 @@
"condition": "tests.webengine-flex",
"output": [ "privateFeature" ]
},
+ "webengine-nodejs": {
+ "label": "node.js",
+ "condition": "tests.webengine-nodejs",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-nodejs10": {
+ "label": "node.js",
+ "condition": "tests.webengine-nodejs && tests.webengine-nodejs.version10",
+ "output": [ "privateFeature" ]
+ },
"webengine-system-ninja": {
"label": "Use System Ninja",
"condition": "tests.webengine-ninja",
- "output": [ "privateFeature" ]
+ "output": [
+ "privateFeature",
+ { "type": "varAssign", "name": "QMAKE_NINJA", "value": "tests.webengine-ninja.path" }
+ ]
},
"webengine-system-fontconfig": {
"label": "fontconfig",
@@ -509,6 +520,11 @@
"condition": "config.unix && libs.webengine-x11",
"output": [ "privateFeature" ]
},
+ "webengine-system-xproto-gl" : {
+ "label": "xproto (glproto)",
+ "condition": "config.unix && libs.webengine-xproto-gl",
+ "output": [ "privateFeature" ]
+ },
"webengine-host-pkg-config": {
"label": "host-pkg-config",
"condition": "config.unix && tests.webengine-host-pkg-config",
@@ -525,6 +541,7 @@
&& features.webengine-system-xcomposite
&& features.webengine-system-xcursor
&& features.webengine-system-xi
+ && features.webengine-system-xproto-gl
&& features.webengine-system-xtst",
"output": [ "privateFeature" ]
},
@@ -541,6 +558,11 @@
"condition": "config.unix && features.system-harfbuzz && libs.webengine-harfbuzz",
"output": [ "privateFeature" ]
},
+ "webengine-qt-harfbuzz" : {
+ "label": "qtharfbuzz",
+ "condition": "config.static && !features.system-harfbuzz && features.harfbuzz",
+ "output": [ "privateFeature" ]
+ },
"webengine-system-glib" : {
"label": "glib",
"condition": "config.unix && libs.webengine-glib",
@@ -556,31 +578,36 @@
"condition": "config.unix && features.system-zlib && libs.webengine-zlib",
"output": [ "privateFeature" ]
},
+ "webengine-qt-zlib" : {
+ "label": "QtZlib",
+ "condition": "config.static && !features.system-zlib",
+ "output": [ "privateFeature" ]
+ },
"webengine-system-libevent" : {
"label": "libevent",
"condition": "config.unix && libs.webengine-libevent",
"output": [ "privateFeature" ]
},
- "webengine-system-jsoncpp" : {
- "label": "jsoncpp",
- "condition": "config.unix && libs.webengine-jsoncpp",
- "output": [ "privateFeature" ]
- },
- "webengine-system-protobuf" : {
- "label": "protobuf",
- "condition": "config.unix && libs.webengine-protobuf && tests.webengine-protoc",
- "output": [ "privateFeature" ]
- },
"webengine-system-png" : {
"label": "png",
"condition": "config.unix && features.system-png && libs.webengine-png",
"output": [ "privateFeature" ]
},
+ "webengine-qt-png" : {
+ "label": "qtlibpng",
+ "condition" : "config.static && !features.system-png && features.png",
+ "output": [ "privateFeature" ]
+ },
"webengine-system-jpeg" : {
"label": "JPEG",
"condition": "config.unix && features.system-jpeg && libs.webengine-jpeglib",
"output": [ "privateFeature" ]
},
+ "webengine-qt-jpeg" : {
+ "label": "qtlibjpeg",
+ "condition": "config.static && !features.system-jpeg && features.jpeg",
+ "output": [ "privateFeature" ]
+ },
"webengine-system-re2": {
"label": "re2",
"condition": "config.unix && libs.webengine-re2",
@@ -623,6 +650,11 @@
"condition": "config.unix && features.system-freetype && libs.webengine-freetype",
"output": [ "privateFeature" ]
},
+ "webengine-qt-freetype" : {
+ "label": "qtfreetype",
+ "condition": "config.static && !features.system-freetype && features.freetype",
+ "output": [ "privateFeature" ]
+ },
"webengine-system-libvpx" : {
"label": "libvpx",
"condition": "config.unix && libs.webengine-libvpx",
@@ -725,7 +757,6 @@
"section": "Qt WebEngine Build Tools",
"entries": [
"webengine-system-ninja",
- "webengine-system-gn",
{
"message": "Jumbo Build Merge Limit",
"type": "jumboBuild"
@@ -756,6 +787,7 @@
"webengine-system-xcomposite",
"webengine-system-xcursor",
"webengine-system-xi",
+ "webengine-system-xproto-gl",
"webengine-system-xtst"
]
},
@@ -774,8 +806,6 @@
"webengine-system-zlib",
"webengine-system-minizip",
"webengine-system-libevent",
- "webengine-system-jsoncpp",
- "webengine-system-protobuf",
"webengine-system-libxml2",
"webengine-system-lcms2",
"webengine-system-png",
@@ -783,6 +813,17 @@
"webengine-system-harfbuzz",
"webengine-system-freetype"
]
+ },
+ {
+ "section": "Qt 3rdparty libs",
+ "condition": "config.static",
+ "entries": [
+ "webengine-qt-freetype",
+ "webengine-qt-harfbuzz",
+ "webengine-qt-png",
+ "webengine-qt-jpeg",
+ "webengine-qt-zlib"
+ ]
}
]
}
diff --git a/src/buildtools/gn.pro b/src/buildtools/gn.pro
index 033202e6e..9e8cfe157 100644
--- a/src/buildtools/gn.pro
+++ b/src/buildtools/gn.pro
@@ -11,8 +11,6 @@ build_pass|!debug_and_release {
buildgn.target = build_gn
out = $$gnPath()
out_path = $$dirname(out)
- !qtConfig(webengine-system-ninja): ninja_path = $$ninjaPath()
- else: ninja_path="ninja"
# check if it is not already build
!exists($$out) {
src_3rd_party_dir = $$absolute_path("$${getChromiumSrcDir()}/../", "$$QTWEBENGINE_ROOT")
@@ -32,7 +30,7 @@ build_pass|!debug_and_release {
!system("$$pythonPathForSystem() $$gn_configure") {
error("GN generation error!")
}
- !system("cd $$system_quote($$system_path($$out_path)) && $$ninja_path $$basename(out)" ) {
+ !system("cd $$system_quote($$system_path($$out_path)) && $$system_quote($$system_path($$ninjaPath())) $$basename(out)" ) {
error("GN build error!")
}
}
diff --git a/src/core/accessibility_tree_formatter_qt.cpp b/src/core/accessibility_tree_formatter_qt.cpp
index 081856b37..51d33534b 100644
--- a/src/core/accessibility_tree_formatter_qt.cpp
+++ b/src/core/accessibility_tree_formatter_qt.cpp
@@ -37,7 +37,7 @@
**
****************************************************************************/
-#include "content/browser/accessibility/accessibility_tree_formatter_browser.h"
+#include "content/browser/accessibility/accessibility_tree_formatter_base.h"
#include <utility>
@@ -53,19 +53,26 @@
namespace content {
#if QT_CONFIG(accessibility)
-class AccessibilityTreeFormatterQt : public AccessibilityTreeFormatterBrowser {
+class AccessibilityTreeFormatterQt : public AccessibilityTreeFormatterBase {
public:
explicit AccessibilityTreeFormatterQt();
~AccessibilityTreeFormatterQt() override;
+ std::unique_ptr<base::DictionaryValue> BuildAccessibilityTreeForSelector(const content::AccessibilityTreeFormatter::TreeSelector &)
+ { return nullptr; }
+ std::unique_ptr<base::DictionaryValue> BuildAccessibilityTreeForWindow(gfx::AcceleratedWidget) override { return nullptr; }
+ std::unique_ptr<base::DictionaryValue> BuildAccessibilityTree(content::BrowserAccessibility *) override;
+
private:
base::FilePath::StringType GetExpectedFileSuffix() override;
const std::string GetAllowEmptyString() override;
const std::string GetAllowString() override;
const std::string GetDenyString() override;
const std::string GetDenyNodeString() override;
- void AddProperties(const BrowserAccessibility &node, base::DictionaryValue* dict) override;
- base::string16 ProcessTreeForOutput(const base::DictionaryValue &node, base::DictionaryValue * = nullptr) override;
+ const std::string GetRunUntilEventString() override;
+ void RecursiveBuildAccessibilityTree(const content::BrowserAccessibility &node, base::DictionaryValue *dict) const;
+ void AddProperties(const BrowserAccessibility &node, base::DictionaryValue *dict) const;
+ std::string ProcessTreeForOutput(const base::DictionaryValue &node, base::DictionaryValue * = nullptr) override;
};
AccessibilityTreeFormatterQt::AccessibilityTreeFormatterQt()
@@ -76,7 +83,30 @@ AccessibilityTreeFormatterQt::~AccessibilityTreeFormatterQt()
{
}
-void AccessibilityTreeFormatterQt::AddProperties(const BrowserAccessibility &node, base::DictionaryValue *dict)
+std::unique_ptr<base::DictionaryValue> AccessibilityTreeFormatterQt::BuildAccessibilityTree(content::BrowserAccessibility *root)
+{
+ std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
+ RecursiveBuildAccessibilityTree(*root, dict.get());
+ return dict;
+}
+
+void AccessibilityTreeFormatterQt::RecursiveBuildAccessibilityTree(const BrowserAccessibility &node, base::DictionaryValue *dict) const
+{
+ AddProperties(node, dict);
+
+ auto children = std::make_unique<base::ListValue>();
+ for (size_t i = 0; i < node.PlatformChildCount(); ++i) {
+ std::unique_ptr<base::DictionaryValue> child_dict(new base::DictionaryValue);
+
+ content::BrowserAccessibility *child_node = node.PlatformGetChild(i);
+
+ RecursiveBuildAccessibilityTree(*child_node, child_dict.get());
+ children->Append(std::move(child_dict));
+ }
+ dict->Set(kChildrenDictAttr, std::move(children));
+}
+
+void AccessibilityTreeFormatterQt::AddProperties(const BrowserAccessibility &node, base::DictionaryValue *dict) const
{
dict->SetInteger("id", node.GetId());
const BrowserAccessibilityQt *acc_node = ToBrowserAccessibilityQt(&node);
@@ -142,13 +172,13 @@ void AccessibilityTreeFormatterQt::AddProperties(const BrowserAccessibility &nod
dict->SetString("description", acc_node->text(QAccessible::Description).toStdString());
}
-base::string16 AccessibilityTreeFormatterQt::ProcessTreeForOutput(const base::DictionaryValue &node, base::DictionaryValue *)
+std::string AccessibilityTreeFormatterQt::ProcessTreeForOutput(const base::DictionaryValue &node, base::DictionaryValue *)
{
- base::string16 error_value;
+ std::string error_value;
if (node.GetString("error", &error_value))
return error_value;
- base::string16 line;
+ std::string line;
std::string role_value;
node.GetString("role", &role_value);
if (!role_value.empty())
@@ -176,7 +206,7 @@ base::string16 AccessibilityTreeFormatterQt::ProcessTreeForOutput(const base::Di
node.GetInteger("id", &id_value);
WriteAttribute(false, base::StringPrintf("id=%d", id_value), &line);
- return line + base::ASCIIToUTF16("\n");
+ return line + "\n";
}
base::FilePath::StringType AccessibilityTreeFormatterQt::GetExpectedFileSuffix()
@@ -204,6 +234,11 @@ const std::string AccessibilityTreeFormatterQt::GetDenyNodeString()
return "@QT-DENY-NODE:";
}
+const std::string AccessibilityTreeFormatterQt::GetRunUntilEventString()
+{
+ return "@QT-RUN-UNTIL-EVENT:";
+}
+
#endif // QT_CONFIG(accessibility)
// static
diff --git a/src/core/api/core_api.pro b/src/core/api/core_api.pro
index d53fb6942..3a2a9708c 100644
--- a/src/core/api/core_api.pro
+++ b/src/core/api/core_api.pro
@@ -4,7 +4,7 @@ DESTDIR = $$OUT_PWD/$$getConfigDir()
TEMPLATE = lib
CONFIG += staticlib
-QT += network core-private webenginecoreheaders-private
+QT += network core-private webenginecoreheaders-private quick printsupport qml #fixme
# Don't create .prl file for this intermediate library because
# their contents get used when linking against them, breaking
@@ -26,6 +26,7 @@ CHROMIUM_SRC_DIR = $$QTWEBENGINE_ROOT/$$getChromiumSrcDir()
CHROMIUM_GEN_DIR = $$OUT_PWD/../$$getConfigDir()/gen
INCLUDEPATH += $$QTWEBENGINE_ROOT/src/core \
$$CHROMIUM_GEN_DIR \
+ $$CHROMIUM_SRC_DIR/third_party/abseil-cpp \
$$CHROMIUM_SRC_DIR
gcc: QMAKE_CXXFLAGS_WARN_ON = -Wno-unused-parameter
@@ -36,9 +37,11 @@ HEADERS = \
qwebengineclientcertificatestore.h \
qtwebenginecoreglobal.h \
qtwebenginecoreglobal_p.h \
+ qwebenginecertificateerror.h \
qwebenginecookiestore.h \
qwebenginecookiestore_p.h \
qwebenginefindtextresult.h \
+ qwebenginefullscreenrequest.h \
qwebenginehttprequest.h \
qwebenginemessagepumpscheduler_p.h \
qwebenginenotification.h \
@@ -49,13 +52,30 @@ HEADERS = \
qwebengineurlrequestinfo_p.h \
qwebengineurlrequestjob.h \
qwebengineurlscheme.h \
- qwebengineurlschemehandler.h
+ qwebengineurlschemehandler.h \
+ qwebenginecontextmenurequest.h \
+ qwebenginecontextmenurequest_p.h \
+ qwebenginedownloadrequest.h \
+ qwebenginedownloadrequest_p.h \
+ qwebenginesettings.h \
+ qwebenginescript.h \
+ qwebenginescriptcollection.h \
+ qwebenginescriptcollection_p.h \
+ qwebengineprofile.h \
+ qwebengineprofile_p.h \
+ qwebengineclientcertificateselection.h \
+ qwebenginehistory.h \
+ qwebenginehistory_p.h \
+ qwebenginepage.h \
+ qwebenginepage_p.h
SOURCES = \
qtwebenginecoreglobal.cpp \
+ qwebenginecertificateerror.cpp \
qwebengineclientcertificatestore.cpp \
qwebenginecookiestore.cpp \
qwebenginefindtextresult.cpp \
+ qwebenginefullscreenrequest.cpp \
qwebenginehttprequest.cpp \
qwebenginemessagepumpscheduler.cpp \
qwebenginenotification.cpp \
@@ -64,13 +84,16 @@ SOURCES = \
qwebengineurlrequestinfo.cpp \
qwebengineurlrequestjob.cpp \
qwebengineurlscheme.cpp \
- qwebengineurlschemehandler.cpp
-
-### Qt6 Remove this workaround
-unix:!isEmpty(QMAKE_LFLAGS_VERSION_SCRIPT):!static {
- SOURCES += qtbug-60565.cpp \
- qtbug-61521.cpp
-}
+ qwebengineurlschemehandler.cpp \
+ qwebenginecontextmenurequest.cpp \
+ qwebenginedownloadrequest.cpp \
+ qwebenginesettings.cpp \
+ qwebenginescript.cpp \
+ qwebenginescriptcollection.cpp \
+ qwebengineprofile.cpp \
+ qwebengineclientcertificateselection.cpp \
+ qwebenginehistory.cpp \
+ qwebenginepage.cpp
# Chromium headers included are not remotely clean
CONFIG -= warning_clean
diff --git a/src/core/api/qtbug-60565.cpp b/src/core/api/qtbug-60565.cpp
deleted file mode 100644
index f48a2a701..000000000
--- a/src/core/api/qtbug-60565.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#include <new>
-#include <unistd.h>
-
-#if defined(__LP64__)
-# define SIZE_T_MANGLING "m"
-#else
-# define SIZE_T_MANGLING "j"
-#endif
-
-#define SHIM_ALIAS_SYMBOL(fn) __attribute__((weak, alias(#fn)))
-#define SHIM_HIDDEN __attribute__ ((visibility ("hidden")))
-
-extern "C" {
-
-__asm__(".symver __ShimCppNew, _Znw" SIZE_T_MANGLING "@Qt_5");
-void* __ShimCppNew(size_t size)
- SHIM_ALIAS_SYMBOL(ShimCppNew);
-
-__asm__(".symver __ShimCppDelete, _ZdlPv@Qt_5");
-void __ShimCppDelete(void* address)
- SHIM_ALIAS_SYMBOL(ShimCppDelete);
-
-__asm__(".symver __ShimCppNewArray, _Zna" SIZE_T_MANGLING "@Qt_5");
-void* __ShimCppNewArray(size_t size)
- SHIM_ALIAS_SYMBOL(ShimCppNewArray);
-
-__asm__(".symver __ShimCppDeleteArray, _ZdaPv@Qt_5");
-void __ShimCppDeleteArray(void* address)
- SHIM_ALIAS_SYMBOL(ShimCppDeleteArray);
-
-__asm__(".symver __ShimCppNewNoThrow, _Znw" SIZE_T_MANGLING "RKSt9nothrow_t@Qt_5");
-void *__ShimCppNewNoThrow(size_t size, const std::nothrow_t&) noexcept
- SHIM_ALIAS_SYMBOL(ShimCppNewNoThrow);
-
-__asm__(".symver __ShimCppNewArrayNoThrow, _Zna" SIZE_T_MANGLING "RKSt9nothrow_t@Qt_5");
-void *__ShimCppNewArrayNoThrow(size_t size, const std::nothrow_t&) noexcept
- SHIM_ALIAS_SYMBOL(ShimCppNewArrayNoThrow);
-
-__asm__(".symver __ShimCppDeleteNoThrow, _ZdlPvRKSt9nothrow_t@Qt_5");
-void __ShimCppDeleteNoThrow(void* address, const std::nothrow_t&) noexcept
- SHIM_ALIAS_SYMBOL(ShimCppDeleteNoThrow);
-
-__asm__(".symver __ShimCppDeleteArrayNoThrow, _ZdaPvRKSt9nothrow_t@Qt_5");
-void __ShimCppDeleteArrayNoThrow(void* address, const std::nothrow_t&) noexcept
- SHIM_ALIAS_SYMBOL(ShimCppDeleteArrayNoThrow);
-
-static void* __shimCppNew(size_t size);
-static void* __shimCppNewArray(size_t size);
-static void __shimCppDelete(void *address);
-static void __shimCppDeleteArray(void *address);
-
-SHIM_HIDDEN void* ShimCppNew(size_t size) {
- return __shimCppNew(size);
-}
-
-SHIM_HIDDEN void* ShimCppNewNoThrow(size_t size, const std::nothrow_t&) noexcept {
- return __shimCppNew(size);
-}
-
-SHIM_HIDDEN void* ShimCppNewArray(size_t size) {
- return __shimCppNewArray(size);
-}
-
-SHIM_HIDDEN void* ShimCppNewArrayNoThrow(size_t size, const std::nothrow_t&) noexcept {
- return __shimCppNewArray(size);
-}
-
-SHIM_HIDDEN void ShimCppDelete(void* address) {
- __shimCppDelete(address);
-}
-
-SHIM_HIDDEN void ShimCppDeleteNoThrow(void* address, const std::nothrow_t&) noexcept {
- __shimCppDelete(address);
-}
-
-SHIM_HIDDEN void ShimCppDeleteArray(void* address) {
- __shimCppDeleteArray(address);
-}
-
-SHIM_HIDDEN void ShimCppDeleteArrayNoThrow(void* address, const std::nothrow_t&) noexcept {
- __shimCppDeleteArray(address);
-}
-} // extern "C"
-
-static void* __shimCppNew(size_t size) {
- return operator new(size);
-}
-
-static void* __shimCppNewArray(size_t size) {
- return operator new[](size);
-}
-
-static void __shimCppDelete(void* address) {
- operator delete(address);
-}
-
-static void __shimCppDeleteArray(void* address) {
- operator delete[](address);
-}
diff --git a/src/core/api/qtbug-61521.cpp b/src/core/api/qtbug-61521.cpp
deleted file mode 100644
index 002a1af22..000000000
--- a/src/core/api/qtbug-61521.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#include <stdlib.h>
-#include <malloc.h>
-
-#define SHIM_ALIAS_SYMBOL(fn) __attribute__((weak, alias(#fn)))
-#define SHIM_SYMBOL_VERSION(fn) __asm__(".symver __" #fn "," #fn "@Qt_5")
-#define SHIM_HIDDEN __attribute__ ((visibility ("hidden")))
-
-extern "C" {
-
-SHIM_SYMBOL_VERSION(malloc);
-void* __malloc(size_t size)
- SHIM_ALIAS_SYMBOL(ShimMalloc);
-
-SHIM_SYMBOL_VERSION(free);
-void __free(void* ptr)
- SHIM_ALIAS_SYMBOL(ShimFree);
-
-SHIM_SYMBOL_VERSION(realloc);
-void* __realloc(void* ptr, size_t size)
- SHIM_ALIAS_SYMBOL(ShimRealloc);
-
-SHIM_SYMBOL_VERSION(calloc);
-void* __calloc(size_t n, size_t size)
- SHIM_ALIAS_SYMBOL(ShimCalloc);
-
-SHIM_SYMBOL_VERSION(cfree);
-void __cfree(void* ptr)
- SHIM_ALIAS_SYMBOL(ShimCFree);
-
-SHIM_SYMBOL_VERSION(memalign);
-void* __memalign(size_t align, size_t s)
- SHIM_ALIAS_SYMBOL(ShimMemalign);
-
-SHIM_SYMBOL_VERSION(valloc);
-void* __valloc(size_t size)
- SHIM_ALIAS_SYMBOL(ShimValloc);
-
-SHIM_SYMBOL_VERSION(pvalloc);
-void* __pvalloc(size_t size)
- SHIM_ALIAS_SYMBOL(ShimPvalloc);
-
-SHIM_SYMBOL_VERSION(posix_memalign);
-int __posix_memalign(void** r, size_t a, size_t s)
- SHIM_ALIAS_SYMBOL(ShimPosixMemalign);
-
-SHIM_HIDDEN void* ShimMalloc(size_t size) {
- return malloc(size);
-}
-
-SHIM_HIDDEN void ShimFree(void* ptr) {
- free(ptr);
-}
-
-SHIM_HIDDEN void* ShimRealloc(void* ptr, size_t size) {
- return realloc(ptr,size);
-}
-
-SHIM_HIDDEN void* ShimCalloc(size_t n, size_t size) {
- return calloc(n,size);
-}
-
-SHIM_HIDDEN void ShimCFree(void* ptr) {
- free(ptr);
-}
-
-SHIM_HIDDEN void* ShimMemalign(size_t align, size_t s) {
- return memalign(align,s);
-}
-
-SHIM_HIDDEN void* ShimValloc(size_t size) {
- return valloc(size);
-}
-
-SHIM_HIDDEN void* ShimPvalloc(size_t size) {
- return pvalloc(size);
-}
-
-SHIM_HIDDEN int ShimPosixMemalign(void** r, size_t a, size_t s) {
- return posix_memalign(r,a,s);
-}
-} // extern "C"
diff --git a/src/core/api/qtwebenginecoreglobal.cpp b/src/core/api/qtwebenginecoreglobal.cpp
index 3c9387a10..e6a551e65 100644
--- a/src/core/api/qtwebenginecoreglobal.cpp
+++ b/src/core/api/qtwebenginecoreglobal.cpp
@@ -50,6 +50,7 @@
#endif
#endif
#include <QThread>
+#include <QQuickWindow>
#if QT_CONFIG(opengl)
QT_BEGIN_NAMESPACE
@@ -105,83 +106,125 @@ Q_WEBENGINECORE_PRIVATE_EXPORT void initialize()
qputenv("QT_MAC_PRO_WEBENGINE_WORKAROUND", "1");
#endif
// No need to override the shared context if QApplication already set one (e.g with Qt::AA_ShareOpenGLContexts).
- if (qt_gl_global_share_context())
- return;
+ if (!qt_gl_global_share_context()) {
- QCoreApplication *app = QCoreApplication::instance();
- if (!app) {
- qFatal("QtWebEngine::initialize() but no core application instance.");
- return;
- }
-
- // Bail out silently if the user did not construct a QGuiApplication.
- if (!qobject_cast<QGuiApplication *>(app))
- return;
-
- if (app->thread() != QThread::currentThread()) {
- qFatal("QtWebEngine::initialize() must be called from the Qt gui thread.");
- return;
- }
+ QCoreApplication *app = QCoreApplication::instance();
+ if (!app) {
+ qFatal("QtWebEngine::initialize() but no core application instance.");
+ return;
+ }
- if (shareContext)
- return;
+ // Bail out silently if the user did not construct a QGuiApplication.
+ if (!qobject_cast<QGuiApplication *>(app))
+ return;
- shareContext = new QOpenGLContext;
- QSurfaceFormat format = QSurfaceFormat::defaultFormat();
-// format.setOption(QSurfaceFormat::ResetNotification);
+ if (app->thread() != QThread::currentThread()) {
+ qFatal("QtWebEngine::initialize() must be called from the Qt gui thread.");
+ return;
+ }
-#ifdef Q_OS_MACOS
- if (format == QSurfaceFormat()) {
- QOpenGLContext testContext;
-
- // Chromium turns off OpenGL for CoreProfiles with versions < 4.1
- // The newest Mac that only supports 3.3 was released in Mid 2011,
- // so it should be safe to request 4.1, but we still double check it
- // works in order not to set an invalid default surface format.
- format.setVersion(4, 1);
- format.setProfile(QSurfaceFormat::CoreProfile);
-
- testContext.setFormat(format);
- if (testContext.create()) {
- QOffscreenSurface surface;
- surface.setFormat(format);
- surface.create();
-
- if (testContext.makeCurrent(&surface)) {
- // The Cocoa QPA integration allows sharing between OpenGL 3.2 and 4.1 contexts,
- // which means even though we requested a 4.1 context, if we only get a 3.2 context,
- // it will still work an Chromium will not black list it.
- if (testContext.format().version() >= qMakePair(3, 2) &&
- testContext.format().profile() == QSurfaceFormat::CoreProfile &&
- !isCurrentContextSoftware()) {
- QSurfaceFormat::setDefaultFormat(format);
- } else {
- qWarning("The available OpenGL surface format was either not version 3.2 or higher or not a Core Profile.\n"
- "Chromium on macOS will fall back to software rendering in this case.\n"
- "Hardware acceleration and features such as WebGL will not be available.");
- format = QSurfaceFormat::defaultFormat();
- }
- testContext.doneCurrent();
+ if (shareContext)
+ return;
+
+ shareContext = new QOpenGLContext;
+ QSurfaceFormat format = QSurfaceFormat::defaultFormat();
+
+#if defined(Q_OS_MACOS)
+ if (format == QSurfaceFormat()) {
+ QOpenGLContext testContext;
+
+ // Chromium turns off OpenGL for CoreProfiles with versions < 4.1
+ // The newest Mac that only supports 3.3 was released in Mid 2011,
+ // so it should be safe to request 4.1, but we still double check it
+ // works in order not to set an invalid default surface format.
+ format.setVersion(4, 1);
+ format.setProfile(QSurfaceFormat::CoreProfile);
+
+ testContext.setFormat(format);
+ if (testContext.create()) {
+ QOffscreenSurface surface;
+ surface.setFormat(format);
+ surface.create();
+
+ if (testContext.makeCurrent(&surface)) {
+ // The Cocoa QPA integration allows sharing between OpenGL 3.2 and 4.1 contexts,
+ // which means even though we requested a 4.1 context, if we only get a 3.2
+ // context, it will still work an Chromium will not black list it.
+ if (testContext.format().version() >= qMakePair(3, 2)
+ && testContext.format().profile() == QSurfaceFormat::CoreProfile
+ && !isCurrentContextSoftware()) {
+ QSurfaceFormat::setDefaultFormat(format);
+ } else {
+ qWarning("The available OpenGL surface format was either not version 3.2 "
+ "or higher or not a Core Profile.\n"
+ "Chromium on macOS will fall back to software rendering in this "
+ "case.\n"
+ "Hardware acceleration and features such as WebGL will not be "
+ "available.");
+ format = QSurfaceFormat::defaultFormat();
+ }
+ testContext.doneCurrent();
+ }
+ surface.destroy();
+ }
+ } else {
+ // The user explicitly requested a specific surface format that does not fit Chromium's
+ // requirements. Warn them about this.
+ if (format.version() < qMakePair(3, 2)
+ || format.profile() != QSurfaceFormat::CoreProfile) {
+ qWarning("An OpenGL surfcace format was requested that is either not version 3.2 "
+ "or higher or a not Core Profile.\n"
+ "Chromium on macOS will fall back to software rendering in this case.\n"
+ "Hardware acceleration and features such as WebGL will not be available.");
}
- surface.destroy();
- }
- } else {
- // The user explicitly requested a specific surface format that does not fit Chromium's requirements. Warn them about this.
- if (format.version() < qMakePair(3,2) || format.profile() != QSurfaceFormat::CoreProfile) {
- qWarning("An OpenGL surfcace format was requested that is either not version 3.2 or higher or a not Core Profile.\n"
- "Chromium on macOS will fall back to software rendering in this case.\n"
- "Hardware acceleration and features such as WebGL will not be available.");
}
- }
#endif
- shareContext->setFormat(format);
- shareContext->create();
- qAddPostRoutine(deleteShareContext);
- qt_gl_set_global_share_context(shareContext);
+ shareContext->setFormat(format);
+ shareContext->create();
+ qAddPostRoutine(deleteShareContext);
+ qt_gl_set_global_share_context(shareContext);
+
+ // Classes like QOpenGLWidget check for the attribute
+ app->setAttribute(Qt::AA_ShareOpenGLContexts);
+ }
+
+#if defined(Q_OS_MACOS)
+ // Check that the default QSurfaceFormat OpenGL profile is compatible with the global OpenGL
+ // shared context profile, otherwise this could lead to a nasty crash.
+ QSurfaceFormat sharedFormat = qt_gl_global_share_context()->format();
+ QSurfaceFormat defaultFormat = QSurfaceFormat::defaultFormat();
+
+ if (defaultFormat.profile() != sharedFormat.profile()
+ && defaultFormat.profile() == QSurfaceFormat::CoreProfile
+ && defaultFormat.version() >= qMakePair(3, 2)) {
+ qFatal("QWebEngine: Default QSurfaceFormat OpenGL profile is not compatible with the "
+ "global shared context OpenGL profile. Please make sure you set a compatible "
+ "QSurfaceFormat before the QtGui application instance is created.");
+ }
+#endif
- // Classes like QOpenGLWidget check for the attribute
- app->setAttribute(Qt::AA_ShareOpenGLContexts);
#endif // QT_CONFIG(opengl)
}
} // namespace QtWebEngineCore
+
+static void initialize()
+{
+#if QT_CONFIG(opengl)
+ if (QCoreApplication::instance()) {
+ // On window/ANGLE, calling QtWebEngine::initialize from DllMain will result in a crash.
+ if (!qt_gl_global_share_context()) {
+ qWarning("Qt WebEngine seems to be initialized from a plugin. Please "
+ "set Qt::AA_ShareOpenGLContexts using QCoreApplication::setAttribute and "
+ "QSGRendererInterface::OpenGLRhi using QQuickWindow::setGraphicsApi "
+ "before constructing QGuiApplication.");
+ }
+ return;
+ }
+ // QCoreApplication is not yet instantiated, ensuring the call will be deferred
+ qAddPreRoutine(QtWebEngineCore::initialize);
+ QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGLRhi);
+#endif // QT_CONFIG(opengl)
+}
+
+Q_CONSTRUCTOR_FUNCTION(initialize)
diff --git a/src/core/api/qwebenginecallback_p.h b/src/core/api/qwebenginecallback_p.h
index 133a86f6d..9cc25b7fd 100644
--- a/src/core/api/qwebenginecallback_p.h
+++ b/src/core/api/qwebenginecallback_p.h
@@ -244,7 +244,7 @@ inline void CallbackDirectory::CallbackSharedDataPointer<T>::invokeEmpty()
parent->invokeEmptyInternal(callback);
}
-#define CHECK_RELOCATABLE(x) Q_STATIC_ASSERT((QTypeInfoQuery<QWebEngineCallback<x>>::isRelocatable));
+#define CHECK_RELOCATABLE(x) Q_STATIC_ASSERT((QTypeInfo<QWebEngineCallback<x>>::isRelocatable));
FOR_EACH_TYPE(CHECK_RELOCATABLE)
#undef CHECK_RELOCATABLE
diff --git a/src/webenginewidgets/api/qwebenginecertificateerror.cpp b/src/core/api/qwebenginecertificateerror.cpp
index d86019af8..40c9a1c7b 100644
--- a/src/webenginewidgets/api/qwebenginecertificateerror.cpp
+++ b/src/core/api/qwebenginecertificateerror.cpp
@@ -47,67 +47,18 @@ QT_BEGIN_NAMESPACE
\class QWebEngineCertificateError
\brief The QWebEngineCertificateError class provides information about a certificate error.
\since 5.4
- \inmodule QtWebEngineWidgets
+ \inmodule QtWebEngineCore
Provides information about a certificate error. This class is used as a parameter of
QWebEnginePage::certificateError().
*/
-class QWebEngineCertificateErrorPrivate : public QSharedData {
-public:
- QWebEngineCertificateErrorPrivate(int error, QUrl url, bool overridable, QString errorDescription);
-
- ~QWebEngineCertificateErrorPrivate() {
- if (deferred && !answered)
- rejectCertificate();
- }
-
- void resolveError(bool accept) {
- if (answered)
- return;
- answered = true;
- if (overridable) {
- if (auto ctl = controller.lock())
- ctl->accept(accept);
- }
- }
-
- void ignoreCertificateError() { resolveError(true); }
- void rejectCertificate() { resolveError(false); }
-
- QWebEngineCertificateError::Error error;
- QUrl url;
- bool overridable;
- QString errorDescription;
- QList<QSslCertificate> certificateChain;
-
- bool answered = false, deferred = false;
- QWeakPointer<CertificateErrorController> controller;
-
- Q_DISABLE_COPY(QWebEngineCertificateErrorPrivate)
-};
-
-QWebEngineCertificateErrorPrivate::QWebEngineCertificateErrorPrivate(int error, QUrl url, bool overridable, QString errorDescription)
- : error(QWebEngineCertificateError::Error(error))
- , url(url)
- , overridable(overridable)
- , errorDescription(errorDescription)
-{ }
-
-/*! \internal
-*/
-QWebEngineCertificateError::QWebEngineCertificateError(int error, QUrl url, bool overridable, QString errorDescription)
- : d(new QWebEngineCertificateErrorPrivate(error, url, overridable, errorDescription))
-{ }
-
/*! \internal
*/
-QWebEngineCertificateError::QWebEngineCertificateError(const QSharedPointer<CertificateErrorController> &controller)
- : d(new QWebEngineCertificateErrorPrivate(controller->error(), controller->url(),
- controller->overridable(), controller->errorString()))
+QWebEngineCertificateError::QWebEngineCertificateError(
+ const QSharedPointer<QtWebEngineCore::CertificateErrorController> &controller)
+ : d(controller)
{
- d->controller = controller;
- d->certificateChain = controller->certificateChain();
}
QWebEngineCertificateError::QWebEngineCertificateError(const QWebEngineCertificateError &) = default;
@@ -116,13 +67,10 @@ QWebEngineCertificateError& QWebEngineCertificateError::operator=(const QWebEngi
/*! \internal
*/
-QWebEngineCertificateError::~QWebEngineCertificateError()
-{
-
-}
+QWebEngineCertificateError::~QWebEngineCertificateError() = default;
/*!
- \enum QWebEngineCertificateError::Error
+ \enum QWebEngineCertificateError::Type
This enum describes the type of certificate error encountered.
@@ -150,36 +98,37 @@ QWebEngineCertificateError::~QWebEngineCertificateError()
\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.0)
*/
/*!
Returns whether this error can be overridden and accepted.
- \sa error(), errorDescription()
+ \sa error(), description()
*/
bool QWebEngineCertificateError::isOverridable() const
{
- return d->overridable;
+ return d->overridable();
}
/*!
Returns the URL that triggered the error.
- \sa error(), errorDescription()
+ \sa error(), description()
*/
QUrl QWebEngineCertificateError::url() const
{
- return d->url;
+ return d->url();
}
/*!
Returns the type of the error.
- \sa errorDescription(), isOverridable()
+ \sa description(), isOverridable()
*/
-QWebEngineCertificateError::Error QWebEngineCertificateError::error() const
+QWebEngineCertificateError::Type QWebEngineCertificateError::type() const
{
- return d->error;
+ return d->error();
}
/*!
@@ -187,9 +136,9 @@ QWebEngineCertificateError::Error QWebEngineCertificateError::error() const
\sa error(), url(), isOverridable()
*/
-QString QWebEngineCertificateError::errorDescription() const
+QString QWebEngineCertificateError::description() const
{
- return d->errorDescription;
+ return d->errorString();
}
/*!
@@ -197,9 +146,9 @@ QString QWebEngineCertificateError::errorDescription() const
Marks the certificate error for delayed handling.
- This function should be called when there is a need to postpone the decision whether to ignore a
- certificate error, for example, while waiting for user input. When called, the function pauses the
- URL request until ignoreCertificateError() or rejectCertificate() is called.
+ This function should be called when there is a need to postpone the decision whether to accept a
+ certificate, for example, while waiting for user input. When called, the function pauses the
+ URL request until acceptCertificate() or rejectCertificate() is called.
\note It is only possible to defer overridable certificate errors.
@@ -207,26 +156,15 @@ QString QWebEngineCertificateError::errorDescription() const
*/
void QWebEngineCertificateError::defer()
{
- if (isOverridable())
- d->deferred = true;
+ d->defer();
}
/*!
\since 5.14
- Returns whether the decision for error handling was delayed and the URL load was halted.
+ Accepts the certificate and continues the loading of the requested URL.
*/
-bool QWebEngineCertificateError::deferred() const
-{
- return d->deferred;
-}
-
-/*!
- \since 5.14
-
- Ignores the certificate error and continues the loading of the requested URL.
-*/
-void QWebEngineCertificateError::ignoreCertificateError()
+void QWebEngineCertificateError::acceptCertificate()
{
d->ignoreCertificateError();
}
@@ -244,23 +182,13 @@ void QWebEngineCertificateError::rejectCertificate()
/*!
\since 5.14
- Returns \c true if the error was explicitly rejected or ignored.
-*/
-bool QWebEngineCertificateError::answered() const
-{
- return d->answered;
-}
-
-/*!
- \since 5.14
-
Returns the peer's chain of digital certificates.
Chain starts with the peer's immediate certificate and ending with the CA's certificate.
*/
QList<QSslCertificate> QWebEngineCertificateError::certificateChain() const
{
- return d->certificateChain;
+ return d->certificateChain();
}
QT_END_NAMESPACE
diff --git a/src/webenginewidgets/api/qwebenginecertificateerror.h b/src/core/api/qwebenginecertificateerror.h
index a32f7ab8e..ffcebaf9b 100644
--- a/src/webenginewidgets/api/qwebenginecertificateerror.h
+++ b/src/core/api/qwebenginecertificateerror.h
@@ -40,24 +40,33 @@
#ifndef QWEBENGINECERTIFICATEERROR_H
#define QWEBENGINECERTIFICATEERROR_H
-#include <QtWebEngineWidgets/qtwebenginewidgetsglobal.h>
+#include <QtWebEngineCore/qtwebenginecoreglobal.h>
#include <QtCore/qsharedpointer.h>
#include <QtCore/qurl.h>
#include <QtNetwork/QSslCertificate>
+namespace QtWebEngineCore {
+class WebContentsDelegateQt;
+class CertificateErrorController;
+}
+
QT_BEGIN_NAMESPACE
-class CertificateErrorController;
-class QWebEngineCertificateErrorPrivate;
+class Q_WEBENGINECORE_EXPORT QWebEngineCertificateError {
+ Q_GADGET
+ Q_PROPERTY(QUrl url READ url CONSTANT FINAL)
+ Q_PROPERTY(Type type READ type CONSTANT FINAL)
+ Q_PROPERTY(QString description READ description CONSTANT FINAL)
+ Q_PROPERTY(bool overridable READ isOverridable CONSTANT FINAL)
-class QWEBENGINEWIDGETS_EXPORT QWebEngineCertificateError {
public:
- QWebEngineCertificateError(int error, QUrl url, bool overridable, QString errorDescription);
+ QWebEngineCertificateError(const QWebEngineCertificateError &other);
+ QWebEngineCertificateError& operator=(const QWebEngineCertificateError &other);
~QWebEngineCertificateError();
- // Keep this identical to CertificateErrorController::CertificateError, or add mapping layer.
- enum Error {
+ // Keep this identical to NET_ERROR in net_error_list.h, or add mapping layer.
+ enum Type {
SslPinnedKeyNotInCertificateChain = -150,
CertificateCommonNameInvalid = -200,
CertificateDateInvalid = -201,
@@ -73,32 +82,32 @@ public:
CertificateNameConstraintViolation = -212,
CertificateValidityTooLong = -213,
CertificateTransparencyRequired = -214,
+ CertificateSymantecLegacy = -215,
CertificateKnownInterceptionBlocked = -217,
+ SslObsoleteVersion = -218,
};
+ Q_ENUM(Type)
- Error error() const;
+ Type type() const;
QUrl url() const;
bool isOverridable() const;
- QString errorDescription() const;
+ QString description() const;
- QWebEngineCertificateError(const QWebEngineCertificateError &other);
- QWebEngineCertificateError& operator=(const QWebEngineCertificateError &other);
-
- void defer();
- bool deferred() const;
-
- void rejectCertificate();
- void ignoreCertificateError();
- bool answered() const;
+ Q_INVOKABLE void defer();
+ Q_INVOKABLE void rejectCertificate();
+ Q_INVOKABLE void acceptCertificate();
QList<QSslCertificate> certificateChain() const;
private:
- friend class QWebEnginePagePrivate;
- QWebEngineCertificateError(const QSharedPointer<CertificateErrorController> &controller);
- QExplicitlySharedDataPointer<QWebEngineCertificateErrorPrivate> d;
+ friend class QtWebEngineCore::WebContentsDelegateQt;
+ QWebEngineCertificateError(
+ const QSharedPointer<QtWebEngineCore::CertificateErrorController> &controller);
+ QSharedPointer<QtWebEngineCore::CertificateErrorController> d;
};
QT_END_NAMESPACE
+Q_DECLARE_METATYPE(QWebEngineCertificateError)
+
#endif // QWEBENGINECERTIFICATEERROR_H
diff --git a/src/webenginewidgets/api/qwebengineclientcertificateselection.cpp b/src/core/api/qwebengineclientcertificateselection.cpp
index 9eca01bbe..febfe0a21 100644
--- a/src/webenginewidgets/api/qwebengineclientcertificateselection.cpp
+++ b/src/core/api/qwebengineclientcertificateselection.cpp
@@ -38,9 +38,6 @@
****************************************************************************/
#include "qwebengineclientcertificateselection.h"
-
-#if !defined(QT_NO_SSL) || QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
-
#include "client_cert_select_controller.h"
QT_BEGIN_NAMESPACE
@@ -63,8 +60,9 @@ QT_BEGIN_NAMESPACE
/*! \internal
*/
-QWebEngineClientCertificateSelection::QWebEngineClientCertificateSelection(QSharedPointer<ClientCertSelectController> selectController)
- : d_ptr(selectController)
+QWebEngineClientCertificateSelection::QWebEngineClientCertificateSelection(
+ QSharedPointer<QtWebEngineCore::ClientCertSelectController> selectController)
+ : d_ptr(selectController)
{}
QWebEngineClientCertificateSelection::QWebEngineClientCertificateSelection(const QWebEngineClientCertificateSelection &other)
@@ -86,7 +84,7 @@ QWebEngineClientCertificateSelection::~QWebEngineClientCertificateSelection()
\sa select()
*/
-QVector<QSslCertificate> QWebEngineClientCertificateSelection::certificates() const
+QList<QSslCertificate> QWebEngineClientCertificateSelection::certificates() const
{
return d_ptr->certificates();
}
@@ -124,4 +122,3 @@ QUrl QWebEngineClientCertificateSelection::host() const
QT_END_NAMESPACE
-#endif // !defined(QT_NO_SSL) || QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
diff --git a/src/webenginewidgets/api/qwebengineclientcertificateselection.h b/src/core/api/qwebengineclientcertificateselection.h
index d451d09ae..81c626f73 100644
--- a/src/webenginewidgets/api/qwebengineclientcertificateselection.h
+++ b/src/core/api/qwebengineclientcertificateselection.h
@@ -40,19 +40,19 @@
#ifndef QWEBENGINECLIENTCERTSELECTION_H
#define QWEBENGINECLIENTCERTSELECTION_H
-#include <QtWebEngineWidgets/qtwebenginewidgetsglobal.h>
+#include <QtWebEngineCore/qtwebenginecoreglobal.h>
#include <QtNetwork/qtnetwork-config.h>
-
-#if !defined(QT_NO_SSL) || QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
-
+#include <QtCore/qlist.h>
#include <QtCore/qscopedpointer.h>
-#include <QtCore/qvector.h>
#include <QtNetwork/qsslcertificate.h>
-QT_BEGIN_NAMESPACE
+namespace QtWebEngineCore {
class ClientCertSelectController;
+}
-class QWEBENGINEWIDGETS_EXPORT QWebEngineClientCertificateSelection {
+QT_BEGIN_NAMESPACE
+
+class Q_WEBENGINECORE_EXPORT QWebEngineClientCertificateSelection {
public:
QWebEngineClientCertificateSelection(const QWebEngineClientCertificateSelection &);
~QWebEngineClientCertificateSelection();
@@ -63,18 +63,17 @@ public:
void select(const QSslCertificate &certificate);
void selectNone();
- QVector<QSslCertificate> certificates() const;
+ QList<QSslCertificate> certificates() const;
private:
friend class QWebEnginePagePrivate;
- QWebEngineClientCertificateSelection(QSharedPointer<ClientCertSelectController>);
+ QWebEngineClientCertificateSelection(
+ QSharedPointer<QtWebEngineCore::ClientCertSelectController>);
- QSharedPointer<ClientCertSelectController> d_ptr;
+ QSharedPointer<QtWebEngineCore::ClientCertSelectController> d_ptr;
};
QT_END_NAMESPACE
-#endif // !defined(QT_NO_SSL) || QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
-
#endif // QWEBENGINECLIENTCERTSELECTION_H
diff --git a/src/core/api/qwebengineclientcertificatestore.cpp b/src/core/api/qwebengineclientcertificatestore.cpp
index 84f273328..462a63b26 100644
--- a/src/core/api/qwebengineclientcertificatestore.cpp
+++ b/src/core/api/qwebengineclientcertificatestore.cpp
@@ -88,9 +88,9 @@ void QWebEngineClientCertificateStore::add(const QSslCertificate &certificate, c
Returns an empty list if the store does not contain any certificates.
*/
-QVector<QSslCertificate> QWebEngineClientCertificateStore::certificates() const
+QList<QSslCertificate> QWebEngineClientCertificateStore::certificates() const
{
- QVector<QSslCertificate> certificateList;
+ QList<QSslCertificate> certificateList;
for (auto data : qAsConst(m_storeData->extraCerts))
certificateList.append(data->certificate);
return certificateList;
diff --git a/src/core/api/qwebengineclientcertificatestore.h b/src/core/api/qwebengineclientcertificatestore.h
index a4c83bb2e..a9282f0fb 100644
--- a/src/core/api/qwebengineclientcertificatestore.h
+++ b/src/core/api/qwebengineclientcertificatestore.h
@@ -41,8 +41,10 @@
#define QWEBENGINECLIENTCERTIFICATESTORE_H
#include <QtWebEngineCore/qtwebenginecoreglobal.h>
+#include <QtNetwork/qtnetwork-config.h>
-#include <QtCore/qvector.h>
+#if QT_CONFIG(ssl)
+#include <QtCore/qlist.h>
#include <QtNetwork/qsslcertificate.h>
#include <QtNetwork/qsslkey.h>
@@ -53,13 +55,11 @@ class ProfileAdapter;
QT_BEGIN_NAMESPACE
-#if QT_CONFIG(ssl)
-
class Q_WEBENGINECORE_EXPORT QWebEngineClientCertificateStore {
public:
void add(const QSslCertificate &certificate, const QSslKey &privateKey);
- QVector<QSslCertificate> certificates() const;
+ QList<QSslCertificate> certificates() const;
void remove(const QSslCertificate &certificate);
void clear();
@@ -72,8 +72,7 @@ private:
QtWebEngineCore::ClientCertificateStoreData *m_storeData;
};
-#endif // QT_CONFIG(ssl)
-
QT_END_NAMESPACE
+#endif // QT_CONFIG(ssl)
#endif // QWebEngineClientCertificateStore_H
diff --git a/src/core/api/qwebenginecontextmenurequest.cpp b/src/core/api/qwebenginecontextmenurequest.cpp
new file mode 100644
index 000000000..62a328b72
--- /dev/null
+++ b/src/core/api/qwebenginecontextmenurequest.cpp
@@ -0,0 +1,296 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#include "qwebenginecontextmenurequest.h"
+#include "qwebenginecontextmenurequest_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QWebEngineContextMenuRequest
+ \since 6.0
+ \brief The QWebEngineContextMenuRequest class provides request for populating or extending a context menu with actions.
+
+ \inmodule QtWebEngineCore
+
+ QWebEngineContextMenuRequest is returned by QWebEngineView::lastContextMenuRequest() after a context menu event,
+ and contains information about where the context menu event took place. This is also in the context
+ in which any context specific QWebEnginePage::WebAction will be performed.
+*/
+
+/*!
+ \enum QWebEngineContextMenuRequest::MediaType
+ \readonly
+ \since 6.0
+
+ This enum describes the media type of the context menu request if any.
+
+ \value MediaTypeNone The context is not a media type.
+ \value MediaTypeImage The context is an image element.
+ \value MediaTypeVideo The context is a video element.
+ \value MediaTypeAudio The context is an audio element.
+ \value MediaTypeCanvas The context is a canvas element.
+ \value MediaTypeFile The context is a file.
+ \value MediaTypePlugin The context is a plugin element.
+*/
+
+/*!
+ \enum QWebEngineContextMenuRequest::EditFlag
+ \readonly
+ \since 6.0
+
+ The available edit operations in the current context menu request.
+
+ \value CanUndo Undo is available.
+ \value CanRedo Redo is available.
+ \value CanCut Cut is available.
+ \value CanCopy Copy is available.
+ \value CanPaste Paste is available.
+ \value CanDelete Delete is available.
+ \value CanSelectAll Select All is available.
+ \value CanTranslate Translate is available.
+ \value CanEditRichly Context is richly editable.
+*/
+
+/*!
+ \enum QWebEngineContextMenuRequest::MediaFlag
+ \readonly
+ \since 6.0
+
+ The current media element's status and its available operations.
+ \c MediaNone if the selected web page content is not a media element.
+
+ \value MediaInError An error occurred.
+ \value MediaPaused Media is paused.
+ \value MediaMuted Media is muted.
+ \value MediaLoop Media can be looped.
+ \value MediaCanSave Media can be saved.
+ \value MediaHasAudio Media has audio.
+ \value MediaCanToggleControls Media can show controls.
+ \value MediaControls Media controls are shown.
+ \value MediaCanPrint Media is printable.
+ \value MediaCanRotate Media is rotatable.
+*/
+
+/*!
+ \internal
+*/
+QWebEngineContextMenuRequest::QWebEngineContextMenuRequest(
+ QWebEngineContextMenuRequestPrivate *request)
+ : d(request)
+{
+}
+
+/*!
+ Destroys the context menu request.
+*/
+QWebEngineContextMenuRequest::~QWebEngineContextMenuRequest() = default;
+
+/*!
+ Returns the position of the context menu request, usually the mouse
+ position where the context menu event was triggered.
+*/
+QPoint QWebEngineContextMenuRequest::position() const
+{
+ return d->m_position;
+}
+
+/*!
+ Returns the selected text of the context menu request.
+*/
+QString QWebEngineContextMenuRequest::selectedText() const
+{
+ return d->m_selectedText;
+}
+
+/*!
+ Returns the text of a link if the context menu request was requested for a link.
+*/
+QString QWebEngineContextMenuRequest::linkText() const
+{
+ return d->m_linkText;
+}
+
+/*!
+ Returns the URL of a link if the menu context request is a link.
+ It is not guaranteed to be a valid URL.
+*/
+QUrl QWebEngineContextMenuRequest::linkUrl() const
+{
+ return d->m_unfilteredLinkUrl;
+}
+
+/*!
+ If the context menu request is a media element, returns the URL of that media.
+*/
+QUrl QWebEngineContextMenuRequest::mediaUrl() const
+{
+ return d->m_mediaUrl;
+}
+
+/*!
+ Returns the type of the media element or \c MediaTypeNone
+ if the context menu requestis not a media element.
+*/
+QWebEngineContextMenuRequest::MediaType QWebEngineContextMenuRequest::mediaType() const
+{
+ return static_cast<QWebEngineContextMenuRequest::MediaType>(d->m_mediaType);
+}
+
+/*!
+ Returns \c true if the context menu request is editable by the user;
+ otherwise returns \c false.
+*/
+bool QWebEngineContextMenuRequest::isContentEditable() const
+{
+ return d->m_isEditable;
+}
+
+/*!
+ If the menu context request is a word considered misspelled by the spell-checker,
+ returns the misspelled word.
+
+ For possible replacements of the word, see spellCheckerSuggestions().
+*/
+QString QWebEngineContextMenuRequest::misspelledWord() const
+{
+ return d->m_misspelledWord;
+}
+
+
+/*!
+ If the menu context request is a word considered misspelled by the spell-checker,
+ returns a list of suggested replacements for misspelledWord().
+*/
+QStringList QWebEngineContextMenuRequest::spellCheckerSuggestions() const
+{
+ return d->m_spellCheckerSuggestions;
+}
+
+/*!
+ TODO: needs api in page
+*/
+bool QWebEngineContextMenuRequest::isAccepted() const
+{
+ return d->m_accepted;
+}
+
+/*!
+ TODO: needs api in page
+*/
+void QWebEngineContextMenuRequest::setAccepted(bool accepted)
+{
+ d->m_accepted = accepted;
+}
+
+/*!
+ Returns the current media element's status and its available operations.
+ \c MediaNone if the selected web page content is not a media element.
+*/
+QWebEngineContextMenuRequest::MediaFlags QWebEngineContextMenuRequest::mediaFlags() const
+{
+ return static_cast<QWebEngineContextMenuRequest::MediaFlags>(d->m_mediaFlags);
+}
+
+/*!
+ Returns the available edit operations in the current context
+ or \c CanDoNone if no actions are available.
+*/
+QWebEngineContextMenuRequest::EditFlags QWebEngineContextMenuRequest::editFlags() const
+{
+ return static_cast<QWebEngineContextMenuRequest::EditFlags>(d->m_editFlags);
+}
+
+/*!
+ \internal
+*/
+QUrl QWebEngineContextMenuRequest::filteredLinkUrl() const
+{
+ return d->m_filteredLinkUrl;
+}
+
+/*!
+ \internal
+*/
+QString QWebEngineContextMenuRequest::altText() const
+{
+ return d->m_altText;
+}
+
+/*!
+ \internal
+*/
+QString QWebEngineContextMenuRequest::titleText() const
+{
+ return d->m_titleText;
+}
+
+/*!
+ \internal
+*/
+QUrl QWebEngineContextMenuRequest::referrerUrl() const
+{
+ return !d->m_frameUrl.isEmpty() ? d->m_frameUrl : d->m_pageUrl;
+}
+
+/*!
+ \internal
+*/
+QtWebEngineCore::ReferrerPolicy QWebEngineContextMenuRequest::referrerPolicy() const
+{
+ return d->m_referrerPolicy;
+}
+
+/*!
+ \internal
+*/
+QString QWebEngineContextMenuRequest::suggestedFileName() const
+{
+ return d->m_suggestedFileName;
+}
+
+/*!
+ \internal
+*/
+bool QWebEngineContextMenuRequest::hasImageContent() const
+{
+ return d->m_hasImageContent;
+}
+
+QT_END_NAMESPACE
diff --git a/src/webengine/api/qquickwebenginecontextmenurequest_p.h b/src/core/api/qwebenginecontextmenurequest.h
index bc50eccb8..bc8095dc9 100644
--- a/src/webengine/api/qquickwebenginecontextmenurequest_p.h
+++ b/src/core/api/qwebenginecontextmenurequest.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** 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.
@@ -37,31 +37,39 @@
**
****************************************************************************/
-#ifndef QQUICKWEBENGINECONTEXTMENUREQUEST_H
-#define QQUICKWEBENGINECONTEXTMENUREQUEST_H
+#ifndef QWEBENGINECONTEXTMENUREQUEST_H
+#define QWEBENGINECONTEXTMENUREQUEST_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 <QtWebEngine/private/qtwebengineglobal_p.h>
-#include <QtCore/QScopedPointer>
+#include <QtWebEngineCore/qtwebenginecoreglobal.h>
#include <QtCore/QObject>
#include <QtCore/QUrl>
+#include <QtCore/QPoint>
+#include <QScopedPointer>
namespace QtWebEngineCore {
- class WebEngineContextMenuData;
+class RenderViewContextMenuQt;
+class WebContentsViewQt;
+
+// Must match blink::WebReferrerPolicy
+enum class ReferrerPolicy {
+ Always,
+ Default,
+ NoReferrerWhenDowngrade,
+ Never,
+ Origin,
+ OriginWhenCrossOrigin,
+ NoReferrerWhenDowngradeOriginWhenCrossOrigin,
+ SameOrigin,
+ StrictOrigin,
+ Last = StrictOrigin,
+};
}
QT_BEGIN_NAMESPACE
-class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineContextMenuRequest: public QObject {
+class QWebEngineContextMenuRequestPrivate;
+class Q_WEBENGINECORE_EXPORT QWebEngineContextMenuRequest : public QObject
+{
Q_OBJECT
public:
enum MediaType {
@@ -106,8 +114,7 @@ public:
Q_DECLARE_FLAGS(EditFlags, EditFlag)
Q_FLAG(EditFlags)
- Q_PROPERTY(int x READ x CONSTANT FINAL)
- Q_PROPERTY(int y READ y CONSTANT FINAL)
+ Q_PROPERTY(QPoint position READ position CONSTANT FINAL)
Q_PROPERTY(QString selectedText READ selectedText CONSTANT FINAL)
Q_PROPERTY(QString linkText READ linkText CONSTANT FINAL)
Q_PROPERTY(QUrl linkUrl READ linkUrl CONSTANT FINAL)
@@ -120,9 +127,8 @@ public:
Q_PROPERTY(MediaFlags mediaFlags READ mediaFlags CONSTANT FINAL REVISION 1)
Q_PROPERTY(EditFlags editFlags READ editFlags CONSTANT FINAL REVISION 1)
- ~QQuickWebEngineContextMenuRequest();
- int x() const;
- int y() const;
+ virtual ~QWebEngineContextMenuRequest();
+ QPoint position() const;
QString selectedText() const;
QString linkText() const;
QUrl linkUrl() const;
@@ -137,14 +143,26 @@ public:
EditFlags editFlags() const;
private:
- QQuickWebEngineContextMenuRequest(const QtWebEngineCore::WebEngineContextMenuData &data, QObject *parent = nullptr);
- QScopedPointer<QtWebEngineCore::WebEngineContextMenuData> m_data;
- bool m_accepted;
- friend class QQuickWebEngineView;
+ QUrl filteredLinkUrl() const;
+ QString altText() const;
+ QString titleText() const;
+ QUrl referrerUrl() const;
+ QtWebEngineCore::ReferrerPolicy referrerPolicy() const;
+ bool hasImageContent() const;
+ QString suggestedFileName() const;
+
+private:
+ QWebEngineContextMenuRequest(QWebEngineContextMenuRequestPrivate *d);
+ QScopedPointer<QWebEngineContextMenuRequestPrivate> d;
+ friend class QtWebEngineCore::WebContentsViewQt;
+ friend class QtWebEngineCore::RenderViewContextMenuQt;
friend class QQuickWebEngineViewPrivate;
- Q_DISABLE_COPY(QQuickWebEngineContextMenuRequest)
+ friend class QQuickWebEngineView;
+ friend class ContextMenuRequestJSWrapper;
+ friend class QWebEngineViewPrivate;
+ friend class QWebEnginePage;
};
QT_END_NAMESPACE
-#endif // QQUICKWEBENGINECONTEXTMENUREQUEST_H
+#endif // QWEBENGINECONTEXTMENUREQUEST_H
diff --git a/src/webengine/api/qquickwebenginescript_p.h b/src/core/api/qwebenginecontextmenurequest_p.h
index 30b47a654..c7b98a871 100644
--- a/src/webengine/api/qquickwebenginescript_p.h
+++ b/src/core/api/qwebenginecontextmenurequest_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** 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.
@@ -37,8 +37,8 @@
**
****************************************************************************/
-#ifndef QQUICKWEBENGINESCRIPT_P_H
-#define QQUICKWEBENGINESCRIPT_P_H
+#ifndef QWEBENGINECONTEXTMENUREQUEST_P_H
+#define QWEBENGINECONTEXTMENUREQUEST_P_H
//
// W A R N I N G
@@ -51,37 +51,43 @@
// We mean it.
//
-#include "qquickwebenginescript.h"
-
-#include <QtCore/QBasicTimer>
-#include "user_script.h"
-#include "web_contents_adapter.h"
-
-namespace QtWebEngineCore {
-class UserResourceControllerHost;
-class WebContentsAdapter;
-} // namespace
+#include "qtwebenginecoreglobal_p.h"
+#include "qwebenginecontextmenurequest.h"
+#include <QPoint>
+#include <QUrl>
QT_BEGIN_NAMESPACE
-class QQuickWebEngineScriptPrivate {
+class QWebEngineContextMenuRequestPrivate
+{
public:
- Q_DECLARE_PUBLIC(QQuickWebEngineScript)
- QQuickWebEngineScriptPrivate();
- void aboutToUpdateUnderlyingScript();
- void bind(QtWebEngineCore::UserResourceControllerHost *, QtWebEngineCore::WebContentsAdapter * = 0);
-
- QtWebEngineCore::UserScript coreScript;
- QBasicTimer m_basicTimer;
- QtWebEngineCore::UserResourceControllerHost *m_controllerHost;
- QtWebEngineCore::WebContentsAdapter *m_adapter;
- QUrl m_sourceUrl;
-
-private:
- QQuickWebEngineScript *q_ptr;
-
+ bool m_accepted = false;
+ bool m_hasImageContent = false;
+ bool m_isEditable = false;
+ bool m_isSpellCheckerEnabled = false;
+ uint m_mediaType = 0;
+ uint m_mediaFlags = 0;
+ uint m_editFlags = 0;
+ QPoint m_position;
+ QUrl m_filteredLinkUrl;
+ QUrl m_unfilteredLinkUrl;
+ QUrl m_mediaUrl;
+ QString m_altText;
+ QString m_linkText;
+ QString m_titleText;
+ QString m_selectedText;
+ QString m_suggestedFileName;
+ QString m_misspelledWord;
+ QStringList m_spellCheckerSuggestions;
+ QUrl m_pageUrl;
+ QUrl m_frameUrl;
+ QtWebEngineCore::ReferrerPolicy m_referrerPolicy = QtWebEngineCore::ReferrerPolicy::Default;
+ // Some likely candidates for future additions as we add support for the related actions:
+ // bool isImageBlocked;
+ // <enum tbd> mediaType;
+ // ...
};
QT_END_NAMESPACE
-#endif // QQUICKWEBENGINESCRIPT_P_H
+#endif
diff --git a/src/core/api/qwebenginecookiestore_p.h b/src/core/api/qwebenginecookiestore_p.h
index a79e2b095..e6fa245c2 100644
--- a/src/core/api/qwebenginecookiestore_p.h
+++ b/src/core/api/qwebenginecookiestore_p.h
@@ -56,7 +56,7 @@
#include "qwebenginecallback_p.h"
#include "qwebenginecookiestore.h"
-#include <QVector>
+#include <QList>
#include <QNetworkCookie>
#include <QUrl>
@@ -79,7 +79,7 @@ class Q_WEBENGINECORE_PRIVATE_EXPORT QWebEngineCookieStorePrivate {
public:
QtWebEngineCore::CallbackDirectory callbackDirectory;
std::function<bool(const QWebEngineCookieStore::FilterRequest &)> filterCallback;
- QVector<CookieData> m_pendingUserCookies;
+ QList<CookieData> m_pendingUserCookies;
quint64 m_nextCallbackId;
bool m_deleteSessionCookiesPending;
bool m_deleteAllCookiesPending;
diff --git a/src/webenginewidgets/api/qwebenginedownloaditem.cpp b/src/core/api/qwebenginedownloadrequest.cpp
index 7366dbf59..58f02ee4f 100644
--- a/src/webenginewidgets/api/qwebenginedownloaditem.cpp
+++ b/src/core/api/qwebenginedownloadrequest.cpp
@@ -37,11 +37,10 @@
**
****************************************************************************/
-#include "qwebenginedownloaditem.h"
-#include "qwebenginedownloaditem_p.h"
+#include "qwebenginedownloadrequest.h"
+#include "qwebenginedownloadrequest_p.h"
#include "profile_adapter.h"
-#include "qwebengineprofile_p.h"
#include <QDir>
#include "QFileInfo"
@@ -50,65 +49,63 @@ QT_BEGIN_NAMESPACE
using QtWebEngineCore::ProfileAdapterClient;
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::NoReason, QWebEngineDownloadItem::NoReason)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileFailed, QWebEngineDownloadItem::FileFailed)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileAccessDenied, QWebEngineDownloadItem::FileAccessDenied)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileNoSpace, QWebEngineDownloadItem::FileNoSpace)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileNameTooLong, QWebEngineDownloadItem::FileNameTooLong)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileTooLarge, QWebEngineDownloadItem::FileTooLarge)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileVirusInfected, QWebEngineDownloadItem::FileVirusInfected)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileTransientError, QWebEngineDownloadItem::FileTransientError)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileBlocked, QWebEngineDownloadItem::FileBlocked)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileSecurityCheckFailed, QWebEngineDownloadItem::FileSecurityCheckFailed)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileTooShort, QWebEngineDownloadItem::FileTooShort)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileHashMismatch, QWebEngineDownloadItem::FileHashMismatch)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::NetworkFailed, QWebEngineDownloadItem::NetworkFailed)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::NetworkTimeout, QWebEngineDownloadItem::NetworkTimeout)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::NetworkDisconnected, QWebEngineDownloadItem::NetworkDisconnected)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::NetworkServerDown, QWebEngineDownloadItem::NetworkServerDown)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::NetworkInvalidRequest, QWebEngineDownloadItem::NetworkInvalidRequest)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::ServerFailed, QWebEngineDownloadItem::ServerFailed)
-//ASSERT_ENUMS_MATCH(ProfileAdapterClient::ServerNoRange, QWebEngineDownloadItem::ServerNoRange)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::ServerBadContent, QWebEngineDownloadItem::ServerBadContent)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::ServerUnauthorized, QWebEngineDownloadItem::ServerUnauthorized)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::ServerCertProblem, QWebEngineDownloadItem::ServerCertProblem)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::ServerForbidden, QWebEngineDownloadItem::ServerForbidden)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::ServerUnreachable, QWebEngineDownloadItem::ServerUnreachable)
-ASSERT_ENUMS_MATCH(ProfileAdapterClient::UserCanceled, QWebEngineDownloadItem::UserCanceled)
-//ASSERT_ENUMS_MATCH(ProfileAdapterClient::UserShutdown, QWebEngineDownloadItem::UserShutdown)
-//ASSERT_ENUMS_MATCH(ProfileAdapterClient::Crash, QWebEngineDownloadItem::Crash)
-
-static inline QWebEngineDownloadItem::DownloadState toDownloadState(int state)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::NoReason, QWebEngineDownloadRequest::NoReason)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileFailed, QWebEngineDownloadRequest::FileFailed)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileAccessDenied, QWebEngineDownloadRequest::FileAccessDenied)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileNoSpace, QWebEngineDownloadRequest::FileNoSpace)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileNameTooLong, QWebEngineDownloadRequest::FileNameTooLong)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileTooLarge, QWebEngineDownloadRequest::FileTooLarge)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileVirusInfected, QWebEngineDownloadRequest::FileVirusInfected)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileTransientError, QWebEngineDownloadRequest::FileTransientError)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileBlocked, QWebEngineDownloadRequest::FileBlocked)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileSecurityCheckFailed, QWebEngineDownloadRequest::FileSecurityCheckFailed)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileTooShort, QWebEngineDownloadRequest::FileTooShort)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileHashMismatch, QWebEngineDownloadRequest::FileHashMismatch)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::NetworkFailed, QWebEngineDownloadRequest::NetworkFailed)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::NetworkTimeout, QWebEngineDownloadRequest::NetworkTimeout)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::NetworkDisconnected, QWebEngineDownloadRequest::NetworkDisconnected)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::NetworkServerDown, QWebEngineDownloadRequest::NetworkServerDown)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::NetworkInvalidRequest, QWebEngineDownloadRequest::NetworkInvalidRequest)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::ServerFailed, QWebEngineDownloadRequest::ServerFailed)
+//ASSERT_ENUMS_MATCH(ProfileAdapterClient::ServerNoRange, QWebEngineDownloadRequest::ServerNoRange)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::ServerBadContent, QWebEngineDownloadRequest::ServerBadContent)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::ServerUnauthorized, QWebEngineDownloadRequest::ServerUnauthorized)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::ServerCertProblem, QWebEngineDownloadRequest::ServerCertProblem)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::ServerForbidden, QWebEngineDownloadRequest::ServerForbidden)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::ServerUnreachable, QWebEngineDownloadRequest::ServerUnreachable)
+ASSERT_ENUMS_MATCH(ProfileAdapterClient::UserCanceled, QWebEngineDownloadRequest::UserCanceled)
+//ASSERT_ENUMS_MATCH(ProfileAdapterClient::UserShutdown, QWebEngineDownloadRequest::UserShutdown)
+//ASSERT_ENUMS_MATCH(ProfileAdapterClient::Crash, QWebEngineDownloadRequest::Crash)
+
+static inline QWebEngineDownloadRequest::DownloadState toDownloadState(int state)
{
switch (state) {
case ProfileAdapterClient::DownloadInProgress:
- return QWebEngineDownloadItem::DownloadInProgress;
+ return QWebEngineDownloadRequest::DownloadInProgress;
case ProfileAdapterClient::DownloadCompleted:
- return QWebEngineDownloadItem::DownloadCompleted;
+ return QWebEngineDownloadRequest::DownloadCompleted;
case ProfileAdapterClient::DownloadCancelled:
- return QWebEngineDownloadItem::DownloadCancelled;
+ return QWebEngineDownloadRequest::DownloadCancelled;
case ProfileAdapterClient::DownloadInterrupted:
- return QWebEngineDownloadItem::DownloadInterrupted;
+ return QWebEngineDownloadRequest::DownloadInterrupted;
default:
Q_UNREACHABLE();
- return QWebEngineDownloadItem::DownloadCancelled;
+ return QWebEngineDownloadRequest::DownloadCancelled;
}
}
-static inline QWebEngineDownloadItem::DownloadInterruptReason toDownloadInterruptReason(int reason)
+static inline QWebEngineDownloadRequest::DownloadInterruptReason toDownloadInterruptReason(int reason)
{
- return static_cast<QWebEngineDownloadItem::DownloadInterruptReason>(reason);
+ return static_cast<QWebEngineDownloadRequest::DownloadInterruptReason>(reason);
}
/*!
- \class QWebEngineDownloadItem
- \brief The QWebEngineDownloadItem class provides information about a download.
+ \class QWebEngineDownloadRequest
+ \brief The QWebEngineDownloadRequest class provides information about a download.
- \since 5.5
+ \inmodule QtWebEngineCore
- \inmodule QtWebEngineWidgets
-
- QWebEngineDownloadItem models a download throughout its life cycle, starting
+ QWebEngineDownloadRequest models a download throughout its life cycle, starting
with a pending download request and finishing with a completed download. It
can be used, for example, to get information about new downloads, to monitor
progress, and to pause, resume, and cancel downloads.
@@ -117,7 +114,7 @@ static inline QWebEngineDownloadItem::DownloadInterruptReason toDownloadInterrup
QWebEngineProfile's responsibility to notify the application of new download
requests, which it does by emitting the
\l{QWebEngineProfile::downloadRequested}{downloadRequested} signal together
- with a newly created QWebEngineDownloadItem. The application can then
+ with a newly created QWebEngineDownloadRequest. The application can then
examine this item and decide whether to accept it or not. A signal handler
must explicitly call accept() on the item for \QWE to actually start
downloading and writing data to disk. If no signal handler calls accept(),
@@ -160,45 +157,53 @@ static inline QWebEngineDownloadItem::DownloadInterruptReason toDownloadInterrup
QWebEnginePage::download, QWebEnginePage::save
*/
-QWebEngineDownloadItemPrivate::QWebEngineDownloadItemPrivate(QWebEngineProfilePrivate *p, const QUrl &url)
- : profile(p)
+QWebEngineDownloadRequestPrivate::QWebEngineDownloadRequestPrivate(QtWebEngineCore::ProfileAdapter *adapter, const QUrl &url)
+ : m_profileAdapter(adapter)
, downloadFinished(false)
, downloadId(-1)
- , downloadState(QWebEngineDownloadItem::DownloadCancelled)
- , savePageFormat(QWebEngineDownloadItem::MimeHtmlSaveFormat)
- , type(QWebEngineDownloadItem::Attachment)
- , interruptReason(QWebEngineDownloadItem::NoReason)
+ , downloadState(QWebEngineDownloadRequest::DownloadCancelled)
+ , savePageFormat(QWebEngineDownloadRequest::MimeHtmlSaveFormat)
+ , interruptReason(QWebEngineDownloadRequest::NoReason)
, downloadUrl(url)
, downloadPaused(false)
, isCustomFileName(false)
, totalBytes(-1)
, receivedBytes(0)
- , page(0)
+ , isSavePageDownload(false)
+ , m_adapterClient(nullptr)
{
}
-QWebEngineDownloadItemPrivate::~QWebEngineDownloadItemPrivate()
+QWebEngineDownloadRequestPrivate::~QWebEngineDownloadRequestPrivate()
{
}
-void QWebEngineDownloadItemPrivate::update(const ProfileAdapterClient::DownloadItemInfo &info)
+void QWebEngineDownloadRequestPrivate::update(const ProfileAdapterClient::DownloadItemInfo &info)
{
- Q_Q(QWebEngineDownloadItem);
+ Q_Q(QWebEngineDownloadRequest);
- Q_ASSERT(downloadState != QWebEngineDownloadItem::DownloadRequested);
+ Q_ASSERT(downloadState != QWebEngineDownloadRequest::DownloadRequested);
- if (toDownloadInterruptReason(info.downloadInterruptReason) != interruptReason)
+ if (toDownloadInterruptReason(info.downloadInterruptReason) != interruptReason) {
interruptReason = toDownloadInterruptReason(info.downloadInterruptReason);
-
+ Q_EMIT q->interruptReasonChanged();
+ }
if (toDownloadState(info.state) != downloadState) {
downloadState = toDownloadState(info.state);
Q_EMIT q->stateChanged(downloadState);
}
if (info.receivedBytes != receivedBytes || info.totalBytes != totalBytes) {
- receivedBytes = info.receivedBytes;
- totalBytes = info.totalBytes;
- Q_EMIT q->downloadProgress(receivedBytes, totalBytes);
+
+ if (info.receivedBytes != receivedBytes) {
+ receivedBytes = info.receivedBytes;
+ Q_EMIT q->receivedBytesChanged();
+ }
+ if (info.totalBytes != totalBytes) {
+ totalBytes = info.totalBytes;
+ Q_EMIT q->totalBytesChanged();
+ }
+ Q_EMIT q->downloadProgress(receivedBytes, totalBytes);
}
if (info.done)
@@ -206,17 +211,17 @@ void QWebEngineDownloadItemPrivate::update(const ProfileAdapterClient::DownloadI
if (downloadPaused != info.paused) {
downloadPaused = info.paused;
- Q_EMIT q->isPausedChanged(downloadPaused);
+ Q_EMIT q->isPausedChanged();
}
}
-void QWebEngineDownloadItemPrivate::setFinished()
+void QWebEngineDownloadRequestPrivate::setFinished()
{
if (downloadFinished)
return;
downloadFinished = true;
- Q_EMIT q_ptr->finished();
+ Q_EMIT q_ptr->isFinishedChanged();
}
/*!
@@ -229,14 +234,14 @@ void QWebEngineDownloadItemPrivate::setFinished()
\sa finished(), stateChanged()
*/
-void QWebEngineDownloadItem::accept()
+void QWebEngineDownloadRequest::accept()
{
- Q_D(QWebEngineDownloadItem);
+ Q_D(QWebEngineDownloadRequest);
- if (d->downloadState != QWebEngineDownloadItem::DownloadRequested)
+ if (d->downloadState != QWebEngineDownloadRequest::DownloadRequested)
return;
- d->downloadState = QWebEngineDownloadItem::DownloadInProgress;
+ d->downloadState = QWebEngineDownloadRequest::DownloadInProgress;
Q_EMIT stateChanged(d->downloadState);
}
@@ -254,30 +259,29 @@ void QWebEngineDownloadItem::accept()
\sa finished(), stateChanged()
*/
-void QWebEngineDownloadItem::cancel()
+void QWebEngineDownloadRequest::cancel()
{
- Q_D(QWebEngineDownloadItem);
+ Q_D(QWebEngineDownloadRequest);
- QWebEngineDownloadItem::DownloadState state = d->downloadState;
+ QWebEngineDownloadRequest::DownloadState state = d->downloadState;
- if (state == QWebEngineDownloadItem::DownloadCompleted
- || state == QWebEngineDownloadItem::DownloadCancelled)
+ if (state == QWebEngineDownloadRequest::DownloadCompleted
+ || state == QWebEngineDownloadRequest::DownloadCancelled)
return;
// We directly cancel the download request if the user cancels
// before it even started, so no need to notify the profile here.
- if (state == QWebEngineDownloadItem::DownloadInProgress) {
- if (auto profileAdapter = d->profile->profileAdapter())
- profileAdapter->cancelDownload(d->downloadId);
+ if (state == QWebEngineDownloadRequest::DownloadInProgress) {
+ if (d->m_profileAdapter)
+ d->m_profileAdapter->cancelDownload(d->downloadId);
} else {
- d->downloadState = QWebEngineDownloadItem::DownloadCancelled;
+ d->downloadState = QWebEngineDownloadRequest::DownloadCancelled;
Q_EMIT stateChanged(d->downloadState);
d->setFinished();
}
}
/*!
- \since 5.10
Pauses the download.
Has no effect if the state is not \l DownloadInProgress. Does not change the
@@ -286,20 +290,20 @@ void QWebEngineDownloadItem::cancel()
\sa resume(), isPaused()
*/
-void QWebEngineDownloadItem::pause()
+void QWebEngineDownloadRequest::pause()
{
- Q_D(QWebEngineDownloadItem);
+ Q_D(QWebEngineDownloadRequest);
- QWebEngineDownloadItem::DownloadState state = d->downloadState;
+ QWebEngineDownloadRequest::DownloadState state = d->downloadState;
- if (state != QWebEngineDownloadItem::DownloadInProgress)
+ if (state != QWebEngineDownloadRequest::DownloadInProgress)
return;
- d->profile->profileAdapter()->pauseDownload(d->downloadId);
+ if (d->m_profileAdapter)
+ d->m_profileAdapter->pauseDownload(d->downloadId);
}
/*!
- \since 5.10
Resumes the current download if it was paused or interrupted.
Has no effect if the state is not \l DownloadInProgress or \l
@@ -307,29 +311,30 @@ void QWebEngineDownloadItem::pause()
\sa pause(), isPaused(), state()
*/
-void QWebEngineDownloadItem::resume()
+void QWebEngineDownloadRequest::resume()
{
- Q_D(QWebEngineDownloadItem);
+ Q_D(QWebEngineDownloadRequest);
- QWebEngineDownloadItem::DownloadState state = d->downloadState;
+ QWebEngineDownloadRequest::DownloadState state = d->downloadState;
- if (d->downloadFinished || (state != QWebEngineDownloadItem::DownloadInProgress && state != QWebEngineDownloadItem::DownloadInterrupted))
+ if (d->downloadFinished || (state != QWebEngineDownloadRequest::DownloadInProgress && state != QWebEngineDownloadRequest::DownloadInterrupted))
return;
- d->profile->profileAdapter()->resumeDownload(d->downloadId);
+ if (d->m_profileAdapter)
+ d->m_profileAdapter->resumeDownload(d->downloadId);
}
/*!
Returns the download item's ID.
*/
-quint32 QWebEngineDownloadItem::id() const
+quint32 QWebEngineDownloadRequest::id() const
{
- Q_D(const QWebEngineDownloadItem);
+ Q_D(const QWebEngineDownloadRequest);
return d->downloadId;
}
/*!
- \fn void QWebEngineDownloadItem::finished()
+ \fn void QWebEngineDownloadRequest::finished()
This signal is emitted when the download finishes.
@@ -337,8 +342,7 @@ quint32 QWebEngineDownloadItem::id() const
*/
/*!
- \fn void QWebEngineDownloadItem::isPausedChanged(bool isPaused)
- \since 5.10
+ \fn void QWebEngineDownloadRequest::isPausedChanged(bool isPaused)
This signal is emitted whenever \a isPaused changes.
@@ -346,7 +350,7 @@ quint32 QWebEngineDownloadItem::id() const
*/
/*!
- \fn void QWebEngineDownloadItem::stateChanged(DownloadState state)
+ \fn void QWebEngineDownloadRequest::stateChanged(DownloadState state)
This signal is emitted whenever the download's \a state changes.
@@ -354,7 +358,7 @@ quint32 QWebEngineDownloadItem::id() const
*/
/*!
- \fn void QWebEngineDownloadItem::downloadProgress(qint64 bytesReceived, qint64 bytesTotal)
+ \fn void QWebEngineDownloadRequest::downloadProgress(qint64 bytesReceived, qint64 bytesTotal)
This signal is emitted to indicate the progress of the download request.
@@ -367,7 +371,7 @@ quint32 QWebEngineDownloadItem::id() const
*/
/*!
- \enum QWebEngineDownloadItem::DownloadState
+ \enum QWebEngineDownloadRequest::DownloadState
This enum describes the state of the download:
@@ -380,8 +384,7 @@ quint32 QWebEngineDownloadItem::id() const
*/
/*!
- \enum QWebEngineDownloadItem::SavePageFormat
- \since 5.7
+ \enum QWebEngineDownloadRequest::SavePageFormat
This enum describes the format that is used to save a web page.
@@ -394,28 +397,7 @@ quint32 QWebEngineDownloadItem::id() const
*/
/*!
- \enum QWebEngineDownloadItem::DownloadType
- \since 5.8
- \obsolete
-
- Describes the requested download's type.
-
- \value Attachment The web server's response includes a
- \c Content-Disposition header with the \c attachment directive. If \c Content-Disposition
- is present in the reply, the web server is indicating that the client should prompt the
- user to save the content regardless of the content type.
- See \l {RFC 2616 section 19.5.1} for details.
- \value DownloadAttribute The user clicked a link with the \c download
- attribute.
- \value UserRequested The user initiated the download, for example by
- selecting a web action.
- \value SavePage Saving of the current page was requested (for example by
- the \l{QWebEnginePage::WebAction}{QWebEnginePage::SavePage} web action).
-*/
-
-/*!
- \enum QWebEngineDownloadItem::DownloadInterruptReason
- \since 5.9
+ \enum QWebEngineDownloadRequest::DownloadInterruptReason
Describes the reason why a download was interrupted:
@@ -458,9 +440,9 @@ quint32 QWebEngineDownloadItem::id() const
\sa DownloadState
*/
-QWebEngineDownloadItem::DownloadState QWebEngineDownloadItem::state() const
+QWebEngineDownloadRequest::DownloadState QWebEngineDownloadRequest::state() const
{
- Q_D(const QWebEngineDownloadItem);
+ Q_D(const QWebEngineDownloadRequest);
return d->downloadState;
}
@@ -470,9 +452,9 @@ QWebEngineDownloadItem::DownloadState QWebEngineDownloadItem::state() const
\c -1 means the size is unknown.
*/
-qint64 QWebEngineDownloadItem::totalBytes() const
+qint64 QWebEngineDownloadRequest::totalBytes() const
{
- Q_D(const QWebEngineDownloadItem);
+ Q_D(const QWebEngineDownloadRequest);
return d->totalBytes;
}
@@ -482,9 +464,9 @@ qint64 QWebEngineDownloadItem::totalBytes() const
\c -1 means the size is unknown.
*/
-qint64 QWebEngineDownloadItem::receivedBytes() const
+qint64 QWebEngineDownloadRequest::receivedBytes() const
{
- Q_D(const QWebEngineDownloadItem);
+ Q_D(const QWebEngineDownloadRequest);
return d->receivedBytes;
}
@@ -492,96 +474,33 @@ qint64 QWebEngineDownloadItem::receivedBytes() const
Returns the download's origin URL.
*/
-QUrl QWebEngineDownloadItem::url() const
+QUrl QWebEngineDownloadRequest::url() const
{
- Q_D(const QWebEngineDownloadItem);
+ Q_D(const QWebEngineDownloadRequest);
return d->downloadUrl;
}
/*!
- \since 5.6
-
Returns the MIME type of the download.
*/
-QString QWebEngineDownloadItem::mimeType() const
+QString QWebEngineDownloadRequest::mimeType() const
{
- Q_D(const QWebEngineDownloadItem);
+ Q_D(const QWebEngineDownloadRequest);
return d->mimeType;
}
/*!
- \obsolete
-
- Use \l suggestedFileName(), \l downloadDirectory(), and
- \l downloadFileName() instead.
-
- Returns the full target path where data is being downloaded to.
-
- The path includes the file name. The default suggested path is the standard download location
- and file name is deduced not to overwrite already existing files.
-*/
-
-QString QWebEngineDownloadItem::path() const
-{
- Q_D(const QWebEngineDownloadItem);
- return QDir::cleanPath(QDir(d->downloadDirectory).filePath(d->downloadFileName));
-}
-
-/*!
- \obsolete
-
- Use \l setDownloadDirectory() and \l setDownloadFileName() instead.
-
- Sets the full target path to download the file to.
-
- The \a path should also include the file name. The download path can only be set in response
- to the QWebEngineProfile::downloadRequested() signal before the download is accepted.
- Past that point, this function has no effect on the download item's state.
-*/
-void QWebEngineDownloadItem::setPath(QString path)
-{
- Q_D(QWebEngineDownloadItem);
- if (d->downloadState != QWebEngineDownloadItem::DownloadRequested) {
- qWarning("Setting the download path is not allowed after the download has been accepted.");
- return;
- }
- if (QDir(d->downloadDirectory).filePath(d->downloadFileName) != path) {
- if (QFileInfo(path).fileName().isEmpty()) {
- qWarning("The download path does not include file name.");
- return;
- }
-
- if (QFileInfo(path).isDir()) {
- qWarning("The download path matches with an already existing directory path.");
- return;
- }
-
- if (QFileInfo(path).fileName() == path) {
- d->downloadDirectory = QStringLiteral("");
- d->downloadFileName = path;
- } else {
- d->downloadDirectory = QFileInfo(path).path();
- d->downloadFileName = QFileInfo(path).fileName();
- }
- }
-}
-
-/*!
- \since 5.14
-
Returns the download directory path.
*/
-QString QWebEngineDownloadItem::downloadDirectory() const
+QString QWebEngineDownloadRequest::downloadDirectory() const
{
- Q_D(const QWebEngineDownloadItem);
+ Q_D(const QWebEngineDownloadRequest);
return d->downloadDirectory;
}
/*!
- \since 5.14
-
Sets \a directory as the directory path to download the file to.
The download directory path can only be set in response to the QWebEngineProfile::downloadRequested()
@@ -589,10 +508,10 @@ QString QWebEngineDownloadItem::downloadDirectory() const
download item's state.
*/
-void QWebEngineDownloadItem::setDownloadDirectory(const QString &directory)
+void QWebEngineDownloadRequest::setDownloadDirectory(const QString &directory)
{
- Q_D(QWebEngineDownloadItem);
- if (d->downloadState != QWebEngineDownloadItem::DownloadRequested) {
+ Q_D(QWebEngineDownloadRequest);
+ if (d->downloadState != QWebEngineDownloadRequest::DownloadRequested) {
qWarning("Setting the download directory is not allowed after the download has been accepted.");
return;
}
@@ -600,27 +519,23 @@ void QWebEngineDownloadItem::setDownloadDirectory(const QString &directory)
if (!directory.isEmpty() && d->downloadDirectory != directory)
d->downloadDirectory = directory;
- if (!d->isCustomFileName)
- d->downloadFileName = QFileInfo(d->profile->profileAdapter()->determineDownloadPath(d->downloadDirectory,
+ if (!d->isCustomFileName && d->m_profileAdapter)
+ d->downloadFileName = QFileInfo(d->m_profileAdapter->determineDownloadPath(d->downloadDirectory,
d->suggestedFileName,
d->startTime)).fileName();
}
/*!
- \since 5.14
-
Returns the file name to download the file to.
*/
-QString QWebEngineDownloadItem::downloadFileName() const
+QString QWebEngineDownloadRequest::downloadFileName() const
{
- Q_D(const QWebEngineDownloadItem);
+ Q_D(const QWebEngineDownloadRequest);
return d->downloadFileName;
}
/*!
- \since 5.14
-
Sets \a fileName as the file name to download the file to.
The download file name can only be set in response to the QWebEngineProfile::downloadRequested()
@@ -628,10 +543,10 @@ QString QWebEngineDownloadItem::downloadFileName() const
download item's state.
*/
-void QWebEngineDownloadItem::setDownloadFileName(const QString &fileName)
+void QWebEngineDownloadRequest::setDownloadFileName(const QString &fileName)
{
- Q_D(QWebEngineDownloadItem);
- if (d->downloadState != QWebEngineDownloadItem::DownloadRequested) {
+ Q_D(QWebEngineDownloadRequest);
+ if (d->downloadState != QWebEngineDownloadRequest::DownloadRequested) {
qWarning("Setting the download file name is not allowed after the download has been accepted.");
return;
}
@@ -643,14 +558,12 @@ void QWebEngineDownloadItem::setDownloadFileName(const QString &fileName)
}
/*!
- \since 5.14
-
Returns the suggested file name.
*/
-QString QWebEngineDownloadItem::suggestedFileName() const
+QString QWebEngineDownloadRequest::suggestedFileName() const
{
- Q_D(const QWebEngineDownloadItem);
+ Q_D(const QWebEngineDownloadRequest);
return d->suggestedFileName;
}
@@ -660,9 +573,9 @@ QString QWebEngineDownloadItem::suggestedFileName() const
\sa finished(), state(),
*/
-bool QWebEngineDownloadItem::isFinished() const
+bool QWebEngineDownloadRequest::isFinished() const
{
- Q_D(const QWebEngineDownloadItem);
+ Q_D(const QWebEngineDownloadRequest);
return d->downloadFinished;
}
@@ -672,101 +585,84 @@ bool QWebEngineDownloadItem::isFinished() const
\sa pause(), resume()
*/
-bool QWebEngineDownloadItem::isPaused() const
+bool QWebEngineDownloadRequest::isPaused() const
{
- Q_D(const QWebEngineDownloadItem);
+ Q_D(const QWebEngineDownloadRequest);
return d->downloadPaused;
}
/*!
Returns the format the web page will be saved in if this is a download request for a web page.
- \since 5.7
-
\sa setSavePageFormat(), isSavePageDownload()
*/
-QWebEngineDownloadItem::SavePageFormat QWebEngineDownloadItem::savePageFormat() const
+QWebEngineDownloadRequest::SavePageFormat QWebEngineDownloadRequest::savePageFormat() const
{
- Q_D(const QWebEngineDownloadItem);
+ Q_D(const QWebEngineDownloadRequest);
return d->savePageFormat;
}
/*!
Sets the \a format the web page will be saved in if this is a download request for a web page.
- \since 5.7
\sa savePageFormat(), isSavePageDownload()
*/
-void QWebEngineDownloadItem::setSavePageFormat(QWebEngineDownloadItem::SavePageFormat format)
-{
- Q_D(QWebEngineDownloadItem);
- d->savePageFormat = format;
-}
-
-/*!
- Returns the requested download's type.
- \since 5.8
- \obsolete
-
- \note This property works unreliably, except for \c SavePage
- downloads. Use \l isSavePageDownload() instead.
- */
-
-QWebEngineDownloadItem::DownloadType QWebEngineDownloadItem::type() const
+void QWebEngineDownloadRequest::setSavePageFormat(QWebEngineDownloadRequest::SavePageFormat format)
{
- Q_D(const QWebEngineDownloadItem);
- return d->type;
+ Q_D(QWebEngineDownloadRequest);
+ if (d->savePageFormat != format) {
+ d->savePageFormat = format;
+ Q_EMIT savePageFormatChanged();
+ }
}
/*!
Returns \c true if this is a download request for saving a web page.
- \since 5.11
\sa savePageFormat(), setSavePageFormat()
*/
-bool QWebEngineDownloadItem::isSavePageDownload() const
+bool QWebEngineDownloadRequest::isSavePageDownload() const
{
- Q_D(const QWebEngineDownloadItem);
- return d->type == QWebEngineDownloadItem::SavePage;
+ Q_D(const QWebEngineDownloadRequest);
+ return d->isSavePageDownload;
}
/*!
Returns the reason why the download was interrupted.
- \since 5.9
\sa interruptReasonString()
*/
-QWebEngineDownloadItem::DownloadInterruptReason QWebEngineDownloadItem::interruptReason() const
+QWebEngineDownloadRequest::DownloadInterruptReason QWebEngineDownloadRequest::interruptReason() const
{
- Q_D(const QWebEngineDownloadItem);
+ Q_D(const QWebEngineDownloadRequest);
return d->interruptReason;
}
/*!
Returns a human-readable description of the reason for interrupting the download.
- \since 5.9
\sa interruptReason()
*/
-QString QWebEngineDownloadItem::interruptReasonString() const
+QString QWebEngineDownloadRequest::interruptReasonString() const
{
return ProfileAdapterClient::downloadInterruptReasonToString(
static_cast<ProfileAdapterClient::DownloadInterruptReason>(interruptReason()));
}
/*!
- \since 5.12
Returns the page the download was requested on. If the download was not triggered by content in a page,
\c nullptr is returned.
*/
-QWebEnginePage *QWebEngineDownloadItem::page() const
+QObject *QWebEngineDownloadRequest::page() const
{
- Q_D(const QWebEngineDownloadItem);
- return d->page;
+ Q_D(const QWebEngineDownloadRequest);
+ //TODO: come back here when page is in core
+ Q_UNREACHABLE();
+ return nullptr;
}
-QWebEngineDownloadItem::QWebEngineDownloadItem(QWebEngineDownloadItemPrivate *p, QObject *parent)
+QWebEngineDownloadRequest::QWebEngineDownloadRequest(QWebEngineDownloadRequestPrivate *p, QObject *parent)
: QObject(parent)
, d_ptr(p)
{
@@ -775,7 +671,7 @@ QWebEngineDownloadItem::QWebEngineDownloadItem(QWebEngineDownloadItemPrivate *p,
/*! \internal
*/
-QWebEngineDownloadItem::~QWebEngineDownloadItem()
+QWebEngineDownloadRequest::~QWebEngineDownloadRequest()
{
// MEMO Items are owned by profile by default and will be destroyed on profile's destruction
// It's not safe to access profile in that case, so we rely on profile to clean up items
diff --git a/src/webengine/api/qquickwebenginedownloaditem_p.h b/src/core/api/qwebenginedownloadrequest.h
index e1b1b9040..3e0e0d044 100644
--- a/src/webengine/api/qquickwebenginedownloaditem_p.h
+++ b/src/core/api/qwebenginedownloadrequest.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** 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.
@@ -37,36 +37,43 @@
**
****************************************************************************/
-#ifndef QQUICKWEBENGINEDOWNLOADITEM_P_H
-#define QQUICKWEBENGINEDOWNLOADITEM_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 <QtWebEngine/private/qtwebengineglobal_p.h>
-#include <QObject>
-#include <QScopedPointer>
-#include <QString>
-#include <QUrl>
+#ifndef QWEBENGINEDOWNLOADREQUEST_H
+#define QWEBENGINEDOWNLOADREQUEST_H
+
+#include <QtWebEngineCore/qtwebenginecoreglobal.h>
+
+#include <QtCore/qobject.h>
+#include <QtCore/QUrl>
QT_BEGIN_NAMESPACE
-class QQuickWebEngineDownloadItemPrivate;
-class QQuickWebEngineProfilePrivate;
-class QQuickWebEngineView;
+//TODO: class QWebEnginePage;
+class QWebEngineDownloadRequestPrivate;
+class QWebEngineProfilePrivate;
-class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineDownloadItem: public QObject {
+class Q_WEBENGINECORE_EXPORT QWebEngineDownloadRequest : public QObject
+{
Q_OBJECT
public:
- ~QQuickWebEngineDownloadItem();
+ Q_PROPERTY(quint32 id READ id CONSTANT FINAL)
+ Q_PROPERTY(DownloadState state READ state NOTIFY stateChanged FINAL)
+ Q_PROPERTY(SavePageFormat savePageFormat READ savePageFormat WRITE setSavePageFormat NOTIFY savePageFormatChanged FINAL)
+ Q_PROPERTY(qint64 totalBytes READ totalBytes NOTIFY totalBytesChanged FINAL)
+ Q_PROPERTY(qint64 receivedBytes READ receivedBytes NOTIFY receivedBytesChanged FINAL)
+ Q_PROPERTY(QString mimeType READ mimeType FINAL)
+ Q_PROPERTY(DownloadInterruptReason interruptReason READ interruptReason NOTIFY interruptReasonChanged FINAL)
+ Q_PROPERTY(QString interruptReasonString READ interruptReasonString NOTIFY interruptReasonChanged FINAL)
+ Q_PROPERTY(bool isFinished READ isFinished NOTIFY isFinishedChanged FINAL)
+ Q_PROPERTY(bool isPaused READ isPaused NOTIFY isPausedChanged FINAL)
+ Q_PROPERTY(bool isSavePageDownload READ isSavePageDownload CONSTANT FINAL)
+ //TODO: Q_PROPERTY(QQuickWebEngineView *view READ view CONSTANT REVISION 7 FINAL)
+ Q_PROPERTY(QUrl url READ url CONSTANT FINAL)
+ Q_PROPERTY(QString suggestedFileName READ suggestedFileName CONSTANT FINAL)
+ Q_PROPERTY(QString downloadDirectory READ downloadDirectory WRITE setDownloadDirectory NOTIFY downloadDirectoryChanged FINAL)
+ Q_PROPERTY(QString downloadFileName READ downloadFileName WRITE setDownloadFileName NOTIFY downloadFileNameChanged FINAL)
+
+ ~QWebEngineDownloadRequest();
+
enum DownloadState {
DownloadRequested,
DownloadInProgress,
@@ -115,85 +122,58 @@ public:
};
Q_ENUM(DownloadInterruptReason)
- enum DownloadType {
- Attachment = 0,
- DownloadAttribute,
- UserRequested,
- SavePage
- };
- Q_ENUM(DownloadType)
-
- Q_PROPERTY(quint32 id READ id CONSTANT FINAL)
- Q_PROPERTY(DownloadState state READ state NOTIFY stateChanged FINAL)
- Q_PROPERTY(SavePageFormat savePageFormat READ savePageFormat WRITE setSavePageFormat NOTIFY savePageFormatChanged REVISION 2 FINAL)
- Q_PROPERTY(qint64 totalBytes READ totalBytes NOTIFY totalBytesChanged FINAL)
- Q_PROPERTY(qint64 receivedBytes READ receivedBytes NOTIFY receivedBytesChanged FINAL)
- Q_PROPERTY(QString mimeType READ mimeType NOTIFY mimeTypeChanged REVISION 1 FINAL)
- Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged FINAL)
- Q_PROPERTY(DownloadType type READ type NOTIFY typeChanged REVISION 3 FINAL)
- Q_PROPERTY(DownloadInterruptReason interruptReason READ interruptReason NOTIFY interruptReasonChanged REVISION 4 FINAL)
- Q_PROPERTY(QString interruptReasonString READ interruptReasonString NOTIFY interruptReasonChanged REVISION 4 FINAL)
- Q_PROPERTY(bool isFinished READ isFinished NOTIFY isFinishedChanged REVISION 5 FINAL)
- Q_PROPERTY(bool isPaused READ isPaused NOTIFY isPausedChanged REVISION 5 FINAL)
- Q_PROPERTY(bool isSavePageDownload READ isSavePageDownload CONSTANT REVISION 6 FINAL)
- Q_PROPERTY(QQuickWebEngineView *view READ view CONSTANT REVISION 7 FINAL)
- Q_PROPERTY(QUrl url READ url CONSTANT REVISION 10 FINAL)
- Q_PROPERTY(QString suggestedFileName READ suggestedFileName CONSTANT REVISION 10 FINAL)
- Q_PROPERTY(QString downloadDirectory READ downloadDirectory WRITE setDownloadDirectory NOTIFY downloadDirectoryChanged REVISION 10 FINAL)
- Q_PROPERTY(QString downloadFileName READ downloadFileName WRITE setDownloadFileName NOTIFY downloadFileNameChanged REVISION 10 FINAL)
-
- Q_INVOKABLE void accept();
- Q_INVOKABLE void cancel();
- Q_INVOKABLE void pause();
- Q_INVOKABLE void resume();
-
quint32 id() const;
DownloadState state() const;
qint64 totalBytes() const;
qint64 receivedBytes() const;
+ QUrl url() const;
QString mimeType() const;
- QString path() const;
- void setPath(QString path);
+ bool isFinished() const;
+ bool isPaused() const;
SavePageFormat savePageFormat() const;
void setSavePageFormat(SavePageFormat format);
- DownloadType Q_DECL_DEPRECATED type() const;
DownloadInterruptReason interruptReason() const;
QString interruptReasonString() const;
- bool isFinished() const;
- bool isPaused() const;
bool isSavePageDownload() const;
- QQuickWebEngineView *view() const;
- QUrl url() const;
QString suggestedFileName() const;
QString downloadDirectory() const;
void setDownloadDirectory(const QString &directory);
QString downloadFileName() const;
void setDownloadFileName(const QString &fileName);
- bool isCustomFileName;
+
+ //TODO:
+ QObject *page() const;
+
+public Q_SLOTS:
+ void accept();
+ void cancel();
+ void pause();
+ void resume();
Q_SIGNALS:
- void stateChanged();
- Q_REVISION(2) void savePageFormatChanged();
+ void stateChanged(QWebEngineDownloadRequest::DownloadState state);
+ //TODO: fix it for qml
+ void downloadProgress(qint64 bytesReceived, qint64 bytesTotal);
+ void savePageFormatChanged();
void receivedBytesChanged();
void totalBytesChanged();
- Q_REVISION(1) void mimeTypeChanged();
- void pathChanged();
- Q_REVISION(3) void typeChanged();
- Q_REVISION(4) void interruptReasonChanged();
- Q_REVISION(5) void isFinishedChanged();
- Q_REVISION(5) void isPausedChanged();
- Q_REVISION(10) void downloadDirectoryChanged();
- Q_REVISION(10) void downloadFileNameChanged();
+ void interruptReasonChanged();
+ void isFinishedChanged();
+ void isPausedChanged();
+ void downloadDirectoryChanged();
+ void downloadFileNameChanged();
private:
- QQuickWebEngineDownloadItem(QQuickWebEngineDownloadItemPrivate*, QObject *parent = 0);
- Q_DISABLE_COPY(QQuickWebEngineDownloadItem)
- Q_DECLARE_PRIVATE(QQuickWebEngineDownloadItem)
- friend class QQuickWebEngineProfilePrivate;
+ Q_DISABLE_COPY(QWebEngineDownloadRequest)
+ Q_DECLARE_PRIVATE(QWebEngineDownloadRequest)
- QScopedPointer<QQuickWebEngineDownloadItemPrivate> d_ptr;
+ friend class QWebEngineProfilePrivate;
+ friend class QQuickWebEngineProfilePrivate;
+ friend class QWebEnginePage;
+ QWebEngineDownloadRequest(QWebEngineDownloadRequestPrivate*, QObject *parent = Q_NULLPTR);
+ QScopedPointer<QWebEngineDownloadRequestPrivate> d_ptr;
};
QT_END_NAMESPACE
-#endif // QQUICKWEBENGINEDOWNLOADITEM_P_H
+#endif // QWEBENGINEDOWNLOADREQUEST_H
diff --git a/src/webenginewidgets/api/qwebenginedownloaditem_p.h b/src/core/api/qwebenginedownloadrequest_p.h
index 04c6fadcc..db2e70852 100644
--- a/src/webenginewidgets/api/qwebenginedownloaditem_p.h
+++ b/src/core/api/qwebenginedownloadrequest_p.h
@@ -37,8 +37,8 @@
**
****************************************************************************/
-#ifndef QWEBENGINEDOWNLOADITEM_P_H
-#define QWEBENGINEDOWNLOADITEM_P_H
+#ifndef QWEBENGINEDOWNLOADREQUEST_P_H
+#define QWEBENGINEDOWNLOADREQUEST_P_H
//
// W A R N I N G
@@ -51,30 +51,33 @@
// We mean it.
//
-#include "qtwebenginewidgetsglobal.h"
-
-#include "qwebenginedownloaditem.h"
-#include "qwebengineprofile_p.h"
+#include "qtwebenginecoreglobal.h"
+#include "qwebenginedownloadrequest.h"
+#include "profile_adapter_client.h"
#include <QString>
+#include <QPointer>
+
+namespace QtWebEngineCore {
+class ProfileAdapter;
+class WebContentsAdapterClient;
+}
QT_BEGIN_NAMESPACE
-class QWebEngineDownloadItemPrivate {
- QWebEngineDownloadItem *q_ptr;
- QWebEngineProfilePrivate* profile;
- friend class QWebEngineProfilePrivate;
+class Q_WEBENGINECORE_PRIVATE_EXPORT QWebEngineDownloadRequestPrivate {
public:
- Q_DECLARE_PUBLIC(QWebEngineDownloadItem)
- QWebEngineDownloadItemPrivate(QWebEngineProfilePrivate *p, const QUrl &url);
- ~QWebEngineDownloadItemPrivate();
+ QWebEngineDownloadRequestPrivate(QtWebEngineCore::ProfileAdapter *adapter, const QUrl &url);
+ ~QWebEngineDownloadRequestPrivate();
+
+ void update(const QtWebEngineCore::ProfileAdapterClient::DownloadItemInfo &info);
+ void setFinished();
bool downloadFinished;
quint32 downloadId;
qint64 startTime;
- QWebEngineDownloadItem::DownloadState downloadState;
- QWebEngineDownloadItem::SavePageFormat savePageFormat;
- QWebEngineDownloadItem::DownloadType type;
- QWebEngineDownloadItem::DownloadInterruptReason interruptReason;
+ QWebEngineDownloadRequest::DownloadState downloadState;
+ QWebEngineDownloadRequest::SavePageFormat savePageFormat;
+ QWebEngineDownloadRequest::DownloadInterruptReason interruptReason;
QString downloadPath;
const QUrl downloadUrl;
QString mimeType;
@@ -83,17 +86,16 @@ public:
QString downloadDirectory;
QString downloadFileName;
bool isCustomFileName;
-
qint64 totalBytes;
qint64 receivedBytes;
- QWebEnginePage *page;
-
- void update(const QtWebEngineCore::ProfileAdapterClient::DownloadItemInfo &info);
-
- void setFinished();
+ bool isSavePageDownload;
+ QWebEngineDownloadRequest *q_ptr;
+ QPointer<QtWebEngineCore::ProfileAdapter> m_profileAdapter;
+ QtWebEngineCore::WebContentsAdapterClient *m_adapterClient;
+ Q_DECLARE_PUBLIC(QWebEngineDownloadRequest)
};
QT_END_NAMESPACE
-#endif // QWEBENGINEDOWNLOADITEM_P_H
+#endif // QWEBENGINEDOWNLOADREQUEST_P_H
diff --git a/src/webenginewidgets/api/qwebenginefullscreenrequest.cpp b/src/core/api/qwebenginefullscreenrequest.cpp
index bcf2d5d22..facc8910d 100644
--- a/src/webenginewidgets/api/qwebenginefullscreenrequest.cpp
+++ b/src/core/api/qwebenginefullscreenrequest.cpp
@@ -38,7 +38,6 @@
****************************************************************************/
#include "qwebenginefullscreenrequest.h"
-#include "qwebenginepage_p.h"
QT_BEGIN_NAMESPACE
@@ -49,7 +48,7 @@ QT_BEGIN_NAMESPACE
\since 5.6
- \inmodule QtWebEngineWidgets
+ \inmodule QtWebEngineCore
To allow elements such as videos to be shown in the fullscreen mode,
applications must set QWebEngineSettings::FullScreenSupportEnabled and
@@ -85,39 +84,37 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QWebEngineFullScreenRequest::toggleOn() const
- Returns \c true if the web page has issued a request to enter the fullscreen
- mode, otherwise returns \c false.
-*/
-
-/*!
- \fn QWebEngineFullScreenRequest::origin() const
- Returns the URL to be opened in the fullscreen mode.
-*/
-
-/*!
Creates a request for opening the \a page from the URL specified by
\a origin in the fullscreen mode if \a fullscreen is \c true.
*/
-QWebEngineFullScreenRequest::QWebEngineFullScreenRequest(QWebEnginePage *page, const QUrl &origin, bool fullscreen)
- : m_page(page)
- , m_origin(origin)
- , m_toggleOn(fullscreen)
-{
-}
+class QWebEngineFullScreenRequestPrivate : public QSharedData {
+public:
+ QWebEngineFullScreenRequestPrivate(const QUrl &origin, bool toggleOn, const std::function<void (bool)> &setFullScreenCallback)
+ : m_origin(origin)
+ , m_toggleOn(toggleOn)
+ , m_setFullScreenCallback(setFullScreenCallback) { }
+
+ const QUrl m_origin;
+ const bool m_toggleOn;
+ const std::function<void (bool)> m_setFullScreenCallback;
+};
+
+QWebEngineFullScreenRequest::QWebEngineFullScreenRequest(const QUrl &origin, bool toggleOn, const std::function<void (bool)> &setFullScreenCallback)
+ : d_ptr(new QWebEngineFullScreenRequestPrivate(origin, toggleOn, setFullScreenCallback)) { }
+
+QWebEngineFullScreenRequest::QWebEngineFullScreenRequest(const QWebEngineFullScreenRequest &other) = default;
+QWebEngineFullScreenRequest& QWebEngineFullScreenRequest::operator=(const QWebEngineFullScreenRequest &other) = default;
+QWebEngineFullScreenRequest::QWebEngineFullScreenRequest(QWebEngineFullScreenRequest &&other) = default;
+QWebEngineFullScreenRequest& QWebEngineFullScreenRequest::operator=(QWebEngineFullScreenRequest &&other) = default;
+QWebEngineFullScreenRequest::~QWebEngineFullScreenRequest() = default;
/*!
Rejects a request to enter or exit the fullscreen mode.
*/
void QWebEngineFullScreenRequest::reject()
{
- if (!m_page) {
- qWarning("Cannot reject QWebEngineFullScreenRequest: Originating page is already deleted");
- return;
- }
-
- m_page->d_func()->setFullScreenMode(!m_toggleOn);
+ d_ptr->m_setFullScreenCallback(!d_ptr->m_toggleOn);
}
/*!
@@ -125,12 +122,26 @@ void QWebEngineFullScreenRequest::reject()
*/
void QWebEngineFullScreenRequest::accept()
{
- if (!m_page) {
- qWarning("Cannot accept QWebEngineFullScreenRequest: Originating page is already deleted");
- return;
- }
+ d_ptr->m_setFullScreenCallback(d_ptr->m_toggleOn);
+}
- m_page->d_func()->setFullScreenMode(m_toggleOn);
+/*!
+ \fn QWebEngineFullScreenRequest::toggleOn() const
+ Returns \c true if the web page has issued a request to enter the fullscreen
+ mode, otherwise returns \c false.
+*/
+bool QWebEngineFullScreenRequest::toggleOn() const
+{
+ return d_ptr->m_toggleOn;
+}
+
+/*!
+ \fn QWebEngineFullScreenRequest::origin() const
+ Returns the URL to be opened in the fullscreen mode.
+*/
+QUrl QWebEngineFullScreenRequest::origin() const
+{
+ return d_ptr->m_origin;
}
QT_END_NAMESPACE
diff --git a/src/webenginewidgets/api/qwebenginefullscreenrequest.h b/src/core/api/qwebenginefullscreenrequest.h
index 08505a410..95911ed0a 100644
--- a/src/webenginewidgets/api/qwebenginefullscreenrequest.h
+++ b/src/core/api/qwebenginefullscreenrequest.h
@@ -40,29 +40,41 @@
#ifndef QWEBENGINEFULLSCREENREQUEST_H
#define QWEBENGINEFULLSCREENREQUEST_H
-#include <QtWebEngineWidgets/qtwebenginewidgetsglobal.h>
+#include <QtWebEngineCore/qtwebenginecoreglobal.h>
+
+#include <QtCore/qglobal.h>
+#include <QtCore/qshareddata.h>
#include <QtCore/qurl.h>
-#include <QtCore/qpointer.h>
+
+#include <functional>
QT_BEGIN_NAMESPACE
-class QWebEnginePage;
-class QWEBENGINEWIDGETS_EXPORT QWebEngineFullScreenRequest {
+class QWebEngineFullScreenRequestPrivate;
+
+class Q_WEBENGINECORE_EXPORT QWebEngineFullScreenRequest
+{
Q_GADGET
Q_PROPERTY(bool toggleOn READ toggleOn CONSTANT)
Q_PROPERTY(QUrl origin READ origin CONSTANT)
+
public:
+ QWebEngineFullScreenRequest(const QWebEngineFullScreenRequest &other);
+ QWebEngineFullScreenRequest &operator=(const QWebEngineFullScreenRequest &other);
+ QWebEngineFullScreenRequest(QWebEngineFullScreenRequest &&other);
+ QWebEngineFullScreenRequest &operator=(QWebEngineFullScreenRequest &&other);
+ ~QWebEngineFullScreenRequest();
+
Q_INVOKABLE void reject();
Q_INVOKABLE void accept();
- bool toggleOn() const { return m_toggleOn; }
- const QUrl &origin() const { return m_origin; }
+ bool toggleOn() const;
+ QUrl origin() const;
private:
- QWebEngineFullScreenRequest(QWebEnginePage *page, const QUrl &origin, bool toggleOn);
- QPointer<QWebEnginePage> m_page;
- const QUrl m_origin;
- const bool m_toggleOn;
friend class QWebEnginePagePrivate;
+ friend class QQuickWebEngineViewPrivate;
+ QWebEngineFullScreenRequest(const QUrl &origin, bool toggleOn, const std::function<void (bool)> &setFullScreenCallback);
+ QExplicitlySharedDataPointer<QWebEngineFullScreenRequestPrivate> d_ptr;
};
QT_END_NAMESPACE
diff --git a/src/webenginewidgets/api/qwebenginehistory.cpp b/src/core/api/qwebenginehistory.cpp
index 6a85b984e..2f32444b2 100644
--- a/src/webenginewidgets/api/qwebenginehistory.cpp
+++ b/src/core/api/qwebenginehistory.cpp
@@ -40,7 +40,6 @@
#include "qwebenginehistory.h"
#include "qwebenginehistory_p.h"
-#include "qwebenginepage_p.h"
#include "web_contents_adapter.h"
QT_BEGIN_NAMESPACE
@@ -50,21 +49,15 @@ QT_BEGIN_NAMESPACE
Swaps the history item with the \a other item.
*/
-QWebEngineHistoryItemPrivate::QWebEngineHistoryItemPrivate(QWebEnginePagePrivate *page, int index)
- : page(page)
- , index(index)
+QWebEngineHistoryItemPrivate::QWebEngineHistoryItemPrivate(
+ QtWebEngineCore::WebContentsAdapterClient *adapter, int index)
+ : m_adapter(adapter), index(index)
{
}
-QWebEngineHistoryItem::QWebEngineHistoryItem(QWebEngineHistoryItemPrivate *d)
- : d(d)
-{
-}
+QWebEngineHistoryItem::QWebEngineHistoryItem(QWebEngineHistoryItemPrivate *d) : d(d) { }
-QWebEngineHistoryItem::QWebEngineHistoryItem(const QWebEngineHistoryItem &other)
- : d(other.d)
-{
-}
+QWebEngineHistoryItem::QWebEngineHistoryItem(const QWebEngineHistoryItem &other) : d(other.d) { }
QWebEngineHistoryItem &QWebEngineHistoryItem::operator=(const QWebEngineHistoryItem &other)
{
@@ -72,32 +65,35 @@ QWebEngineHistoryItem &QWebEngineHistoryItem::operator=(const QWebEngineHistoryI
return *this;
}
-QWebEngineHistoryItem::~QWebEngineHistoryItem()
-{
-}
+QWebEngineHistoryItem::~QWebEngineHistoryItem() { }
QUrl QWebEngineHistoryItem::originalUrl() const
{
Q_D(const QWebEngineHistoryItem);
- return d->page ? d->page->webContents()->getNavigationEntryOriginalUrl(d->index) : QUrl();
+ return d->m_adapter
+ ? d->m_adapter->webContentsAdapter()->getNavigationEntryOriginalUrl(d->index)
+ : QUrl();
}
QUrl QWebEngineHistoryItem::url() const
{
Q_D(const QWebEngineHistoryItem);
- return d->page ? d->page->webContents()->getNavigationEntryUrl(d->index) : QUrl();
+ return d->m_adapter ? d->m_adapter->webContentsAdapter()->getNavigationEntryUrl(d->index)
+ : QUrl();
}
QString QWebEngineHistoryItem::title() const
{
Q_D(const QWebEngineHistoryItem);
- return d->page ? d->page->webContents()->getNavigationEntryTitle(d->index) : QString();
+ return d->m_adapter ? d->m_adapter->webContentsAdapter()->getNavigationEntryTitle(d->index)
+ : QString();
}
QDateTime QWebEngineHistoryItem::lastVisited() const
{
Q_D(const QWebEngineHistoryItem);
- return d->page ? d->page->webContents()->getNavigationEntryTimestamp(d->index) : QDateTime();
+ return d->m_adapter ? d->m_adapter->webContentsAdapter()->getNavigationEntryTimestamp(d->index)
+ : QDateTime();
}
/*!
@@ -108,19 +104,21 @@ QDateTime QWebEngineHistoryItem::lastVisited() const
QUrl QWebEngineHistoryItem::iconUrl() const
{
Q_D(const QWebEngineHistoryItem);
- return d->page ? d->page->webContents()->getNavigationEntryIconUrl(d->index) : QUrl();
+ return d->m_adapter ? d->m_adapter->webContentsAdapter()->getNavigationEntryIconUrl(d->index)
+ : QUrl();
}
bool QWebEngineHistoryItem::isValid() const
{
Q_D(const QWebEngineHistoryItem);
- if (!d->page)
+ if (!d->m_adapter)
return false;
- return d->index >= 0 && d->index < d->page->webContents()->navigationEntryCount();
+ return d->index >= 0 && d->index < d->m_adapter->webContentsAdapter()->navigationEntryCount();
}
-QWebEngineHistoryPrivate::QWebEngineHistoryPrivate(QWebEnginePagePrivate *page)
- : page(page)
+QWebEngineHistoryPrivate::QWebEngineHistoryPrivate(
+ QtWebEngineCore::WebContentsAdapterClient *adapter)
+ : m_adapter(adapter)
{
}
@@ -129,38 +127,33 @@ QWebEngineHistoryPrivate::~QWebEngineHistoryPrivate()
// Invalidate shared item references possibly still out there.
QList<QWebEngineHistoryItem>::iterator it, end;
for (it = items.begin(), end = items.end(); it != end; ++it)
- it->d->page = 0;
+ it->d->m_adapter = 0;
}
void QWebEngineHistoryPrivate::updateItems() const
{
// Keep track of items we return to be able to invalidate them
- // and avoid dangling references to our page.
- int entryCount = page->webContents()->navigationEntryCount();
+ // and avoid dangling references to our m_adapter.
+ int entryCount = m_adapter->webContentsAdapter()->navigationEntryCount();
while (items.size() > entryCount) {
- items.last().d->page = 0;
+ items.last().d->m_adapter = 0;
items.removeLast();
}
while (items.size() < entryCount) {
int nextIndex = items.size();
- items.append(QWebEngineHistoryItem(new QWebEngineHistoryItemPrivate(page, nextIndex)));
+ items.append(QWebEngineHistoryItem(new QWebEngineHistoryItemPrivate(m_adapter, nextIndex)));
}
}
-QWebEngineHistory::QWebEngineHistory(QWebEngineHistoryPrivate *d)
- : d_ptr(d)
-{
-}
+QWebEngineHistory::QWebEngineHistory(QWebEngineHistoryPrivate *d) : d_ptr(d) { }
-QWebEngineHistory::~QWebEngineHistory()
-{
-}
+QWebEngineHistory::~QWebEngineHistory() { }
void QWebEngineHistory::clear()
{
Q_D(const QWebEngineHistory);
- d->page->webContents()->clearNavigationHistory();
- d->page->updateNavigationActions();
+ d->m_adapter->webContentsAdapter()->clearNavigationHistory();
+ d->m_adapter->updateNavigationActions();
}
QList<QWebEngineHistoryItem> QWebEngineHistory::items() const
@@ -191,32 +184,32 @@ QList<QWebEngineHistoryItem> QWebEngineHistory::forwardItems(int maxItems) const
bool QWebEngineHistory::canGoBack() const
{
Q_D(const QWebEngineHistory);
- return d->page->webContents()->canGoToOffset(-1);
+ return d->m_adapter->webContentsAdapter()->canGoToOffset(-1);
}
bool QWebEngineHistory::canGoForward() const
{
Q_D(const QWebEngineHistory);
- return d->page->webContents()->canGoToOffset(1);
+ return d->m_adapter->webContentsAdapter()->canGoToOffset(1);
}
void QWebEngineHistory::back()
{
Q_D(const QWebEngineHistory);
- d->page->webContents()->navigateToOffset(-1);
+ d->m_adapter->webContentsAdapter()->navigateToOffset(-1);
}
void QWebEngineHistory::forward()
{
Q_D(const QWebEngineHistory);
- d->page->webContents()->navigateToOffset(1);
+ d->m_adapter->webContentsAdapter()->navigateToOffset(1);
}
void QWebEngineHistory::goToItem(const QWebEngineHistoryItem &item)
{
Q_D(const QWebEngineHistory);
- Q_ASSERT(item.d->page == d->page);
- d->page->webContents()->navigateToIndex(item.d->index);
+ Q_ASSERT(item.d->m_adapter == d->m_adapter);
+ d->m_adapter->webContentsAdapter()->navigateToIndex(item.d->index);
}
QWebEngineHistoryItem QWebEngineHistory::backItem() const
@@ -251,30 +244,15 @@ QWebEngineHistoryItem QWebEngineHistory::itemAt(int i) const
int QWebEngineHistory::currentItemIndex() const
{
Q_D(const QWebEngineHistory);
- return d->page->webContents()->currentNavigationEntryIndex();
+ return d->m_adapter->webContentsAdapter()->currentNavigationEntryIndex();
}
int QWebEngineHistory::count() const
{
Q_D(const QWebEngineHistory);
- if (!d->page->webContents()->isInitialized())
+ if (!d->m_adapter->webContentsAdapter()->isInitialized())
return 0;
- return d->page->webContents()->navigationEntryCount();
-}
-
-QDataStream& operator<<(QDataStream& stream, const QWebEngineHistory& history)
-{
- QtWebEngineCore::WebContentsAdapter *adapter = history.d_func()->page->webContents();
- if (!adapter->isInitialized())
- adapter->loadDefault();
- adapter->serializeNavigationHistory(stream);
- return stream;
-}
-
-QDataStream& operator>>(QDataStream& stream, QWebEngineHistory& history)
-{
- history.d_func()->page->recreateFromSerializedHistory(stream);
- return stream;
+ return d->m_adapter->webContentsAdapter()->navigationEntryCount();
}
QT_END_NAMESPACE
diff --git a/src/webenginewidgets/api/qwebenginehistory.h b/src/core/api/qwebenginehistory.h
index 33d91d523..f7e591e38 100644
--- a/src/webenginewidgets/api/qwebenginehistory.h
+++ b/src/core/api/qwebenginehistory.h
@@ -40,12 +40,12 @@
#ifndef QWEBENGINEHISTORY_H
#define QWEBENGINEHISTORY_H
+#include <QtWebEngineCore/qtwebenginecoreglobal.h>
#include <QtCore/qurl.h>
#include <QtCore/qstring.h>
#include <QtCore/qdatetime.h>
#include <QtCore/qshareddata.h>
#include <QtGui/qicon.h>
-#include <QtWebEngineWidgets/qtwebenginewidgetsglobal.h>
QT_BEGIN_NAMESPACE
@@ -54,7 +54,8 @@ class QWebEngineHistoryItemPrivate;
class QWebEnginePage;
class QWebEnginePagePrivate;
-class QWEBENGINEWIDGETS_EXPORT QWebEngineHistoryItem {
+class Q_WEBENGINECORE_EXPORT QWebEngineHistoryItem
+{
public:
QWebEngineHistoryItem(const QWebEngineHistoryItem &other);
QWebEngineHistoryItem &operator=(const QWebEngineHistoryItem &other);
@@ -82,7 +83,8 @@ private:
Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QWebEngineHistoryItem)
class QWebEngineHistoryPrivate;
-class QWEBENGINEWIDGETS_EXPORT QWebEngineHistory {
+class Q_WEBENGINECORE_EXPORT QWebEngineHistory
+{
public:
void clear();
@@ -114,15 +116,12 @@ private:
Q_DECLARE_PRIVATE(QWebEngineHistory)
QScopedPointer<QWebEngineHistoryPrivate> d_ptr;
- friend QWEBENGINEWIDGETS_EXPORT QDataStream& operator>>(QDataStream&, QWebEngineHistory&);
- friend QWEBENGINEWIDGETS_EXPORT QDataStream& operator<<(QDataStream&, const QWebEngineHistory&);
+ friend Q_WEBENGINECORE_EXPORT QDataStream &operator>>(QDataStream &, QWebEngineHistory &);
+ friend Q_WEBENGINECORE_EXPORT QDataStream &operator<<(QDataStream &, const QWebEngineHistory &);
friend class QWebEnginePage;
friend class QWebEnginePagePrivate;
};
-QWEBENGINEWIDGETS_EXPORT QDataStream& operator<<(QDataStream& stream, const QWebEngineHistory& history);
-QWEBENGINEWIDGETS_EXPORT QDataStream& operator>>(QDataStream& stream, QWebEngineHistory& history);
-
QT_END_NAMESPACE
#endif // QWEBENGINEHISTORY_H
diff --git a/src/webenginewidgets/api/qwebenginehistory_p.h b/src/core/api/qwebenginehistory_p.h
index 8f7001967..2ca944e5b 100644
--- a/src/webenginewidgets/api/qwebenginehistory_p.h
+++ b/src/core/api/qwebenginehistory_p.h
@@ -50,29 +50,33 @@
//
// We mean it.
//
-
+#include "qtwebenginecoreglobal_p.h"
#include <QtCore/qshareddata.h>
+namespace QtWebEngineCore {
+class WebContentsAdapterClient;
+}
+
QT_BEGIN_NAMESPACE
class QWebEnginePagePrivate;
class QWebEngineHistoryItemPrivate : public QSharedData
{
public:
- QWebEngineHistoryItemPrivate(QWebEnginePagePrivate *page = 0, int index = 0);
-
- QWebEnginePagePrivate *page;
+ QWebEngineHistoryItemPrivate(QtWebEngineCore::WebContentsAdapterClient *adapter = nullptr,
+ int index = 0);
+ QtWebEngineCore::WebContentsAdapterClient *m_adapter;
int index;
};
-class QWebEngineHistoryPrivate
+class Q_WEBENGINECORE_PRIVATE_EXPORT QWebEngineHistoryPrivate
{
public:
- QWebEngineHistoryPrivate(QWebEnginePagePrivate *page);
+ QWebEngineHistoryPrivate(QtWebEngineCore::WebContentsAdapterClient *adapter);
~QWebEngineHistoryPrivate();
void updateItems() const;
- QWebEnginePagePrivate *page;
+ QtWebEngineCore::WebContentsAdapterClient *m_adapter;
mutable QList<QWebEngineHistoryItem> items;
};
diff --git a/src/core/api/qwebenginehttprequest.cpp b/src/core/api/qwebenginehttprequest.cpp
index 3395cc99f..f5733cde4 100644
--- a/src/core/api/qwebenginehttprequest.cpp
+++ b/src/core/api/qwebenginehttprequest.cpp
@@ -72,7 +72,7 @@ public:
QUrl url;
QWebEngineHttpRequest::Method method;
typedef QPair<QByteArray, QByteArray> HeaderPair;
- typedef QVector<HeaderPair> Headers;
+ typedef QList<HeaderPair> Headers;
Headers headers;
QByteArray postData;
@@ -96,7 +96,7 @@ public:
Headers::ConstIterator findHeader(const QByteArray &key) const;
Headers allHeaders() const;
- QVector<QByteArray> headersKeys() const;
+ QList<QByteArray> headersKeys() const;
void setHeader(const QByteArray &key, const QByteArray &value);
void unsetHeader(const QByteArray &key);
void setAllHeaders(const Headers &list);
@@ -293,7 +293,7 @@ QByteArray QWebEngineHttpRequest::header(const QByteArray &headerName) const
\sa setHeader(), header(), hasHeader(), unsetHeader()
*/
-QVector<QByteArray> QWebEngineHttpRequest::headers() const
+QList<QByteArray> QWebEngineHttpRequest::headers() const
{
return d->headersKeys();
}
@@ -339,9 +339,9 @@ QWebEngineHttpRequestPrivate::Headers QWebEngineHttpRequestPrivate::allHeaders()
return headers;
}
-QVector<QByteArray> QWebEngineHttpRequestPrivate::headersKeys() const
+QList<QByteArray> QWebEngineHttpRequestPrivate::headersKeys() const
{
- QVector<QByteArray> result;
+ QList<QByteArray> result;
result.reserve(headers.size());
Headers::ConstIterator it = headers.constBegin(), end = headers.constEnd();
for (; it != end; ++it)
diff --git a/src/core/api/qwebenginehttprequest.h b/src/core/api/qwebenginehttprequest.h
index 1c4d7837b..ce77c04dd 100644
--- a/src/core/api/qwebenginehttprequest.h
+++ b/src/core/api/qwebenginehttprequest.h
@@ -41,9 +41,9 @@
#define QWEBENGINEHTTPREQUEST_H
#include <QtWebEngineCore/qtwebenginecoreglobal.h>
-#include <QtCore/qshareddata.h>
-#include <QtCore/qvector.h>
+#include <QtCore/qlist.h>
#include <QtCore/qmap.h>
+#include <QtCore/qshareddata.h>
#include <QtCore/qstring.h>
#include <QtCore/qurl.h>
@@ -87,7 +87,7 @@ public:
void setPostData(const QByteArray &postData);
bool hasHeader(const QByteArray &headerName) const;
- QVector<QByteArray> headers() const;
+ QList<QByteArray> headers() const;
QByteArray header(const QByteArray &headerName) const;
void setHeader(const QByteArray &headerName, const QByteArray &value);
void unsetHeader(const QByteArray &headerName);
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/core/api/qwebenginepage.cpp
index 6fb3c5c43..aa3fba24e 100644
--- a/src/webenginewidgets/api/qwebenginepage.cpp
+++ b/src/core/api/qwebenginepage.cpp
@@ -40,16 +40,16 @@
#include "qwebenginepage.h"
#include "qwebenginepage_p.h"
+#include "qwebenginedownloadrequest_p.h"
#include "authentication_dialog_controller.h"
#include "profile_adapter.h"
-#include "certificate_error_controller.h"
#include "color_chooser_controller.h"
#include "favicon_manager.h"
#include "find_text_helper.h"
#include "file_picker_controller.h"
#include "javascript_dialog_controller.h"
#if QT_CONFIG(webengine_printing_and_pdf)
-#include "printer_worker.h"
+#include "printing/printer_worker.h"
#endif
#include "qwebenginecertificateerror.h"
#include "qwebenginefindtextresult.h"
@@ -63,45 +63,25 @@
#include "qwebengineregisterprotocolhandlerrequest.h"
#include "qwebenginescriptcollection_p.h"
#include "qwebenginesettings.h"
-#include "qwebengineview.h"
-#include "qwebengineview_p.h"
#include "user_notification_controller.h"
-#include "render_widget_host_view_qt_delegate_widget.h"
+#include "render_widget_host_view_qt_delegate.h"
#include "web_contents_adapter.h"
#include "web_engine_settings.h"
#include "qwebenginescript.h"
-
+#include "render_view_context_menu_qt.h"
+#include "render_widget_host_view_qt_delegate_client.h"
#include <QAction>
-#include <QApplication>
+#include <QGuiApplication>
#include <QAuthenticator>
#include <QClipboard>
-#if QT_CONFIG(colordialog)
-#include <QColorDialog>
-#endif
-#include <QContextMenuEvent>
-#if QT_CONFIG(filedialog)
-#include <QFileDialog>
-#endif
#include <QKeyEvent>
#include <QIcon>
-#if QT_CONFIG(inputdialog)
-#include <QInputDialog>
-#endif
-#include <QLayout>
#include <QLoggingCategory>
-#if QT_CONFIG(menu)
-#include <QMenu>
-#endif
-#if QT_CONFIG(messagebox)
-#include <QMessageBox>
-#endif
#include <QMimeData>
#if QT_CONFIG(webengine_printing_and_pdf)
#include <QPrinter>
#include <QThread>
#endif
-#include <QStandardPaths>
-#include <QStyle>
#include <QTimer>
#include <QUrl>
@@ -111,6 +91,49 @@ using namespace QtWebEngineCore;
static const int MaxTooltipLength = 1024;
+// 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
+ { /*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 *client) override { }
+ bool copySurface(const QRect &rect, const QSize &size, QImage &image)
+ {
+ 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) {
@@ -177,7 +200,7 @@ 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 new RenderWidgetHostViewQtDelegateWidget(client, this->view);
+ return view ? view->CreateRenderWidgetHostViewQtDelegate(client) : new DummyDelegate(client);
}
void QWebEnginePagePrivate::initializationFinished()
@@ -261,7 +284,7 @@ void QWebEnginePagePrivate::renderProcessPidChanged(qint64 pid)
QRectF QWebEnginePagePrivate::viewportRect() const
{
- return view ? view->rect() : QRectF();
+ return view ? view->viewportRect() : QRectF();
}
QColor QWebEnginePagePrivate::backgroundColor() const
@@ -278,7 +301,7 @@ void QWebEnginePagePrivate::loadStarted(const QUrl &provisionalUrl, bool isError
return;
isLoading = true;
- m_certificateErrorControllers.clear();
+
QTimer::singleShot(0, q, &QWebEnginePage::loadStarted);
}
@@ -290,7 +313,6 @@ void QWebEnginePagePrivate::loadFinished(bool success, const QUrl &url, bool isE
Q_UNUSED(errorDescription);
if (isErrorPage) {
- Q_ASSERT(settings->testAttribute(QWebEngineSettings::ErrorPageEnabled));
QTimer::singleShot(0, q, [q](){
emit q->loadFinished(false);
});
@@ -316,15 +338,15 @@ void QWebEnginePagePrivate::didPrintPageToPdf(const QString &filePath, bool succ
void QWebEnginePagePrivate::focusContainer()
{
if (view) {
- view->activateWindow();
- view->setFocus();
+ view->focusContainer();
}
}
void QWebEnginePagePrivate::unhandledKeyEvent(QKeyEvent *event)
{
- if (view && view->parentWidget())
- QGuiApplication::sendEvent(view->parentWidget(), event);
+ if (view) {
+ view->unhandledKeyEvent(event);
+ }
}
QSharedPointer<WebContentsAdapter>
@@ -337,8 +359,13 @@ QWebEnginePagePrivate::adoptNewWindow(QSharedPointer<WebContentsAdapter> newWebC
Q_UNUSED(targetUrl);
QWebEnginePage *newPage = q->createWindow(toWindowType(disposition));
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
if (!newPage)
return nullptr;
+#else
+ if (!newPage)
+ return adapter;
+#endif
if (!newWebContents->webContents())
return newPage->d_func()->adapter; // Reuse existing adapter
@@ -433,9 +460,7 @@ void QWebEnginePagePrivate::didPrintPage(quint64 requestId, QSharedPointer<QByte
bool QWebEnginePagePrivate::passOnFocus(bool reverse)
{
- if (view)
- return view->focusNextPrevChild(!reverse);
- return false;
+ return view ? view->passOnFocus(reverse) : false;
}
void QWebEnginePagePrivate::authenticationRequired(QSharedPointer<AuthenticationDialogController> controller)
@@ -467,20 +492,8 @@ void QWebEnginePagePrivate::releaseProfile()
void QWebEnginePagePrivate::showColorDialog(QSharedPointer<ColorChooserController> controller)
{
-#if QT_CONFIG(colordialog)
- QColorDialog *dialog = new QColorDialog(controller.data()->initialColor(), view);
-
- QColorDialog::connect(dialog, SIGNAL(colorSelected(QColor)), controller.data(), SLOT(accept(QColor)));
- QColorDialog::connect(dialog, SIGNAL(rejected()), controller.data(), SLOT(reject()));
-
- // Delete when done
- QColorDialog::connect(dialog, SIGNAL(colorSelected(QColor)), dialog, SLOT(deleteLater()));
- QColorDialog::connect(dialog, SIGNAL(rejected()), dialog, SLOT(deleteLater()));
-
- dialog->open();
-#else
- Q_UNUSED(controller);
-#endif
+ if (view)
+ view->showColorDialog(controller);
}
void QWebEnginePagePrivate::runMediaAccessPermissionRequest(const QUrl &securityOrigin, WebContentsAdapterClient::MediaRequestFlags requestFlags)
@@ -542,13 +555,13 @@ void QWebEnginePagePrivate::runRegisterProtocolHandlerRequest(QWebEngineRegister
QObject *QWebEnginePagePrivate::accessibilityParentObject()
{
- return view;
+ return view ? view->accessibilityParentObject() : nullptr;
}
void QWebEnginePagePrivate::updateAction(QWebEnginePage::WebAction action) const
{
#ifdef QT_NO_ACTION
- Q_UNUSED(action)
+ Q_UNUSED(action);
#else
QAction *a = actions[action];
if (!a)
@@ -674,12 +687,6 @@ const QObject *QWebEnginePagePrivate::holdingQObject() const
return q;
}
-void QWebEnginePagePrivate::widgetChanged(RenderWidgetHostViewQtDelegate *newWidgetBase)
-{
- Q_Q(QWebEnginePage);
- bindPageAndWidget(q, static_cast<RenderWidgetHostViewQtDelegateWidget *>(newWidgetBase));
-}
-
void QWebEnginePagePrivate::findTextFinished(const QWebEngineFindTextResult &result)
{
Q_Q(QWebEnginePage);
@@ -692,90 +699,6 @@ void QWebEnginePagePrivate::ensureInitialized() const
adapter->loadDefault();
}
-void QWebEnginePagePrivate::bindPageAndView(QWebEnginePage *page, QWebEngineView *view)
-{
- auto oldView = page ? page->d_func()->view : nullptr;
- auto oldPage = view ? view->d_func()->page : nullptr;
-
- bool ownNewPage = false;
- bool deleteOldPage = false;
-
- // Change pointers first.
-
- if (page && oldView != view) {
- if (oldView) {
- ownNewPage = oldView->d_func()->m_ownsPage;
- oldView->d_func()->page = nullptr;
- oldView->d_func()->m_ownsPage = false;
- }
- page->d_func()->view = view;
- }
-
- if (view && oldPage != page) {
- if (oldPage) {
- if (oldPage->d_func())
- oldPage->d_func()->view = nullptr;
- deleteOldPage = view->d_func()->m_ownsPage;
- }
- view->d_func()->m_ownsPage = ownNewPage;
- view->d_func()->page = page;
- }
-
- // Then notify.
-
- auto widget = page ? page->d_func()->widget : nullptr;
- auto oldWidget = (oldPage && oldPage->d_func()) ? oldPage->d_func()->widget : nullptr;
-
- if (page && oldView != view && oldView) {
- oldView->d_func()->pageChanged(page, nullptr);
- if (widget)
- oldView->d_func()->widgetChanged(widget, nullptr);
- }
-
- if (view && oldPage != page) {
- if (oldPage && oldPage->d_func())
- view->d_func()->pageChanged(oldPage, page);
- else
- view->d_func()->pageChanged(nullptr, page);
- if (oldWidget != widget)
- view->d_func()->widgetChanged(oldWidget, widget);
- }
- if (deleteOldPage)
- delete oldPage;
-}
-
-void QWebEnginePagePrivate::bindPageAndWidget(QWebEnginePage *page, RenderWidgetHostViewQtDelegateWidget *widget)
-{
- auto oldPage = widget ? widget->m_page : nullptr;
- auto oldWidget = page ? page->d_func()->widget : nullptr;
-
- // Change pointers first.
-
- if (widget && oldPage != page) {
- if (oldPage && oldPage->d_func())
- oldPage->d_func()->widget = nullptr;
- widget->m_page = page;
- }
-
- if (page && oldWidget != widget) {
- if (oldWidget)
- oldWidget->m_page = nullptr;
- page->d_func()->widget = widget;
- }
-
- // Then notify.
-
- if (widget && oldPage != page && oldPage && oldPage->d_func()) {
- if (auto oldView = oldPage->d_func()->view)
- oldView->d_func()->widgetChanged(widget, nullptr);
- }
-
- if (page && oldWidget != widget) {
- if (auto view = page->d_func()->view)
- view->d_func()->widgetChanged(oldWidget, widget);
- }
-}
-
QWebEnginePage::QWebEnginePage(QObject* parent)
: QObject(parent)
, d_ptr(new QWebEnginePagePrivate())
@@ -857,15 +780,15 @@ QWebEnginePage::QWebEnginePage(QObject* parent)
*/
/*!
- \fn QWebEnginePage::registerProtocolHandlerRequested(QWebEngineRegisterProtocolHandlerRequest request)
- \since 5.11
+ \fn QWebEnginePage::registerProtocolHandlerRequested(QWebEngineRegisterProtocolHandlerRequest
+ request) \since 5.11
This signal is emitted when the web page tries to register a custom protocol
using the \l registerProtocolHandler API.
The request object \a request can be used to accept or reject the request:
- \snippet webenginewidgets/simplebrowser/webpage.cpp registerProtocolHandlerRequested
+ \snippet webenginewidgets/simplebrowser/webview.cpp registerProtocolHandlerRequested
*/
/*!
@@ -964,8 +887,7 @@ QWebEnginePage::~QWebEnginePage()
if (d_ptr) {
// d_ptr might be exceptionally null if profile adapter got deleted first
setDevToolsPage(nullptr);
- QWebEnginePagePrivate::bindPageAndView(this, nullptr);
- QWebEnginePagePrivate::bindPageAndWidget(this, nullptr);
+ emit _q_aboutToDelete();
}
}
@@ -1041,8 +963,8 @@ void QWebEnginePage::setWebChannel(QWebChannel *channel, uint worldId)
d->adapter->setWebChannel(channel, worldId);
}
#else
- Q_UNUSED(channel)
- Q_UNUSED(worldId)
+ Q_UNUSED(channel);
+ Q_UNUSED(worldId);
qWarning("WebEngine compiled without webchannel support");
#endif
}
@@ -1087,11 +1009,11 @@ void QWebEnginePage::setBackgroundColor(const QColor &color)
*
* This function issues an asynchronous download request for the web page and returns immediately.
*
- * \sa QWebEngineDownloadItem::SavePageFormat
+ * \sa QWebEngineDownloadRequest::SavePageFormat
* \since 5.8
*/
void QWebEnginePage::save(const QString &filePath,
- QWebEngineDownloadItem::SavePageFormat format) const
+ QWebEngineDownloadRequest::SavePageFormat format) const
{
Q_D(const QWebEnginePage);
d->ensureInitialized();
@@ -1151,17 +1073,6 @@ qint64 QWebEnginePage::renderProcessPid() const
return d->adapter->renderProcessPid();
}
-void QWebEnginePage::setView(QWidget *newViewBase)
-{
- QWebEnginePagePrivate::bindPageAndView(this, qobject_cast<QWebEngineView *>(newViewBase));
-}
-
-QWidget *QWebEnginePage::view() const
-{
- Q_D(const QWebEnginePage);
- return d->view;
-}
-
/*!
Returns the web engine profile the page belongs to.
\since 5.5
@@ -1193,29 +1104,21 @@ QAction *QWebEnginePage::action(WebAction action) const
return d->actions[action];
QString text;
- QIcon icon;
- QStyle *style = d->view ? d->view->style() : qApp->style();
-
switch (action) {
case Back:
text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::Back);
- icon = style->standardIcon(QStyle::SP_ArrowBack);
break;
case Forward:
text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::Forward);
- icon = style->standardIcon(QStyle::SP_ArrowForward);
break;
case Stop:
text = tr("Stop");
- icon = style->standardIcon(QStyle::SP_BrowserStop);
break;
case Reload:
text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::Reload);
- icon = style->standardIcon(QStyle::SP_BrowserReload);
break;
case ReloadAndBypassCache:
text = tr("Reload and Bypass Cache");
- icon = style->standardIcon(QStyle::SP_BrowserReload);
break;
case Cut:
text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::Cut);
@@ -1346,7 +1249,6 @@ QAction *QWebEnginePage::action(WebAction action) const
QAction *a = new QAction(const_cast<QWebEnginePage*>(this));
a->setText(text);
a->setData(action);
- a->setIcon(icon);
connect(a, SIGNAL(triggered(bool)), this, SLOT(_q_webActionTriggered(bool)));
@@ -1360,7 +1262,6 @@ void QWebEnginePage::triggerAction(WebAction action, bool)
{
Q_D(QWebEnginePage);
d->ensureInitialized();
- const QtWebEngineCore::WebEngineContextMenuData *menuData = d->contextData.d;
switch (action) {
case Back:
d->adapter->navigateBack();
@@ -1402,35 +1303,36 @@ void QWebEnginePage::triggerAction(WebAction action, bool)
d->adapter->unselect();
break;
case OpenLinkInThisWindow:
- if (menuData && menuData->linkUrl().isValid())
- setUrl(menuData->linkUrl());
+ if (d->view && d->view->lastContextMenuRequest()->filteredLinkUrl().isValid())
+ setUrl(d->view->lastContextMenuRequest()->filteredLinkUrl());
break;
case OpenLinkInNewWindow:
- if (menuData && menuData->linkUrl().isValid()) {
+ if (d->view && d->view->lastContextMenuRequest()->filteredLinkUrl().isValid()) {
QWebEnginePage *newPage = createWindow(WebBrowserWindow);
if (newPage)
- newPage->setUrl(menuData->linkUrl());
+ newPage->setUrl(d->view->lastContextMenuRequest()->filteredLinkUrl());
}
break;
case OpenLinkInNewTab:
- if (menuData && menuData->linkUrl().isValid()) {
+ if (d->view && d->view->lastContextMenuRequest()->filteredLinkUrl().isValid()) {
QWebEnginePage *newPage = createWindow(WebBrowserTab);
if (newPage)
- newPage->setUrl(menuData->linkUrl());
+ newPage->setUrl(d->view->lastContextMenuRequest()->filteredLinkUrl());
}
break;
case OpenLinkInNewBackgroundTab:
- if (menuData && menuData->linkUrl().isValid()) {
+ if (d->view && d->view->lastContextMenuRequest()->filteredLinkUrl().isValid()) {
QWebEnginePage *newPage = createWindow(WebBrowserBackgroundTab);
if (newPage)
- newPage->setUrl(menuData->linkUrl());
+ newPage->setUrl(d->view->lastContextMenuRequest()->filteredLinkUrl());
}
break;
case CopyLinkToClipboard:
- if (menuData && !menuData->unfilteredLinkUrl().isEmpty()) {
- QString urlString = menuData->unfilteredLinkUrl().toString(QUrl::FullyEncoded);
- QString linkText = menuData->linkText().toHtmlEscaped();
- QString title = menuData->titleText();
+ if (d->view && !d->view->lastContextMenuRequest()->linkUrl().isEmpty()) {
+ QString urlString = d->view->lastContextMenuRequest()->linkUrl().toString(
+ QUrl::FullyEncoded);
+ QString linkText = d->view->lastContextMenuRequest()->linkText().toHtmlEscaped();
+ QString title = d->view->lastContextMenuRequest()->titleText();
if (!title.isEmpty())
title = QStringLiteral(" title=\"%1\"").arg(title.toHtmlEscaped());
QMimeData *data = new QMimeData();
@@ -1438,102 +1340,127 @@ void QWebEnginePage::triggerAction(WebAction action, bool)
QString html = QStringLiteral("<a href=\"") + urlString + QStringLiteral("\"") + title + QStringLiteral(">")
+ linkText + QStringLiteral("</a>");
data->setHtml(html);
- data->setUrls(QList<QUrl>() << menuData->unfilteredLinkUrl());
- qApp->clipboard()->setMimeData(data);
+ data->setUrls(QList<QUrl>() << d->view->lastContextMenuRequest()->linkUrl());
+ QGuiApplication::clipboard()->setMimeData(data);
}
break;
case DownloadLinkToDisk:
- if (menuData && menuData->linkUrl().isValid())
- d->adapter->download(menuData->linkUrl(), menuData->suggestedFileName(),
- menuData->referrerUrl(), menuData->referrerPolicy());
+ if (d->view && d->view->lastContextMenuRequest()->filteredLinkUrl().isValid())
+ d->adapter->download(d->view->lastContextMenuRequest()->filteredLinkUrl(),
+ d->view->lastContextMenuRequest()->suggestedFileName(),
+ d->view->lastContextMenuRequest()->referrerUrl(),
+ d->view->lastContextMenuRequest()->referrerPolicy());
break;
case CopyImageToClipboard:
- if (menuData && menuData->hasImageContent() &&
- (menuData->mediaType() == WebEngineContextMenuData::MediaTypeImage ||
- menuData->mediaType() == WebEngineContextMenuData::MediaTypeCanvas))
- {
- d->adapter->copyImageAt(menuData->position());
+ if (d->view && d->view->lastContextMenuRequest()->hasImageContent()
+ && (d->view->lastContextMenuRequest()->mediaType()
+ == QWebEngineContextMenuRequest::MediaTypeImage
+ || d->view->lastContextMenuRequest()->mediaType()
+ == QWebEngineContextMenuRequest::MediaTypeCanvas)) {
+ d->adapter->copyImageAt(d->view->lastContextMenuRequest()->position());
}
break;
case CopyImageUrlToClipboard:
- if (menuData && menuData->mediaUrl().isValid() && menuData->mediaType() == WebEngineContextMenuData::MediaTypeImage) {
- QString urlString = menuData->mediaUrl().toString(QUrl::FullyEncoded);
- QString alt = menuData->altText();
+ if (d->view && d->view->lastContextMenuRequest()->mediaUrl().isValid()
+ && d->view->lastContextMenuRequest()->mediaType()
+ == QWebEngineContextMenuRequest::MediaTypeImage) {
+ QString urlString =
+ d->view->lastContextMenuRequest()->mediaUrl().toString(QUrl::FullyEncoded);
+ QString alt = d->view->lastContextMenuRequest()->altText();
if (!alt.isEmpty())
alt = QStringLiteral(" alt=\"%1\"").arg(alt.toHtmlEscaped());
- QString title = menuData->titleText();
+ QString title = d->view->lastContextMenuRequest()->titleText();
if (!title.isEmpty())
title = QStringLiteral(" title=\"%1\"").arg(title.toHtmlEscaped());
QMimeData *data = new QMimeData();
data->setText(urlString);
QString html = QStringLiteral("<img src=\"") + urlString + QStringLiteral("\"") + title + alt + QStringLiteral("></img>");
data->setHtml(html);
- data->setUrls(QList<QUrl>() << menuData->mediaUrl());
- qApp->clipboard()->setMimeData(data);
+ data->setUrls(QList<QUrl>() << d->view->lastContextMenuRequest()->mediaUrl());
+ QGuiApplication::clipboard()->setMimeData(data);
}
break;
case DownloadImageToDisk:
case DownloadMediaToDisk:
- if (menuData && menuData->mediaUrl().isValid())
- d->adapter->download(menuData->mediaUrl(), menuData->suggestedFileName(),
- menuData->referrerUrl(), menuData->referrerPolicy());
+ if (d->view && d->view->lastContextMenuRequest()->mediaUrl().isValid())
+ d->adapter->download(d->view->lastContextMenuRequest()->mediaUrl(),
+ d->view->lastContextMenuRequest()->suggestedFileName(),
+ d->view->lastContextMenuRequest()->referrerUrl(),
+ d->view->lastContextMenuRequest()->referrerPolicy());
break;
case CopyMediaUrlToClipboard:
- if (menuData && menuData->mediaUrl().isValid() &&
- (menuData->mediaType() == WebEngineContextMenuData::MediaTypeAudio ||
- menuData->mediaType() == WebEngineContextMenuData::MediaTypeVideo))
- {
- QString urlString = menuData->mediaUrl().toString(QUrl::FullyEncoded);
- QString title = menuData->titleText();
+ if (d->view && d->view->lastContextMenuRequest()->mediaUrl().isValid()
+ && (d->view->lastContextMenuRequest()->mediaType()
+ == QWebEngineContextMenuRequest::MediaTypeAudio
+ || d->view->lastContextMenuRequest()->mediaType()
+ == QWebEngineContextMenuRequest::MediaTypeVideo)) {
+ QString urlString =
+ d->view->lastContextMenuRequest()->mediaUrl().toString(QUrl::FullyEncoded);
+ QString title = d->view->lastContextMenuRequest()->titleText();
if (!title.isEmpty())
title = QStringLiteral(" title=\"%1\"").arg(title.toHtmlEscaped());
QMimeData *data = new QMimeData();
data->setText(urlString);
- if (menuData->mediaType() == WebEngineContextMenuData::MediaTypeAudio)
+ if (d->view->lastContextMenuRequest()->mediaType()
+ == QWebEngineContextMenuRequest::MediaTypeAudio)
data->setHtml(QStringLiteral("<audio src=\"") + urlString + QStringLiteral("\"") + title +
QStringLiteral("></audio>"));
else
data->setHtml(QStringLiteral("<video src=\"") + urlString + QStringLiteral("\"") + title +
QStringLiteral("></video>"));
- data->setUrls(QList<QUrl>() << menuData->mediaUrl());
- qApp->clipboard()->setMimeData(data);
+ data->setUrls(QList<QUrl>() << d->view->lastContextMenuRequest()->mediaUrl());
+ QGuiApplication::clipboard()->setMimeData(data);
}
break;
case ToggleMediaControls:
- if (menuData && menuData->mediaUrl().isValid() && menuData->mediaFlags() & WebEngineContextMenuData::MediaCanToggleControls) {
- bool enable = !(menuData->mediaFlags() & WebEngineContextMenuData::MediaControls);
- d->adapter->executeMediaPlayerActionAt(menuData->position(), WebContentsAdapter::MediaPlayerControls, enable);
+ if (d->view && d->view->lastContextMenuRequest()->mediaUrl().isValid()
+ && d->view->lastContextMenuRequest()->mediaFlags()
+ & QWebEngineContextMenuRequest::MediaCanToggleControls) {
+ bool enable = !(d->view->lastContextMenuRequest()->mediaFlags()
+ & QWebEngineContextMenuRequest::MediaControls);
+ d->adapter->executeMediaPlayerActionAt(d->view->lastContextMenuRequest()->position(),
+ WebContentsAdapter::MediaPlayerControls, enable);
}
break;
case ToggleMediaLoop:
- if (menuData && menuData->mediaUrl().isValid() &&
- (menuData->mediaType() == WebEngineContextMenuData::MediaTypeAudio ||
- menuData->mediaType() == WebEngineContextMenuData::MediaTypeVideo))
- {
- bool enable = !(menuData->mediaFlags() & WebEngineContextMenuData::MediaLoop);
- d->adapter->executeMediaPlayerActionAt(menuData->position(), WebContentsAdapter::MediaPlayerLoop, enable);
+ if (d->view && d->view->lastContextMenuRequest()->mediaUrl().isValid()
+ && (d->view->lastContextMenuRequest()->mediaType()
+ == QWebEngineContextMenuRequest::MediaTypeAudio
+ || d->view->lastContextMenuRequest()->mediaType()
+ == QWebEngineContextMenuRequest::MediaTypeVideo)) {
+ bool enable = !(d->view->lastContextMenuRequest()->mediaFlags()
+ & QWebEngineContextMenuRequest::MediaLoop);
+ d->adapter->executeMediaPlayerActionAt(d->view->lastContextMenuRequest()->position(),
+ WebContentsAdapter::MediaPlayerLoop, enable);
}
break;
case ToggleMediaPlayPause:
- if (menuData && menuData->mediaUrl().isValid() &&
- (menuData->mediaType() == WebEngineContextMenuData::MediaTypeAudio ||
- menuData->mediaType() == WebEngineContextMenuData::MediaTypeVideo))
- {
- bool enable = (menuData->mediaFlags() & WebEngineContextMenuData::MediaPaused);
- d->adapter->executeMediaPlayerActionAt(menuData->position(), WebContentsAdapter::MediaPlayerPlay, enable);
+ if (d->view && d->view->lastContextMenuRequest()->mediaUrl().isValid()
+ && (d->view->lastContextMenuRequest()->mediaType()
+ == QWebEngineContextMenuRequest::MediaTypeAudio
+ || d->view->lastContextMenuRequest()->mediaType()
+ == QWebEngineContextMenuRequest::MediaTypeVideo)) {
+ bool enable = (d->view->lastContextMenuRequest()->mediaFlags()
+ & QWebEngineContextMenuRequest::MediaPaused);
+ d->adapter->executeMediaPlayerActionAt(d->view->lastContextMenuRequest()->position(),
+ WebContentsAdapter::MediaPlayerPlay, enable);
}
break;
case ToggleMediaMute:
- if (menuData && menuData->mediaUrl().isValid() && menuData->mediaFlags() & WebEngineContextMenuData::MediaHasAudio) {
+ if (d->view && d->view->lastContextMenuRequest()->mediaUrl().isValid()
+ && d->view->lastContextMenuRequest()->mediaFlags()
+ & QWebEngineContextMenuRequest::MediaHasAudio) {
// Make sure to negate the value, so that toggling actually works.
- bool enable = !(menuData->mediaFlags() & WebEngineContextMenuData::MediaMuted);
- d->adapter->executeMediaPlayerActionAt(menuData->position(), WebContentsAdapter::MediaPlayerMute, enable);
+ bool enable = !(d->view->lastContextMenuRequest()->mediaFlags()
+ & QWebEngineContextMenuRequest::MediaMuted);
+ d->adapter->executeMediaPlayerActionAt(d->view->lastContextMenuRequest()->position(),
+ WebContentsAdapter::MediaPlayerMute, enable);
}
break;
case InspectElement:
- if (menuData)
- d->adapter->inspectElementAt(menuData->position());
+ if (d->view)
+ d->adapter->inspectElementAt(d->view->lastContextMenuRequest()->position());
break;
case ExitFullScreen:
// See under ViewSource, anything that can trigger a delete of the current view is dangerous to call directly here.
@@ -1604,8 +1531,8 @@ void QWebEnginePage::triggerAction(WebAction action, bool)
* \since 5.8
* Replace the current misspelled word with \a replacement.
*
- * The current misspelled word can be found in QWebEngineContextMenuData::misspelledWord(),
- * and suggested replacements in QWebEngineContextMenuData::spellCheckerSuggestions().
+ * The current misspelled word can be found in QWebEngineContextMenuRequest::misspelledWord(),
+ * and suggested replacements in QWebEngineContextMenuRequest::spellCheckerSuggestions().
*
* \sa contextMenuData(),
*/
@@ -1635,40 +1562,10 @@ bool QWebEnginePage::event(QEvent *e)
return QObject::event(e);
}
-void QWebEnginePagePrivate::contextMenuRequested(const WebEngineContextMenuData &data)
+void QWebEnginePagePrivate::contextMenuRequested(QWebEngineContextMenuRequest *data)
{
-#if QT_CONFIG(action)
- if (!view)
- return;
-
- contextData.reset();
- switch (view->contextMenuPolicy()) {
- case Qt::DefaultContextMenu:
- {
- contextData = data;
- QContextMenuEvent event(QContextMenuEvent::Mouse, data.position(), view->mapToGlobal(data.position()));
- view->contextMenuEvent(&event);
- return;
- }
- case Qt::CustomContextMenu:
- contextData = data;
- Q_EMIT view->customContextMenuRequested(data.position());
- return;
- case Qt::ActionsContextMenu:
- if (view->actions().count()) {
- QContextMenuEvent event(QContextMenuEvent::Mouse, data.position(), view->mapToGlobal(data.position()));
- QMenu::exec(view->actions(), event.globalPos(), 0, view);
- }
- return;
- case Qt::PreventContextMenu:
- case Qt::NoContextMenu:
- return;
- }
-
- Q_UNREACHABLE();
-#else
- Q_UNUSED(data);
-#endif // QT_CONFIG(action)
+ if (view)
+ view->contextMenuRequested(data);
}
void QWebEnginePagePrivate::navigationRequested(int navigationType, const QUrl &url, int &navigationRequestAction, bool isMainFrame)
@@ -1683,8 +1580,8 @@ void QWebEnginePagePrivate::navigationRequested(int navigationType, const QUrl &
void QWebEnginePagePrivate::requestFullScreenMode(const QUrl &origin, bool fullscreen)
{
Q_Q(QWebEnginePage);
- QWebEngineFullScreenRequest request(q, origin, fullscreen);
- Q_EMIT q->fullScreenRequested(request);
+ QWebEngineFullScreenRequest request(origin, fullscreen, [q = QPointer(q)] (bool toggleOn) { if (q) q->d_ptr->setFullScreenMode(toggleOn); });
+ Q_EMIT q->fullScreenRequested(std::move(request));
}
bool QWebEnginePagePrivate::isFullScreenMode() const
@@ -1714,9 +1611,8 @@ void QWebEnginePagePrivate::javascriptDialog(QSharedPointer<JavaScriptDialogCont
accepted = q->javaScriptConfirm(controller->securityOrigin(), QCoreApplication::translate("QWebEnginePage", "Are you sure you want to leave this page? Changes that you made may not be saved."));
break;
case InternalAuthorizationDialog:
-#if QT_CONFIG(messagebox)
- accepted = (QMessageBox::question(view, controller->title(), controller->message(), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes);
-#endif // QT_CONFIG(messagebox)
+ accepted = view ? view->showAuthorizationDialog(controller->title(), controller->message())
+ : false;
break;
}
if (accepted)
@@ -1725,32 +1621,20 @@ void QWebEnginePagePrivate::javascriptDialog(QSharedPointer<JavaScriptDialogCont
controller->reject();
}
-void QWebEnginePagePrivate::allowCertificateError(const QSharedPointer<CertificateErrorController> &controller)
+void QWebEnginePagePrivate::allowCertificateError(const QWebEngineCertificateError &error)
{
Q_Q(QWebEnginePage);
- bool accepted = false;
-
- QWebEngineCertificateError error(controller);
- accepted = q->certificateError(error);
- if (error.deferred() && !error.answered())
- m_certificateErrorControllers.append(controller);
- else if (!error.answered())
- controller->accept(error.isOverridable() && accepted);
+ q->certificateError(error);
}
void QWebEnginePagePrivate::selectClientCert(const QSharedPointer<ClientCertSelectController> &controller)
{
-#if !defined(QT_NO_SSL) || QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
Q_Q(QWebEnginePage);
QWebEngineClientCertificateSelection certSelection(controller);
Q_EMIT q->selectClientCertificate(certSelection);
-#else
- Q_UNUSED(controller);
-#endif
}
-#if !defined(QT_NO_SSL) || QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
/*!
\fn void QWebEnginePage::selectClientCertificate(QWebEngineClientCertificateSelection clientCertificateSelection)
\since 5.12
@@ -1766,7 +1650,6 @@ void QWebEnginePagePrivate::selectClientCert(const QSharedPointer<ClientCertSele
\sa QWebEngineClientCertificateSelection
*/
-#endif
void QWebEnginePagePrivate::javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, const QString &message, int lineNumber, const QString &sourceID)
{
@@ -1789,29 +1672,17 @@ void QWebEnginePagePrivate::requestGeometryChange(const QRect &geometry, const Q
Q_EMIT q->geometryChangeRequested(frameGeometry);
}
-void QWebEnginePagePrivate::startDragging(const content::DropData &dropData,
- Qt::DropActions allowedActions, const QPixmap &pixmap,
- const QPoint &offset)
+QObject *QWebEnginePagePrivate::dragSource() const
{
#if !QT_CONFIG(draganddrop)
- Q_UNUSED(dropData);
- Q_UNUSED(allowedActions);
- Q_UNUSED(pixmap);
- Q_UNUSED(offset);
+ return view;
#else
- adapter->startDragging(view, dropData, allowedActions, pixmap, offset);
+ return nullptr;
#endif // QT_CONFIG(draganddrop)
}
-bool QWebEnginePagePrivate::supportsDragging() const
-{
- return true;
-}
-
bool QWebEnginePagePrivate::isEnabled() const
{
- const Q_Q(QWebEnginePage);
- const QWidget *view = q->view();
if (view)
return view->isEnabled();
return true;
@@ -1819,23 +1690,8 @@ bool QWebEnginePagePrivate::isEnabled() const
void QWebEnginePagePrivate::setToolTip(const QString &toolTipText)
{
- if (!view)
- return;
-
- // Hide tooltip if shown.
- if (toolTipText.isEmpty()) {
- if (!view->toolTip().isEmpty())
- view->setToolTip(QString());
-
- return;
- }
-
- // Update tooltip if text was changed.
- QString wrappedTip = QLatin1String("<p style=\"white-space:pre-wrap\">")
- % toolTipText.toHtmlEscaped().left(MaxTooltipLength)
- % QLatin1String("</p>");
- if (view->toolTip() != wrappedTip)
- view->setToolTip(wrappedTip);
+ if (view)
+ view->setToolTip(toolTipText);
}
void QWebEnginePagePrivate::printRequested()
@@ -1886,27 +1742,6 @@ void QWebEnginePage::setUrlRequestInterceptor(QWebEngineUrlRequestInterceptor *i
d->adapter->setRequestInterceptor(interceptor);
}
-#if QT_CONFIG(menu)
-QMenu *QWebEnginePage::createStandardContextMenu()
-{
- Q_D(QWebEnginePage);
- if (!d->contextData.d)
- return nullptr;
- d->ensureInitialized();
-
- QMenu *menu = new QMenu(d->view);
- const WebEngineContextMenuData &contextMenuData = *d->contextData.d;
-
- QContextMenuBuilder contextMenuBuilder(contextMenuData, this, menu);
-
- contextMenuBuilder.initMenu();
-
- menu->setAttribute(Qt::WA_DeleteOnClose, true);
-
- return menu;
-}
-#endif // QT_CONFIG(menu)
-
void QWebEnginePage::setFeaturePermission(const QUrl &securityOrigin, QWebEnginePage::Feature feature, QWebEnginePage::PermissionPolicy policy)
{
Q_D(QWebEnginePage);
@@ -2003,9 +1838,9 @@ void QWebEnginePagePrivate::runFileChooser(QSharedPointer<FilePickerController>
controller->rejected();
}
-WebEngineSettings *QWebEnginePagePrivate::webEngineSettings() const
+QWebEngineSettings *QWebEnginePagePrivate::webEngineSettings() const
{
- return settings->d_func();
+ return settings;
}
/*!
@@ -2209,12 +2044,7 @@ QWebEngineScriptCollection &QWebEnginePage::scripts()
QWebEnginePage *QWebEnginePage::createWindow(WebWindowType type)
{
Q_D(QWebEnginePage);
- if (d->view) {
- QWebEngineView *newView = d->view->createWindow(type);
- if (newView)
- return newView->page();
- }
- return 0;
+ return d->view ? d->view->createPageForWindow(type) : nullptr;
}
/*!
@@ -2309,89 +2139,33 @@ void QWebEnginePage::setDevToolsPage(QWebEnginePage *devToolsPage)
ASSERT_ENUMS_MATCH(FilePickerController::Open, QWebEnginePage::FileSelectOpen)
ASSERT_ENUMS_MATCH(FilePickerController::OpenMultiple, QWebEnginePage::FileSelectOpenMultiple)
+// TODO: remove virtuals
QStringList QWebEnginePage::chooseFiles(FileSelectionMode mode, const QStringList &oldFiles, const QStringList &acceptedMimeTypes)
{
-#if QT_CONFIG(filedialog)
- const QStringList &filter = FilePickerController::nameFilters(acceptedMimeTypes);
- QStringList ret;
- QString str;
- switch (static_cast<FilePickerController::FileChooserMode>(mode)) {
- case FilePickerController::OpenMultiple:
- ret = QFileDialog::getOpenFileNames(view(), QString(), QString(), filter.join(QStringLiteral(";;")), nullptr, QFileDialog::HideNameFilterDetails);
- break;
- // Chromium extension, not exposed as part of the public API for now.
- case FilePickerController::UploadFolder:
- str = QFileDialog::getExistingDirectory(view(), tr("Select folder to upload"));
- if (!str.isNull())
- ret << str;
- break;
- case FilePickerController::Save:
- str = QFileDialog::getSaveFileName(view(), QString(), (QStandardPaths::writableLocation(QStandardPaths::DownloadLocation) + oldFiles.first()));
- if (!str.isNull())
- ret << str;
- break;
- case FilePickerController::Open:
- str = QFileDialog::getOpenFileName(view(), QString(), oldFiles.first(), filter.join(QStringLiteral(";;")), nullptr, QFileDialog::HideNameFilterDetails);
- if (!str.isNull())
- ret << str;
- break;
- }
- return ret;
-#else
- Q_UNUSED(mode);
- Q_UNUSED(oldFiles);
- Q_UNUSED(acceptedMimeTypes);
-
- return QStringList();
-#endif // QT_CONFIG(filedialog)
+ Q_D(const QWebEnginePage);
+ return d->view ? d->view->chooseFiles(mode, oldFiles, acceptedMimeTypes) : QStringList();
}
void QWebEnginePage::javaScriptAlert(const QUrl &securityOrigin, const QString &msg)
{
Q_UNUSED(securityOrigin);
-#if QT_CONFIG(messagebox)
- QMessageBox::information(view(),
- QStringLiteral("Javascript Alert - %1").arg(url().toString()),
- msg.toHtmlEscaped());
-#else
- Q_UNUSED(msg);
-#endif // QT_CONFIG(messagebox)
+ Q_D(const QWebEnginePage);
+ if (d->view)
+ d->view->javaScriptAlert(url(), msg);
}
bool QWebEnginePage::javaScriptConfirm(const QUrl &securityOrigin, const QString &msg)
{
Q_UNUSED(securityOrigin);
-#if QT_CONFIG(messagebox)
- return (QMessageBox::information(view(),
- QStringLiteral("Javascript Confirm - %1").arg(url().toString()),
- msg.toHtmlEscaped(),
- QMessageBox::Ok,
- QMessageBox::Cancel) == QMessageBox::Ok);
-#else
- Q_UNUSED(msg);
- return false;
-#endif // QT_CONFIG(messagebox)
+ Q_D(const QWebEnginePage);
+ return d->view ? d->view->javaScriptConfirm(url(), msg) : false;
}
bool QWebEnginePage::javaScriptPrompt(const QUrl &securityOrigin, const QString &msg, const QString &defaultValue, QString *result)
{
Q_UNUSED(securityOrigin);
-#if QT_CONFIG(inputdialog)
- bool ret = false;
- if (result)
- *result = QInputDialog::getText(view(),
- QStringLiteral("Javascript Prompt - %1").arg(url().toString()),
- msg.toHtmlEscaped(),
- QLineEdit::Normal,
- defaultValue.toHtmlEscaped(),
- &ret);
- return ret;
-#else
- Q_UNUSED(msg);
- Q_UNUSED(defaultValue);
- Q_UNUSED(result);
- return false;
-#endif // QT_CONFIG(inputdialog)
+ Q_D(const QWebEnginePage);
+ return d->view ? d->view->javaScriptPrompt(url(), msg, defaultValue, result) : false;
}
void QWebEnginePage::javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, const QString &message, int lineNumber, const QString &sourceID)
@@ -2416,10 +2190,7 @@ void QWebEnginePage::javaScriptConsoleMessage(JavaScriptConsoleMessageLevel leve
}
}
-bool QWebEnginePage::certificateError(const QWebEngineCertificateError &)
-{
- return false;
-}
+void QWebEnginePage::certificateError(QWebEngineCertificateError) { }
bool QWebEnginePage::acceptNavigationRequest(const QUrl &url, NavigationType type, bool isMainFrame)
{
@@ -2545,19 +2316,6 @@ void QWebEnginePage::print(QPrinter *printer, const QWebEngineCallback<bool> &re
#endif
}
-/*!
- \since 5.7
-
- Returns additional data about the current context menu. It is only guaranteed to be valid during the call to the QWebEngineView::contextMenuEvent()
- handler of the associated QWebEngineView.
-
- \sa createStandardContextMenu()
-*/
-const QWebEngineContextMenuData &QWebEnginePage::contextMenuData() const
-{
- Q_D(const QWebEnginePage);
- return d->contextData;
-}
/*!
\enum QWebEnginePage::LifecycleState
@@ -2673,172 +2431,26 @@ void QWebEnginePage::setVisible(bool visible)
d->adapter->setVisible(visible);
}
-#if QT_CONFIG(action)
-QContextMenuBuilder::QContextMenuBuilder(const QtWebEngineCore::WebEngineContextMenuData &data,
- QWebEnginePage *page,
- QMenu *menu)
- : QtWebEngineCore::RenderViewContextMenuQt(data)
- , m_page(page)
- , m_menu(menu)
-{
+QWebEnginePage* QWebEnginePage::fromDownloadRequest(QWebEngineDownloadRequest *request) {
+ return static_cast<QWebEnginePagePrivate *>(request->d_ptr->m_adapterClient)->q_ptr;
}
-bool QContextMenuBuilder::hasInspector()
+QDataStream &operator<<(QDataStream &stream, const QWebEngineHistory &history)
{
- return m_page->d_ptr->adapter->hasInspector();
-}
-
-bool QContextMenuBuilder::isFullScreenMode()
-{
- return m_page->d_ptr->isFullScreenMode();
+ QtWebEngineCore::WebContentsAdapter *adapter =
+ history.d_func()->m_adapter->webContentsAdapter();
+ if (!adapter->isInitialized())
+ adapter->loadDefault();
+ adapter->serializeNavigationHistory(stream);
+ return stream;
}
-void QContextMenuBuilder::addMenuItem(ContextMenuItem menuItem)
+QDataStream &operator>>(QDataStream &stream, QWebEngineHistory &history)
{
- QPointer<QWebEnginePage> thisRef(m_page);
- QAction *action = 0;
-
- switch (menuItem) {
- case ContextMenuItem::Back:
- action = thisRef->action(QWebEnginePage::Back);
- break;
- case ContextMenuItem::Forward:
- action = thisRef->action(QWebEnginePage::Forward);
- break;
- case ContextMenuItem::Reload:
- action = thisRef->action(QWebEnginePage::Reload);
- break;
- case ContextMenuItem::Cut:
- action = thisRef->action(QWebEnginePage::Cut);
- break;
- case ContextMenuItem::Copy:
- action = thisRef->action(QWebEnginePage::Copy);
- break;
- case ContextMenuItem::Paste:
- action = thisRef->action(QWebEnginePage::Paste);
- break;
- case ContextMenuItem::Undo:
- action = thisRef->action(QWebEnginePage::Undo);
- break;
- case ContextMenuItem::Redo:
- action = thisRef->action(QWebEnginePage::Redo);
- break;
- case ContextMenuItem::SelectAll:
- action = thisRef->action(QWebEnginePage::SelectAll);
- break;
- case ContextMenuItem::PasteAndMatchStyle:
- action = thisRef->action(QWebEnginePage::PasteAndMatchStyle);
- break;
- case ContextMenuItem::OpenLinkInNewWindow:
- action = thisRef->action(QWebEnginePage::OpenLinkInNewWindow);
- break;
- case ContextMenuItem::OpenLinkInNewTab:
- action = thisRef->action(QWebEnginePage::OpenLinkInNewTab);
- break;
- case ContextMenuItem::CopyLinkToClipboard:
- action = thisRef->action(QWebEnginePage::CopyLinkToClipboard);
- break;
- case ContextMenuItem::DownloadLinkToDisk:
- action = thisRef->action(QWebEnginePage::DownloadLinkToDisk);
- break;
- case ContextMenuItem::CopyImageToClipboard:
- action = thisRef->action(QWebEnginePage::CopyImageToClipboard);
- break;
- case ContextMenuItem::CopyImageUrlToClipboard:
- action = thisRef->action(QWebEnginePage::CopyImageUrlToClipboard);
- break;
- case ContextMenuItem::DownloadImageToDisk:
- action = thisRef->action(QWebEnginePage::DownloadImageToDisk);
- break;
- case ContextMenuItem::CopyMediaUrlToClipboard:
- action = thisRef->action(QWebEnginePage::CopyMediaUrlToClipboard);
- break;
- case ContextMenuItem::ToggleMediaControls:
- action = thisRef->action(QWebEnginePage::ToggleMediaControls);
- break;
- case ContextMenuItem::ToggleMediaLoop:
- action = thisRef->action(QWebEnginePage::ToggleMediaLoop);
- break;
- case ContextMenuItem::DownloadMediaToDisk:
- action = thisRef->action(QWebEnginePage::DownloadMediaToDisk);
- break;
- case ContextMenuItem::InspectElement:
- action = thisRef->action(QWebEnginePage::InspectElement);
- break;
- case ContextMenuItem::ExitFullScreen:
- action = thisRef->action(QWebEnginePage::ExitFullScreen);
- break;
- case ContextMenuItem::SavePage:
- action = thisRef->action(QWebEnginePage::SavePage);
- break;
- case ContextMenuItem::ViewSource:
- action = thisRef->action(QWebEnginePage::ViewSource);
- break;
- case ContextMenuItem::SpellingSuggestions:
- for (int i=0; i < m_contextData.spellCheckerSuggestions().count() && i < 4; i++) {
- action = new QAction(m_menu);
- QString replacement = m_contextData.spellCheckerSuggestions().at(i);
- QObject::connect(action, &QAction::triggered, [thisRef, replacement] { if (thisRef) thisRef->replaceMisspelledWord(replacement); });
- action->setText(replacement);
- m_menu->addAction(action);
- }
- return;
- case ContextMenuItem::Separator:
- if (!m_menu->isEmpty())
- m_menu->addSeparator();
- return;
- }
- action->setEnabled(isMenuItemEnabled(menuItem));
- m_menu->addAction(action);
-}
-
-bool QContextMenuBuilder::isMenuItemEnabled(ContextMenuItem menuItem)
-{
- switch (menuItem) {
- case ContextMenuItem::Back:
- return m_page->d_ptr->adapter->canGoBack();
- case ContextMenuItem::Forward:
- return m_page->d_ptr->adapter->canGoForward();
- case ContextMenuItem::Reload:
- return true;
- case ContextMenuItem::Cut:
- return m_contextData.editFlags() & QtWebEngineCore::WebEngineContextMenuData::CanCut;
- case ContextMenuItem::Copy:
- return m_contextData.editFlags() & QtWebEngineCore::WebEngineContextMenuData::CanCopy;
- case ContextMenuItem::Paste:
- return m_contextData.editFlags() & QtWebEngineCore::WebEngineContextMenuData::CanPaste;
- case ContextMenuItem::Undo:
- return m_contextData.editFlags() & QtWebEngineCore::WebEngineContextMenuData::CanUndo;
- case ContextMenuItem::Redo:
- return m_contextData.editFlags() & QtWebEngineCore::WebEngineContextMenuData::CanRedo;
- case ContextMenuItem::SelectAll:
- return m_contextData.editFlags() & QtWebEngineCore::WebEngineContextMenuData::CanSelectAll;
- case ContextMenuItem::PasteAndMatchStyle:
- return m_contextData.editFlags() & QtWebEngineCore::WebEngineContextMenuData::CanPaste;
- case ContextMenuItem::OpenLinkInNewWindow:
- case ContextMenuItem::OpenLinkInNewTab:
- case ContextMenuItem::CopyLinkToClipboard:
- case ContextMenuItem::DownloadLinkToDisk:
- case ContextMenuItem::CopyImageToClipboard:
- case ContextMenuItem::CopyImageUrlToClipboard:
- case ContextMenuItem::DownloadImageToDisk:
- case ContextMenuItem::CopyMediaUrlToClipboard:
- case ContextMenuItem::ToggleMediaControls:
- case ContextMenuItem::ToggleMediaLoop:
- case ContextMenuItem::DownloadMediaToDisk:
- case ContextMenuItem::InspectElement:
- case ContextMenuItem::ExitFullScreen:
- case ContextMenuItem::SavePage:
- return true;
- case ContextMenuItem::ViewSource:
- return m_page->d_ptr->adapter->canViewSource();
- case ContextMenuItem::SpellingSuggestions:
- case ContextMenuItem::Separator:
- return true;
- }
- Q_UNREACHABLE();
+ static_cast<QWebEnginePagePrivate *>(history.d_func()->m_adapter)
+ ->recreateFromSerializedHistory(stream);
+ return stream;
}
-#endif // QT_CONFIG(action)
QT_END_NAMESPACE
diff --git a/src/webenginewidgets/api/qwebenginepage.h b/src/core/api/qwebenginepage.h
index 3bf79526d..09b7b54df 100644
--- a/src/webenginewidgets/api/qwebenginepage.h
+++ b/src/core/api/qwebenginepage.h
@@ -40,9 +40,9 @@
#ifndef QWEBENGINEPAGE_H
#define QWEBENGINEPAGE_H
-#include <QtWebEngineWidgets/qtwebenginewidgetsglobal.h>
-#include <QtWebEngineWidgets/qwebengineclientcertificateselection.h>
-#include <QtWebEngineWidgets/qwebenginedownloaditem.h>
+#include <QtWebEngineCore/qtwebenginecoreglobal.h>
+#include <QtWebEngineCore/qwebengineclientcertificateselection.h>
+#include <QtWebEngineCore/qwebenginedownloadrequest.h>
#include <QtWebEngineCore/qwebenginecallback.h>
#include <QtWebEngineCore/qwebenginehttprequest.h>
@@ -50,8 +50,8 @@
#include <QtCore/qurl.h>
#include <QtCore/qvariant.h>
#include <QtGui/qpagelayout.h>
+#include <QtGui/qaction.h>
#include <QtNetwork/qnetworkaccessmanager.h>
-#include <QtWidgets/qwidget.h>
QT_BEGIN_NAMESPACE
class QMenu;
@@ -61,7 +61,6 @@ class QContextMenuBuilder;
class QWebChannel;
class QWebEngineCertificateError;
class QWebEngineClientCertificateSelection;
-class QWebEngineContextMenuData;
class QWebEngineFindTextResult;
class QWebEngineFullScreenRequest;
class QWebEngineHistory;
@@ -74,7 +73,7 @@ class QWebEngineScriptCollection;
class QWebEngineSettings;
class QWebEngineUrlRequestInterceptor;
-class QWEBENGINEWIDGETS_EXPORT QWebEnginePage : public QObject {
+class Q_WEBENGINECORE_EXPORT QWebEnginePage : public QObject {
Q_OBJECT
Q_PROPERTY(QString selectedText READ selectedText)
Q_PROPERTY(bool hasSelection READ hasSelection)
@@ -240,9 +239,6 @@ public:
~QWebEnginePage();
QWebEngineHistory *history() const;
- void setView(QWidget *view);
- QWidget *view() const;
-
bool hasSelection() const;
QString selectedText() const;
@@ -259,10 +255,6 @@ public:
void findText(const QString &subString, FindFlags options = FindFlags(), const QWebEngineCallback<bool> &resultCallback = QWebEngineCallback<bool>());
-#if QT_CONFIG(menu)
- QMenu *createStandardContextMenu();
-#endif
-
void setFeaturePermission(const QUrl &securityOrigin, Feature feature, PermissionPolicy policy);
void load(const QUrl &url);
@@ -300,8 +292,8 @@ public:
QColor backgroundColor() const;
void setBackgroundColor(const QColor &color);
- void save(const QString &filePath, QWebEngineDownloadItem::SavePageFormat format
- = QWebEngineDownloadItem::MimeHtmlSaveFormat) const;
+ void save(const QString &filePath, QWebEngineDownloadRequest::SavePageFormat format
+ = QWebEngineDownloadRequest::MimeHtmlSaveFormat) const;
bool isAudioMuted() const;
void setAudioMuted(bool muted);
@@ -319,8 +311,6 @@ public:
void setUrlRequestInterceptor(QWebEngineUrlRequestInterceptor *interceptor);
- const QWebEngineContextMenuData &contextMenuData() const;
-
LifecycleState lifecycleState() const;
void setLifecycleState(LifecycleState state);
@@ -329,6 +319,8 @@ public:
bool isVisible() const;
void setVisible(bool visible);
+ static QWebEnginePage* fromDownloadRequest(QWebEngineDownloadRequest * request);
+
Q_SIGNALS:
void loadStarted();
void loadProgress(int progress);
@@ -344,10 +336,7 @@ Q_SIGNALS:
void fullScreenRequested(QWebEngineFullScreenRequest fullScreenRequest);
void quotaRequested(QWebEngineQuotaRequest quotaRequest);
void registerProtocolHandlerRequested(QWebEngineRegisterProtocolHandlerRequest request);
-#if !defined(QT_NO_SSL) || QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
void selectClientCertificate(QWebEngineClientCertificateSelection clientCertSelection);
-#endif
-
void authenticationRequired(const QUrl &requestUrl, QAuthenticator *authenticator);
void proxyAuthenticationRequired(const QUrl &requestUrl, QAuthenticator *authenticator, const QString &proxyHost);
@@ -375,6 +364,9 @@ Q_SIGNALS:
void findTextFinished(const QWebEngineFindTextResult &result);
+ // TODO: fixme / rewrite bindPageToView
+ void _q_aboutToDelete();
+
protected:
virtual QWebEnginePage *createWindow(WebWindowType type);
virtual QStringList chooseFiles(FileSelectionMode mode, const QStringList &oldFiles, const QStringList &acceptedMimeTypes);
@@ -382,9 +374,8 @@ protected:
virtual bool javaScriptConfirm(const QUrl &securityOrigin, const QString& msg);
virtual bool javaScriptPrompt(const QUrl &securityOrigin, const QString& msg, const QString& defaultValue, QString* result);
virtual void javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, const QString& message, int lineNumber, const QString& sourceID);
- virtual bool certificateError(const QWebEngineCertificateError &certificateError);
+ virtual void certificateError(QWebEngineCertificateError certificateError);
virtual bool acceptNavigationRequest(const QUrl &url, NavigationType type, bool isMainFrame);
-
private:
Q_DISABLE_COPY(QWebEnginePage)
Q_DECLARE_PRIVATE(QWebEnginePage)
@@ -404,6 +395,10 @@ private:
Q_DECLARE_OPERATORS_FOR_FLAGS(QWebEnginePage::FindFlags)
+Q_WEBENGINECORE_EXPORT QDataStream &operator<<(QDataStream &stream,
+ const QWebEngineHistory &history);
+Q_WEBENGINECORE_EXPORT QDataStream &operator>>(QDataStream &stream, QWebEngineHistory &history);
+
QT_END_NAMESPACE
#endif // QWEBENGINEPAGE_H
diff --git a/src/webenginewidgets/api/qwebenginepage_p.h b/src/core/api/qwebenginepage_p.h
index 3ddf4b3d6..d2101e49f 100644
--- a/src/webenginewidgets/api/qwebenginepage_p.h
+++ b/src/core/api/qwebenginepage_p.h
@@ -54,9 +54,7 @@
#include "qwebenginepage.h"
#include "qwebenginecallback_p.h"
-#include "qwebenginecontextmenudata.h"
#include "qwebenginescriptcollection.h"
-#include "render_view_context_menu_qt.h"
#include "web_contents_adapter_client.h"
#include <QtCore/qcompilerdetection.h>
@@ -66,6 +64,7 @@
namespace QtWebEngineCore {
class RenderWidgetHostViewQtDelegate;
class RenderWidgetHostViewQtDelegateWidget;
+class RenderWidgetHostViewQtDelegateClient;
class TouchHandleDrawableClient;
class TouchSelectionMenuController;
class WebContentsAdapter;
@@ -79,7 +78,35 @@ class QWebEngineProfile;
class QWebEngineSettings;
class QWebEngineView;
-class QWebEnginePagePrivate : public QtWebEngineCore::WebContentsAdapterClient
+class PageView
+{
+public:
+ virtual void contextMenuRequested(QWebEngineContextMenuRequest *request) = 0;
+ virtual QStringList chooseFiles(QWebEnginePage::FileSelectionMode mode,
+ const QStringList &oldFiles,
+ const QStringList &acceptedMimeTypes) = 0;
+ virtual void
+ showColorDialog(QSharedPointer<QtWebEngineCore::ColorChooserController> controller) = 0;
+ virtual bool showAuthorizationDialog(const QString &title, const QString &message) = 0;
+ virtual void javaScriptAlert(const QUrl &url, const QString &msg) = 0;
+ virtual bool javaScriptConfirm(const QUrl &url, const QString &msg) = 0;
+ virtual bool javaScriptPrompt(const QUrl &url, const QString &msg, const QString &defaultValue,
+ QString *result) = 0;
+ virtual void setToolTip(const QString &toolTipText) = 0;
+ virtual QtWebEngineCore::RenderWidgetHostViewQtDelegate *CreateRenderWidgetHostViewQtDelegate(
+ QtWebEngineCore::RenderWidgetHostViewQtDelegateClient *client) = 0;
+ virtual QWebEngineContextMenuRequest *lastContextMenuRequest() const = 0;
+ virtual QWebEnginePage *createPageForWindow(QWebEnginePage::WebWindowType type) = 0;
+ virtual bool isEnabled() const = 0;
+ virtual bool isVisible() const = 0;
+ virtual QRect viewportRect() const = 0;
+ virtual void focusContainer() = 0;
+ virtual void unhandledKeyEvent(QKeyEvent *event) = 0;
+ virtual bool passOnFocus(bool reverse) = 0;
+ virtual QObject *accessibilityParentObject() = 0;
+};
+
+class Q_WEBENGINECORE_PRIVATE_EXPORT QWebEnginePagePrivate : public QtWebEngineCore::WebContentsAdapterClient
{
public:
Q_DECLARE_PUBLIC(QWebEnginePage)
@@ -106,7 +133,7 @@ public:
QColor backgroundColor() const override;
void loadStarted(const QUrl &provisionalUrl, bool isErrorPage = false) override;
void loadCommitted() override { }
- void loadVisuallyCommitted() override { }
+ void didFirstVisuallyNonEmptyPaint() override { }
void loadFinished(bool success, const QUrl &url, bool isErrorPage = false, int errorCode = 0, const QString &errorDescription = QString()) override;
void focusContainer() override;
void unhandledKeyEvent(QKeyEvent *event) override;
@@ -117,7 +144,7 @@ public:
bool isBeingAdopted() override;
void close() override;
void windowCloseRejected() override;
- void contextMenuRequested(const QtWebEngineCore::WebEngineContextMenuData &data) override;
+ void contextMenuRequested(QWebEngineContextMenuRequest *request) override;
void navigationRequested(int navigationType, const QUrl &url, int &navigationRequestAction, bool isMainFrame) override;
void requestFullScreenMode(const QUrl &origin, bool fullscreen) override;
bool isFullScreenMode() const override;
@@ -139,18 +166,17 @@ public:
void runQuotaRequest(QWebEngineQuotaRequest) override;
void runRegisterProtocolHandlerRequest(QWebEngineRegisterProtocolHandlerRequest) override;
QObject *accessibilityParentObject() override;
- QtWebEngineCore::WebEngineSettings *webEngineSettings() const override;
- void allowCertificateError(const QSharedPointer<CertificateErrorController> &controller) override;
- void selectClientCert(const QSharedPointer<ClientCertSelectController> &controller) override;
+ QWebEngineSettings *webEngineSettings() const override;
+ void allowCertificateError(const QWebEngineCertificateError &error) override;
+ void selectClientCert(
+ const QSharedPointer<QtWebEngineCore::ClientCertSelectController> &controller) override;
void renderProcessTerminated(RenderProcessTerminationStatus terminationStatus, int exitCode) override;
void requestGeometryChange(const QRect &geometry, const QRect &frameGeometry) override;
void updateScrollPosition(const QPointF &position) override;
void updateContentsSize(const QSizeF &size) override;
void updateNavigationActions() override;
void updateEditActions() override;
- void startDragging(const content::DropData &dropData, Qt::DropActions allowedActions,
- const QPixmap &pixmap, const QPoint &offset) override;
- bool supportsDragging() const override;
+ QObject *dragSource() const override;
bool isEnabled() const override;
void setToolTip(const QString &toolTipText) override;
void printRequested() override;
@@ -159,7 +185,6 @@ public:
void hideTouchSelectionMenu() override { }
const QObject *holdingQObject() const override;
ClientType clientType() override { return QtWebEngineCore::WebContentsAdapterClient::WidgetsClient; }
- void widgetChanged(QtWebEngineCore::RenderWidgetHostViewQtDelegate *newWidget) override;
void findTextFinished(const QWebEngineFindTextResult &result) override;
QtWebEngineCore::ProfileAdapter *profileAdapter() override;
@@ -174,17 +199,12 @@ public:
void setFullScreenMode(bool);
void ensureInitialized() const;
- static void bindPageAndView(QWebEnginePage *page, QWebEngineView *view);
- static void bindPageAndWidget(QWebEnginePage *page,
- QtWebEngineCore::RenderWidgetHostViewQtDelegateWidget *widget);
-
QSharedPointer<QtWebEngineCore::WebContentsAdapter> adapter;
QWebEngineHistory *history;
QWebEngineProfile *profile;
QWebEngineSettings *settings;
- QWebEngineView *view;
+ PageView *view;
QUrl url;
- QWebEngineContextMenuData contextData;
bool isLoading;
QWebEngineScriptCollection scriptCollection;
bool m_isBeingAdopted;
@@ -206,24 +226,6 @@ public:
#if QT_CONFIG(webengine_printing_and_pdf)
QPrinter *currentPrinter;
#endif
-
- QList<QSharedPointer<CertificateErrorController>> m_certificateErrorControllers;
-};
-
-class QContextMenuBuilder : public QtWebEngineCore::RenderViewContextMenuQt
-{
-public:
- QContextMenuBuilder(const QtWebEngineCore::WebEngineContextMenuData &data, QWebEnginePage *page, QMenu *menu);
-
-private:
- virtual bool hasInspector() override;
- virtual bool isFullScreenMode() override;
-
- virtual void addMenuItem(ContextMenuItem entry) override;
- virtual bool isMenuItemEnabled(ContextMenuItem entry) override;
-
- QWebEnginePage *m_page;
- QMenu *m_menu;
};
QT_END_NAMESPACE
diff --git a/src/webenginewidgets/api/qwebengineprofile.cpp b/src/core/api/qwebengineprofile.cpp
index 4c49be709..6f0e9d82c 100644
--- a/src/webenginewidgets/api/qwebengineprofile.cpp
+++ b/src/core/api/qwebengineprofile.cpp
@@ -39,13 +39,11 @@
#include "qwebengineprofile.h"
#include "qwebengineprofile_p.h"
-
+#include "qwebenginenotification.h"
#include "qwebenginecookiestore.h"
-#include "qwebenginedownloaditem.h"
-#include "qwebenginedownloaditem_p.h"
-#include "qwebenginenotificationpresenter_p.h"
-#include "qwebenginepage.h"
-#include "qwebenginepage_p.h"
+#include "qwebenginedownloadrequest.h"
+#include "qwebenginedownloadrequest_p.h"
+#include "qwebenginenotification.h"
#include "qwebenginesettings.h"
#include "qwebenginescriptcollection_p.h"
#include "qtwebenginecoreglobal.h"
@@ -58,10 +56,10 @@
QT_BEGIN_NAMESPACE
-ASSERT_ENUMS_MATCH(QWebEngineDownloadItem::UnknownSaveFormat, QtWebEngineCore::ProfileAdapterClient::UnknownSavePageFormat)
-ASSERT_ENUMS_MATCH(QWebEngineDownloadItem::SingleHtmlSaveFormat, QtWebEngineCore::ProfileAdapterClient::SingleHtmlSaveFormat)
-ASSERT_ENUMS_MATCH(QWebEngineDownloadItem::CompleteHtmlSaveFormat, QtWebEngineCore::ProfileAdapterClient::CompleteHtmlSaveFormat)
-ASSERT_ENUMS_MATCH(QWebEngineDownloadItem::MimeHtmlSaveFormat, QtWebEngineCore::ProfileAdapterClient::MimeHtmlSaveFormat)
+ASSERT_ENUMS_MATCH(QWebEngineDownloadRequest::UnknownSaveFormat, QtWebEngineCore::ProfileAdapterClient::UnknownSavePageFormat)
+ASSERT_ENUMS_MATCH(QWebEngineDownloadRequest::SingleHtmlSaveFormat, QtWebEngineCore::ProfileAdapterClient::SingleHtmlSaveFormat)
+ASSERT_ENUMS_MATCH(QWebEngineDownloadRequest::CompleteHtmlSaveFormat, QtWebEngineCore::ProfileAdapterClient::CompleteHtmlSaveFormat)
+ASSERT_ENUMS_MATCH(QWebEngineDownloadRequest::MimeHtmlSaveFormat, QtWebEngineCore::ProfileAdapterClient::MimeHtmlSaveFormat)
using QtWebEngineCore::ProfileAdapter;
@@ -151,19 +149,19 @@ void QWebEngineProfilePrivate::showNotification(QSharedPointer<QtWebEngineCore::
}
/*!
- \fn QWebEngineProfile::downloadRequested(QWebEngineDownloadItem *download)
+ \fn QWebEngineProfile::downloadRequested(QWebEngineDownloadRequest *download)
\since 5.5
This signal is emitted whenever a download has been triggered.
The \a download argument holds the state of the download.
- The download has to be explicitly accepted with QWebEngineDownloadItem::accept() or it will be
+ The download has to be explicitly accepted with QWebEngineDownloadRequest::accept() or it will be
cancelled by default.
The download item is parented by the profile. If it is not accepted, it
will be deleted immediately after the signal emission.
This signal cannot be used with a queued connection.
- \sa QWebEngineDownloadItem, QWebEnginePage::download()
+ \sa QWebEngineDownloadRequest, QWebEnginePage::download()
*/
QWebEngineProfilePrivate::QWebEngineProfilePrivate(ProfileAdapter* profileAdapter)
@@ -173,7 +171,6 @@ QWebEngineProfilePrivate::QWebEngineProfilePrivate(ProfileAdapter* profileAdapte
new QWebEngineScriptCollectionPrivate(profileAdapter->userResourceController())))
{
m_profileAdapter->addClient(this);
- m_settings->d_ptr->initDefaults();
}
QWebEngineProfilePrivate::~QWebEngineProfilePrivate()
@@ -223,37 +220,37 @@ void QWebEngineProfilePrivate::downloadRequested(DownloadItemInfo &info)
Q_Q(QWebEngineProfile);
Q_ASSERT(!m_ongoingDownloads.contains(info.id));
- QWebEngineDownloadItemPrivate *itemPrivate = new QWebEngineDownloadItemPrivate(this, info.url);
+ QWebEngineDownloadRequestPrivate *itemPrivate = new QWebEngineDownloadRequestPrivate(m_profileAdapter, info.url);
itemPrivate->downloadId = info.id;
- itemPrivate->downloadState = info.accepted ? QWebEngineDownloadItem::DownloadInProgress
- : QWebEngineDownloadItem::DownloadRequested;
+ itemPrivate->downloadState = info.accepted ? QWebEngineDownloadRequest::DownloadInProgress
+ : QWebEngineDownloadRequest::DownloadRequested;
itemPrivate->startTime = info.startTime;
itemPrivate->downloadDirectory = QFileInfo(info.path).path();
itemPrivate->downloadFileName = QFileInfo(info.path).fileName();
itemPrivate->suggestedFileName = info.suggestedFileName;
itemPrivate->mimeType = info.mimeType;
- itemPrivate->savePageFormat = static_cast<QWebEngineDownloadItem::SavePageFormat>(info.savePageFormat);
- itemPrivate->type = static_cast<QWebEngineDownloadItem::DownloadType>(info.downloadType);
+ itemPrivate->savePageFormat = static_cast<QWebEngineDownloadRequest::SavePageFormat>(info.savePageFormat);
+ itemPrivate->isSavePageDownload = info.isSavePageDownload;
if (info.page && info.page->clientType() == QtWebEngineCore::WebContentsAdapterClient::WidgetsClient)
- itemPrivate->page = static_cast<QWebEnginePagePrivate *>(info.page)->q_ptr;
+ itemPrivate->m_adapterClient = info.page;
else
- itemPrivate->page = nullptr;
+ itemPrivate->m_adapterClient = nullptr;
- QWebEngineDownloadItem *download = new QWebEngineDownloadItem(itemPrivate, q);
+ QWebEngineDownloadRequest *download = new QWebEngineDownloadRequest(itemPrivate, q);
m_ongoingDownloads.insert(info.id, download);
- QObject::connect(download, &QWebEngineDownloadItem::destroyed, q, [id = info.id, this] () { downloadDestroyed(id); });
+ QObject::connect(download, &QWebEngineDownloadRequest::destroyed, q, [id = info.id, this] () { downloadDestroyed(id); });
Q_EMIT q->downloadRequested(download);
- QWebEngineDownloadItem::DownloadState state = download->state();
+ QWebEngineDownloadRequest::DownloadState state = download->state();
info.path = QDir(download->downloadDirectory()).filePath(download->downloadFileName());
info.savePageFormat = static_cast<QtWebEngineCore::ProfileAdapterClient::SavePageFormat>(
download->savePageFormat());
- info.accepted = state != QWebEngineDownloadItem::DownloadCancelled;
+ info.accepted = state != QWebEngineDownloadRequest::DownloadCancelled;
- if (state == QWebEngineDownloadItem::DownloadRequested) {
+ if (state == QWebEngineDownloadRequest::DownloadRequested) {
// Delete unaccepted downloads.
info.accepted = false;
delete download;
@@ -265,7 +262,7 @@ void QWebEngineProfilePrivate::downloadUpdated(const DownloadItemInfo &info)
if (!m_ongoingDownloads.contains(info.id))
return;
- QWebEngineDownloadItem* download = m_ongoingDownloads.value(info.id).data();
+ QWebEngineDownloadRequest* download = m_ongoingDownloads.value(info.id).data();
if (!download) {
downloadDestroyed(info.id);
@@ -585,34 +582,6 @@ QWebEngineCookieStore* QWebEngineProfile::cookieStore()
return d->profileAdapter()->cookieStore();
}
-#if QT_DEPRECATED_SINCE(5, 13)
-/*!
- Registers a request interceptor singleton \a interceptor to intercept URL requests.
-
- The profile does not take ownership of the pointer.
-
- \obsolete
-
- Interceptors installed with this method will call
- QWebEngineUrlRequestInterceptor::interceptRequest on the I/O thread. Therefore
- the user has to provide thread-safe interaction with the other user classes.
- For a duration of this call ui thread is blocked.
- Use setUrlRequestInterceptor instead.
-
- \since 5.6
- \sa QWebEngineUrlRequestInfo
-
-*/
-void QWebEngineProfile::setRequestInterceptor(QWebEngineUrlRequestInterceptor *interceptor)
-{
- Q_D(QWebEngineProfile);
- if (interceptor)
- interceptor->setProperty("deprecated", true);
- d->profileAdapter()->setRequestInterceptor(interceptor);
- if (interceptor)
- qDebug("Use of deprecated not thread-safe setter, use setUrlRequestInterceptor instead.");
-}
-#endif
/*!
Registers a request interceptor singleton \a interceptor to intercept URL requests.
@@ -685,6 +654,16 @@ void QWebEngineProfile::setNotificationPresenter(std::function<void(std::unique_
}
/*!
+ Returns presenter responsible for presenting sent notifications
+ \since 6.0
+ */
+std::function<void(std::unique_ptr<QWebEngineNotification>)> QWebEngineProfile::notificationPresenter()
+{
+ Q_D(QWebEngineProfile);
+ return d->m_notificationPresenter;
+}
+
+/*!
Returns the default profile.
The default profile uses the storage name "Default".
@@ -696,8 +675,6 @@ QWebEngineProfile *QWebEngineProfile::defaultProfile()
static QWebEngineProfile* profile = new QWebEngineProfile(
new QWebEngineProfilePrivate(ProfileAdapter::createDefaultProfileAdapter()),
ProfileAdapter::globalQObjectRoot());
- if (!profile->d_ptr->m_notificationPresenter)
- profile->setNotificationPresenter(&defaultNotificationPresenter);
return profile;
}
@@ -830,6 +807,8 @@ void QWebEngineProfile::removeAllUrlSchemeHandlers()
/*!
\since 5.13
+ \obsolete
+
Sets if this profile is to be used for downloading and caching when needed
during certificate verification, for instance for OCSP, CRLs, and AIA.
@@ -838,11 +817,14 @@ void QWebEngineProfile::removeAllUrlSchemeHandlers()
needlessly re-downloading. If you set the option on a second profile,
it will be disabled on the profile it is currently set.
- Currently only affects Linux/NSS installations where it enables OCSP.
-
As long as one profile has \a enabled set to \c true, all other profiles
will be able to use it for their certificate verification.
+ Originally only affected Linux/NSS installations where it enabled OCSP.
+
+ Since 5.15.3, no longer does anything. Certificate verification is done
+ using AIO on the requesting profile.
+
\sa isUsedForGlobalCertificateVerification(), httpCacheType()
*/
void QWebEngineProfile::setUseForGlobalCertificateVerification(bool enabled)
@@ -854,6 +836,8 @@ void QWebEngineProfile::setUseForGlobalCertificateVerification(bool enabled)
/*!
\since 5.13
+ \obsolete
+
Returns \c true if this profile is currently being used for global
certificate verification.
*/
diff --git a/src/webenginewidgets/api/qwebengineprofile.h b/src/core/api/qwebengineprofile.h
index 794ba6279..b2088cf5d 100644
--- a/src/webenginewidgets/api/qwebengineprofile.h
+++ b/src/core/api/qwebengineprofile.h
@@ -40,7 +40,7 @@
#ifndef QWEBENGINEPROFILE_H
#define QWEBENGINEPROFILE_H
-#include <QtWebEngineWidgets/qtwebenginewidgetsglobal.h>
+#include <QtWebEngineCore/qtwebenginecoreglobal.h>
#include <QtCore/qobject.h>
#include <QtCore/qscopedpointer.h>
@@ -55,17 +55,15 @@ class QObject;
class QUrl;
class QWebEngineClientCertificateStore;
class QWebEngineCookieStore;
-class QWebEngineDownloadItem;
+class QWebEngineDownloadRequest;
class QWebEngineNotification;
-class QWebEnginePage;
-class QWebEnginePagePrivate;
class QWebEngineProfilePrivate;
class QWebEngineSettings;
class QWebEngineScriptCollection;
class QWebEngineUrlRequestInterceptor;
class QWebEngineUrlSchemeHandler;
-class QWEBENGINEWIDGETS_EXPORT QWebEngineProfile : public QObject {
+class Q_WEBENGINECORE_EXPORT QWebEngineProfile : public QObject {
Q_OBJECT
public:
explicit QWebEngineProfile(QObject *parent = Q_NULLPTR);
@@ -143,13 +141,14 @@ public:
void setDownloadPath(const QString &path);
void setNotificationPresenter(std::function<void(std::unique_ptr<QWebEngineNotification>)> notificationPresenter);
+ std::function<void(std::unique_ptr<QWebEngineNotification>)> notificationPresenter();
QWebEngineClientCertificateStore *clientCertificateStore();
static QWebEngineProfile *defaultProfile();
Q_SIGNALS:
- void downloadRequested(QWebEngineDownloadItem *download);
+ void downloadRequested(QWebEngineDownloadRequest *download);
private:
Q_DISABLE_COPY(QWebEngineProfile)
diff --git a/src/webenginewidgets/api/qwebengineprofile_p.h b/src/core/api/qwebengineprofile_p.h
index 64e9500b0..4bec7d6dc 100644
--- a/src/webenginewidgets/api/qwebengineprofile_p.h
+++ b/src/core/api/qwebengineprofile_p.h
@@ -73,7 +73,7 @@ class QWebEngineProfilePrivate;
class QWebEngineNotification;
class QWebEngineSettings;
-class QWebEngineProfilePrivate : public QtWebEngineCore::ProfileAdapterClient {
+class Q_WEBENGINECORE_PRIVATE_EXPORT QWebEngineProfilePrivate : public QtWebEngineCore::ProfileAdapterClient {
public:
Q_DECLARE_PUBLIC(QWebEngineProfile)
QWebEngineProfilePrivate(QtWebEngineCore::ProfileAdapter *profileAdapter);
@@ -99,7 +99,7 @@ private:
QWebEngineSettings *m_settings;
QPointer<QtWebEngineCore::ProfileAdapter> m_profileAdapter;
QScopedPointer<QWebEngineScriptCollection> m_scriptCollection;
- QMap<quint32, QPointer<QWebEngineDownloadItem> > m_ongoingDownloads;
+ QMap<quint32, QPointer<QWebEngineDownloadRequest> > m_ongoingDownloads;
std::function<void(std::unique_ptr<QWebEngineNotification>)> m_notificationPresenter;
};
diff --git a/src/webenginewidgets/api/qwebenginescript.cpp b/src/core/api/qwebenginescript.cpp
index af6b9aa8d..650ad5c53 100644
--- a/src/webenginewidgets/api/qwebenginescript.cpp
+++ b/src/core/api/qwebenginescript.cpp
@@ -41,12 +41,15 @@
#include "user_script.h"
#include <QtCore/QDebug>
+#include <QtCore/QFile>
using QtWebEngineCore::UserScript;
+QT_BEGIN_NAMESPACE
+
/*!
\class QWebEngineScript
- \inmodule QtWebEngineWidgets
+ \inmodule QtWebEngineCore
\since 5.5
\brief The QWebEngineScript class encapsulates a JavaScript program.
@@ -143,14 +146,6 @@ QWebEngineScript &QWebEngineScript::operator=(const QWebEngineScript &other)
}
/*!
- Returns \c true is the script is null; otherwise returns \c false.
-*/
-bool QWebEngineScript::isNull() const
-{
- return d->isNull();
-}
-
-/*!
* Returns the name of the script. Can be useful to retrieve a particular script from a
* QWebEngineScriptCollection.
*
@@ -172,6 +167,37 @@ void QWebEngineScript::setName(const QString &scriptName)
d->setName(scriptName);
}
+
+QUrl QWebEngineScript::sourceUrl() const
+{
+ return d->sourceUrl();
+}
+
+void QWebEngineScript::setSourceUrl(const QUrl &url)
+{
+ if (url == sourceUrl())
+ return;
+
+ d->setSourceUrl(url);
+
+ QFile file;
+ if (url.scheme().compare(QLatin1String("qrc"), Qt::CaseInsensitive) == 0) {
+ if (url.authority().isEmpty())
+ file.setFileName(QLatin1Char(':') + url.path());
+ return;
+ } else {
+ file.setFileName(url.toLocalFile());
+ }
+
+ if (!file.open(QIODevice::ReadOnly)) {
+ qWarning() << "Can't open user script " << url;
+ return;
+ }
+
+ QString source = QString::fromUtf8(file.readAll());
+ setSourceCode(source);
+}
+
/*!
Returns the source of the script.
*/
@@ -271,9 +297,6 @@ QWebEngineScript::QWebEngineScript(const UserScript &coreScript)
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug d, const QWebEngineScript &script)
{
- if (script.isNull())
- return d.maybeSpace() << "QWebEngineScript()";
-
d.nospace() << "QWebEngineScript(" << script.name() << ", ";
switch (script.injectionPoint()) {
case QWebEngineScript::DocumentCreation:
@@ -291,3 +314,5 @@ QDebug operator<<(QDebug d, const QWebEngineScript &script)
return d.space();
}
#endif
+
+QT_END_NAMESPACE
diff --git a/src/webenginewidgets/api/qwebenginescript.h b/src/core/api/qwebenginescript.h
index e3f65ec59..0c1849dac 100644
--- a/src/webenginewidgets/api/qwebenginescript.h
+++ b/src/core/api/qwebenginescript.h
@@ -40,10 +40,10 @@
#ifndef QWEBENGINESCRIPT_H
#define QWEBENGINESCRIPT_H
-#include <QtWebEngineWidgets/qtwebenginewidgetsglobal.h>
-
-#include <QtCore/qshareddata.h>
-#include <QtCore/qstring.h>
+#include <QtWebEngineCore/qtwebenginecoreglobal.h>
+#include <QtCore/QUrl>
+#include <QtCore/QObject>
+#include <QtCore/QSharedDataPointer>
namespace QtWebEngineCore {
class UserScript;
@@ -51,31 +51,46 @@ class UserScript;
QT_BEGIN_NAMESPACE
-class QWEBENGINEWIDGETS_EXPORT QWebEngineScript {
+class Q_WEBENGINECORE_EXPORT QWebEngineScript {
+
+ Q_GADGET
+ Q_PROPERTY(QString name READ name WRITE setName FINAL)
+ Q_PROPERTY(QUrl sourceUrl READ sourceUrl WRITE setSourceUrl FINAL)
+ Q_PROPERTY(QString sourceCode READ sourceCode WRITE setSourceCode FINAL)
+ Q_PROPERTY(InjectionPoint injectionPoint READ injectionPoint WRITE setInjectionPoint FINAL)
+ Q_PROPERTY(quint32 worldId READ worldId WRITE setWorldId FINAL)
+ Q_PROPERTY(bool runsOnSubFrames READ runsOnSubFrames WRITE setRunsOnSubFrames FINAL)
+
public:
+
enum InjectionPoint {
Deferred,
DocumentReady,
DocumentCreation
};
+ Q_ENUM(InjectionPoint)
+
enum ScriptWorldId {
MainWorld = 0,
ApplicationWorld,
UserWorld
};
+ Q_ENUM(ScriptWorldId)
+
QWebEngineScript();
QWebEngineScript(const QWebEngineScript &other);
~QWebEngineScript();
QWebEngineScript &operator=(const QWebEngineScript &other);
- bool isNull() const;
-
QString name() const;
void setName(const QString &);
+ QUrl sourceUrl() const;
+ void setSourceUrl(const QUrl &url);
+
QString sourceCode() const;
void setSourceCode(const QString &);
@@ -93,8 +108,8 @@ public:
{ return !operator==(other); }
void swap(QWebEngineScript &other) { qSwap(d, other.d); }
-
private:
+ friend class QQuickWebEngineScriptCollectionPrivate;
friend class QWebEngineScriptCollectionPrivate;
friend class QWebEngineScriptCollection;
QWebEngineScript(const QtWebEngineCore::UserScript &);
@@ -102,10 +117,10 @@ private:
QSharedDataPointer<QtWebEngineCore::UserScript> d;
};
-Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QWebEngineScript)
+Q_DECLARE_TYPEINFO(QWebEngineScript, Q_MOVABLE_TYPE);
#ifndef QT_NO_DEBUG_STREAM
-QWEBENGINEWIDGETS_EXPORT QDebug operator<<(QDebug, const QWebEngineScript &);
+Q_WEBENGINECORE_EXPORT QDebug operator<<(QDebug, const QWebEngineScript &);
#endif
QT_END_NAMESPACE
diff --git a/src/webenginewidgets/api/qwebenginescriptcollection.cpp b/src/core/api/qwebenginescriptcollection.cpp
index 8cbeeb804..6dfa12c46 100644
--- a/src/webenginewidgets/api/qwebenginescriptcollection.cpp
+++ b/src/core/api/qwebenginescriptcollection.cpp
@@ -46,7 +46,7 @@ using QtWebEngineCore::UserScript;
/*!
\class QWebEngineScriptCollection
- \inmodule QtWebEngineWidgets
+ \inmodule QtWebEngineCore
\since 5.5
\brief The QWebEngineScriptCollection class represents a collection of user scripts.
@@ -103,24 +103,11 @@ bool QWebEngineScriptCollection::contains(const QWebEngineScript &value) const
}
/*!
- * Returns the first script found in the collection with the name \a name, or a null
- * QWebEngineScript if none was found.
- * \note The order in which the script collection is traversed is undefined, which means this should
- * be used when the unicity is guaranteed at the application level.
- * \sa findScripts()
- */
-
-QWebEngineScript QWebEngineScriptCollection::findScript(const QString &name) const
-{
- return d->find(name);
-}
-
-/*!
Returns the list of scripts in the collection with the name \a name, or an empty list if none
was found.
*/
-QList<QWebEngineScript> QWebEngineScriptCollection::findScripts(const QString &name) const
+QList<QWebEngineScript> QWebEngineScriptCollection::find(const QString &name) const
{
return d->toList(name);
}
@@ -187,8 +174,6 @@ bool QWebEngineScriptCollectionPrivate::contains(const QWebEngineScript &s) cons
void QWebEngineScriptCollectionPrivate::insert(const QWebEngineScript &script)
{
- if (!script.d || script.d->isNull())
- return;
m_scripts.append(script);
if (!m_contents || m_contents->isInitialized())
m_scriptController->addUserScript(*script.d, m_contents.data());
@@ -196,8 +181,6 @@ void QWebEngineScriptCollectionPrivate::insert(const QWebEngineScript &script)
bool QWebEngineScriptCollectionPrivate::remove(const QWebEngineScript &script)
{
- if (!script.d || script.d->isNull())
- return false;
if (!m_contents || m_contents->isInitialized())
m_scriptController->removeUserScript(*script.d, m_contents.data());
return m_scripts.removeAll(script);
@@ -215,14 +198,6 @@ QList<QWebEngineScript> QWebEngineScriptCollectionPrivate::toList(const QString
return ret;
}
-QWebEngineScript QWebEngineScriptCollectionPrivate::find(const QString &name) const
-{
- for (const QWebEngineScript &script : qAsConst(m_scripts))
- if (name == script.name())
- return script;
- return QWebEngineScript();
-}
-
void QWebEngineScriptCollectionPrivate::clear()
{
m_scripts.clear();
diff --git a/src/webenginewidgets/api/qwebenginescriptcollection.h b/src/core/api/qwebenginescriptcollection.h
index e68dfce8f..2a1ab7dbf 100644
--- a/src/webenginewidgets/api/qwebenginescriptcollection.h
+++ b/src/core/api/qwebenginescriptcollection.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** 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.
@@ -40,9 +40,8 @@
#ifndef QWEBENGINESCRIPTCOLLECTION_H
#define QWEBENGINESCRIPTCOLLECTION_H
-#include <QtWebEngineWidgets/qtwebenginewidgetsglobal.h>
-#include <QtWebEngineWidgets/qwebenginescript.h>
-
+#include <QtWebEngineCore/qtwebenginecoreglobal.h>
+#include <QtWebEngineCore/qwebenginescript.h>
#include <QtCore/qscopedpointer.h>
#include <QtCore/qlist.h>
#include <QtCore/qset.h>
@@ -50,20 +49,16 @@
QT_BEGIN_NAMESPACE
class QWebEngineScriptCollectionPrivate;
-class QWEBENGINEWIDGETS_EXPORT QWebEngineScriptCollection {
+class Q_WEBENGINECORE_EXPORT QWebEngineScriptCollection {
public:
~QWebEngineScriptCollection();
+
bool isEmpty() const { return !count(); }
int count() const;
- inline int size() const { return count(); }
bool contains(const QWebEngineScript &value) const;
-
- QWebEngineScript findScript(const QString &name) const;
- QList<QWebEngineScript> findScripts(const QString &name) const;
-
+ QList<QWebEngineScript> find(const QString &name) const;
void insert(const QWebEngineScript &);
void insert(const QList<QWebEngineScript> &list);
-
bool remove(const QWebEngineScript &);
void clear();
@@ -73,6 +68,8 @@ private:
Q_DISABLE_COPY(QWebEngineScriptCollection)
friend class QWebEnginePagePrivate;
friend class QWebEngineProfilePrivate;
+ friend class QQuickWebEngineProfilePrivate;
+ friend class QQuickWebEngineViewPrivate;
QWebEngineScriptCollection(QWebEngineScriptCollectionPrivate *);
QScopedPointer<QWebEngineScriptCollectionPrivate> d;
diff --git a/src/webenginewidgets/api/qwebenginescriptcollection_p.h b/src/core/api/qwebenginescriptcollection_p.h
index 322ade3b6..442f8fe3d 100644
--- a/src/webenginewidgets/api/qwebenginescriptcollection_p.h
+++ b/src/core/api/qwebenginescriptcollection_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** 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.
@@ -51,8 +51,7 @@
// We mean it.
//
-#include "qtwebenginewidgetsglobal.h"
-
+#include "qtwebenginecoreglobal.h"
#include "qwebenginescript.h"
#include "web_contents_adapter.h"
@@ -64,17 +63,13 @@ class UserResourceControllerHost;
} // namespace
QT_BEGIN_NAMESPACE
-class QWebEngineScriptCollectionPrivate {
+class Q_WEBENGINECORE_PRIVATE_EXPORT QWebEngineScriptCollectionPrivate {
public:
QWebEngineScriptCollectionPrivate(QtWebEngineCore::UserResourceControllerHost *, QSharedPointer<QtWebEngineCore::WebContentsAdapter> = QSharedPointer<QtWebEngineCore::WebContentsAdapter>());
-
int count() const;
bool contains(const QWebEngineScript &) const;
QList<QWebEngineScript> toList(const QString &scriptName = QString()) const;
- QWebEngineScript find(const QString & name) const;
-
void initializationFinished(QSharedPointer<QtWebEngineCore::WebContentsAdapter> contents);
-
void insert(const QWebEngineScript &);
bool remove(const QWebEngineScript &);
void clear();
diff --git a/src/core/api/qwebenginesettings.cpp b/src/core/api/qwebenginesettings.cpp
new file mode 100644
index 000000000..c7c0a47b2
--- /dev/null
+++ b/src/core/api/qwebenginesettings.cpp
@@ -0,0 +1,142 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#include "qwebenginesettings.h"
+#include "web_engine_settings.h"
+
+QT_BEGIN_NAMESPACE
+
+using QtWebEngineCore::WebEngineSettings;
+
+QWebEngineSettings::QWebEngineSettings(QWebEngineSettings *parentSettings)
+ : d_ptr(new WebEngineSettings(parentSettings ? parentSettings->d_ptr.data() : nullptr))
+{
+ d_ptr->scheduleApplyRecursively();
+}
+
+QWebEngineSettings::~QWebEngineSettings() { }
+
+/*!
+ Returns the settings for a web engine page that belongs to the default
+ profile. All web pages not specifically created with another profile belong
+ to the default profile.
+
+QWebEngineSettings *QWebEngineSettings::defaultSettings()
+{
+ return QWebEngineProfile::defaultProfile()->settings();
+}
+*/
+
+void QWebEngineSettings::setFontFamily(QWebEngineSettings::FontFamily which, const QString &family)
+{
+ d_ptr->setFontFamily(which, family);
+}
+
+QString QWebEngineSettings::fontFamily(QWebEngineSettings::FontFamily which) const
+{
+ return d_ptr->fontFamily(which);
+}
+
+void QWebEngineSettings::resetFontFamily(QWebEngineSettings::FontFamily which)
+{
+ d_ptr->resetFontFamily(which);
+}
+
+void QWebEngineSettings::setFontSize(QWebEngineSettings::FontSize type, int size)
+{
+ d_ptr->setFontSize(type, size);
+}
+
+int QWebEngineSettings::fontSize(QWebEngineSettings::FontSize type) const
+{
+ return d_ptr->fontSize(type);
+}
+
+void QWebEngineSettings::resetFontSize(QWebEngineSettings::FontSize type)
+{
+ d_ptr->resetFontSize(type);
+}
+
+QString QWebEngineSettings::defaultTextEncoding() const
+{
+ return d_ptr->defaultTextEncoding();
+}
+
+QWebEngineSettings::UnknownUrlSchemePolicy QWebEngineSettings::unknownUrlSchemePolicy() const
+{
+ return d_ptr->unknownUrlSchemePolicy();
+}
+
+void QWebEngineSettings::resetUnknownUrlSchemePolicy()
+{
+ d_ptr->setUnknownUrlSchemePolicy(QWebEngineSettings::InheritedUnknownUrlSchemePolicy);
+}
+
+void QWebEngineSettings::setAttribute(QWebEngineSettings::WebAttribute attr, bool on)
+{
+ d_ptr->setAttribute(attr, on);
+}
+
+bool QWebEngineSettings::testAttribute(QWebEngineSettings::WebAttribute attr) const
+{
+ return d_ptr->testAttribute(attr);
+}
+
+void QWebEngineSettings::resetAttribute(QWebEngineSettings::WebAttribute attr)
+{
+ d_ptr->resetAttribute(attr);
+}
+
+void QWebEngineSettings::setDefaultTextEncoding(const QString &encoding)
+{
+ d_ptr->setDefaultTextEncoding(encoding);
+}
+
+void QWebEngineSettings::setUnknownUrlSchemePolicy(
+ QWebEngineSettings::UnknownUrlSchemePolicy policy)
+{
+ d_ptr->setUnknownUrlSchemePolicy(policy);
+}
+
+void QWebEngineSettings::setParentSettings(QWebEngineSettings *parentSettings)
+{
+ d_ptr->setParentSettings(parentSettings->d_ptr.data());
+}
+
+QT_END_NAMESPACE
diff --git a/src/webenginewidgets/api/qwebenginesettings.h b/src/core/api/qwebenginesettings.h
index d39291fed..f565f8ee2 100644
--- a/src/webenginewidgets/api/qwebenginesettings.h
+++ b/src/core/api/qwebenginesettings.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** 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.
@@ -40,7 +40,7 @@
#ifndef QWEBENGINESETTINGS_H
#define QWEBENGINESETTINGS_H
-#include <QtWebEngineWidgets/qtwebenginewidgetsglobal.h>
+#include <QtWebEngineCore/qtwebenginecoreglobal.h>
#include <QtCore/qscopedpointer.h>
#include <QtCore/qstring.h>
@@ -54,7 +54,7 @@ class QIcon;
class QPixmap;
class QUrl;
-class QWEBENGINEWIDGETS_EXPORT QWebEngineSettings {
+class Q_WEBENGINECORE_EXPORT QWebEngineSettings {
public:
enum FontFamily {
StandardFont,
@@ -65,6 +65,7 @@ public:
FantasyFont,
PictographFont
};
+
enum WebAttribute {
AutoLoadImages,
JavascriptEnabled,
@@ -107,16 +108,16 @@ public:
};
enum UnknownUrlSchemePolicy {
+ InheritedUnknownUrlSchemePolicy = 0, // TODO: hide
DisallowUnknownUrlSchemes = 1,
AllowUnknownUrlSchemesFromUserInteraction,
AllowAllUnknownUrlSchemes
};
-#if QT_DEPRECATED_SINCE(5, 5)
- static QWebEngineSettings *globalSettings();
-#endif
- static QWebEngineSettings *defaultSettings();
-
+ //TODO: see if we still need it
+ //static QWebEngineSettings *defaultSettings();
+public:
+ ~QWebEngineSettings();
void setFontFamily(FontFamily which, const QString &family);
QString fontFamily(FontFamily which) const;
void resetFontFamily(FontFamily which);
@@ -137,16 +138,15 @@ public:
void resetUnknownUrlSchemePolicy();
private:
+ explicit QWebEngineSettings(QWebEngineSettings *parentSettings = nullptr);
+ void setParentSettings(QWebEngineSettings *parentSettings);
Q_DISABLE_COPY(QWebEngineSettings)
typedef ::QtWebEngineCore::WebEngineSettings QWebEngineSettingsPrivate;
- QWebEngineSettingsPrivate* d_func() { return d_ptr.data(); }
- const QWebEngineSettingsPrivate* d_func() const { return d_ptr.data(); }
QScopedPointer<QWebEngineSettingsPrivate> d_ptr;
friend class QWebEnginePagePrivate;
friend class QWebEngineProfilePrivate;
-
- ~QWebEngineSettings();
- explicit QWebEngineSettings(QWebEngineSettings *parentSettings = Q_NULLPTR);
+ friend class QQuickWebEngineSettings;
+ friend class QtWebEngineCore::WebEngineSettings;
};
QT_END_NAMESPACE
diff --git a/src/core/browser_accessibility_manager_qt.cpp b/src/core/browser_accessibility_manager_qt.cpp
index 5968bfd30..1d635a6e9 100644
--- a/src/core/browser_accessibility_manager_qt.cpp
+++ b/src/core/browser_accessibility_manager_qt.cpp
@@ -48,13 +48,11 @@ namespace content {
BrowserAccessibilityManager* BrowserAccessibilityManager::Create(
const ui::AXTreeUpdate& initialTree,
- BrowserAccessibilityDelegate* delegate,
- BrowserAccessibilityFactory* factory)
+ BrowserAccessibilityDelegate* delegate)
{
#if QT_CONFIG(accessibility)
- return new BrowserAccessibilityManagerQt(nullptr, initialTree, delegate, factory);
+ return new BrowserAccessibilityManagerQt(nullptr, initialTree, delegate);
#else
- delete factory;
return nullptr;
#endif // QT_CONFIG(accessibility)
}
@@ -71,8 +69,8 @@ BrowserAccessibility *BrowserAccessibility::Create()
#if QT_CONFIG(accessibility)
BrowserAccessibilityManagerQt::BrowserAccessibilityManagerQt(
QObject *parentObject, const ui::AXTreeUpdate &initialTree,
- BrowserAccessibilityDelegate* delegate, BrowserAccessibilityFactory* factory)
- : BrowserAccessibilityManager(delegate, factory)
+ BrowserAccessibilityDelegate* delegate)
+ : BrowserAccessibilityManager(delegate)
, m_parentObject(parentObject)
{
Initialize(initialTree);
diff --git a/src/core/browser_accessibility_manager_qt.h b/src/core/browser_accessibility_manager_qt.h
index 6d6086811..2a1d273b9 100644
--- a/src/core/browser_accessibility_manager_qt.h
+++ b/src/core/browser_accessibility_manager_qt.h
@@ -47,19 +47,16 @@
#if QT_CONFIG(accessibility)
-QT_BEGIN_NAMESPACE
-class QAccessibleInterface;
-QT_END_NAMESPACE
+QT_FORWARD_DECLARE_CLASS(QAccessibleInterface)
namespace content {
class BrowserAccessibilityManagerQt : public BrowserAccessibilityManager
{
public:
- BrowserAccessibilityManagerQt(QObject* parentObject,
- const ui::AXTreeUpdate& initialTree,
- BrowserAccessibilityDelegate* delegate,
- BrowserAccessibilityFactory* factory = new BrowserAccessibilityFactory());
+ BrowserAccessibilityManagerQt(QObject *parentObject,
+ const ui::AXTreeUpdate &initialTree,
+ BrowserAccessibilityDelegate *delegate);
~BrowserAccessibilityManagerQt() override;
void FireBlinkEvent(ax::mojom::Event event_type,
BrowserAccessibility* node) override;
diff --git a/src/core/browser_accessibility_qt.cpp b/src/core/browser_accessibility_qt.cpp
index f4fe2f694..fabad0609 100644
--- a/src/core/browser_accessibility_qt.cpp
+++ b/src/core/browser_accessibility_qt.cpp
@@ -79,7 +79,7 @@ bool BrowserAccessibilityQt::isValid() const
QObject *BrowserAccessibilityQt::object() const
{
- return 0;
+ return nullptr;
}
QAccessibleInterface *BrowserAccessibilityQt::childAt(int x, int y) const
@@ -90,7 +90,7 @@ QAccessibleInterface *BrowserAccessibilityQt::childAt(int x, int y) const
if (childIface->rect().contains(x,y))
return childIface;
}
- return 0;
+ return nullptr;
}
void *BrowserAccessibilityQt::interface_cast(QAccessible::InterfaceType type)
@@ -132,7 +132,7 @@ void *BrowserAccessibilityQt::interface_cast(QAccessible::InterfaceType type)
default:
break;
}
- return 0;
+ return nullptr;
}
QAccessibleInterface *BrowserAccessibilityQt::parent() const
@@ -209,6 +209,13 @@ QAccessible::Role BrowserAccessibilityQt::role() const
case ax::mojom::Role::kUnknown:
return QAccessible::NoRole;
+ // Internal roles (matching auralinux and win)
+ case ax::mojom::Role::kKeyboard:
+ case ax::mojom::Role::kIgnored:
+ case ax::mojom::Role::kImeCandidate:
+ case ax::mojom::Role::kPresentational:
+ return QAccessible::NoRole;
+
// Used by Chromium to distinguish between the root of the tree
// for this page, and a web area for a frame within this page.
case ax::mojom::Role::kWebArea:
@@ -376,8 +383,6 @@ QAccessible::Role BrowserAccessibilityQt::role() const
return QAccessible::WebDocument;
case ax::mojom::Role::kIframePresentational:
return QAccessible::Grouping;
- case ax::mojom::Role::kIgnored:
- return QAccessible::NoRole;
case ax::mojom::Role::kImage:
return QAccessible::Graphic;
case ax::mojom::Role::kImageMap:
@@ -386,8 +391,6 @@ QAccessible::Role BrowserAccessibilityQt::role() const
return QAccessible::StaticText;
case ax::mojom::Role::kInputTime:
return QAccessible::SpinBox;
- case ax::mojom::Role::kKeyboard:
- return QAccessible::NoRole; // FIXME
case ax::mojom::Role::kLabelText:
return QAccessible::StaticText;
case ax::mojom::Role::kLayoutTable:
@@ -432,8 +435,6 @@ QAccessible::Role BrowserAccessibilityQt::role() const
return QAccessible::CheckBox;
case ax::mojom::Role::kMenuItemRadio:
return QAccessible::RadioButton;
- case ax::mojom::Role::kMenuButton:
- return QAccessible::MenuItem;
case ax::mojom::Role::kMenuListOption:
return QAccessible::MenuItem;
case ax::mojom::Role::kMenuListPopup:
@@ -458,8 +459,6 @@ QAccessible::Role BrowserAccessibilityQt::role() const
return QAccessible::Button;
case ax::mojom::Role::kPre:
return QAccessible::Section;
- case ax::mojom::Role::kPresentational:
- return QAccessible::NoRole; // FIXME
case ax::mojom::Role::kProgressIndicator:
return QAccessible::ProgressBar;
case ax::mojom::Role::kRadioButton:
@@ -646,16 +645,7 @@ QAccessible::State BrowserAccessibilityQt::state() const
return state;
}
-// Qt does not reference count accessibles
-void BrowserAccessibilityQt::NativeAddReference()
-{
-}
-
-// there is no reference counting, but BrowserAccessibility::Destroy
-// calls this (and that is the only place in the chromium sources,
-// so we can safely use it to dispose of ourselves here
-// (the default implementation of this function just contains a "delete this")
-void BrowserAccessibilityQt::NativeReleaseReference()
+void BrowserAccessibilityQt::Destroy()
{
// delete this
QAccessible::Id interfaceId = QAccessible::uniqueId(this);
@@ -987,7 +977,7 @@ QAccessibleInterface *BrowserAccessibilityQt::table() const
while (find_table && find_table->GetRole() != ax::mojom::Role::kTable)
find_table = find_table->PlatformGetParent();
if (!find_table)
- return 0;
+ return nullptr;
return static_cast<BrowserAccessibilityQt*>(find_table);
}
diff --git a/src/core/browser_accessibility_qt.h b/src/core/browser_accessibility_qt.h
index 19c7a1e54..32a4fc76b 100644
--- a/src/core/browser_accessibility_qt.h
+++ b/src/core/browser_accessibility_qt.h
@@ -80,9 +80,7 @@ public:
QAccessible::State state() const override;
// BrowserAccessible
- void NativeAddReference() override;
- void NativeReleaseReference() override;
- bool IsNative() const override { return true; }
+ void Destroy() override;
// QAccessibleActionInterface
QStringList actionNames() const override;
diff --git a/src/core/browser_main_parts_qt.cpp b/src/core/browser_main_parts_qt.cpp
index c1f4cbb2d..1add722a5 100644
--- a/src/core/browser_main_parts_qt.cpp
+++ b/src/core/browser_main_parts_qt.cpp
@@ -41,10 +41,9 @@
#include "api/qwebenginemessagepumpscheduler_p.h"
-#include "base/message_loop/message_loop.h"
-#include "base/message_loop/message_loop_current.h"
#include "base/message_loop/message_pump_for_ui.h"
#include "base/process/process.h"
+#include "base/task/current_thread.h"
#include "base/task/sequence_manager/sequence_manager_impl.h"
#include "base/task/sequence_manager/thread_controller_with_message_pump_impl.h"
#include "base/threading/thread_restrictions.h"
@@ -79,7 +78,7 @@
#include <QOpenGLContext>
#endif
-#if defined(OS_MACOSX)
+#if defined(OS_MAC)
#include "base/message_loop/message_pump_mac.h"
#include "ui/base/idle/idle.h"
#endif
@@ -150,7 +149,7 @@ private:
void ensureDelegate()
{
if (!m_delegate) {
- auto seqMan = base::MessageLoopCurrent::GetCurrentSequenceManagerImpl();
+ auto seqMan = base::CurrentThread::Get()->GetCurrentSequenceManagerImpl();
m_delegate = static_cast<base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl *>(
seqMan->controller_.get());
}
@@ -226,7 +225,7 @@ std::unique_ptr<base::MessagePump> messagePumpFactory()
madePrimaryPump = true;
return std::make_unique<MessagePumpForUIQt>();
}
-#if defined(OS_MACOSX)
+#if defined(OS_MAC)
return base::MessagePumpMac::Create();
#else
return std::make_unique<base::MessagePumpForUI>();
@@ -269,7 +268,7 @@ int BrowserMainPartsQt::PreCreateThreads()
{
base::ThreadRestrictions::SetIOAllowed(true);
-#if defined(OS_MACOSX)
+#if defined(OS_MAC)
ui::InitIdleMonitor();
#endif
diff --git a/src/core/browser_message_filter_qt.cpp b/src/core/browser_message_filter_qt.cpp
index a4b75f075..54d6551e4 100644
--- a/src/core/browser_message_filter_qt.cpp
+++ b/src/core/browser_message_filter_qt.cpp
@@ -64,90 +64,77 @@ BrowserMessageFilterQt::BrowserMessageFilterQt(int /*render_process_id*/, Profil
bool BrowserMessageFilterQt::OnMessageReceived(const IPC::Message& message)
{
IPC_BEGIN_MESSAGE_MAP(BrowserMessageFilterQt, message)
- IPC_MESSAGE_HANDLER(QtWebEngineHostMsg_AllowDatabase, OnAllowDatabase)
- IPC_MESSAGE_HANDLER(QtWebEngineHostMsg_AllowDOMStorage, OnAllowDOMStorage)
- IPC_MESSAGE_HANDLER_DELAY_REPLY(QtWebEngineHostMsg_RequestFileSystemAccessSync,
- OnRequestFileSystemAccessSync)
- IPC_MESSAGE_HANDLER(QtWebEngineHostMsg_RequestFileSystemAccessAsync,
- OnRequestFileSystemAccessAsync)
- IPC_MESSAGE_HANDLER(QtWebEngineHostMsg_AllowIndexedDB, OnAllowIndexedDB)
+ IPC_MESSAGE_HANDLER(QtWebEngineHostMsg_AllowStorageAccess, OnAllowStorageAccess)
+ IPC_MESSAGE_HANDLER_DELAY_REPLY(QtWebEngineHostMsg_RequestStorageAccessSync,
+ OnRequestStorageAccessSync)
+ IPC_MESSAGE_HANDLER(QtWebEngineHostMsg_RequestStorageAccessAsync,
+ OnRequestStorageAccessAsync)
IPC_MESSAGE_UNHANDLED(return false)
IPC_END_MESSAGE_MAP()
return true;
}
-void BrowserMessageFilterQt::OnAllowDatabase(int /*render_frame_id*/,
- const GURL &origin_url,
- const GURL &top_origin_url,
- bool* allowed)
+void BrowserMessageFilterQt::OnAllowStorageAccess(int /*render_frame_id*/,
+ const GURL &origin_url,
+ const GURL &top_origin_url,
+ int /*storage_type*/,
+ bool *allowed)
{
*allowed = m_profileData->canGetCookies(toQt(top_origin_url), toQt(origin_url));
}
-void BrowserMessageFilterQt::OnAllowDOMStorage(int /*render_frame_id*/,
- const GURL &origin_url,
- const GURL &top_origin_url,
- bool /*local*/,
- bool *allowed)
-{
- *allowed = m_profileData->canGetCookies(toQt(top_origin_url), toQt(origin_url));
-}
-
-void BrowserMessageFilterQt::OnAllowIndexedDB(int /*render_frame_id*/,
- const GURL &origin_url,
- const GURL &top_origin_url,
- bool *allowed)
-{
- *allowed = m_profileData->canGetCookies(toQt(top_origin_url), toQt(origin_url));
-}
-
-void BrowserMessageFilterQt::OnRequestFileSystemAccessSync(int render_frame_id,
- const GURL& origin_url,
- const GURL& top_origin_url,
- IPC::Message* reply_msg)
+void BrowserMessageFilterQt::OnRequestStorageAccessSync(int render_frame_id,
+ const GURL& origin_url,
+ const GURL& top_origin_url,
+ int storage_type,
+ IPC::Message* reply_msg)
{
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
base::Callback<void(bool)> callback = base::Bind(
- &BrowserMessageFilterQt::OnRequestFileSystemAccessSyncResponse,
+ &BrowserMessageFilterQt::OnRequestStorageAccessSyncResponse,
base::WrapRefCounted(this), reply_msg);
- OnRequestFileSystemAccess(render_frame_id,
- origin_url,
- top_origin_url,
- callback);
+ OnRequestStorageAccess(render_frame_id,
+ origin_url,
+ top_origin_url,
+ storage_type,
+ callback);
}
-void BrowserMessageFilterQt::OnRequestFileSystemAccessSyncResponse(IPC::Message *reply_msg, bool allowed)
+void BrowserMessageFilterQt::OnRequestStorageAccessSyncResponse(IPC::Message *reply_msg, bool allowed)
{
- QtWebEngineHostMsg_RequestFileSystemAccessSync::WriteReplyParams(reply_msg, allowed);
+ QtWebEngineHostMsg_RequestStorageAccessSync::WriteReplyParams(reply_msg, allowed);
Send(reply_msg);
}
-void BrowserMessageFilterQt::OnRequestFileSystemAccessAsync(int render_frame_id,
- int request_id,
- const GURL& origin_url,
- const GURL& top_origin_url)
+void BrowserMessageFilterQt::OnRequestStorageAccessAsync(int render_frame_id,
+ int request_id,
+ const GURL& origin_url,
+ const GURL& top_origin_url,
+ int storage_type)
{
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
base::Callback<void(bool)> callback = base::Bind(
- &BrowserMessageFilterQt::OnRequestFileSystemAccessAsyncResponse,
+ &BrowserMessageFilterQt::OnRequestStorageAccessAsyncResponse,
base::WrapRefCounted(this), render_frame_id, request_id);
- OnRequestFileSystemAccess(render_frame_id,
- origin_url,
- top_origin_url,
- callback);
+ OnRequestStorageAccess(render_frame_id,
+ origin_url,
+ top_origin_url,
+ storage_type,
+ callback);
}
-void BrowserMessageFilterQt::OnRequestFileSystemAccessAsyncResponse(int render_frame_id,
- int request_id,
- bool allowed)
+void BrowserMessageFilterQt::OnRequestStorageAccessAsyncResponse(int render_frame_id,
+ int request_id,
+ bool allowed)
{
- Send(new QtWebEngineMsg_RequestFileSystemAccessAsyncResponse(render_frame_id, request_id, allowed));
+ Send(new QtWebEngineMsg_RequestStorageAccessAsyncResponse(render_frame_id, request_id, allowed));
}
-void BrowserMessageFilterQt::OnRequestFileSystemAccess(int /*render_frame_id*/,
- const GURL &origin_url,
- const GURL &top_origin_url,
- base::Callback<void(bool)> callback)
+void BrowserMessageFilterQt::OnRequestStorageAccess(int /*render_frame_id*/,
+ const GURL &origin_url,
+ const GURL &top_origin_url,
+ int /*storage_type*/,
+ base::Callback<void(bool)> callback)
{
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
bool allowed = m_profileData->canGetCookies(toQt(top_origin_url), toQt(origin_url));
diff --git a/src/core/browser_message_filter_qt.h b/src/core/browser_message_filter_qt.h
index 4abc612f8..85de0486a 100644
--- a/src/core/browser_message_filter_qt.h
+++ b/src/core/browser_message_filter_qt.h
@@ -42,7 +42,6 @@
#include "base/callback.h"
#include "content/public/browser/browser_message_filter.h"
-#include "content/public/common/webplugininfo.h"
class GURL;
class Profile;
@@ -59,39 +58,33 @@ public:
private:
bool OnMessageReceived(const IPC::Message& message) override;
- void OnAllowDatabase(int render_frame_id,
- const GURL &origin_url,
- const GURL &top_origin_url,
- bool *allowed);
- void OnAllowDOMStorage(int render_frame_id,
- const GURL &origin_url,
- const GURL &top_origin_url,
- bool local,
- bool *allowed);
+ void OnAllowStorageAccess(int render_frame_id,
+ const GURL &origin_url,
+ const GURL &top_origin_url,
+ int storage_type,
+ bool *allowed);
- void OnAllowIndexedDB(int render_frame_id,
- const GURL &origin_url,
- const GURL &top_origin_url,
- bool *allowed);
-
- void OnRequestFileSystemAccessSync(int render_frame_id,
- const GURL &origin_url,
- const GURL &top_origin_url,
- IPC::Message *message);
- void OnRequestFileSystemAccessAsync(int render_frame_id,
- int request_id,
- const GURL &origin_url,
- const GURL &top_origin_url);
- void OnRequestFileSystemAccessSyncResponse(IPC::Message *reply_msg,
- bool allowed);
- void OnRequestFileSystemAccessAsyncResponse(int render_frame_id,
- int request_id,
- bool allowed);
- void OnRequestFileSystemAccess(int render_frame_id,
- const GURL &origin_url,
- const GURL &top_origin_url,
- base::Callback<void(bool)> callback);
+ void OnRequestStorageAccessSync(int render_frame_id,
+ const GURL &origin_url,
+ const GURL &top_origin_url,
+ int storage_type,
+ IPC::Message *message);
+ void OnRequestStorageAccessAsync(int render_frame_id,
+ int request_id,
+ const GURL &origin_url,
+ const GURL &top_origin_url,
+ int storage_type);
+ void OnRequestStorageAccessSyncResponse(IPC::Message *reply_msg,
+ bool allowed);
+ void OnRequestStorageAccessAsyncResponse(int render_frame_id,
+ int request_id,
+ bool allowed);
+ void OnRequestStorageAccess(int render_frame_id,
+ const GURL &origin_url,
+ const GURL &top_origin_url,
+ int storage_type,
+ base::Callback<void(bool)> callback);
ProfileIODataQt *m_profileData;
};
diff --git a/src/core/browsing_data_remover_delegate_qt.cpp b/src/core/browsing_data_remover_delegate_qt.cpp
index 344ba817f..6e79ab6c6 100644
--- a/src/core/browsing_data_remover_delegate_qt.cpp
+++ b/src/core/browsing_data_remover_delegate_qt.cpp
@@ -48,7 +48,7 @@
namespace QtWebEngineCore {
-bool DoesOriginMatchEmbedderMask(int origin_type_mask,
+bool DoesOriginMatchEmbedderMask(uint64_t origin_type_mask,
const url::Origin &origin,
storage::SpecialStoragePolicy *policy)
{
@@ -70,10 +70,10 @@ bool BrowsingDataRemoverDelegateQt::MayRemoveDownloadHistory()
void BrowsingDataRemoverDelegateQt::RemoveEmbedderData(const base::Time &delete_begin,
const base::Time &delete_end,
- int remove_mask,
+ uint64_t remove_mask,
content::BrowsingDataFilterBuilder *filter_builder,
- int origin_type_mask,
- base::OnceClosure callback)
+ uint64_t origin_type_mask,
+ base::OnceCallback<void(/*failed_data_types=*/uint64_t)> callback)
{
Q_UNUSED(delete_begin);
Q_UNUSED(delete_end);
@@ -83,7 +83,12 @@ void BrowsingDataRemoverDelegateQt::RemoveEmbedderData(const base::Time &delete_
if (remove_mask & content::BrowsingDataRemover::DATA_TYPE_CACHE)
web_cache::WebCacheManager::GetInstance()->ClearCache();
- std::move(callback).Run();
+ std::move(callback).Run(0);
+}
+
+std::vector<std::string> BrowsingDataRemoverDelegateQt::GetDomainsForDeferredCookieDeletion(uint64_t)
+{
+ return {};
}
} // namespace QtWebEngineCore
diff --git a/src/core/browsing_data_remover_delegate_qt.h b/src/core/browsing_data_remover_delegate_qt.h
index dc2761ffc..a10409f39 100644
--- a/src/core/browsing_data_remover_delegate_qt.h
+++ b/src/core/browsing_data_remover_delegate_qt.h
@@ -55,10 +55,11 @@ public:
void RemoveEmbedderData(
const base::Time &delete_begin,
const base::Time &delete_end,
- int remove_mask,
+ uint64_t remove_mask,
content::BrowsingDataFilterBuilder *filter_builder,
- int origin_type_mask,
- base::OnceClosure callback) override;
+ uint64_t origin_type_mask,
+ base::OnceCallback<void(/*failed_data_types=*/uint64_t)> callback) override;
+ std::vector<std::string> GetDomainsForDeferredCookieDeletion(uint64_t) override;
};
} // namespace QtWebEngineCore
diff --git a/src/core/certificate_error_controller.cpp b/src/core/certificate_error_controller.cpp
index d9043bf8e..0c0137ca4 100644
--- a/src/core/certificate_error_controller.cpp
+++ b/src/core/certificate_error_controller.cpp
@@ -38,7 +38,6 @@
****************************************************************************/
#include "certificate_error_controller.h"
-#include "certificate_error_controller_p.h"
#include <net/base/net_errors.h>
#include <net/cert/x509_certificate.h>
@@ -48,94 +47,136 @@
#include "components/strings/grit/components_strings.h"
#include "type_conversion.h"
-QT_BEGIN_NAMESPACE
-
-using namespace QtWebEngineCore;
-
-ASSERT_ENUMS_MATCH(CertificateErrorController::SslPinnedKeyNotInCertificateChain, net::ERR_SSL_PINNED_KEY_NOT_IN_CERT_CHAIN)
-ASSERT_ENUMS_MATCH(CertificateErrorController::CertificateCommonNameInvalid, net::ERR_CERT_COMMON_NAME_INVALID)
-ASSERT_ENUMS_MATCH(CertificateErrorController::CertificateDateInvalid, net::ERR_CERT_DATE_INVALID)
-ASSERT_ENUMS_MATCH(CertificateErrorController::CertificateAuthorityInvalid, net::ERR_CERT_AUTHORITY_INVALID)
-ASSERT_ENUMS_MATCH(CertificateErrorController::CertificateContainsErrors, net::ERR_CERT_CONTAINS_ERRORS)
-ASSERT_ENUMS_MATCH(CertificateErrorController::CertificateUnableToCheckRevocation, net::ERR_CERT_UNABLE_TO_CHECK_REVOCATION)
-ASSERT_ENUMS_MATCH(CertificateErrorController::CertificateRevoked, net::ERR_CERT_REVOKED)
-ASSERT_ENUMS_MATCH(CertificateErrorController::CertificateInvalid, net::ERR_CERT_INVALID)
-ASSERT_ENUMS_MATCH(CertificateErrorController::CertificateWeakSignatureAlgorithm, net::ERR_CERT_WEAK_SIGNATURE_ALGORITHM)
-ASSERT_ENUMS_MATCH(CertificateErrorController::CertificateNonUniqueName, net::ERR_CERT_NON_UNIQUE_NAME)
-ASSERT_ENUMS_MATCH(CertificateErrorController::CertificateWeakKey, net::ERR_CERT_WEAK_KEY)
-ASSERT_ENUMS_MATCH(CertificateErrorController::CertificateNameConstraintViolation, net::ERR_CERT_NAME_CONSTRAINT_VIOLATION)
-ASSERT_ENUMS_MATCH(CertificateErrorController::CertificateValidityTooLong, net::ERR_CERT_VALIDITY_TOO_LONG)
-ASSERT_ENUMS_MATCH(CertificateErrorController::CertificateTransparencyRequired, net::ERR_CERTIFICATE_TRANSPARENCY_REQUIRED)
-ASSERT_ENUMS_MATCH(CertificateErrorController::CertificateSymantecLegacy, net::ERR_CERT_SYMANTEC_LEGACY)
-ASSERT_ENUMS_MATCH(CertificateErrorController::CertificateKnownInterceptionBlocked, net::ERR_CERT_KNOWN_INTERCEPTION_BLOCKED)
-ASSERT_ENUMS_MATCH(CertificateErrorController::SslObsoleteVersion, net::ERR_SSL_OBSOLETE_VERSION)
-ASSERT_ENUMS_MATCH(CertificateErrorController::CertificateErrorEnd, net::ERR_CERT_END)
-
-void CertificateErrorControllerPrivate::accept(bool accepted)
+namespace QtWebEngineCore {
+
+ASSERT_ENUMS_MATCH(QWebEngineCertificateError::SslPinnedKeyNotInCertificateChain,
+ net::ERR_SSL_PINNED_KEY_NOT_IN_CERT_CHAIN)
+ASSERT_ENUMS_MATCH(QWebEngineCertificateError::CertificateCommonNameInvalid, net::ERR_CERT_BEGIN)
+ASSERT_ENUMS_MATCH(QWebEngineCertificateError::CertificateCommonNameInvalid,
+ net::ERR_CERT_COMMON_NAME_INVALID)
+ASSERT_ENUMS_MATCH(QWebEngineCertificateError::CertificateDateInvalid, net::ERR_CERT_DATE_INVALID)
+ASSERT_ENUMS_MATCH(QWebEngineCertificateError::CertificateAuthorityInvalid,
+ net::ERR_CERT_AUTHORITY_INVALID)
+ASSERT_ENUMS_MATCH(QWebEngineCertificateError::CertificateContainsErrors,
+ net::ERR_CERT_CONTAINS_ERRORS)
+ASSERT_ENUMS_MATCH(QWebEngineCertificateError::CertificateUnableToCheckRevocation,
+ net::ERR_CERT_UNABLE_TO_CHECK_REVOCATION)
+ASSERT_ENUMS_MATCH(QWebEngineCertificateError::CertificateRevoked, net::ERR_CERT_REVOKED)
+ASSERT_ENUMS_MATCH(QWebEngineCertificateError::CertificateInvalid, net::ERR_CERT_INVALID)
+ASSERT_ENUMS_MATCH(QWebEngineCertificateError::CertificateWeakSignatureAlgorithm,
+ net::ERR_CERT_WEAK_SIGNATURE_ALGORITHM)
+ASSERT_ENUMS_MATCH(QWebEngineCertificateError::CertificateNonUniqueName,
+ net::ERR_CERT_NON_UNIQUE_NAME)
+ASSERT_ENUMS_MATCH(QWebEngineCertificateError::CertificateWeakKey, net::ERR_CERT_WEAK_KEY)
+ASSERT_ENUMS_MATCH(QWebEngineCertificateError::CertificateNameConstraintViolation,
+ net::ERR_CERT_NAME_CONSTRAINT_VIOLATION)
+ASSERT_ENUMS_MATCH(QWebEngineCertificateError::CertificateValidityTooLong,
+ net::ERR_CERT_VALIDITY_TOO_LONG)
+ASSERT_ENUMS_MATCH(QWebEngineCertificateError::CertificateTransparencyRequired,
+ net::ERR_CERTIFICATE_TRANSPARENCY_REQUIRED)
+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)
+
+// Copied from chrome/browser/ssl/ssl_error_handler.cc:
+static int IsCertErrorFatal(int cert_error)
{
- std::move(callback).Run(accepted ? content::CERTIFICATE_REQUEST_RESULT_TYPE_CONTINUE : content::CERTIFICATE_REQUEST_RESULT_TYPE_DENY);
+ switch (cert_error) {
+ case net::ERR_CERT_COMMON_NAME_INVALID:
+ case net::ERR_CERT_DATE_INVALID:
+ case net::ERR_CERT_AUTHORITY_INVALID:
+ case net::ERR_CERT_NO_REVOCATION_MECHANISM:
+ case net::ERR_CERT_UNABLE_TO_CHECK_REVOCATION:
+ case net::ERR_CERT_WEAK_SIGNATURE_ALGORITHM:
+ case net::ERR_CERT_WEAK_KEY:
+ case net::ERR_CERT_NAME_CONSTRAINT_VIOLATION:
+ case net::ERR_CERT_VALIDITY_TOO_LONG:
+ 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:
+ case net::ERR_CERT_INVALID:
+ case net::ERR_SSL_PINNED_KEY_NOT_IN_CERT_CHAIN:
+ return true;
+ default:
+ NOTREACHED();
+ }
+ return true;
}
-CertificateErrorControllerPrivate::CertificateErrorControllerPrivate(int cert_error,
- const net::SSLInfo& ssl_info,
- const GURL &request_url,
- bool main_frame,
- bool fatal_error,
- bool strict_enforcement,
- base::OnceCallback<void(content::CertificateRequestResultType)> cb
- )
- : certError(CertificateErrorController::CertificateError(cert_error))
- , requestUrl(toQt(request_url))
- , resourceType(main_frame ? CertificateErrorController::ResourceTypeMainFrame : CertificateErrorController::ResourceTypeOther)
- , fatalError(fatal_error)
- , strictEnforcement(strict_enforcement)
- , callback(std::move(cb))
+CertificateErrorController::CertificateErrorController(
+ int cert_error, const net::SSLInfo &ssl_info, const GURL &request_url,
+ bool strict_enforcement, base::OnceCallback<void(content::CertificateRequestResultType)> cb)
+ : m_certError(QWebEngineCertificateError::Type(cert_error))
+ , m_requestUrl(toQt(request_url))
+ , m_overridable(!IsCertErrorFatal(cert_error) && !strict_enforcement)
{
+ if (m_overridable)
+ m_callback = std::move(cb);
if (auto cert = ssl_info.cert.get()) {
- validStart = toQt(cert->valid_start());
- validExpiry = toQt(cert->valid_expiry());
- certificateChain = toCertificateChain(cert);
+ m_validExpiry = toQt(cert->valid_expiry());
+ m_certificateChain = toCertificateChain(cert);
}
}
-CertificateErrorController::CertificateErrorController(CertificateErrorControllerPrivate *p) : d(p)
-{
-}
-
CertificateErrorController::~CertificateErrorController()
{
- delete d;
- d = 0;
+ if (!answered())
+ rejectCertificate();
}
-CertificateErrorController::CertificateError CertificateErrorController::error() const
+QWebEngineCertificateError::Type CertificateErrorController::error() const
{
- return d->certError;
+ return m_certError;
}
QUrl CertificateErrorController::url() const
{
- return d->requestUrl;
+ return m_requestUrl;
}
bool CertificateErrorController::overridable() const
{
- return !d->fatalError && !d->strictEnforcement;
+ return m_overridable;
+}
+
+bool CertificateErrorController::deferred() const
+{
+ return m_deferred;
+}
+
+void CertificateErrorController::defer()
+{
+ m_deferred = true;
}
-bool CertificateErrorController::strictEnforcement() const
+bool CertificateErrorController::answered() const
{
- return d->strictEnforcement;
+ return m_answered;
}
void CertificateErrorController::accept(bool accepted)
{
- d->accept(accepted);
+ if (answered())
+ return;
+
+ m_answered = true;
+ if (m_callback)
+ std::move(m_callback)
+ .Run(accepted ? content::CERTIFICATE_REQUEST_RESULT_TYPE_CONTINUE
+ : content::CERTIFICATE_REQUEST_RESULT_TYPE_DENY);
}
-CertificateErrorController::ResourceType CertificateErrorController::resourceType() const
+void CertificateErrorController::deactivate()
{
- return d->resourceType;
+ m_callback.Reset();
}
static QString getQStringForMessageId(int message_id) {
@@ -148,43 +189,43 @@ QString CertificateErrorController::errorString() const
// Try to use chromiums translation of the error strings, though not all are
// consistently described and we need to use versions that does not contain HTML
// formatted text.
- switch (d->certError) {
- case SslPinnedKeyNotInCertificateChain:
+ switch (m_certError) {
+ case QWebEngineCertificateError::SslPinnedKeyNotInCertificateChain:
return getQStringForMessageId(IDS_CERT_ERROR_SUMMARY_PINNING_FAILURE_DETAILS);
- case CertificateCommonNameInvalid:
+ case QWebEngineCertificateError::CertificateCommonNameInvalid:
return getQStringForMessageId(IDS_CERT_ERROR_COMMON_NAME_INVALID_DESCRIPTION);
- case CertificateDateInvalid:
- if (QDateTime::currentDateTime() > d->validExpiry)
+ case QWebEngineCertificateError::CertificateDateInvalid:
+ if (QDateTime::currentDateTime() > m_validExpiry)
return getQStringForMessageId(IDS_CERT_ERROR_EXPIRED_DESCRIPTION);
else
return getQStringForMessageId(IDS_CERT_ERROR_NOT_YET_VALID_DESCRIPTION);
- case CertificateAuthorityInvalid:
- case CertificateKnownInterceptionBlocked:
- case CertificateSymantecLegacy:
+ case QWebEngineCertificateError::CertificateAuthorityInvalid:
+ case QWebEngineCertificateError::CertificateKnownInterceptionBlocked:
+ case QWebEngineCertificateError::CertificateSymantecLegacy:
return getQStringForMessageId(IDS_CERT_ERROR_AUTHORITY_INVALID_DESCRIPTION);
- case CertificateContainsErrors:
+ case QWebEngineCertificateError::CertificateContainsErrors:
return getQStringForMessageId(IDS_CERT_ERROR_CONTAINS_ERRORS_DESCRIPTION);
- case CertificateNoRevocationMechanism:
+ case QWebEngineCertificateError::CertificateNoRevocationMechanism:
return getQStringForMessageId(IDS_CERT_ERROR_NO_REVOCATION_MECHANISM_DESCRIPTION);
- case CertificateRevoked:
+ case QWebEngineCertificateError::CertificateRevoked:
return getQStringForMessageId(IDS_CERT_ERROR_REVOKED_CERT_DESCRIPTION);
- case CertificateInvalid:
+ case QWebEngineCertificateError::CertificateInvalid:
return getQStringForMessageId(IDS_CERT_ERROR_INVALID_CERT_DESCRIPTION);
- case CertificateWeakSignatureAlgorithm:
+ case QWebEngineCertificateError::CertificateWeakSignatureAlgorithm:
return getQStringForMessageId(IDS_CERT_ERROR_WEAK_SIGNATURE_ALGORITHM_DESCRIPTION);
- case CertificateNonUniqueName:
+ case QWebEngineCertificateError::CertificateNonUniqueName:
return getQStringForMessageId(IDS_PAGE_INFO_SECURITY_TAB_NON_UNIQUE_NAME);
- case CertificateWeakKey:
+ case QWebEngineCertificateError::CertificateWeakKey:
return getQStringForMessageId(IDS_CERT_ERROR_WEAK_KEY_DESCRIPTION);
- case CertificateNameConstraintViolation:
+ case QWebEngineCertificateError::CertificateNameConstraintViolation:
return getQStringForMessageId(IDS_CERT_ERROR_NAME_CONSTRAINT_VIOLATION_DESCRIPTION);
- case CertificateValidityTooLong:
+ case QWebEngineCertificateError::CertificateValidityTooLong:
return getQStringForMessageId(IDS_CERT_ERROR_VALIDITY_TOO_LONG_DESCRIPTION);
- case CertificateTransparencyRequired:
+ case QWebEngineCertificateError::CertificateTransparencyRequired:
return getQStringForMessageId(IDS_CERT_ERROR_CERTIFICATE_TRANSPARENCY_REQUIRED_DESCRIPTION);
- case SslObsoleteVersion:
+ case QWebEngineCertificateError::SslObsoleteVersion:
return getQStringForMessageId(IDS_SSL_ERROR_OBSOLETE_VERSION_DESCRIPTION);
- case CertificateUnableToCheckRevocation: // Deprecated in Chromium.
+ case QWebEngineCertificateError::CertificateUnableToCheckRevocation: // Deprecated in Chromium.
default:
break;
}
@@ -194,7 +235,7 @@ QString CertificateErrorController::errorString() const
QList<QSslCertificate> CertificateErrorController::certificateChain() const
{
- return d->certificateChain;
+ return m_certificateChain;
}
-QT_END_NAMESPACE
+}
diff --git a/src/core/certificate_error_controller.h b/src/core/certificate_error_controller.h
index 740f7a9d4..ec3e26806 100644
--- a/src/core/certificate_error_controller.h
+++ b/src/core/certificate_error_controller.h
@@ -52,84 +52,59 @@
#define CERTIFICATE_ERROR_CONTROLLER_H
#include "qtwebenginecoreglobal_p.h"
-
+#include "base/callback.h"
+#include "content/public/browser/certificate_request_result_type.h"
+#include "qwebenginecertificateerror.h"
#include <QtCore/QDateTime>
+#include <QtCore/QScopedPointer>
#include <QtCore/QUrl>
#include <QtNetwork/QSslCertificate>
-QT_BEGIN_NAMESPACE
+namespace net {
+class SSLInfo;
+}
+class GURL;
-class CertificateErrorControllerPrivate;
+namespace QtWebEngineCore {
class Q_WEBENGINECORE_PRIVATE_EXPORT CertificateErrorController {
public:
- CertificateErrorController(CertificateErrorControllerPrivate *p);
+ CertificateErrorController(
+ int cert_error, const net::SSLInfo &ssl_info, const GURL &request_url,
+ bool strict_enforcement,
+ base::OnceCallback<void(content::CertificateRequestResultType)> callback);
~CertificateErrorController();
- // We can't use QSslError::SslErrors, because the error categories doesn't map.
- // Keep up to date with net/base/net_errors.h and net::IsCertificateError():
- enum CertificateError {
- SslPinnedKeyNotInCertificateChain = -150,
- CertificateCommonNameInvalid = -200,
- CertificateDateInvalid = -201,
- CertificateAuthorityInvalid = -202,
- CertificateContainsErrors = -203,
- CertificateNoRevocationMechanism = -204,
- CertificateUnableToCheckRevocation = -205,
- CertificateRevoked = -206,
- CertificateInvalid = -207,
- CertificateWeakSignatureAlgorithm = -208,
- CertificateNonUniqueName = -210,
- CertificateWeakKey = -211,
- CertificateNameConstraintViolation = -212,
- CertificateValidityTooLong = -213,
- CertificateTransparencyRequired = -214,
- CertificateSymantecLegacy = -215,
- CertificateKnownInterceptionBlocked = -217,
- SslObsoleteVersion = -218,
- CertificateErrorEnd = -219 // not an error, just an enum boundary
- };
-
- CertificateError error() const;
+ QWebEngineCertificateError::Type error() const;
QUrl url() const;
bool overridable() const;
- bool strictEnforcement() const;
QString errorString() const;
- QDateTime validStart() const;
QDateTime validExpiry() const;
QList<QSslCertificate> certificateChain() const;
+ bool deferred() const;
+ void defer();
+
+ bool answered() const;
void accept(bool);
- // Note: The resource type should probably not be exported, since once accepted the certificate exception
- // counts for all resource types.
- // Keep up to date with webkit/common/resource_type.h
- enum ResourceType {
- ResourceTypeMainFrame = 0, // top level page
- ResourceTypeSubFrame, // frame or iframe
- ResourceTypeStylesheet, // a CSS stylesheet
- ResourceTypeScript, // an external script
- ResourceTypeImage, // an image (jpg/gif/png/etc)
- ResourceTypeFont, // a font
- ResourceTypeOther, // an "other" subresource.
- ResourceTypeObject, // an object (or embed) tag for a plugin,
- // or a resource that a plugin requested.
- ResourceTypeMedia, // a media resource.
- ResourceTypeWorker, // the main resource of a dedicated worker.
- ResourceTypeSharedWorker, // the main resource of a shared worker.
- ResourceTypePrefetch, // an explicitly requested prefetch
- ResourceTypeFavicon, // a favicon
- ResourceTypeXHR, // a XMLHttpRequest
- ResourceTypePing, // a ping request for <a ping>
- ResourceTypeServiceWorker, // the main resource of a service worker.
- };
+ void ignoreCertificateError() { accept(true); }
+ void rejectCertificate() { accept(false); }
- ResourceType resourceType() const;
+ void deactivate();
+
+ QWebEngineCertificateError::Type m_certError;
+ const QUrl m_requestUrl;
+ QDateTime m_validExpiry;
+ bool m_overridable;
+ base::OnceCallback<void(content::CertificateRequestResultType)> m_callback;
+ QList<QSslCertificate> m_certificateChain;
+
+ bool m_answered = false, m_deferred = false;
private:
- CertificateErrorControllerPrivate* d;
+ Q_DISABLE_COPY(CertificateErrorController)
};
-QT_END_NAMESPACE
-
+}
#endif // CERTIFICATE_ERROR_CONTROLLER_H
diff --git a/src/core/certificate_error_controller_p.h b/src/core/certificate_error_controller_p.h
deleted file mode 100644
index b0b0bc658..000000000
--- a/src/core/certificate_error_controller_p.h
+++ /dev/null
@@ -1,79 +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 CERTIFICATE_ERROR_CONTROLLER_P_H
-#define CERTIFICATE_ERROR_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 "content/public/browser/content_browser_client.h"
-
-#include "certificate_error_controller.h"
-
-QT_BEGIN_NAMESPACE
-
-class CertificateErrorControllerPrivate {
-public:
- CertificateErrorControllerPrivate(int cert_error, const net::SSLInfo& ssl_info, const GURL& request_url, bool main_frame, bool fatal_error, bool strict_enforcement, base::OnceCallback<void(content::CertificateRequestResultType)> callback);
-
- void accept(bool accepted);
-
- CertificateErrorController::CertificateError certError;
- const QUrl requestUrl;
- QDateTime validStart;
- QDateTime validExpiry;
- CertificateErrorController::ResourceType resourceType;
- bool fatalError;
- bool strictEnforcement;
- base::OnceCallback<void(content::CertificateRequestResultType)> callback;
- QList<QSslCertificate> certificateChain;
-};
-
-QT_END_NAMESPACE
-
-#endif // CERTIFICATE_ERROR_CONTROLLER_P_H
diff --git a/src/core/chromium_overrides.cpp b/src/core/chromium_overrides.cpp
index 01937d3e7..019c7aac1 100644
--- a/src/core/chromium_overrides.cpp
+++ b/src/core/chromium_overrides.cpp
@@ -43,7 +43,6 @@
#include "base/values.h"
#include "content/browser/accessibility/accessibility_tree_formatter_blink.h"
-#include "content/browser/accessibility/accessibility_tree_formatter_browser.h"
#include "content/browser/renderer_host/render_widget_host_view_base.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/common/font_list.h"
@@ -63,7 +62,6 @@
#if defined(USE_AURA) && !defined(USE_OZONE)
#include "ui/base/dragdrop/os_exchange_data.h"
-#include "ui/base/dragdrop/os_exchange_data_provider_aura.h"
#include "ui/gfx/render_text.h"
#include "ui/gfx/platform_font.h"
#endif
@@ -110,8 +108,7 @@ std::unique_ptr<base::ListValue> GetFontList_SlowBlocking()
{
std::unique_ptr<base::ListValue> font_list(new base::ListValue);
- QFontDatabase database;
- for (auto family : database.families()){
+ 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.
@@ -195,7 +192,7 @@ void GrabViewSnapshotAsync(gfx::NativeView view,
} // namespace ui
#endif // defined(USE_AURA)
-std::unique_ptr<ui::OSExchangeData::Provider>
-ui::OSExchangeDataProviderFactory::CreateProvider() {
+std::unique_ptr<ui::OSExchangeDataProvider> ui::OSExchangeDataProviderFactory::CreateProvider()
+{
return nullptr;
}
diff --git a/src/core/client_cert_select_controller.cpp b/src/core/client_cert_select_controller.cpp
index 0baaf2bc5..2f2d24716 100644
--- a/src/core/client_cert_select_controller.cpp
+++ b/src/core/client_cert_select_controller.cpp
@@ -50,9 +50,7 @@
#include <QDebug>
-QT_BEGIN_NAMESPACE
-
-using namespace QtWebEngineCore;
+namespace QtWebEngineCore {
ClientCertSelectController::ClientCertSelectController(net::SSLCertRequestInfo *certRequestInfo,
std::vector<std::unique_ptr<net::ClientCertIdentity>> clientCerts,
@@ -73,8 +71,6 @@ ClientCertSelectController::~ClientCertSelectController()
m_delegate->ContinueWithCertificate(nullptr, nullptr);
}
-#if !defined(QT_NO_SSL) || QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
-
void ClientCertSelectController::selectNone()
{
if (m_selected) {
@@ -132,7 +128,7 @@ void ClientCertSelectController::select(const QSslCertificate &certificate)
<< " Selected certificate needs to be one of the offered";
}
-QVector<QSslCertificate> ClientCertSelectController::certificates() const
+QList<QSslCertificate> ClientCertSelectController::certificates() const
{
if (!m_certificates.isEmpty())
return m_certificates;
@@ -144,6 +140,4 @@ QVector<QSslCertificate> ClientCertSelectController::certificates() const
return m_certificates;
}
-#endif // !defined(QT_NO_SSL) || QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
-
-QT_END_NAMESPACE
+}
diff --git a/src/core/client_cert_select_controller.h b/src/core/client_cert_select_controller.h
index f121c1155..3a733f56f 100644
--- a/src/core/client_cert_select_controller.h
+++ b/src/core/client_cert_select_controller.h
@@ -55,10 +55,8 @@
#include <QtNetwork/qtnetwork-config.h>
#include <QtCore/QUrl>
-#if !defined(QT_NO_SSL) || QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
-#include <QtCore/QVector>
+#include <QtCore/QList>
#include <QtNetwork/QSslCertificate>
-#endif
#include <memory>
namespace content {
@@ -70,7 +68,7 @@ class ClientCertIdentity;
class SSLCertRequestInfo;
}
-QT_BEGIN_NAMESPACE
+namespace QtWebEngineCore {
class Q_WEBENGINECORE_PRIVATE_EXPORT ClientCertSelectController {
public:
@@ -80,22 +78,20 @@ public:
~ClientCertSelectController();
QUrl hostAndPort() const { return m_hostAndPort; }
-#if !defined(QT_NO_SSL) || QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
void selectNone();
void select(const QSslCertificate &certificate);
void select(int index);
- QVector<QSslCertificate> certificates() const;
-#endif
+ QList<QSslCertificate> certificates() const;
private:
QUrl m_hostAndPort;
std::vector<std::unique_ptr<net::ClientCertIdentity>> m_clientCerts;
std::unique_ptr<content::ClientCertificateDelegate> m_delegate;
- mutable QVector<QSslCertificate> m_certificates;
+ mutable QList<QSslCertificate> m_certificates;
bool m_selected;
};
-QT_END_NAMESPACE
+}
#endif // CLIENT_CERT_SELECT_CONTROLLER_H
diff --git a/src/core/clipboard_qt.cpp b/src/core/clipboard_qt.cpp
index a1dba8150..65e3e90ac 100644
--- a/src/core/clipboard_qt.cpp
+++ b/src/core/clipboard_qt.cpp
@@ -51,6 +51,7 @@
#include "ui/base/clipboard/custom_data_helper.h"
#include "ui/base/clipboard/clipboard.h"
#include "ui/base/clipboard/clipboard_constants.h"
+#include "ui/base/clipboard/clipboard_data_endpoint.h"
#include "ui/base/clipboard/clipboard_format_type.h"
#include <QGuiApplication>
@@ -106,7 +107,7 @@ Clipboard *Clipboard::Create()
namespace QtWebEngineCore {
-void ClipboardQt::WritePortableRepresentations(ui::ClipboardBuffer type, const ObjectMap &objects)
+void ClipboardQt::WritePortableRepresentations(ui::ClipboardBuffer type, const ObjectMap &objects, std::unique_ptr<ui::ClipboardDataEndpoint> data_src)
{
DCHECK(CalledOnValidThread());
DCHECK(IsSupportedClipboardBuffer(type));
@@ -125,12 +126,15 @@ void ClipboardQt::WritePortableRepresentations(ui::ClipboardBuffer type, const O
if (text_iter != objects.end()) {
// Copy text and SourceTag to the selection clipboard.
WritePortableRepresentations(ui::ClipboardBuffer::kSelection,
- ObjectMap(text_iter, text_iter + 1));
+ ObjectMap(text_iter, text_iter + 1),
+ std::move(data_src));
}
}
}
-void ClipboardQt::WritePlatformRepresentations(ui::ClipboardBuffer buffer, std::vector<ui::Clipboard::PlatformRepresentation> platform_representations)
+void ClipboardQt::WritePlatformRepresentations(ui::ClipboardBuffer buffer,
+ std::vector<ui::Clipboard::PlatformRepresentation> platform_representations,
+ std::unique_ptr<ui::ClipboardDataEndpoint> data_src)
{
DCHECK(CalledOnValidThread());
DCHECK(IsSupportedClipboardBuffer(buffer));
@@ -188,7 +192,9 @@ void ClipboardQt::WriteData(const ui::ClipboardFormatType &format, const char *d
getUncommittedData()->setData(QString::fromStdString(format.GetName()), QByteArray(data_data, data_len));
}
-bool ClipboardQt::IsFormatAvailable(const ui::ClipboardFormatType &format, ui::ClipboardBuffer type) const
+bool ClipboardQt::IsFormatAvailable(const ui::ClipboardFormatType &format,
+ ui::ClipboardBuffer type,
+ const ui::ClipboardDataEndpoint *data_dst) const
{
const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData(
type == ui::ClipboardBuffer::kCopyPaste ? QClipboard::Clipboard : QClipboard::Selection);
@@ -201,10 +207,11 @@ void ClipboardQt::Clear(ui::ClipboardBuffer type)
: QClipboard::Selection);
}
-void ClipboardQt::ReadAvailableTypes(ui::ClipboardBuffer type, std::vector<base::string16> *types,
- bool *contains_filenames) const
+void ClipboardQt::ReadAvailableTypes(ui::ClipboardBuffer type,
+ const ui::ClipboardDataEndpoint *data_dst,
+ std::vector<base::string16> *types) const
{
- if (!types || !contains_filenames) {
+ if (!types) {
NOTREACHED();
return;
}
@@ -219,13 +226,14 @@ void ClipboardQt::ReadAvailableTypes(ui::ClipboardBuffer type, std::vector<base:
const QStringList formats = mimeData->formats();
for (const QString &mimeType : formats)
types->push_back(toString16(mimeType));
- *contains_filenames = false;
const QByteArray customData = mimeData->data(QString::fromLatin1(ui::kMimeTypeWebCustomData));
ui::ReadCustomDataTypes(customData.constData(), customData.size(), types);
}
-void ClipboardQt::ReadText(ui::ClipboardBuffer type, base::string16 *result) const
+void ClipboardQt::ReadText(ui::ClipboardBuffer type,
+ const ui::ClipboardDataEndpoint *data_dst,
+ base::string16 *result) const
{
const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData(
type == ui::ClipboardBuffer::kCopyPaste ? QClipboard::Clipboard : QClipboard::Selection);
@@ -233,7 +241,9 @@ void ClipboardQt::ReadText(ui::ClipboardBuffer type, base::string16 *result) con
*result = toString16(mimeData->text());
}
-void ClipboardQt::ReadAsciiText(ui::ClipboardBuffer type, std::string *result) const
+void ClipboardQt::ReadAsciiText(ui::ClipboardBuffer type,
+ const ui::ClipboardDataEndpoint *data_dst,
+ std::string *result) const
{
const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData(
type == ui::ClipboardBuffer::kCopyPaste ? QClipboard::Clipboard : QClipboard::Selection);
@@ -241,7 +251,9 @@ void ClipboardQt::ReadAsciiText(ui::ClipboardBuffer type, std::string *result) c
*result = mimeData->text().toStdString();
}
-void ClipboardQt::ReadHTML(ui::ClipboardBuffer type, base::string16 *markup, std::string *src_url,
+void ClipboardQt::ReadHTML(ui::ClipboardBuffer type,
+ const ui::ClipboardDataEndpoint *data_dst,
+ base::string16 *markup, std::string *src_url,
uint32_t *fragment_start, uint32_t *fragment_end) const
{
markup->clear();
@@ -258,7 +270,9 @@ void ClipboardQt::ReadHTML(ui::ClipboardBuffer type, base::string16 *markup, std
*fragment_end = static_cast<uint32_t>(markup->length());
}
-void ClipboardQt::ReadRTF(ui::ClipboardBuffer type, std::string *result) const
+void ClipboardQt::ReadRTF(ui::ClipboardBuffer type,
+ const ui::ClipboardDataEndpoint *data_dst,
+ std::string *result) const
{
const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData(
type == ui::ClipboardBuffer::kCopyPaste ? QClipboard::Clipboard : QClipboard::Selection);
@@ -268,7 +282,9 @@ void ClipboardQt::ReadRTF(ui::ClipboardBuffer type, std::string *result) const
*result = std::string(byteArray.constData(), byteArray.length());
}
-void ClipboardQt::ReadImage(ui::ClipboardBuffer type, ReadImageCallback callback) const
+void ClipboardQt::ReadImage(ui::ClipboardBuffer type,
+ const ui::ClipboardDataEndpoint *data_dst,
+ ReadImageCallback callback) const
{
const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData(
type == ui::ClipboardBuffer::kCopyPaste ? QClipboard::Clipboard : QClipboard::Selection);
@@ -294,7 +310,9 @@ void ClipboardQt::ReadImage(ui::ClipboardBuffer type, ReadImageCallback callback
return std::move(callback).Run(bitmap);
}
-void ClipboardQt::ReadCustomData(ui::ClipboardBuffer clipboard_type, const base::string16 &type, base::string16 *result) const
+void ClipboardQt::ReadCustomData(ui::ClipboardBuffer clipboard_type, const base::string16 &type,
+ const ui::ClipboardDataEndpoint *data_dst,
+ base::string16 *result) const
{
const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData(
clipboard_type == ui::ClipboardBuffer::kCopyPaste ? QClipboard::Clipboard : QClipboard::Selection);
@@ -304,12 +322,33 @@ void ClipboardQt::ReadCustomData(ui::ClipboardBuffer clipboard_type, const base:
ui::ReadCustomDataForType(customData.constData(), customData.size(), type, result);
}
-void ClipboardQt::ReadBookmark(base::string16 *title, std::string *url) const
+void ClipboardQt::ReadBookmark(const ui::ClipboardDataEndpoint *data_dst, base::string16 *title, std::string *url) const
{
NOTIMPLEMENTED();
}
-void ClipboardQt::ReadData(const ui::ClipboardFormatType &format, std::string *result) const
+void ClipboardQt::ReadSvg(ui::ClipboardBuffer clipboard_type,
+ const ui::ClipboardDataEndpoint *,
+ base::string16 *result) const
+{
+ const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData(
+ clipboard_type == ui::ClipboardBuffer::kCopyPaste ? QClipboard::Clipboard : QClipboard::Selection);
+ if (!mimeData)
+ return;
+ const QByteArray svgData = mimeData->data(QString::fromLatin1(ui::kMimeTypeSvg));
+ if (!svgData.isEmpty())
+ *result = toString16(QString::fromUtf8(svgData));
+}
+
+void ClipboardQt::WriteSvg(const char *svg_data, size_t data_len)
+{
+ getUncommittedData()->setData(QString::fromLatin1(ui::kMimeTypeSvg),
+ QByteArray(svg_data, data_len));
+}
+
+void ClipboardQt::ReadData(const ui::ClipboardFormatType &format,
+ const ui::ClipboardDataEndpoint *data_dst,
+ std::string *result) const
{
const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData();
if (!mimeData)
@@ -324,18 +363,28 @@ uint64_t ClipboardQt::GetSequenceNumber(ui::ClipboardBuffer type) const
: QClipboard::Selection);
}
-std::vector<base::string16> ClipboardQt::ReadAvailablePlatformSpecificFormatNames(ui::ClipboardBuffer buffer) const
+
+#if defined(USE_OZONE)
+bool ClipboardQt::IsSelectionBufferAvailable() const
+{
+ return QGuiApplication::clipboard()->supportsSelection();
+}
+#endif
+
+std::vector<base::string16> ClipboardQt::ReadAvailablePlatformSpecificFormatNames(ui::ClipboardBuffer buffer, const ui::ClipboardDataEndpoint *data_dst) const
{
// based on ClipboardAura
std::vector<base::string16> types;
- if (IsFormatAvailable(ui::ClipboardFormatType::GetPlainTextType(), buffer))
+ if (IsFormatAvailable(ui::ClipboardFormatType::GetPlainTextType(), buffer, data_dst))
types.push_back(base::UTF8ToUTF16(ui::ClipboardFormatType::GetPlainTextType().GetName()));
- if (IsFormatAvailable(ui::ClipboardFormatType::GetHtmlType(), buffer))
+ if (IsFormatAvailable(ui::ClipboardFormatType::GetHtmlType(), buffer, data_dst))
types.push_back(base::UTF8ToUTF16(ui::ClipboardFormatType::GetHtmlType().GetName()));
- if (IsFormatAvailable(ui::ClipboardFormatType::GetRtfType(), buffer))
+ if (IsFormatAvailable(ui::ClipboardFormatType::GetRtfType(), buffer, data_dst))
types.push_back(base::UTF8ToUTF16(ui::ClipboardFormatType::GetRtfType().GetName()));
- if (IsFormatAvailable(ui::ClipboardFormatType::GetBitmapType(), buffer))
+ if (IsFormatAvailable(ui::ClipboardFormatType::GetBitmapType(), buffer, data_dst))
types.push_back(base::UTF8ToUTF16(ui::kMimeTypePNG));
+ if (IsFormatAvailable(ui::ClipboardFormatType::GetSvgType(), buffer, data_dst))
+ types.push_back(base::UTF8ToUTF16(ui::kMimeTypeSvg));
return types;
}
diff --git a/src/core/clipboard_qt.h b/src/core/clipboard_qt.h
index cc1b95a32..b4c9d4c7d 100644
--- a/src/core/clipboard_qt.h
+++ b/src/core/clipboard_qt.h
@@ -44,31 +44,43 @@
namespace QtWebEngineCore {
-class ClipboardQt : public ui::Clipboard {
+class ClipboardQt : public ui::Clipboard
+{
public:
uint64_t GetSequenceNumber(ui::ClipboardBuffer type) const override;
- bool IsFormatAvailable(const ui::ClipboardFormatType &format, ui::ClipboardBuffer type) const override;
+ bool IsFormatAvailable(const ui::ClipboardFormatType &format,
+ ui::ClipboardBuffer buffer,
+ const ui::ClipboardDataEndpoint *data_dst) const override;
void Clear(ui::ClipboardBuffer type) override;
- void ReadAvailableTypes(ui::ClipboardBuffer type, std::vector<base::string16> *types,
- bool *contains_filenames) const override;
- void ReadText(ui::ClipboardBuffer type, base::string16 *result) const override;
- void ReadAsciiText(ui::ClipboardBuffer type, std::string *result) const override;
- void ReadHTML(ui::ClipboardBuffer type, base::string16 *markup, std::string *src_url, uint32_t *fragment_start,
+ void ReadAvailableTypes(ui::ClipboardBuffer type,
+ const ui::ClipboardDataEndpoint *data_dst,
+ std::vector<base::string16> *types) const override;
+ void ReadText(ui::ClipboardBuffer type, const ui::ClipboardDataEndpoint *data_dst, base::string16 *result) const override;
+ void ReadAsciiText(ui::ClipboardBuffer type, const ui::ClipboardDataEndpoint *data_dst, std::string *result) const override;
+ void ReadHTML(ui::ClipboardBuffer type, const ui::ClipboardDataEndpoint *data_dst, base::string16 *markup, std::string *src_url, uint32_t *fragment_start,
uint32_t *fragment_end) const override;
- void ReadRTF(ui::ClipboardBuffer type, std::string *result) const override;
- void ReadImage(ui::ClipboardBuffer buffer, ReadImageCallback callback) const override;
- void ReadCustomData(ui::ClipboardBuffer clipboard_type, const base::string16 &type, base::string16 *result) const override;
- void ReadBookmark(base::string16 *title, std::string *url) const override;
- void ReadData(const ui::ClipboardFormatType &format, std::string *result) const override;
-
+ void ReadRTF(ui::ClipboardBuffer type, const ui::ClipboardDataEndpoint *data_dst, std::string *result) const override;
+ void ReadImage(ui::ClipboardBuffer buffer, const ui::ClipboardDataEndpoint *data_dst, ReadImageCallback callback) const override;
+ void ReadCustomData(ui::ClipboardBuffer clipboard_type, const base::string16 &type, const ui::ClipboardDataEndpoint *data_dst, base::string16 *result) const override;
+ void ReadBookmark(const ui::ClipboardDataEndpoint *data_dst, base::string16 *title, std::string *url) const override;
+ void ReadData(const ui::ClipboardFormatType &format, const ui::ClipboardDataEndpoint *data_dst, std::string *result) const override;
+#if defined(USE_OZONE)
+ bool IsSelectionBufferAvailable() const override;
+#endif
void OnPreShutdown() override {}
-
- std::vector<base::string16> ReadAvailablePlatformSpecificFormatNames(ui::ClipboardBuffer buffer) const override;
+ void ReadSvg(ui::ClipboardBuffer, const ui::ClipboardDataEndpoint *, base::string16 *) const override;
+ void WriteSvg(const char *, size_t) override;
+ std::vector<base::string16> ReadAvailablePlatformSpecificFormatNames(ui::ClipboardBuffer buffer, const ui::ClipboardDataEndpoint *data_dst) const override;
protected:
- void WritePortableRepresentations(ui::ClipboardBuffer type, const ObjectMap &objects) override;
- void WritePlatformRepresentations(ui::ClipboardBuffer type,
- std::vector<ui::Clipboard::PlatformRepresentation> platform_representations) override;
+ void WritePortableRepresentations(
+ ui::ClipboardBuffer buffer,
+ const ObjectMap &objects,
+ std::unique_ptr<ui::ClipboardDataEndpoint> data_src) override;
+ void WritePlatformRepresentations(
+ ui::ClipboardBuffer buffer,
+ std::vector<Clipboard::PlatformRepresentation> platform_representations,
+ std::unique_ptr<ui::ClipboardDataEndpoint> data_src) override;
void WriteText(const char *text_data, size_t text_len) override;
void WriteHTML(const char *markup_data, size_t markup_len, const char *url_data, size_t url_len) override;
void WriteRTF(const char *rtf_data, size_t data_len) override;
diff --git a/src/core/common/extensions/api/qtwebengine_extensions_features.gni b/src/core/common/extensions/api/qtwebengine_extensions_features.gni
index ed7e713c6..3873e235a 100644
--- a/src/core/common/extensions/api/qtwebengine_extensions_features.gni
+++ b/src/core/common/extensions/api/qtwebengine_extensions_features.gni
@@ -12,7 +12,8 @@ json_features("qt_permission_features") {
feature_type = "PermissionFeature"
method_name = "AddQtPermissionFeatures"
sources = [
- "//extensions/common/api/_permission_features.json"
+ "//chrome/common/extensions/api/_permission_features.json",
+ "//extensions/common/api/_permission_features.json",
]
}
@@ -20,6 +21,7 @@ group("qtwebengine_extensions_features") {
public_deps = [
":qt_api_features",
":qt_permission_features",
+ "//chrome/common/extensions/api:extensions_features",
"//extensions/common/api:extensions_features",
]
}
diff --git a/src/core/common/extensions/extensions_api_provider_qt.cpp b/src/core/common/extensions/extensions_api_provider_qt.cpp
index 22154a9d1..81eb76f3e 100644
--- a/src/core/common/extensions/extensions_api_provider_qt.cpp
+++ b/src/core/common/extensions/extensions_api_provider_qt.cpp
@@ -39,6 +39,8 @@
#include "extensions_api_provider_qt.h"
+#include "chrome/common/extensions/permissions/chrome_api_permissions.h"
+#include "chrome/common/extensions/api/generated_schemas.h"
#include "chrome/grit/common_resources.h"
#include "extensions/common/api/api_features.h"
@@ -51,6 +53,7 @@
#include "extensions/common/features/json_feature_provider_source.h"
#include "extensions/common/permissions/permissions_info.h"
#include "extensions/grit/extensions_resources.h"
+#include "qtwebengine/common/extensions/api/generated_schemas.h"
#include "qt_api_features.h"
//#include "qt_behavior_features.h"
@@ -85,16 +88,30 @@ void ExtensionsAPIProviderQt::AddPermissionFeatures(FeatureProvider *provider)
bool ExtensionsAPIProviderQt::IsAPISchemaGenerated(const std::string &name)
{
- return api::GeneratedSchemas::IsGenerated(name);
+ return api::GeneratedSchemas::IsGenerated(name) ||
+ api::ChromeGeneratedSchemas::IsGenerated(name) ||
+ api::QtWebEngineGeneratedSchemas::IsGenerated(name);
}
base::StringPiece ExtensionsAPIProviderQt::GetAPISchema(const std::string &name)
{
- return api::GeneratedSchemas::Get(name);
+ if (!api::GeneratedSchemas::Get(name).empty())
+ return api::GeneratedSchemas::Get(name);
+
+ if (!api::ChromeGeneratedSchemas::Get(name).empty())
+ return api::ChromeGeneratedSchemas::Get(name);
+
+ if (!api::QtWebEngineGeneratedSchemas::Get(name).empty())
+ return api::QtWebEngineGeneratedSchemas::Get(name);
+
+ return "";
}
void ExtensionsAPIProviderQt::RegisterPermissions(PermissionsInfo* permissions_info)
{
+ permissions_info->RegisterPermissions(
+ chrome_api_permissions::GetPermissionInfos(),
+ chrome_api_permissions::GetPermissionAliases());
}
}
diff --git a/src/core/common/extensions/extensions_client_qt.cpp b/src/core/common/extensions/extensions_client_qt.cpp
index dd1de1483..c4cc2321a 100644
--- a/src/core/common/extensions/extensions_client_qt.cpp
+++ b/src/core/common/extensions/extensions_client_qt.cpp
@@ -108,18 +108,18 @@ void ExtensionsClientQt::FilterHostPermissions(const URLPatternSet &hosts,
{
}
-// Replaces the scripting whitelist with |whitelist|. Used in the renderer{}
+// Replaces the scripting allowlist with |allowlist|. Used in the renderer{}
// only used for testing in the browser process.
-void ExtensionsClientQt::SetScriptingWhitelist(const ExtensionsClient::ScriptingWhitelist &whitelist)
+void ExtensionsClientQt::SetScriptingAllowlist(const ExtensionsClient::ScriptingAllowlist &allowlist)
{
- scripting_whitelist_ = whitelist;
+ scripting_allowlist_ = allowlist;
}
-// Return the whitelist of extensions that can run content scripts on
+// Return the allowlist of extensions that can run content scripts on
// any origin.
-const ExtensionsClient::ScriptingWhitelist &ExtensionsClientQt::GetScriptingWhitelist() const
+const ExtensionsClient::ScriptingAllowlist &ExtensionsClientQt::GetScriptingAllowlist() const
{
- return scripting_whitelist_;
+ return scripting_allowlist_;
}
// Get the set of chrome:// hosts that |extension| can run content scripts on.
diff --git a/src/core/common/extensions/extensions_client_qt.h b/src/core/common/extensions/extensions_client_qt.h
index e689f76b7..2466e14e3 100644
--- a/src/core/common/extensions/extensions_client_qt.h
+++ b/src/core/common/extensions/extensions_client_qt.h
@@ -87,13 +87,13 @@ public:
URLPatternSet *new_hosts,
PermissionIDSet *permissions) const override;
- // Replaces the scripting whitelist with |whitelist|. Used in the renderer;
+ // Replaces the scripting allowlist with |allowlist|. Used in the renderer;
// only used for testing in the browser process.
- void SetScriptingWhitelist(const ScriptingWhitelist &whitelist) override;
+ void SetScriptingAllowlist(const ScriptingAllowlist &allowlist) override;
- // Return the whitelist of extensions that can run content scripts on
+ // Return the allowlist of extensions that can run content scripts on
// any origin.
- const ScriptingWhitelist &GetScriptingWhitelist() const override;
+ const ScriptingAllowlist &GetScriptingAllowlist() const override;
// Get the set of chrome:// hosts that |extension| can run content scripts on.
URLPatternSet GetPermittedChromeSchemeHosts(const Extension *extension,
@@ -127,7 +127,7 @@ public:
static ExtensionsClientQt *GetInstance();
private:
- ScriptingWhitelist scripting_whitelist_;
+ ScriptingAllowlist scripting_allowlist_;
const ChromePermissionMessageProvider permission_message_provider_;
mutable GURL update_url_;
mutable GURL base_url_;
diff --git a/src/core/common/qt_messages.h b/src/core/common/qt_messages.h
index 43f07c9a6..ebf49e8c3 100644
--- a/src/core/common/qt_messages.h
+++ b/src/core/common/qt_messages.h
@@ -9,20 +9,6 @@
#include "content/public/common/webplugininfo.h"
#include "ipc/ipc_message_macros.h"
#include "ppapi/buildflags/buildflags.h"
-#include "user_script_data.h"
-
-IPC_STRUCT_TRAITS_BEGIN(UserScriptData)
- IPC_STRUCT_TRAITS_MEMBER(source)
- IPC_STRUCT_TRAITS_MEMBER(url)
- IPC_STRUCT_TRAITS_MEMBER(injectionPoint)
- IPC_STRUCT_TRAITS_MEMBER(injectForSubframes)
- IPC_STRUCT_TRAITS_MEMBER(worldId)
- IPC_STRUCT_TRAITS_MEMBER(scriptId)
- IPC_STRUCT_TRAITS_MEMBER(globs)
- IPC_STRUCT_TRAITS_MEMBER(excludeGlobs)
- IPC_STRUCT_TRAITS_MEMBER(urlPatterns)
-IPC_STRUCT_TRAITS_END()
-
#define IPC_MESSAGE_START QtMsgStart
@@ -30,87 +16,41 @@ IPC_STRUCT_TRAITS_END()
// RenderView messages
// These are messages sent from the browser to the renderer process.
-IPC_MESSAGE_ROUTED1(RenderViewObserverQt_FetchDocumentMarkup,
- uint64_t /* requestId */)
-
-IPC_MESSAGE_ROUTED1(RenderViewObserverQt_FetchDocumentInnerText,
- uint64_t /* requestId */)
-
-IPC_MESSAGE_ROUTED1(RenderViewObserverQt_SetBackgroundColor,
- uint32_t /* color */)
-
-// User scripts messages
-IPC_MESSAGE_ROUTED1(RenderFrameObserverHelper_AddScript,
- UserScriptData /* script */)
-IPC_MESSAGE_ROUTED1(RenderFrameObserverHelper_RemoveScript,
- UserScriptData /* script */)
-IPC_MESSAGE_ROUTED0(RenderFrameObserverHelper_ClearScripts)
-
-IPC_MESSAGE_CONTROL1(UserResourceController_AddScript, UserScriptData /* scriptContents */)
-IPC_MESSAGE_CONTROL1(UserResourceController_RemoveScript, UserScriptData /* scriptContents */)
-IPC_MESSAGE_CONTROL0(UserResourceController_ClearScripts)
-
-// Tells the renderer whether or not a file system access has been allowed.
-IPC_MESSAGE_ROUTED2(QtWebEngineMsg_RequestFileSystemAccessAsyncResponse,
+// Tells the renderer whether or not a storage access has been allowed.
+IPC_MESSAGE_ROUTED2(QtWebEngineMsg_RequestStorageAccessAsyncResponse,
int /* request_id */,
bool /* allowed */)
-
//-----------------------------------------------------------------------------
// WebContents messages
// These are messages sent from the renderer back to the browser process.
-IPC_MESSAGE_ROUTED2(RenderViewObserverHostQt_DidFetchDocumentMarkup,
- uint64_t /* requestId */,
- base::string16 /* markup */)
-
-IPC_MESSAGE_ROUTED2(RenderViewObserverHostQt_DidFetchDocumentInnerText,
- uint64_t /* requestId */,
- base::string16 /* innerText */)
-
IPC_MESSAGE_ROUTED0(RenderViewObserverHostQt_DidFirstVisuallyNonEmptyLayout)
//-----------------------------------------------------------------------------
// Misc messages
// These are messages sent from the renderer to the browser process.
-// Sent by the renderer process to check whether access to web databases is
-// granted by content settings.
-IPC_SYNC_MESSAGE_CONTROL3_1(QtWebEngineHostMsg_AllowDatabase,
+IPC_SYNC_MESSAGE_CONTROL4_1(QtWebEngineHostMsg_AllowStorageAccess,
int /* render_frame_id */,
GURL /* origin_url */,
GURL /* top origin url */,
+ int /* storage_type */,
bool /* allowed */)
-// Sent by the renderer process to check whether access to DOM Storage is
-// granted by content settings.
-IPC_SYNC_MESSAGE_CONTROL4_1(QtWebEngineHostMsg_AllowDOMStorage,
+IPC_SYNC_MESSAGE_CONTROL4_1(QtWebEngineHostMsg_RequestStorageAccessSync,
int /* render_frame_id */,
GURL /* origin_url */,
GURL /* top origin url */,
- bool /* if true local storage, otherwise session */,
+ int /* storage_type */,
bool /* allowed */)
-// Sent by the renderer process to check whether access to FileSystem is
+// Sent by the renderer process to check whether access to storage is
// granted by content settings.
-IPC_SYNC_MESSAGE_CONTROL3_1(QtWebEngineHostMsg_RequestFileSystemAccessSync,
- int /* render_frame_id */,
- GURL /* origin_url */,
- GURL /* top origin url */,
- bool /* allowed */)
-
-// Sent by the renderer process to check whether access to FileSystem is
-// granted by content settings.
-IPC_MESSAGE_CONTROL4(QtWebEngineHostMsg_RequestFileSystemAccessAsync,
+IPC_MESSAGE_CONTROL5(QtWebEngineHostMsg_RequestStorageAccessAsync,
int /* render_frame_id */,
int /* request_id */,
GURL /* origin_url */,
- GURL /* top origin url */)
+ GURL /* top origin url */,
+ int /* storage_type */)
-// Sent by the renderer process to check whether access to Indexed DB is
-// granted by content settings.
-IPC_SYNC_MESSAGE_CONTROL3_1(QtWebEngineHostMsg_AllowIndexedDB,
- int /* render_frame_id */,
- GURL /* origin_url */,
- GURL /* top origin url */,
- bool /* allowed */)
diff --git a/src/core/common/user_script_data.h b/src/core/common/user_script_data.h
deleted file mode 100644
index 8d98890e3..000000000
--- a/src/core/common/user_script_data.h
+++ /dev/null
@@ -1,74 +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 USER_SCRIPT_DATA_H
-#define USER_SCRIPT_DATA_H
-
-#include <QtCore/QHash>
-#include <string>
-#include "ipc/ipc_message_utils.h"
-#include "url/gurl.h"
-
-struct UserScriptData {
- enum InjectionPoint {
- AfterLoad,
- DocumentLoadFinished,
- DocumentElementCreation
- };
-
- UserScriptData();
-
- std::string source;
- GURL url;
- /*InjectionPoint*/uint8_t injectionPoint;
- bool injectForSubframes;
- uint worldId;
- uint64_t scriptId;
- std::vector<std::string> globs;
- std::vector<std::string> excludeGlobs;
- std::vector<std::string> urlPatterns;
-};
-
-QT_BEGIN_NAMESPACE
-
-Q_DECLARE_TYPEINFO(UserScriptData, Q_MOVABLE_TYPE);
-
-QT_END_NAMESPACE
-
-#endif // USER_SCRIPT_DATA_H
diff --git a/src/core/compositor/compositor.cpp b/src/core/compositor/compositor.cpp
new file mode 100644
index 000000000..655126f20
--- /dev/null
+++ b/src/core/compositor/compositor.cpp
@@ -0,0 +1,197 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#include "compositor.h"
+
+#include "base/memory/ref_counted.h"
+#include "components/viz/common/surfaces/frame_sink_id.h"
+
+#include <QHash>
+#include <QImage>
+#include <QMutex>
+
+namespace QtWebEngineCore {
+
+// Compositor::Id
+
+Compositor::Id::Id(viz::FrameSinkId fid) : client_id(fid.client_id()), sink_id(fid.sink_id()) { }
+
+static size_t qHash(Compositor::Id id, size_t seed = 0)
+{
+ QtPrivate::QHashCombine hasher;
+ seed = hasher(seed, id.client_id);
+ seed = hasher(seed, id.sink_id);
+ return seed;
+}
+
+static bool operator==(Compositor::Id id1, Compositor::Id id2)
+{
+ return id1.client_id == id2.client_id && id1.sink_id == id2.sink_id;
+}
+
+// Compositor::Binding and Compositor::Bindings
+
+struct Compositor::Binding
+{
+ const Id id;
+ Compositor *compositor = nullptr;
+ Observer *observer = nullptr;
+
+ Binding(Id id) : id(id) { }
+ ~Binding();
+};
+
+class Compositor::BindingMap
+{
+public:
+ void lock() { m_mutex.lock(); }
+
+ void unlock() { m_mutex.unlock(); }
+
+ Binding *findOrCreate(Id id)
+ {
+ auto it = m_map.find(id);
+ if (it == m_map.end())
+ it = m_map.insert(id, new Binding(id));
+ return *it;
+ }
+
+ void remove(Id id) { m_map.remove(id); }
+
+private:
+ QMutex m_mutex;
+ QHash<Id, Binding *> m_map;
+} static g_bindings;
+
+Compositor::Binding::~Binding()
+{
+ g_bindings.remove(id);
+}
+
+// Compositor::Observer
+
+void Compositor::Observer::bind(Id id)
+{
+ DCHECK(!m_binding);
+ g_bindings.lock();
+ m_binding = g_bindings.findOrCreate(id);
+ DCHECK(!m_binding->observer);
+ m_binding->observer = this;
+ g_bindings.unlock();
+}
+
+void Compositor::Observer::unbind()
+{
+ DCHECK(m_binding);
+ g_bindings.lock();
+ m_binding->observer = nullptr;
+ if (m_binding->compositor == nullptr)
+ delete m_binding;
+ m_binding = nullptr;
+ g_bindings.unlock();
+}
+
+Compositor::Handle<Compositor> Compositor::Observer::compositor()
+{
+ if (!m_binding)
+ return nullptr;
+ g_bindings.lock();
+ if (m_binding->compositor)
+ return m_binding->compositor; // delay unlock
+ g_bindings.unlock();
+ return nullptr;
+}
+
+// Compositor
+
+void Compositor::bind(Id id)
+{
+ DCHECK(!m_binding);
+ g_bindings.lock();
+ m_binding = g_bindings.findOrCreate(id);
+ DCHECK(!m_binding->compositor);
+ m_binding->compositor = this;
+ g_bindings.unlock();
+}
+
+void Compositor::unbind()
+{
+ DCHECK(m_binding);
+ g_bindings.lock();
+ m_binding->compositor = nullptr;
+ if (m_binding->observer == nullptr)
+ delete m_binding;
+ m_binding = nullptr;
+ g_bindings.unlock();
+}
+
+Compositor::Handle<Compositor::Observer> Compositor::observer()
+{
+ if (!m_binding)
+ return nullptr;
+ g_bindings.lock();
+ if (m_binding->observer)
+ return m_binding->observer; // delay unlock
+ g_bindings.unlock();
+ return nullptr;
+}
+
+QImage Compositor::image()
+{
+ Q_UNREACHABLE();
+ return {};
+}
+
+void Compositor::waitForTexture()
+{
+ Q_UNREACHABLE();
+}
+
+int Compositor::textureId()
+{
+ Q_UNREACHABLE();
+ return 0;
+}
+
+// static
+void Compositor::unlockBindings()
+{
+ g_bindings.unlock();
+}
+} // namespace QtWebEngineCore
diff --git a/src/core/compositor/compositor.h b/src/core/compositor/compositor.h
new file mode 100644
index 000000000..316178891
--- /dev/null
+++ b/src/core/compositor/compositor.h
@@ -0,0 +1,195 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef COMPOSITOR_H
+#define COMPOSITOR_H
+
+#include "qtwebenginecoreglobal_p.h"
+
+QT_BEGIN_NAMESPACE
+class QImage;
+class QSize;
+QT_END_NAMESPACE
+
+namespace viz {
+class FrameSinkId;
+} // namespace viz
+
+namespace QtWebEngineCore {
+
+// Produces composited frames for display.
+//
+// Used by quick/widgets libraries for accessing the frame and
+// controlling frame swapping. Must be cast to a subclass to access
+// the frame as QImage or OpenGL texture, etc.
+class Q_WEBENGINECORE_PRIVATE_EXPORT Compositor
+{
+ struct Binding;
+
+public:
+ // Identifies the implementation type.
+ enum class Type {
+ Software,
+ OpenGL,
+ };
+
+ // Identifies a compositor.
+ //
+ // The purpose of assigning ids to compositors is to allow the
+ // corresponding observer to be registered before the compositor
+ // itself is created, which is necessary since the creation
+ // happens on a different thread in the depths of viz.
+ //
+ // (Maps to viz::FrameSinkId internally).
+ struct Id
+ {
+ quint32 client_id;
+ quint32 sink_id;
+
+ Id(viz::FrameSinkId);
+ };
+
+ // Pointer to Compositor or Observer that holds a lock to prevent
+ // either from being unbound and destroyed.
+ template<typename T>
+ class Handle
+ {
+ public:
+ Handle(std::nullptr_t) : m_data(nullptr) { }
+ Handle(T *data) : m_data(data) { }
+ Handle(Handle &&that) : m_data(that.m_data) { that.m_data = nullptr; }
+ ~Handle()
+ {
+ if (m_data)
+ Compositor::unlockBindings();
+ }
+ T *operator->() const { return m_data; }
+ T &operator*() const { return *m_data; }
+ explicit operator bool() const { return m_data; }
+
+ private:
+ T *m_data;
+ };
+
+ // Observes the compositor corresponding to the given id.
+ //
+ // Only one observer can exist per compositor.
+ class Q_WEBENGINECORE_PRIVATE_EXPORT Observer
+ {
+ public:
+ // Binding to compositor
+ void bind(Id id);
+ void unbind();
+
+ // Compositor if bound
+ Handle<Compositor> compositor();
+
+ // There's a new frame ready, time to swapFrame().
+ virtual void readyToSwap() = 0;
+
+ protected:
+ Observer() = default;
+ ~Observer() = default;
+
+ private:
+ Binding *m_binding = nullptr;
+ };
+
+ // Type determines which methods can be called.
+ Type type() const { return m_type; }
+
+ // Binding to observer.
+ void bind(Id id);
+ void unbind();
+
+ // Observer if bound.
+ Handle<Observer> observer();
+
+ // Update to next frame if possible.
+ virtual void swapFrame() = 0;
+
+ // Ratio of pixels to DIPs.
+ //
+ // Don't use the devicePixelRatio of QImage, it's always 1.
+ virtual float devicePixelRatio() = 0;
+
+ // Size of frame in pixels.
+ virtual QSize size() = 0;
+
+ // Whether frame needs an alpha channel.
+ //
+ // In software mode, the image format can be either
+ // QImage::Format_ARGB32_Premultiplied or
+ // QImage::Format_RGBA8888_Premultiplied
+ //
+ // In OpenGL mode, the texture format is either GL_RGBA or GL_RGB.
+ virtual bool hasAlphaChannel() = 0;
+
+ // (Software) QImage of the frame.
+ //
+ // This is a big image so we should try not to make copies of it.
+ // In particular, the client should drop its QImage reference
+ // before calling swapFrame(), otherwise each swap will cause a
+ // detach.
+ virtual QImage image();
+
+ // (OpenGL) Wait on texture fence in Qt's current OpenGL context.
+ virtual void waitForTexture();
+
+ // (OpenGL) Texture of the frame.
+ virtual int textureId();
+
+protected:
+ Compositor(Type type) : m_type(type) { }
+ ~Compositor() = default;
+
+private:
+ template<typename T>
+ friend class Handle;
+
+ class BindingMap;
+ static void unlockBindings();
+
+ const Type m_type;
+ Binding *m_binding = nullptr;
+};
+
+} // namespace QtWebEngineCore
+
+#endif // !COMPOSITOR_H
diff --git a/src/core/compositor/display_frame_sink.cpp b/src/core/compositor/display_frame_sink.cpp
deleted file mode 100644
index 945600299..000000000
--- a/src/core/compositor/display_frame_sink.cpp
+++ /dev/null
@@ -1,140 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#include "display_frame_sink.h"
-
-#include <QMap>
-
-namespace QtWebEngineCore {
-
-namespace {
-
-class DisplayFrameSinkMap
-{
-public:
- static DisplayFrameSinkMap *instance()
- {
- static DisplayFrameSinkMap map;
- return &map;
- }
-
- scoped_refptr<DisplayFrameSink> findOrCreate(viz::FrameSinkId frameSinkId)
- {
- QMutexLocker locker(&m_mutex);
- auto it = m_map.find(frameSinkId);
- if (it == m_map.end())
- it = m_map.insert(frameSinkId, new DisplayFrameSink(frameSinkId));
- return *it;
- }
-
- void remove(viz::FrameSinkId frameSinkId)
- {
- QMutexLocker locker(&m_mutex);
- m_map.remove(frameSinkId);
- }
-
-private:
- mutable QMutex m_mutex;
- QMap<viz::FrameSinkId, DisplayFrameSink *> m_map;
-};
-
-} // namespace
-
-// static
-scoped_refptr<DisplayFrameSink> DisplayFrameSink::findOrCreate(viz::FrameSinkId frameSinkId)
-{
- return DisplayFrameSinkMap::instance()->findOrCreate(frameSinkId);
-}
-
-DisplayFrameSink::DisplayFrameSink(viz::FrameSinkId frameSinkId)
- : m_frameSinkId(frameSinkId)
-{
- DCHECK(m_frameSinkId.is_valid());
-}
-
-DisplayFrameSink::~DisplayFrameSink()
-{
- DisplayFrameSinkMap::instance()->remove(m_frameSinkId);
-}
-
-void DisplayFrameSink::connect(DisplayConsumer *consumer)
-{
- QMutexLocker locker(&m_mutex);
- DCHECK(m_consumer == nullptr);
- m_consumer = consumer;
-}
-
-void DisplayFrameSink::connect(DisplayProducer *producer)
-{
- QMutexLocker locker(&m_mutex);
- DCHECK(m_producer == nullptr);
- m_producer = producer;
-}
-
-void DisplayFrameSink::disconnect(DisplayConsumer *consumer)
-{
- QMutexLocker locker(&m_mutex);
- DCHECK(m_consumer == consumer);
- m_consumer = nullptr;
-}
-
-void DisplayFrameSink::disconnect(DisplayProducer *producer)
-{
- QMutexLocker locker(&m_mutex);
- DCHECK(m_producer == producer);
- m_producer = nullptr;
-}
-
-void DisplayFrameSink::scheduleUpdate()
-{
- QMutexLocker locker(&m_mutex);
- if (m_consumer)
- m_consumer->scheduleUpdate();
-}
-
-QSGNode *DisplayFrameSink::updatePaintNode(QSGNode *oldNode, RenderWidgetHostViewQtDelegate *delegate)
-{
- QMutexLocker locker(&m_mutex);
- QSGNode *newNode = oldNode;
- if (m_producer)
- newNode = m_producer->updatePaintNode(oldNode, delegate);
- return newNode;
-}
-
-} // namespace QtWebEngineCore
diff --git a/src/core/compositor/display_frame_sink.h b/src/core/compositor/display_frame_sink.h
deleted file mode 100644
index f620dc4f2..000000000
--- a/src/core/compositor/display_frame_sink.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#ifndef DISPLAY_FRAME_SINK_H
-#define DISPLAY_FRAME_SINK_H
-
-#include "display_consumer.h"
-#include "display_producer.h"
-
-#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_refptr.h"
-#include "components/viz/common/surfaces/frame_sink_id.h"
-
-#include <QMutex>
-
-namespace QtWebEngineCore {
-
-// Connects a DisplayConsumer with a DisplayProducer.
-class DisplayFrameSink final : public base::RefCountedThreadSafe<DisplayFrameSink>
-{
-public:
- static scoped_refptr<DisplayFrameSink> findOrCreate(viz::FrameSinkId frameSinkId);
- DisplayFrameSink(viz::FrameSinkId frameSinkId);
- ~DisplayFrameSink();
- void connect(DisplayConsumer *consumer);
- void connect(DisplayProducer *producer);
- void disconnect(DisplayConsumer *consumer);
- void disconnect(DisplayProducer *producer);
- void scheduleUpdate();
- QSGNode *updatePaintNode(QSGNode *oldNode, RenderWidgetHostViewQtDelegate *delegate);
-
-private:
- const viz::FrameSinkId m_frameSinkId;
- mutable QMutex m_mutex;
- DisplayProducer *m_producer = nullptr;
- DisplayConsumer *m_consumer = nullptr;
-};
-
-} // namespace QtWebEngineCore
-
-#endif // !DISPLAY_FRAME_SINK_H
diff --git a/src/core/compositor/display_gl_output_surface.cpp b/src/core/compositor/display_gl_output_surface.cpp
index 370eb07e6..16a925bd4 100644
--- a/src/core/compositor/display_gl_output_surface.cpp
+++ b/src/core/compositor/display_gl_output_surface.cpp
@@ -39,6 +39,8 @@
#include "display_gl_output_surface.h"
+#include "type_conversion.h"
+
#include "base/threading/thread_task_runner_handle.h"
#include "components/viz/service/display/display.h"
#include "components/viz/service/display/output_surface_frame.h"
@@ -51,8 +53,10 @@
namespace QtWebEngineCore {
-DisplayGLOutputSurface::DisplayGLOutputSurface(scoped_refptr<viz::VizProcessContextProvider> contextProvider)
+DisplayGLOutputSurface::DisplayGLOutputSurface(
+ scoped_refptr<viz::VizProcessContextProvider> contextProvider)
: OutputSurface(contextProvider)
+ , Compositor(Compositor::Type::OpenGL)
, m_commandBuffer(contextProvider->command_buffer())
, m_gl(contextProvider->ContextGL())
, m_vizContextProvider(contextProvider)
@@ -63,18 +67,16 @@ DisplayGLOutputSurface::DisplayGLOutputSurface(scoped_refptr<viz::VizProcessCont
DisplayGLOutputSurface::~DisplayGLOutputSurface()
{
+ unbind();
m_vizContextProvider->SetUpdateVSyncParametersCallback(viz::UpdateVSyncParametersCallback());
m_gl->DeleteFramebuffers(1, &m_fboId);
- if (m_sink)
- m_sink->disconnect(this);
}
// Called from viz::Display::Initialize.
void DisplayGLOutputSurface::BindToClient(viz::OutputSurfaceClient *client)
{
m_display = static_cast<viz::Display *>(client);
- m_sink = DisplayFrameSink::findOrCreate(m_display->frame_sink_id());
- m_sink->connect(this);
+ bind(m_display->frame_sink_id());
}
// Triggered by ui::Compositor::SetVisible(true).
@@ -213,7 +215,8 @@ void DisplayGLOutputSurface::swapBuffersOnGpuThread(unsigned int id, std::unique
m_readyToUpdate = true;
}
- m_sink->scheduleUpdate();
+ if (auto obs = observer())
+ obs->readyToSwap();
}
void DisplayGLOutputSurface::swapBuffersOnVizThread()
@@ -300,4 +303,45 @@ gfx::OverlayTransform DisplayGLOutputSurface::GetDisplayTransform()
return gfx::OVERLAY_TRANSFORM_NONE;
}
+void DisplayGLOutputSurface::swapFrame()
+{
+ QMutexLocker locker(&m_mutex);
+ if (m_readyToUpdate) {
+ std::swap(m_middleBuffer, m_frontBuffer);
+ m_taskRunner->PostTask(FROM_HERE,
+ base::BindOnce(&DisplayGLOutputSurface::swapBuffersOnVizThread,
+ base::Unretained(this)));
+ m_taskRunner.reset();
+ m_readyToUpdate = false;
+ }
+}
+
+void DisplayGLOutputSurface::waitForTexture()
+{
+ if (m_frontBuffer && m_frontBuffer->fence) {
+ m_frontBuffer->fence->wait();
+ m_frontBuffer->fence.reset();
+ }
+}
+
+int DisplayGLOutputSurface::textureId()
+{
+ return m_frontBuffer ? m_frontBuffer->serviceId : 0;
+}
+
+QSize DisplayGLOutputSurface::size()
+{
+ return m_frontBuffer ? toQt(m_frontBuffer->shape.sizeInPixels) : QSize();
+}
+
+bool DisplayGLOutputSurface::hasAlphaChannel()
+{
+ return m_frontBuffer ? m_frontBuffer->shape.hasAlpha : false;
+}
+
+float DisplayGLOutputSurface::devicePixelRatio()
+{
+ return m_frontBuffer ? m_frontBuffer->shape.devicePixelRatio : 1;
+}
+
} // namespace QtWebEngineCore
diff --git a/src/core/compositor/display_gl_output_surface.h b/src/core/compositor/display_gl_output_surface.h
index d2e203b4e..5c6b1ab23 100644
--- a/src/core/compositor/display_gl_output_surface.h
+++ b/src/core/compositor/display_gl_output_surface.h
@@ -41,7 +41,7 @@
#define DISPLAY_GL_OUTPUT_SURFACE_H
#include "compositor_resource_fence.h"
-#include "display_frame_sink.h"
+#include "compositor.h"
#include "components/viz/common/display/update_vsync_parameters_callback.h"
#include "components/viz/service/display/output_surface.h"
@@ -49,6 +49,8 @@
#include "gpu/command_buffer/common/mailbox.h"
#include "gpu/command_buffer/common/sync_token.h"
+#include <QMutex>
+
namespace viz {
class Display;
class SyntheticBeginFrameSource;
@@ -56,9 +58,7 @@ class SyntheticBeginFrameSource;
namespace QtWebEngineCore {
-// NOTE: Some methods are defined in display_gl_output_surface_qsg.cpp due
-// to conflicts between Qt & Chromium OpenGL APIs.
-class DisplayGLOutputSurface final : public viz::OutputSurface, public DisplayProducer
+class DisplayGLOutputSurface final : public viz::OutputSurface, public Compositor
{
public:
DisplayGLOutputSurface(scoped_refptr<viz::VizProcessContextProvider> contextProvider);
@@ -88,8 +88,13 @@ public:
scoped_refptr<gpu::GpuTaskSchedulerHelper> GetGpuTaskSchedulerHelper() override;
gpu::MemoryTracker *GetMemoryTracker() override;
- // Overridden from DisplayProducer.
- QSGNode *updatePaintNode(QSGNode *oldNode, RenderWidgetHostViewQtDelegate *delegate) override;
+ // Overridden from Compositor.
+ void swapFrame() override;
+ void waitForTexture() override;
+ int textureId() override;
+ QSize size() override;
+ bool hasAlphaChannel() override;
+ float devicePixelRatio() override;
private:
struct Shape
@@ -136,7 +141,6 @@ private:
mutable QMutex m_mutex;
uint32_t m_fboId = 0;
viz::Display *m_display = nullptr;
- scoped_refptr<DisplayFrameSink> m_sink;
Shape m_currentShape;
std::unique_ptr<Buffer> m_backBuffer;
std::unique_ptr<Buffer> m_middleBuffer;
diff --git a/src/core/compositor/display_gl_output_surface_qsg.cpp b/src/core/compositor/display_gl_output_surface_qsg.cpp
deleted file mode 100644
index 0e9fff6e3..000000000
--- a/src/core/compositor/display_gl_output_surface_qsg.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#include "display_gl_output_surface.h"
-
-#include "compositor_resource_fence.h"
-#include "render_widget_host_view_qt_delegate.h"
-#include "type_conversion.h"
-
-#include <QOpenGLFunctions>
-#include <QSGImageNode>
-#include <QSGTexture>
-
-namespace QtWebEngineCore {
-
-class DisplayGLOutputSurface::Texture final : public QSGTexture
-{
-public:
- Texture(uint32_t id, QSize sizeInPixels, bool hasAlphaChannel, scoped_refptr<CompositorResourceFence> fence)
- : m_id(id)
- , m_sizeInPixels(sizeInPixels)
- , m_hasAlphaChannel(hasAlphaChannel)
- , m_fence(std::move(fence))
- {
- }
-
- // QSGTexture:
- int textureId() const override { return m_id; }
- QSize textureSize() const override { return m_sizeInPixels; }
- bool hasAlphaChannel() const override { return m_hasAlphaChannel; }
- bool hasMipmaps() const override { return false; }
- void bind() override
- {
- if (m_fence) {
- m_fence->wait();
- m_fence.reset();
- }
-
- QOpenGLContext *context = QOpenGLContext::currentContext();
- QOpenGLFunctions *funcs = context->functions();
- funcs->glBindTexture(GL_TEXTURE_2D, m_id);
- }
-
-private:
- uint32_t m_id;
- QSize m_sizeInPixels;
- bool m_hasAlphaChannel;
- scoped_refptr<CompositorResourceFence> m_fence;
-};
-
-QSGNode *DisplayGLOutputSurface::updatePaintNode(QSGNode *oldNode, RenderWidgetHostViewQtDelegate *delegate)
-{
- {
- QMutexLocker locker(&m_mutex);
- if (m_readyToUpdate) {
- std::swap(m_middleBuffer, m_frontBuffer);
- m_taskRunner->PostTask(
- FROM_HERE,
- base::BindOnce(&DisplayGLOutputSurface::swapBuffersOnVizThread, base::Unretained(this)));
- m_taskRunner.reset();
- m_readyToUpdate = false;
- }
- }
-
- if (!m_frontBuffer)
- return oldNode;
-
- auto node = static_cast<QSGImageNode *>(oldNode);
- if (!node)
- node = delegate->createImageNode();
-
- QSize sizeInPixels = toQt(m_frontBuffer->shape.sizeInPixels);
- QSizeF sizeInDips = QSizeF(sizeInPixels) / m_frontBuffer->shape.devicePixelRatio;
- QRectF rectInDips(QPointF(0, 0), sizeInDips);
- node->setRect(rectInDips);
- node->setOwnsTexture(true);
- node->setTexture(new Texture(m_frontBuffer->serviceId,
- sizeInPixels,
- m_frontBuffer->shape.hasAlpha,
- m_frontBuffer->fence));
- node->setTextureCoordinatesTransform(QSGImageNode::MirrorVertically);
-
- return node;
-}
-
-} // namespace QtWebEngineCore
diff --git a/src/core/compositor/display_software_output_surface.cpp b/src/core/compositor/display_software_output_surface.cpp
index ba99799f0..218bff94a 100644
--- a/src/core/compositor/display_software_output_surface.cpp
+++ b/src/core/compositor/display_software_output_surface.cpp
@@ -39,7 +39,7 @@
#include "display_software_output_surface.h"
-#include "display_frame_sink.h"
+#include "compositor.h"
#include "render_widget_host_view_qt_delegate.h"
#include "type_conversion.h"
@@ -49,28 +49,29 @@
#include <QMutex>
#include <QPainter>
-#include <QSGImageNode>
namespace QtWebEngineCore {
-class DisplaySoftwareOutputSurface::Device final : public viz::SoftwareOutputDevice, public DisplayProducer
+class DisplaySoftwareOutputSurface::Device final : public viz::SoftwareOutputDevice,
+ public Compositor
{
public:
+ Device();
~Device();
- // Called from DisplaySoftwareOutputSurface.
- void bind(viz::FrameSinkId frameSinkId);
-
// Overridden from viz::SoftwareOutputDevice.
void Resize(const gfx::Size &sizeInPixels, float devicePixelRatio) override;
void OnSwapBuffers(SwapBuffersCallback swap_ack_callback) override;
- // Overridden from DisplayProducer.
- QSGNode *updatePaintNode(QSGNode *oldNode, RenderWidgetHostViewQtDelegate *delegate) override;
+ // Overridden from Compositor.
+ void swapFrame() override;
+ QImage image() override;
+ float devicePixelRatio() override;
+ QSize size() override;
+ bool hasAlphaChannel() override;
private:
mutable QMutex m_mutex;
- scoped_refptr<DisplayFrameSink> m_sink;
float m_devicePixelRatio = 1.0;
scoped_refptr<base::SingleThreadTaskRunner> m_taskRunner;
SwapBuffersCallback m_swapCompletionCallback;
@@ -78,16 +79,13 @@ private:
float m_imageDevicePixelRatio = 1.0;
};
-DisplaySoftwareOutputSurface::Device::~Device()
-{
- if (m_sink)
- m_sink->disconnect(this);
-}
+DisplaySoftwareOutputSurface::Device::Device()
+ : Compositor(Type::Software)
+{}
-void DisplaySoftwareOutputSurface::Device::bind(viz::FrameSinkId frameSinkId)
+DisplaySoftwareOutputSurface::Device::~Device()
{
- m_sink = DisplayFrameSink::findOrCreate(frameSinkId);
- m_sink->connect(this);
+ unbind();
}
void DisplaySoftwareOutputSurface::Device::Resize(const gfx::Size &sizeInPixels, float devicePixelRatio)
@@ -104,7 +102,8 @@ void DisplaySoftwareOutputSurface::Device::OnSwapBuffers(SwapBuffersCallback swa
QMutexLocker locker(&m_mutex);
m_taskRunner = base::ThreadTaskRunnerHandle::Get();
m_swapCompletionCallback = std::move(swap_ack_callback);
- m_sink->scheduleUpdate();
+ if (auto obs = observer())
+ obs->readyToSwap();
}
inline QImage::Format imageFormat(SkColorType colorType)
@@ -120,41 +119,51 @@ inline QImage::Format imageFormat(SkColorType colorType)
}
}
-QSGNode *DisplaySoftwareOutputSurface::Device::updatePaintNode(
- QSGNode *oldNode, RenderWidgetHostViewQtDelegate *delegate)
+void DisplaySoftwareOutputSurface::Device::swapFrame()
{
QMutexLocker locker(&m_mutex);
- // Delete old node to make sure refcount of m_image is at most 1.
- delete oldNode;
- QSGImageNode *node = delegate->createImageNode();
-
- if (m_swapCompletionCallback) {
- SkPixmap skPixmap;
- surface_->peekPixels(&skPixmap);
- QImage image(reinterpret_cast<const uchar *>(skPixmap.addr()),
- viewport_pixel_size_.width(), viewport_pixel_size_.height(),
- skPixmap.rowBytes(), imageFormat(skPixmap.colorType()));
- if (m_image.size() == image.size()) {
- QRect damageRect = toQt(damage_rect_);
- QPainter painter(&m_image);
- painter.setCompositionMode(QPainter::CompositionMode_Source);
- painter.drawImage(damageRect, image, damageRect);
- } else {
- m_image = image;
- m_image.detach();
- }
- m_imageDevicePixelRatio = m_devicePixelRatio;
- m_taskRunner->PostTask(FROM_HERE, base::BindOnce(std::move(m_swapCompletionCallback), toGfx(m_image.size())));
- m_taskRunner.reset();
+ if (!m_swapCompletionCallback)
+ return;
+
+ SkPixmap skPixmap;
+ surface_->peekPixels(&skPixmap);
+ QImage image(reinterpret_cast<const uchar *>(skPixmap.addr()), viewport_pixel_size_.width(),
+ viewport_pixel_size_.height(), skPixmap.rowBytes(),
+ imageFormat(skPixmap.colorType()));
+ if (m_image.size() == image.size()) {
+ QRect damageRect = toQt(damage_rect_);
+ QPainter painter(&m_image);
+ painter.setCompositionMode(QPainter::CompositionMode_Source);
+ painter.drawImage(damageRect, image, damageRect);
+ } else {
+ m_image = image;
+ m_image.detach();
}
+ m_imageDevicePixelRatio = m_devicePixelRatio;
+ m_taskRunner->PostTask(
+ FROM_HERE, base::BindOnce(std::move(m_swapCompletionCallback), toGfx(m_image.size())));
+ m_taskRunner.reset();
+}
- QSizeF sizeInDips = QSizeF(m_image.size()) / m_imageDevicePixelRatio;
- node->setRect(QRectF(QPointF(0, 0), sizeInDips));
- node->setOwnsTexture(true);
- node->setTexture(delegate->createTextureFromImage(m_image));
+QImage DisplaySoftwareOutputSurface::Device::image()
+{
+ return m_image;
+}
+
+float DisplaySoftwareOutputSurface::Device::devicePixelRatio()
+{
+ return m_imageDevicePixelRatio;
+}
- return node;
+QSize DisplaySoftwareOutputSurface::Device::size()
+{
+ return m_image.size();
+}
+
+bool DisplaySoftwareOutputSurface::Device::hasAlphaChannel()
+{
+ return m_image.format() == QImage::Format_ARGB32_Premultiplied;
}
DisplaySoftwareOutputSurface::DisplaySoftwareOutputSurface()
diff --git a/src/core/config/common.pri b/src/core/config/common.pri
index 9432fac7d..b48d0b496 100644
--- a/src/core/config/common.pri
+++ b/src/core/config/common.pri
@@ -1,4 +1,3 @@
-
qtConfig(webengine-printing-and-pdf) {
gn_args += enable_basic_printing=true enable_print_preview=true
gn_args += enable_pdf=true
@@ -22,14 +21,15 @@ qtConfig(webengine-spellchecker) {
qtConfig(webengine-webrtc) {
gn_args += enable_webrtc=true
} else {
- gn_args += enable_webrtc=false audio_processing_in_audio_service_supported=false
+ gn_args += enable_webrtc=false
}
qtConfig(webengine-proprietary-codecs) {
gn_args += proprietary_codecs=true ffmpeg_branding=\"Chrome\"
- qtConfig(webengine-webrtc) {
- gn_args += rtc_use_h264=true
- }
+# Fix after updating 3rdparty in dev to include the right fix
+# qtConfig(webengine-webrtc) {
+# gn_args += rtc_use_h264=true
+# }
} else {
gn_args += proprietary_codecs=false
}
@@ -46,8 +46,4 @@ qtConfig(webengine-kerberos) {
gn_args += use_kerberos=false
}
-qtConfig(webengine-nodejs) {
- gn_args += have_nodejs=true
-} else {
- gn_args += have_nodejs=false
-}
+!qtConfig(webengine-nodejs10): gn_args += use_rollup=false
diff --git a/src/core/config/linux.pri b/src/core/config/linux.pri
index 26d0dcf7d..3e490a0d5 100644
--- a/src/core/config/linux.pri
+++ b/src/core/config/linux.pri
@@ -41,9 +41,4 @@ qtConfig(webengine-embedded-build) {
qtConfig(webengine-system-ffmpeg): gn_args += use_system_ffmpeg=true
qtConfig(webengine-system-re2): gn_args += use_system_re2=true
qtConfig(webengine-system-lcms2): gn_args += use_system_lcms2=true
-
- # FIXME:
- #qtConfig(webengine-system-protobuf): gn_args += use_system_protobuf=true
- #qtConfig(webengine-system-jsoncpp): gn_args += use_system_jsoncpp=true
- #qtConfig(webengine-system-libsrtp: gn_args += use_system_libsrtp=true
}
diff --git a/src/core/config/windows.pri b/src/core/config/windows.pri
index 732a61e28..9543daf90 100644
--- a/src/core/config/windows.pri
+++ b/src/core/config/windows.pri
@@ -6,6 +6,3 @@ qtConfig(build-qtwebengine-core):qtConfig(webengine-spellchecker) {
} else {
gn_args += use_browser_spellchecker=false
}
-
-# Avoid conflicting vulkan.h headers
-gn_args += enable_vulkan=false
diff --git a/src/core/configure.json b/src/core/configure.json
index 4cd6174fc..9e39ae59a 100644
--- a/src/core/configure.json
+++ b/src/core/configure.json
@@ -91,10 +91,6 @@
"webengine-embedded-build": {
"label": "embedded build",
"type": "detectEmbedded"
- },
- "webengine-nodejs": {
- "label": "node.js",
- "type": "detectNodeJS"
}
},
"features": {
@@ -212,11 +208,6 @@
{ "type": "privateConfig", "name": "v8base_debug" },
{ "type": "privateConfig", "name": "webcore_debug" }
]
- },
- "webengine-nodejs": {
- "label": "Node.js",
- "condition": "tests.webengine-nodejs",
- "output": [ "privateFeature" ]
}
},
@@ -235,11 +226,6 @@
"type": "warning",
"condition": "config.unix && config.cross_compile && !features.webengine-v8-snapshot-support",
"message": "V8 snapshot cannot be built. Most likely, the 32-bit host compiler does not work. Please make sure you have 32-bit devel environment installed."
- },
- {
- "type": "warning",
- "condition": "!features.webengine-nodejs",
- "message": "Building without node.js will disable some features of QtWebEngine DevTools."
}
],
@@ -261,7 +247,6 @@
"webengine-webchannel",
"webengine-kerberos",
"webengine-extensions",
- "webengine-nodejs",
{
"type": "feature",
"args": "webengine-ozone",
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp
index d3181c555..426c3beb2 100644
--- a/src/core/content_browser_client_qt.cpp
+++ b/src/core/content_browser_client_qt.cpp
@@ -43,7 +43,6 @@
#include "base/optional.h"
#include "base/path_service.h"
#include "base/strings/utf_string_conversions.h"
-#include "base/message_loop/message_loop.h"
#include "base/task/post_task.h"
#include "base/threading/thread_restrictions.h"
#include "chrome/browser/custom_handlers/protocol_handler_registry.h"
@@ -56,15 +55,12 @@
#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_registry.h"
-#include "components/performance_manager/graph/process_node_impl.h"
-#include "components/performance_manager/performance_manager_impl.h"
-#include "components/performance_manager/public/mojom/coordination_unit.mojom.h"
#include "components/performance_manager/public/performance_manager.h"
-#include "components/performance_manager/render_process_user_data.h"
#include "components/spellcheck/spellcheck_buildflags.h"
#include "content/browser/renderer_host/render_view_host_delegate.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/common/url_schemes.h"
+#include "content/public/browser/browser_main_runner.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"
@@ -90,6 +86,7 @@
#include "extensions/buildflags/buildflags.h"
#include "extensions/browser/extension_protocols.h"
#include "extensions/browser/guest_view/web_view/web_view_guest.h"
+#include "extensions/browser/process_map.h"
#include "mojo/public/cpp/bindings/binding.h"
#include "mojo/public/cpp/bindings/binding_set.h"
#include "mojo/public/cpp/bindings/remote.h"
@@ -98,21 +95,18 @@
#include "qtwebengine/browser/qtwebengine_content_renderer_overlay_manifest.h"
#include "net/ssl/client_cert_identity.h"
#include "net/ssl/client_cert_store.h"
+#include "sandbox/policy/switches.h"
#include "services/network/network_service.h"
#include "services/network/public/cpp/features.h"
+#include "services/service_manager/switches.h"
#include "services/service_manager/public/cpp/connector.h"
#include "services/service_manager/public/cpp/service.h"
-#include "services/service_manager/sandbox/switches.h"
#include "storage/browser/quota/quota_settings.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 "third_party/blink/public/mojom/insecure_input/insecure_input_service.mojom.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/ui_base_switches.h"
-#include "ui/gl/gl_context.h"
-#include "ui/gl/gl_implementation.h"
-#include "ui/gl/gl_share_group.h"
-#include "ui/gl/gpu_timing.h"
#include "url/url_util_qt.h"
#include "qtwebengine/common/renderer_configuration.mojom.h"
@@ -122,7 +116,6 @@
#include "browser_main_parts_qt.h"
#include "browser_message_filter_qt.h"
#include "certificate_error_controller.h"
-#include "certificate_error_controller_p.h"
#include "client_cert_select_controller.h"
#include "devtools_manager_delegate_qt.h"
#include "login_delegate_qt.h"
@@ -151,7 +144,7 @@
#include "api/qwebenginecookiestore.h"
#include "api/qwebenginecookiestore_p.h"
#include "api/qwebengineurlscheme.h"
-
+#include "ozone/gl_share_context_qt.h"
#if defined(Q_OS_LINUX)
#include "global_descriptors_qt.h"
#include "ui/base/resource/resource_bundle.h"
@@ -170,6 +163,7 @@
#if BUILDFLAG(ENABLE_EXTENSIONS)
#include "content/public/browser/file_url_loader.h"
#include "extensions/browser/extension_message_filter.h"
+#include "extensions/browser/extension_registry.h"
#include "extensions/browser/guest_view/extensions_guest_view_message_filter.h"
#include "extensions/browser/url_loader_factory_manager.h"
#include "extensions/common/constants.h"
@@ -193,15 +187,6 @@
#include <QGuiApplication>
#include <QLocale>
#include <QStandardPaths>
-#if QT_CONFIG(opengl)
-# include <QOpenGLContext>
-# include <QOpenGLExtraFunctions>
-#endif
-#include <qpa/qplatformnativeinterface.h>
-
-QT_BEGIN_NAMESPACE
-Q_GUI_EXPORT QOpenGLContext *qt_gl_global_share_context();
-QT_END_NAMESPACE
// Implement IsHandledProtocol as declared in //url/url_util_qt.h.
namespace url {
@@ -242,93 +227,6 @@ bool IsHandledProtocol(base::StringPiece scheme)
namespace QtWebEngineCore {
-class QtShareGLContext : public gl::GLContext {
-public:
- QtShareGLContext(QOpenGLContext *qtContext)
- : gl::GLContext(0)
- , m_handle(0)
- {
- QString platform = qApp->platformName().toLower();
- QPlatformNativeInterface *pni = QGuiApplication::platformNativeInterface();
- if (platform == QLatin1String("xcb") || platform == QLatin1String("offscreen")) {
- if (gl::GetGLImplementation() == gl::kGLImplementationEGLGLES2)
- m_handle = pni->nativeResourceForContext(QByteArrayLiteral("eglcontext"), qtContext);
- else
- m_handle = pni->nativeResourceForContext(QByteArrayLiteral("glxcontext"), qtContext);
- } else if (platform == QLatin1String("cocoa"))
- m_handle = pni->nativeResourceForContext(QByteArrayLiteral("cglcontextobj"), qtContext);
- else if (platform == QLatin1String("qnx"))
- m_handle = pni->nativeResourceForContext(QByteArrayLiteral("eglcontext"), qtContext);
- else if (platform == QLatin1String("eglfs") || platform == QLatin1String("wayland")
- || platform == QLatin1String("wayland-egl"))
- m_handle = pni->nativeResourceForContext(QByteArrayLiteral("eglcontext"), qtContext);
- else if (platform == QLatin1String("windows")) {
- if (gl::GetGLImplementation() == gl::kGLImplementationEGLGLES2)
- m_handle = pni->nativeResourceForContext(QByteArrayLiteral("eglContext"), qtContext);
- else
- m_handle = pni->nativeResourceForContext(QByteArrayLiteral("renderingcontext"), qtContext);
- } else {
- qFatal("%s platform not yet supported", platform.toLatin1().constData());
- // Add missing platforms once they work.
- Q_UNREACHABLE();
- }
- }
-
- void* GetHandle() override { return m_handle; }
- unsigned int CheckStickyGraphicsResetStatus() override
- {
-#if QT_CONFIG(opengl)
- if (QOpenGLContext *context = qt_gl_global_share_context()) {
- if (context->format().testOption(QSurfaceFormat::ResetNotification))
- return context->extraFunctions()->glGetGraphicsResetStatus();
- }
-#endif
- return 0 /*GL_NO_ERROR*/;
- }
-
- // We don't care about the rest, this context shouldn't be used except for its handle.
- bool Initialize(gl::GLSurface *, const gl::GLContextAttribs &) override { Q_UNREACHABLE(); return false; }
- bool MakeCurrent(gl::GLSurface *) override { Q_UNREACHABLE(); return false; }
- void ReleaseCurrent(gl::GLSurface *) override { Q_UNREACHABLE(); }
- bool IsCurrent(gl::GLSurface *) override { Q_UNREACHABLE(); return false; }
- scoped_refptr<gl::GPUTimingClient> CreateGPUTimingClient() override
- {
- return nullptr;
- }
- const gfx::ExtensionSet& GetExtensions() override
- {
- static const gfx::ExtensionSet s_emptySet;
- return s_emptySet;
- }
- void ResetExtensions() override
- {
- }
-
-private:
- void *m_handle;
-};
-
-class ShareGroupQtQuick : public gl::GLShareGroup {
-public:
- gl::GLContext* GetContext() override { return m_shareContextQtQuick.get(); }
- void AboutToAddFirstContext() override;
-
-private:
- scoped_refptr<QtShareGLContext> m_shareContextQtQuick;
-};
-
-void ShareGroupQtQuick::AboutToAddFirstContext()
-{
-#if QT_CONFIG(opengl)
- // This currently has to be setup by ::main in all applications using QQuickWebEngineView with delegated rendering.
- QOpenGLContext *shareContext = qt_gl_global_share_context();
- if (!shareContext) {
- qFatal("QWebEngine: OpenGL resource sharing is not set up in QtQuick. Please make sure to call QtWebEngine::initialize() in your main() function before QCoreApplication is created.");
- }
- m_shareContextQtQuick = new QtShareGLContext(shareContext);
-#endif
-}
-
ContentBrowserClientQt::ContentBrowserClientQt()
{
}
@@ -366,16 +264,16 @@ void ContentBrowserClientQt::RenderProcessWillLaunch(content::RenderProcessHost
#endif //ENABLE_EXTENSIONS
bool is_incognito_process = profile->IsOffTheRecord();
- qtwebengine::mojom::RendererConfigurationAssociatedPtr renderer_configuration;
+ mojo::AssociatedRemote<qtwebengine::mojom::RendererConfiguration> renderer_configuration;
host->GetChannel()->GetRemoteAssociatedInterface(&renderer_configuration);
renderer_configuration->SetInitialConfiguration(is_incognito_process);
}
gl::GLShareGroup *ContentBrowserClientQt::GetInProcessGpuShareGroup()
{
- if (!m_shareGroupQtQuick.get())
- m_shareGroupQtQuick = new ShareGroupQtQuick;
- return m_shareGroupQtQuick.get();
+ if (!m_shareGroupQt.get())
+ m_shareGroupQt = new ShareGroupQt;
+ return m_shareGroupQt.get();
}
content::MediaObserver *ContentBrowserClientQt::GetMediaObserver()
@@ -383,12 +281,16 @@ content::MediaObserver *ContentBrowserClientQt::GetMediaObserver()
return MediaCaptureDevicesDispatcher::GetInstance();
}
-void ContentBrowserClientQt::OverrideWebkitPrefs(content::RenderViewHost *rvh, content::WebPreferences *web_prefs)
+void ContentBrowserClientQt::OverrideWebkitPrefs(content::RenderViewHost *rvh, blink::web_pref::WebPreferences *web_prefs)
{
if (content::WebContents *webContents = rvh->GetDelegate()->GetAsWebContents()) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
if (guest_view::GuestViewBase::IsGuest(webContents))
return;
+
+ WebContentsViewQt *view = WebContentsViewQt::from(static_cast<content::WebContentsImpl *>(webContents)->GetView());
+ if (!view->client())
+ return;
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
WebContentsDelegateQt* delegate = static_cast<WebContentsDelegateQt*>(webContents->GetDelegate());
if (delegate)
@@ -401,55 +303,18 @@ scoped_refptr<content::QuotaPermissionContext> ContentBrowserClientQt::CreateQuo
return new QuotaPermissionContextQt;
}
-// Copied from chrome/browser/ssl/ssl_error_handler.cc:
-static int IsCertErrorFatal(int cert_error)
-{
- switch (cert_error) {
- case net::ERR_CERT_COMMON_NAME_INVALID:
- case net::ERR_CERT_DATE_INVALID:
- case net::ERR_CERT_AUTHORITY_INVALID:
- case net::ERR_CERT_NO_REVOCATION_MECHANISM:
- case net::ERR_CERT_UNABLE_TO_CHECK_REVOCATION:
- case net::ERR_CERT_WEAK_SIGNATURE_ALGORITHM:
- case net::ERR_CERT_WEAK_KEY:
- case net::ERR_CERT_NAME_CONSTRAINT_VIOLATION:
- case net::ERR_CERT_VALIDITY_TOO_LONG:
- 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:
- case net::ERR_CERT_INVALID:
- case net::ERR_SSL_PINNED_KEY_NOT_IN_CERT_CHAIN:
- return true;
- default:
- NOTREACHED();
- }
- return true;
-}
-
void ContentBrowserClientQt::AllowCertificateError(content::WebContents *webContents,
int cert_error,
const net::SSLInfo &ssl_info,
const GURL &request_url,
- bool is_main_frame_request,
+ bool /* is_main_frame_request */,
bool strict_enforcement,
base::OnceCallback<void(content::CertificateRequestResultType)> callback)
{
WebContentsDelegateQt* contentsDelegate = static_cast<WebContentsDelegateQt*>(webContents->GetDelegate());
- QSharedPointer<CertificateErrorController> errorController(
- new CertificateErrorController(
- new CertificateErrorControllerPrivate(
- cert_error,
- ssl_info,
- request_url,
- is_main_frame_request,
- IsCertErrorFatal(cert_error),
- strict_enforcement,
- std::move(callback))));
+ QSharedPointer<CertificateErrorController> errorController(new CertificateErrorController(
+ cert_error, ssl_info, request_url, strict_enforcement, std::move(callback)));
contentsDelegate->allowCertificateError(errorController);
}
@@ -498,7 +363,7 @@ void ContentBrowserClientQt::AppendExtraCommandLineSwitches(base::CommandLine* c
url::CustomScheme::SaveSchemes(command_line);
std::string processType = command_line->GetSwitchValueASCII(switches::kProcessType);
- if (processType == service_manager::switches::kZygoteProcess)
+ if (processType == switches::kZygoteProcess)
command_line->AppendSwitchASCII(switches::kLang, GetApplicationLocale());
}
@@ -607,23 +472,6 @@ private:
WEB_CONTENTS_USER_DATA_KEY_IMPL(ServiceDriver)
-void ContentBrowserClientQt::InitFrameInterfaces()
-{
- m_frameInterfaces = std::make_unique<service_manager::BinderRegistry>();
- m_frameInterfacesParameterized = std::make_unique<service_manager::BinderRegistryWithArgs<content::RenderFrameHost*>>();
-}
-
-void ContentBrowserClientQt::BindInterfaceRequestFromFrame(content::RenderFrameHost* render_frame_host,
- const std::string& interface_name,
- mojo::ScopedMessagePipeHandle interface_pipe)
-{
- if (!m_frameInterfaces.get() && !m_frameInterfacesParameterized.get())
- InitFrameInterfaces();
-
- if (!m_frameInterfacesParameterized->TryBindInterface(interface_name, &interface_pipe, render_frame_host))
- m_frameInterfaces->TryBindInterface(interface_name, &interface_pipe);
-}
-
void ContentBrowserClientQt::BindHostReceiverForRenderer(content::RenderProcessHost *render_process_host,
mojo::GenericPendingReceiver receiver)
{
@@ -643,41 +491,19 @@ static void BindNetworkHintsHandler(content::RenderFrameHost *frame_host,
void ContentBrowserClientQt::RegisterBrowserInterfaceBindersForFrame(
content::RenderFrameHost *render_frame_host,
- service_manager::BinderMapWithContext<content::RenderFrameHost *> *map)
+ mojo::BinderMapWithContext<content::RenderFrameHost *> *map)
{
Q_UNUSED(render_frame_host);
map->Add<blink::mojom::InsecureInputService>(base::BindRepeating(&ServiceDriver::BindInsecureInputService));
map->Add<network_hints::mojom::NetworkHintsHandler>(base::BindRepeating(&BindNetworkHintsHandler));
}
-namespace {
-void BindProcessNode(int render_process_host_id,
- mojo::PendingReceiver<performance_manager::mojom::ProcessCoordinationUnit> receiver)
-{
- content::RenderProcessHost *render_process_host = content::RenderProcessHost::FromID(render_process_host_id);
- if (!render_process_host)
- return;
-
- performance_manager::RenderProcessUserData *user_data =
- performance_manager::RenderProcessUserData::GetForRenderProcessHost(render_process_host);
-
- DCHECK(performance_manager::PerformanceManagerImpl::IsAvailable());
- performance_manager::PerformanceManagerImpl::CallOnGraphImpl(
- FROM_HERE, base::BindOnce(&performance_manager::ProcessNodeImpl::Bind,
- base::Unretained(user_data->process_node()),
- std::move(receiver)));
-}
-} // namespace
-
void ContentBrowserClientQt::ExposeInterfacesToRenderer(service_manager::BinderRegistry *registry,
blink::AssociatedInterfaceRegistry *associated_registry,
content::RenderProcessHost *render_process_host)
{
Q_UNUSED(associated_registry);
- registry->AddInterface(base::BindRepeating(&BindProcessNode, render_process_host->GetID()),
- base::SequencedTaskRunnerHandle::Get());
-
- performance_manager::PerformanceManagerRegistry::GetInstance()->CreateProcessNodeForRenderProcessHost(render_process_host);
+ performance_manager::PerformanceManagerRegistry::GetInstance()->CreateProcessNodeAndExposeInterfacesToRendererProcess(registry, render_process_host);
}
void ContentBrowserClientQt::RunServiceInstance(const service_manager::Identity &identity,
@@ -788,36 +614,41 @@ bool ContentBrowserClientQt::WillCreateRestrictedCookieManager(network::mojom::R
bool ContentBrowserClientQt::AllowAppCache(const GURL &manifest_url,
const GURL &first_party,
+ const base::Optional<url::Origin> &top_frame_origin,
content::BrowserContext *context)
{
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
return static_cast<ProfileQt *>(context)->profileAdapter()->cookieStore()->d_func()->canAccessCookies(toQt(first_party), toQt(manifest_url));
}
-bool ContentBrowserClientQt::AllowServiceWorkerOnIO(const GURL &scope,
+content::AllowServiceWorkerResult
+ContentBrowserClientQt::AllowServiceWorkerOnIO(const GURL &scope,
const GURL &site_for_cookies,
const base::Optional<url::Origin> & /*top_frame_origin*/,
const GURL & /*script_url*/,
- content::ResourceContext *context,
- base::RepeatingCallback<content::WebContents*()> wc_getter)
+ content::ResourceContext *context)
{
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
// FIXME: Chrome also checks if javascript is enabled here to check if has been disabled since the service worker
// was started.
- return ProfileIODataQt::FromResourceContext(context)->canGetCookies(toQt(site_for_cookies), toQt(scope));
+ return ProfileIODataQt::FromResourceContext(context)->canGetCookies(toQt(site_for_cookies), toQt(scope))
+ ? content::AllowServiceWorkerResult::Yes()
+ : content::AllowServiceWorkerResult::No();
}
-bool ContentBrowserClientQt::AllowServiceWorkerOnUI(const GURL &scope,
+content::AllowServiceWorkerResult
+ContentBrowserClientQt::AllowServiceWorkerOnUI(const GURL &scope,
const GURL &site_for_cookies,
const base::Optional<url::Origin> & /*top_frame_origin*/,
const GURL & /*script_url*/,
- content::BrowserContext *context,
- base::RepeatingCallback<content::WebContents*()> wc_getter)
+ content::BrowserContext *context)
{
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
// 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), toQt(scope))
+ ? content::AllowServiceWorkerResult::Yes()
+ : content::AllowServiceWorkerResult::No();
}
// We control worker access to FS and indexed-db using cookie permissions, this is mirroring Chromium's logic.
@@ -907,7 +738,8 @@ public:
const network::mojom::URLResponseHead &response_head,
bool *defer,
std::vector<std::string> *to_be_removed_headers,
- net::HttpRequestHeaders *modified_headers) override
+ net::HttpRequestHeaders *modified_headers,
+ net::HttpRequestHeaders *modified_cors_exempt_headers) override
{
TranslateUrl(&redirect_info->new_url);
}
@@ -977,6 +809,11 @@ static bool navigationThrottleCallback(content::WebContents *source,
ProfileQt *profile = static_cast<ProfileQt *>(source->GetBrowserContext());
if (params.is_external_protocol() && !profile->profileAdapter()->urlSchemeHandler(toQByteArray(params.url().scheme())))
return false;
+
+ WebContentsViewQt *view = WebContentsViewQt::from(static_cast<content::WebContentsImpl *>(source)->GetView());
+ if (!view->client())
+ return false;
+
int navigationRequestAction = WebContentsAdapterClient::AcceptRequest;
WebContentsDelegateQt *delegate = static_cast<WebContentsDelegateQt *>(source->GetDelegate());
WebContentsAdapterClient *client = delegate->adapterClient();
@@ -1109,34 +946,34 @@ void ContentBrowserClientQt::OnNetworkServiceCreated(network::mojom::NetworkServ
SystemNetworkContextManager::GetInstance()->OnNetworkServiceCreated(network_service);
}
-mojo::Remote<network::mojom::NetworkContext> ContentBrowserClientQt::CreateNetworkContext(
+void ContentBrowserClientQt::ConfigureNetworkContextParams(
content::BrowserContext *context,
bool in_memory,
- const base::FilePath &relative_partition_path)
+ const base::FilePath &relative_partition_path,
+ network::mojom::NetworkContextParams *network_context_params,
+ network::mojom::CertVerifierCreationParams *cert_verifier_creation_params)
{
- mojo::Remote<network::mojom::NetworkContext> network_context;
- // ### do we need to pass in_memory and relative_partition_path to ProfileIODataQt::CreateNetworkContextParams() ?
- network::mojom::NetworkContextParamsPtr context_params = ProfileIODataQt::FromBrowserContext(context)->CreateNetworkContextParams();
- content::GetNetworkService()->CreateNetworkContext(
- network_context.BindNewPipeAndPassReceiver(), std::move(context_params));
-
- network::mojom::CookieManagerPtrInfo cookie_manager_info;
- network_context->GetCookieManager(mojo::MakeRequest(&cookie_manager_info));
- ProfileIODataQt::FromBrowserContext(context)->cookieDelegate()->setMojoCookieManager(std::move(cookie_manager_info));
+ ProfileIODataQt::FromBrowserContext(context)->ConfigureNetworkContextParams(in_memory, relative_partition_path,
+ network_context_params, cert_verifier_creation_params);
- return network_context;
+ mojo::PendingRemote<network::mojom::CookieManager> cookie_manager_remote;
+ network_context_params->cookie_manager = cookie_manager_remote.InitWithNewPipeAndPassReceiver();
+ ProfileIODataQt::FromBrowserContext(context)->cookieDelegate()->setMojoCookieManager(std::move(cookie_manager_remote));
}
std::vector<base::FilePath> ContentBrowserClientQt::GetNetworkContextsParentDirectory()
{
return {
- toFilePath(QStandardPaths::writableLocation(QStandardPaths::DataLocation)),
+ toFilePath(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)),
toFilePath(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)) };
}
void ContentBrowserClientQt::RegisterNonNetworkNavigationURLLoaderFactories(int frame_tree_node_id,
+ base::UkmSourceId ukm_source_id,
+ NonNetworkURLLoaderFactoryDeprecatedMap *uniquely_owned_factories,
NonNetworkURLLoaderFactoryMap *factories)
{
+ Q_UNUSED(uniquely_owned_factories);
content::WebContents *web_contents = content::WebContents::FromFrameTreeNodeId(frame_tree_node_id);
Profile *profile = Profile::FromBrowserContext(web_contents->GetBrowserContext());
ProfileAdapter *profileAdapter = static_cast<ProfileQt *>(profile)->profileAdapter();
@@ -1147,7 +984,7 @@ void ContentBrowserClientQt::RegisterNonNetworkNavigationURLLoaderFactories(int
#if BUILDFLAG(ENABLE_EXTENSIONS)
factories->emplace(
extensions::kExtensionScheme,
- extensions::CreateExtensionNavigationURLLoaderFactory(profile,
+ extensions::CreateExtensionNavigationURLLoaderFactory(profile, ukm_source_id,
!!extensions::WebViewGuest::FromWebContents(web_contents)));
#endif
}
@@ -1163,8 +1000,10 @@ void ContentBrowserClientQt::RegisterNonNetworkWorkerMainResourceURLLoaderFactor
}
void ContentBrowserClientQt::RegisterNonNetworkSubresourceURLLoaderFactories(int render_process_id, int render_frame_id,
+ NonNetworkURLLoaderFactoryDeprecatedMap *uniquely_owned_factories,
NonNetworkURLLoaderFactoryMap *factories)
{
+ Q_UNUSED(uniquely_owned_factories);
content::RenderProcessHost *process_host = content::RenderProcessHost::FromID(render_process_id);
Profile *profile = Profile::FromBrowserContext(process_host->GetBrowserContext());
ProfileAdapter *profileAdapter = static_cast<ProfileQt *>(profile)->profileAdapter();
@@ -1187,7 +1026,7 @@ void ContentBrowserClientQt::RegisterNonNetworkSubresourceURLLoaderFactories(int
#endif
if (!install_file_scheme && web_contents) {
const auto *settings = static_cast<WebContentsDelegateQt *>(web_contents->GetDelegate())->webEngineSettings();
- if (settings->testAttribute(WebEngineSettings::LocalContentCanAccessFileUrls)) {
+ if (settings->testAttribute(QWebEngineSettings::LocalContentCanAccessFileUrls)) {
for (const auto &local_scheme : url::GetLocalSchemes()) {
if (url.SchemeIs(local_scheme)) {
install_file_scheme = true;
@@ -1230,9 +1069,9 @@ void ContentBrowserClientQt::RegisterNonNetworkSubresourceURLLoaderFactories(int
}
if (!allowed_webui_hosts.empty()) {
factories->emplace(content::kChromeUIScheme,
- content::CreateWebUIURLLoader(frame_host,
- content::kChromeUIScheme,
- std::move(allowed_webui_hosts)));
+ content::CreateWebUIURLLoaderFactory(frame_host,
+ content::kChromeUIScheme,
+ std::move(allowed_webui_hosts)));
}
#endif
}
@@ -1244,6 +1083,7 @@ bool ContentBrowserClientQt::WillCreateURLLoaderFactory(
URLLoaderFactoryType type,
const url::Origin &request_initiator,
base::Optional<int64_t> navigation_id,
+ base::UkmSourceId ukm_source_id,
mojo::PendingReceiver<network::mojom::URLLoaderFactory> *factory_receiver,
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient> *header_client,
bool *bypass_redirect_checks,
@@ -1259,6 +1099,9 @@ bool ContentBrowserClientQt::WillCreateURLLoaderFactory(
if (web_contents) {
WebContentsAdapterClient *client =
WebContentsViewQt::from(static_cast<content::WebContentsImpl *>(web_contents)->GetView())->client();
+ if (!client)
+ return false;
+
page_interceptor = client->webContentsAdapter()->requestInterceptor();
}
@@ -1275,4 +1118,36 @@ bool ContentBrowserClientQt::WillCreateURLLoaderFactory(
return false;
}
+void ContentBrowserClientQt::SiteInstanceGotProcess(content::SiteInstance *site_instance)
+{
+#if BUILDFLAG(ENABLE_EXTENSIONS)
+ content::BrowserContext *context = site_instance->GetBrowserContext();
+ extensions::ExtensionRegistry *registry = extensions::ExtensionRegistry::Get(context);
+ const extensions::Extension *extension = registry->enabled_extensions().GetExtensionOrAppByURL(site_instance->GetSiteURL());
+ if (!extension)
+ return;
+
+ extensions::ProcessMap *processMap = extensions::ProcessMap::Get(context);
+ processMap->Insert(extension->id(), site_instance->GetProcess()->GetID(), site_instance->GetId());
+#endif
+}
+
+void ContentBrowserClientQt::SiteInstanceDeleting(content::SiteInstance *site_instance)
+{
+#if BUILDFLAG(ENABLE_EXTENSIONS)
+ // Don't do anything if we're shutting down.
+ if (content::BrowserMainRunner::ExitedMainMessageLoop() || !site_instance->HasProcess())
+ return;
+
+ content::BrowserContext *context = site_instance->GetBrowserContext();
+ extensions::ExtensionRegistry *registry = extensions::ExtensionRegistry::Get(context);
+ const extensions::Extension *extension = registry->enabled_extensions().GetExtensionOrAppByURL(site_instance->GetSiteURL());
+ if (!extension)
+ return;
+
+ extensions::ProcessMap *processMap = extensions::ProcessMap::Get(context);
+ processMap->Remove(extension->id(), site_instance->GetProcess()->GetID(), site_instance->GetId());
+#endif
+}
+
} // namespace QtWebEngineCore
diff --git a/src/core/content_browser_client_qt.h b/src/core/content_browser_client_qt.h
index fe6d8a076..05a814ead 100644
--- a/src/core/content_browser_client_qt.h
+++ b/src/core/content_browser_client_qt.h
@@ -76,7 +76,7 @@ namespace QtWebEngineCore {
class BrowserMainPartsQt;
class ProfileQt;
-class ShareGroupQtQuick;
+class ShareGroupQt;
class ContentBrowserClientQt : public content::ContentBrowserClient
{
@@ -88,7 +88,8 @@ public:
gl::GLShareGroup* GetInProcessGpuShareGroup() override;
content::MediaObserver* GetMediaObserver() override;
scoped_refptr<content::QuotaPermissionContext> CreateQuotaPermissionContext() override;
- void OverrideWebkitPrefs(content::RenderViewHost *, content::WebPreferences *) override;
+ void OverrideWebkitPrefs(content::RenderViewHost *render_view_host,
+ blink::web_pref::WebPreferences *prefs) override;
void AllowCertificateError(content::WebContents *web_contents,
int cert_error,
const net::SSLInfo &ssl_info,
@@ -112,13 +113,10 @@ public:
void GetAdditionalWebUISchemes(std::vector<std::string>* additional_schemes) override;
void GetAdditionalAllowedSchemesForFileSystem(std::vector<std::string>* additional_schemes) override;
- void BindInterfaceRequestFromFrame(content::RenderFrameHost* render_frame_host,
- const std::string& interface_name,
- mojo::ScopedMessagePipeHandle interface_pipe) override;
void BindHostReceiverForRenderer(content::RenderProcessHost *render_process_host,
mojo::GenericPendingReceiver receiver) override;
void RegisterBrowserInterfaceBindersForFrame(content::RenderFrameHost *render_frame_host,
- service_manager::BinderMapWithContext<content::RenderFrameHost *> *map) override;
+ mojo::BinderMapWithContext<content::RenderFrameHost *> *map) override;
void RunServiceInstance(const service_manager::Identity &identity,
mojo::PendingReceiver<service_manager::mojom::Service> *receiver) override;
void ExposeInterfacesToRenderer(service_manager::BinderRegistry *registry,
@@ -155,21 +153,20 @@ public:
bool AllowAppCache(const GURL &manifest_url,
const GURL &first_party,
+ const base::Optional<url::Origin> &top_frame_origin,
content::BrowserContext *context) override;
-
- bool AllowServiceWorkerOnIO(const GURL &scope,
- const GURL &site_for_cookies,
- const base::Optional<url::Origin> &top_frame_origin,
- const GURL &script_url,
- content::ResourceContext *context,
- base::RepeatingCallback<content::WebContents*()> wc_getter) override;
-
- bool AllowServiceWorkerOnUI(const GURL &scope,
- const GURL &site_for_cookies,
- const base::Optional<url::Origin> &top_frame_origin,
- const GURL &script_url,
- content::BrowserContext *context,
- base::RepeatingCallback<content::WebContents*()> wc_getter) override;
+ content::AllowServiceWorkerResult AllowServiceWorkerOnIO(
+ const GURL &scope,
+ const GURL &site_for_cookies,
+ const base::Optional<url::Origin> &top_frame_origin,
+ const GURL &script_url,
+ content::ResourceContext *context) override;
+ content::AllowServiceWorkerResult AllowServiceWorkerOnUI(
+ const GURL &scope,
+ const GURL &site_for_cookies,
+ const base::Optional<url::Origin> &top_frame_origin,
+ const GURL &script_url,
+ content::BrowserContext *context) override;
void AllowWorkerFileSystem(const GURL &url,
content::BrowserContext *context,
@@ -239,6 +236,7 @@ public:
URLLoaderFactoryType type,
const url::Origin &request_initiator,
base::Optional<int64_t> navigation_id,
+ base::UkmSourceId ukm_source_id,
mojo::PendingReceiver<network::mojom::URLLoaderFactory> *factory_receiver,
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient> *header_client,
bool *bypass_redirect_checks,
@@ -247,15 +245,23 @@ public:
scoped_refptr<network::SharedURLLoaderFactory> GetSystemSharedURLLoaderFactory() override;
network::mojom::NetworkContext *GetSystemNetworkContext() override;
void OnNetworkServiceCreated(network::mojom::NetworkService *network_service) override;
- mojo::Remote<network::mojom::NetworkContext> CreateNetworkContext(content::BrowserContext *context,
- bool in_memory,
- const base::FilePath &relative_partition_path) override;
+ void ConfigureNetworkContextParams(content::BrowserContext *context,
+ bool in_memory,
+ const base::FilePath &relative_partition_path,
+ network::mojom::NetworkContextParams *network_context_params,
+ network::mojom::CertVerifierCreationParams *cert_verifier_creation_params) override;
+
std::vector<base::FilePath> GetNetworkContextsParentDirectory() override;
- void RegisterNonNetworkNavigationURLLoaderFactories(int frame_tree_node_id, NonNetworkURLLoaderFactoryMap *factories) override;
+ void RegisterNonNetworkNavigationURLLoaderFactories(int frame_tree_node_id, base::UkmSourceId ukm_source_id,
+ NonNetworkURLLoaderFactoryDeprecatedMap *uniquely_owned_factories,
+ NonNetworkURLLoaderFactoryMap *factories) override;
void RegisterNonNetworkSubresourceURLLoaderFactories(int render_process_id, int render_frame_id,
- NonNetworkURLLoaderFactoryMap* factories) override;
+ NonNetworkURLLoaderFactoryDeprecatedMap *uniquely_owned_factories,
+ NonNetworkURLLoaderFactoryMap *factories) override;
void RegisterNonNetworkWorkerMainResourceURLLoaderFactories(content::BrowserContext* browser_context,
NonNetworkURLLoaderFactoryMap* factories) override;
+ void SiteInstanceGotProcess(content::SiteInstance *site_instance) override;
+ void SiteInstanceDeleting(content::SiteInstance *site_instance) override;
static std::string getUserAgent();
@@ -263,11 +269,7 @@ public:
std::string GetProduct() override;
private:
- void InitFrameInterfaces();
-
- scoped_refptr<ShareGroupQtQuick> m_shareGroupQtQuick;
- std::unique_ptr<service_manager::BinderRegistry> m_frameInterfaces;
- std::unique_ptr<service_manager::BinderRegistryWithArgs<content::RenderFrameHost*>> m_frameInterfacesParameterized;
+ scoped_refptr<ShareGroupQt> m_shareGroupQt;
};
} // namespace QtWebEngineCore
diff --git a/src/core/content_client_qt.cpp b/src/core/content_client_qt.cpp
index 647d45819..d74e7eb76 100644
--- a/src/core/content_client_qt.cpp
+++ b/src/core/content_client_qt.cpp
@@ -54,7 +54,7 @@
#include "ui/base/layout.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
-#include "services/service_manager/embedder/switches.h"
+#include "services/service_manager/switches.h"
#include "type_conversion.h"
#include <QCoreApplication>
@@ -71,7 +71,7 @@
// File name of the CDM on different platforms.
const char kWidevineCdmFileName[] =
-#if defined(OS_MACOSX)
+#if defined(OS_MAC)
"widevinecdm.plugin";
#elif defined(OS_WIN)
"widevinecdm.dll";
@@ -422,8 +422,7 @@ void ContentClientQt::AddContentDecryptionModules(std::vector<content::CdmInfo>
content::CdmCapability capability(
{}, {media::EncryptionScheme::kCenc, media::EncryptionScheme::kCbcs},
{media::CdmSessionType::kTemporary,
- media::CdmSessionType::kPersistentLicense},
- {});
+ media::CdmSessionType::kPersistentLicense});
// Register kExternalClearKeyDifferentGuidTestKeySystem first separately.
// Otherwise, it'll be treated as a sub-key-system of normal
diff --git a/src/core/content_main_delegate_qt.cpp b/src/core/content_main_delegate_qt.cpp
index 2d7d1eb57..59d7050a4 100644
--- a/src/core/content_main_delegate_qt.cpp
+++ b/src/core/content_main_delegate_qt.cpp
@@ -42,6 +42,7 @@
#include "base/command_line.h"
#include "base/i18n/rtl.h"
#include "base/logging.h"
+#include "base/no_destructor.h"
#include "base/path_service.h"
#include "base/strings/string_number_conversions.h"
#include "chrome/grit/generated_resources.h"
@@ -55,8 +56,8 @@
#include "ui/base/webui/jstemplate_builder.h"
#include "net/grit/net_resources.h"
#include "net/base/net_module.h"
-#include "services/service_manager/embedder/switches.h"
-#include "services/service_manager/sandbox/switches.h"
+#include "sandbox/policy/switches.h"
+#include "services/service_manager/switches.h"
#include "url/url_util_qt.h"
#include "content_client_qt.h"
@@ -82,7 +83,7 @@
#include "media/gpu/windows/media_foundation_video_encode_accelerator_win.h"
#endif
-#if defined(OS_MACOSX)
+#if defined(OS_MAC)
#include "content/public/common/content_features.h"
#include "media/gpu/mac/vt_video_decode_accelerator_mac.h"
#endif
@@ -216,7 +217,7 @@ void ContentMainDelegateQt::PreSandboxStartup()
media::MediaFoundationVideoEncodeAccelerator::PreSandboxInitialization();
#endif
-#if defined(OS_MACOSX)
+#if defined(OS_MAC)
if (base::FeatureList::IsEnabled(features::kMacV2GPUSandbox)) {
TRACE_EVENT0("gpu", "Initialize VideoToolbox");
media::InitializeVideoToolbox();
@@ -224,7 +225,8 @@ void ContentMainDelegateQt::PreSandboxStartup()
#endif
if (parsedCommandLine->HasSwitch(service_manager::switches::kApplicationName)) {
- const std::string appName = parsedCommandLine->GetSwitchValueASCII(service_manager::switches::kApplicationName);
+ std::string appName = parsedCommandLine->GetSwitchValueASCII(service_manager::switches::kApplicationName);
+ appName = QByteArray::fromPercentEncoding(QByteArray::fromStdString(appName)).toStdString();
QCoreApplication::setApplicationName(QString::fromStdString(appName));
#if defined(OS_LINUX)
media::AudioManager::SetGlobalAppName(appName);
@@ -259,7 +261,7 @@ content::ContentRendererClient *ContentMainDelegateQt::CreateContentRendererClie
#if defined(OS_LINUX)
base::CommandLine *parsedCommandLine = base::CommandLine::ForCurrentProcess();
std::string process_type = parsedCommandLine->GetSwitchValueASCII(switches::kProcessType);
- bool no_sandbox = parsedCommandLine->HasSwitch(service_manager::switches::kNoSandbox);
+ bool no_sandbox = parsedCommandLine->HasSwitch(sandbox::policy::switches::kNoSandbox);
// Reload locale if the renderer process is sandboxed
if (process_type == switches::kRendererProcess && !no_sandbox) {
diff --git a/src/core/core_chromium.pri b/src/core/core_chromium.pri
index 836d30c0e..c22d5901f 100644
--- a/src/core/core_chromium.pri
+++ b/src/core/core_chromium.pri
@@ -52,9 +52,8 @@ SOURCES = \
color_chooser_controller.cpp \
common/qt_ipc_logging.cpp \
common/qt_messages.cpp \
- common/user_script_data.cpp \
+ compositor/compositor.cpp \
compositor/content_gpu_client_qt.cpp \
- compositor/display_frame_sink.cpp \
compositor/display_overrides.cpp \
compositor/display_software_output_surface.cpp \
content_client_qt.cpp \
@@ -89,6 +88,7 @@ SOURCES = \
net/url_request_custom_job_proxy.cpp \
net/webui_controller_factory_qt.cpp \
ozone/gl_context_qt.cpp \
+ ozone/gl_share_context_qt.cpp \
ozone/gl_ozone_egl_qt.cpp \
ozone/gl_surface_qt.cpp \
ozone/gl_surface_egl_qt.cpp \
@@ -108,14 +108,15 @@ SOURCES = \
register_protocol_handler_request_controller_impl.cpp \
render_view_context_menu_qt.cpp \
render_widget_host_view_qt.cpp \
+ render_widget_host_view_qt_delegate_client.cpp \
renderer/content_renderer_client_qt.cpp \
renderer/content_settings_observer_qt.cpp \
renderer/render_frame_observer_qt.cpp \
- renderer/render_view_observer_qt.cpp \
- renderer/render_thread_observer_qt.cpp \
+ renderer/web_engine_page_render_frame.cpp \
+ renderer/render_configuration.cpp \
renderer/user_resource_controller.cpp \
renderer/plugins/plugin_placeholder_qt.cpp \
- renderer_host/render_view_observer_host_qt.cpp \
+ renderer_host/web_engine_page_host.cpp \
renderer_host/user_resource_controller_host.cpp \
resource_bundle_qt.cpp \
resource_context_qt.cpp \
@@ -146,7 +147,6 @@ HEADERS = \
browsing_data_remover_delegate_qt.h \
browser_main_parts_qt.h \
browser_message_filter_qt.h \
- certificate_error_controller_p.h \
certificate_error_controller.h \
client_cert_select_controller.h \
clipboard_change_observer.h \
@@ -155,9 +155,8 @@ HEADERS = \
color_chooser_controller_p.h \
color_chooser_controller.h \
common/qt_messages.h \
- common/user_script_data.h \
+ compositor/compositor.h \
compositor/content_gpu_client_qt.h \
- compositor/display_frame_sink.h \
compositor/display_software_output_surface.h \
content_client_qt.h \
content_browser_client_qt.h \
@@ -190,6 +189,7 @@ HEADERS = \
net/url_request_custom_job_proxy.h \
net/webui_controller_factory_qt.h \
ozone/gl_context_qt.h \
+ ozone/gl_share_context_qt.h \
ozone/gl_ozone_egl_qt.h \
ozone/gl_surface_qt.h \
ozone/gl_surface_egl_qt.h \
@@ -214,14 +214,15 @@ HEADERS = \
render_view_context_menu_qt.h \
render_widget_host_view_qt.h \
render_widget_host_view_qt_delegate.h \
+ render_widget_host_view_qt_delegate_client.h \
renderer/content_renderer_client_qt.h \
renderer/content_settings_observer_qt.h \
renderer/render_frame_observer_qt.h \
- renderer/render_view_observer_qt.h \
- renderer/render_thread_observer_qt.h \
+ renderer/web_engine_page_render_frame.h \
+ renderer/render_configuration.h \
renderer/user_resource_controller.h \
renderer/plugins/plugin_placeholder_qt.h \
- renderer_host/render_view_observer_host_qt.h \
+ renderer_host/web_engine_page_host.h \
renderer_host/user_resource_controller_host.h \
request_controller.h \
resource_context_qt.h \
@@ -275,12 +276,14 @@ qtConfig(webengine-printing-and-pdf) {
printing/printing_message_filter_qt.cpp \
printing/print_view_manager_base_qt.cpp \
printing/print_view_manager_qt.cpp \
+ printing/printer_worker.cpp \
renderer/print_web_view_helper_delegate_qt.cpp
HEADERS += \
printing/printing_message_filter_qt.h \
printing/print_view_manager_base_qt.h \
printing/print_view_manager_qt.h \
+ printing/printer_worker.h \
renderer/print_web_view_helper_delegate_qt.h
# pdf sources
@@ -291,11 +294,11 @@ qtConfig(webengine-printing-and-pdf) {
contains(QT_CONFIG, opengl) {
SOURCES += \
compositor/compositor_resource_fence.cpp \
- compositor/display_gl_output_surface.cpp \
- compositor/display_gl_output_surface_qsg.cpp
+ compositor/display_gl_output_surface.cpp
HEADERS += \
compositor/compositor_resource_fence.h \
compositor/display_gl_output_surface.h
+
macos {
HEADERS+=macos_context_type_helper.h
SOURCES+=macos_context_type_helper.mm
@@ -320,11 +323,13 @@ qtConfig(webengine-extensions) {
common/extensions/extensions_api_provider_qt.cpp \
common/extensions/extensions_client_qt.cpp \
extensions/component_extension_resource_manager_qt.cpp \
+ extensions/extension_host_delegate_qt.cpp \
extensions/extension_system_qt.cpp \
extensions/extension_system_factory_qt.cpp \
extensions/extension_web_contents_observer_qt.cpp \
extensions/extensions_api_client_qt.cpp \
extensions/extensions_browser_client_qt.cpp \
+ extensions/messaging_delegate_qt.cpp \
extensions/mime_handler_view_guest_delegate_qt.cpp \
net/plugin_response_interceptor_url_loader_throttle.cpp \
renderer/extensions/extensions_dispatcher_delegate_qt.cpp \
@@ -336,11 +341,13 @@ qtConfig(webengine-extensions) {
common/extensions/extensions_api_provider_qt.h \
common/extensions/extensions_client_qt.h \
extensions/component_extension_resource_manager_qt.h \
+ extensions/extension_host_delegate_qt.h \
extensions/extension_system_qt.h \
extensions/extension_system_factory_qt.h \
extensions/extension_web_contents_observer_qt.h \
extensions/extensions_api_client_qt.h \
extensions/extensions_browser_client_qt.h \
+ extensions/messaging_delegate_qt.h \
extensions/mime_handler_view_guest_delegate_qt.h \
net/plugin_response_interceptor_url_loader_throttle.h \
renderer/extensions/extensions_dispatcher_delegate_qt.h \
diff --git a/src/core/core_common.pri b/src/core/core_common.pri
index e10d14267..ee15a06e8 100644
--- a/src/core/core_common.pri
+++ b/src/core/core_common.pri
@@ -7,6 +7,7 @@ QT_FOR_CONFIG += buildtools-private webenginecore webenginecore-private
TARGET = QtWebEngineCore
QT += qml-private quick-private gui-private core-private
+qtConfig(webengine-printing-and-pdf): QT += printsupport
QT_PRIVATE += webenginecoreheaders-private
qtConfig(webengine-geolocation): QT += positioning
diff --git a/src/core/core_module.pro b/src/core/core_module.pro
index 3b439e818..733e40534 100644
--- a/src/core/core_module.pro
+++ b/src/core/core_module.pro
@@ -41,7 +41,11 @@ QMAKE_INFO_PLIST = Info_mac.plist
# and doesn't let Chromium get access to libc symbols through dlsym.
CONFIG -= bsymbolic_functions
-linux:qtConfig(separate_debug_info): QMAKE_POST_LINK="cd $(DESTDIR) && $(STRIP) --strip-unneeded $(TARGET)"
+linux {
+ QMAKE_LINK="ulimit -n 4096 && $$QMAKE_LINK"
+ QMAKE_LINK_SHLIB="ulimit -n 4096 && $$QMAKE_LINK_SHLIB"
+ qtConfig(separate_debug_info): QMAKE_POST_LINK="cd $(DESTDIR) && $(STRIP) --strip-unneeded $(TARGET)"
+}
REPACK_DIR = $$OUT_PWD/$$getConfigDir()
diff --git a/src/core/desktop_screen_qt.cpp b/src/core/desktop_screen_qt.cpp
index 15a3856fc..1f715444b 100644
--- a/src/core/desktop_screen_qt.cpp
+++ b/src/core/desktop_screen_qt.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** 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.
@@ -40,74 +40,20 @@
#include "desktop_screen_qt.h"
#include "ui/display/display.h"
-#include "ui/gfx/geometry/point.h"
-
-#include <QtGlobal>
namespace QtWebEngineCore {
-gfx::Point DesktopScreenQt::GetCursorScreenPoint()
-{
- Q_UNREACHABLE();
- return gfx::Point();
-}
-
-bool DesktopScreenQt::IsWindowUnderCursor(gfx::NativeWindow)
-{
- Q_UNREACHABLE();
- return false;
-}
-
-gfx::NativeWindow DesktopScreenQt::GetWindowAtScreenPoint(const gfx::Point& point)
+DesktopScreenQt::DesktopScreenQt()
{
- Q_UNREACHABLE();
- return gfx::NativeWindow();
+ ProcessDisplayChanged(display::Display::GetDefaultDisplay(), true /* is_primary */);
}
-int DesktopScreenQt::GetNumDisplays() const
-{
- Q_UNREACHABLE();
- return 0;
-}
-
-std::vector<display::Display>& DesktopScreenQt::GetAllDisplays() const
-{
- static std::vector<display::Display> empty;
- return empty;
-}
-
-display::Display DesktopScreenQt::GetDisplayNearestWindow(gfx::NativeWindow window) const
-{
- // RenderViewHostImpl::OnStartDragging uses this to determine
- // the scale factor for the view.
- return display::Display(0);
-}
-
-display::Display DesktopScreenQt::GetDisplayNearestPoint(const gfx::Point& point) const
-{
- Q_UNREACHABLE();
- return display::Display();
-}
-
-display::Display DesktopScreenQt::GetDisplayMatching(const gfx::Rect& match_rect) const
-{
- Q_UNREACHABLE();
- return display::Display();
-}
-
-display::Display DesktopScreenQt::GetPrimaryDisplay() const
-{
- return display::Display(0);
-}
-
-void DesktopScreenQt::AddObserver(display::DisplayObserver* observer)
-{
- Q_UNREACHABLE();
-}
+DesktopScreenQt::~DesktopScreenQt()
+{}
-void DesktopScreenQt::RemoveObserver(display::DisplayObserver* observer)
+display::Display DesktopScreenQt::GetDisplayNearestWindow(gfx::NativeWindow /*window*/) const
{
- Q_UNREACHABLE();
+ return GetPrimaryDisplay();
}
} // namespace QtWebEngineCore
diff --git a/src/core/desktop_screen_qt.h b/src/core/desktop_screen_qt.h
index 0c52c615a..f47cfabbc 100644
--- a/src/core/desktop_screen_qt.h
+++ b/src/core/desktop_screen_qt.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** 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.
@@ -40,24 +40,17 @@
#ifndef DESKTOP_SCREEN_QT_H
#define DESKTOP_SCREEN_QT_H
-#include "ui/display/screen.h"
+#include "ui/display/screen_base.h"
namespace QtWebEngineCore {
-class DesktopScreenQt : public display::Screen {
+class DesktopScreenQt : public display::ScreenBase
+{
public:
- // Overridden from gfx::Screen:
- gfx::Point GetCursorScreenPoint() override;
- bool IsWindowUnderCursor(gfx::NativeWindow) override;
- gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override;
- int GetNumDisplays() const override;
- std::vector<display::Display>& GetAllDisplays() const override;
- display::Display GetDisplayNearestWindow(gfx::NativeWindow window) const override;
- display::Display GetDisplayNearestPoint(const gfx::Point& point) const override;
- display::Display GetDisplayMatching(const gfx::Rect& match_rect) const override;
- display::Display GetPrimaryDisplay() const override;
- void AddObserver(display::DisplayObserver* observer) override;
- void RemoveObserver(display::DisplayObserver* observer) override;
+ DesktopScreenQt();
+ ~DesktopScreenQt() override;
+
+ display::Display GetDisplayNearestWindow(gfx::NativeWindow /*window*/) const override;
};
} // namespace QtWebEngineCore
diff --git a/src/core/devtools_frontend_qt.cpp b/src/core/devtools_frontend_qt.cpp
index da82a46d3..028f5f0d3 100644
--- a/src/core/devtools_frontend_qt.cpp
+++ b/src/core/devtools_frontend_qt.cpp
@@ -442,11 +442,11 @@ void DevToolsFrontendQt::HandleMessageFromDevToolsFrontend(const std::string &me
resource_request->site_for_cookies = net::SiteForCookies::FromUrl(gurl);
resource_request->headers.AddHeadersFromString(headers);
- std::unique_ptr<network::mojom::URLLoaderFactory> file_url_loader_factory;
+ mojo::Remote<network::mojom::URLLoaderFactory> file_url_loader_factory;
scoped_refptr<network::SharedURLLoaderFactory> network_url_loader_factory;
network::mojom::URLLoaderFactory *url_loader_factory;
if (gurl.SchemeIsFile()) {
- file_url_loader_factory = content::CreateFileURLLoaderFactory(base::FilePath(), nullptr);
+ file_url_loader_factory.Bind(content::CreateFileURLLoaderFactory(base::FilePath(), nullptr));
url_loader_factory = file_url_loader_factory.get();
} else if (content::HasWebUIScheme(gurl)) {
base::DictionaryValue response;
diff --git a/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc b/src/core/doc/src/qwebenginesettings_lgpl.qdoc
index b83da9440..a62abfbab 100644
--- a/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc
+++ b/src/core/doc/src/qwebenginesettings_lgpl.qdoc
@@ -22,22 +22,13 @@
// by its LGPL license. Documentation written from scratch for new methods should be
// placed inline in the code as usual.
-#if QT_DEPRECATED_SINCE(5, 5)
-/*!
- \fn static QWebEngineSettings *QWebEngineSettings::globalSettings()
- \obsolete
-
- Use defaultSettings() instead.
-*/
-#endif
-
/*!
\class QWebEngineSettings
\since 5.4
\brief The QWebEngineSettings class provides an object to store the settings used
by QWebEnginePage.
- \inmodule QtWebEngineWidgets
+ \inmodule QtWebEngineCore
QWebEngineSettings allows configuration of browser properties, such as font sizes and
families, the location of a custom style sheet, and generic attributes, such as JavaScript
diff --git a/src/core/download_manager_delegate_qt.cpp b/src/core/download_manager_delegate_qt.cpp
index b3c0c7c07..b3abf6bdd 100644
--- a/src/core/download_manager_delegate_qt.cpp
+++ b/src/core/download_manager_delegate_qt.cpp
@@ -68,7 +68,6 @@ DownloadManagerDelegateQt::DownloadManagerDelegateQt(ProfileAdapter *profileAdap
: m_profileAdapter(profileAdapter)
, m_currentId(0)
, m_weakPtrFactory(this)
- , m_nextDownloadIsUserRequested(false)
{
Q_ASSERT(m_profileAdapter);
}
@@ -95,6 +94,7 @@ void DownloadManagerDelegateQt::cancelDownload(content::DownloadTargetCallback c
download::DownloadDangerType::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT,
download::DownloadItem::UNKNOWN,
base::FilePath(),
+ base::nullopt,
download::DownloadInterruptReason::DOWNLOAD_INTERRUPT_REASON_USER_CANCELED);
}
@@ -135,6 +135,7 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(download::DownloadItem *
download::DownloadDangerType::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
download::DownloadItem::VALIDATED,
item->GetForcedFilePath(),
+ base::nullopt,
download::DownloadInterruptReason::DOWNLOAD_INTERRUPT_REASON_NONE);
return true;
}
@@ -142,17 +143,6 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(download::DownloadItem *
QString suggestedFilename = toQt(item->GetSuggestedFilename());
QString mimeTypeString = toQt(item->GetMimeType());
- int downloadType = 0;
- if (m_nextDownloadIsUserRequested) {
- downloadType = ProfileAdapterClient::UserRequested;
- m_nextDownloadIsUserRequested = false;
- } else {
- bool isAttachment = net::HttpContentDisposition(item->GetContentDisposition(), std::string()).is_attachment();
- if (isAttachment)
- downloadType = ProfileAdapterClient::Attachment;
- else
- downloadType = ProfileAdapterClient::DownloadAttribute;
- }
if (suggestedFilename.isEmpty())
suggestedFilename = toQt(net::HttpContentDisposition(item->GetContentDisposition(), net::kCharsetLatin1).filename());
@@ -195,7 +185,7 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(download::DownloadItem *
false /* accepted */,
false /* paused */,
false /* done */,
- downloadType,
+ false /* isSavePageDownload */,
item->GetLastReason(),
adapterClient,
suggestedFilename,
@@ -226,6 +216,7 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(download::DownloadItem *
download::DownloadDangerType::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT,
download::DownloadItem::VALIDATED,
filePathForCallback.AddExtension(toFilePathString("download")),
+ base::nullopt,
download::DownloadInterruptReason::DOWNLOAD_INTERRUPT_REASON_NONE);
} else
cancelDownload(std::move(*callback));
@@ -297,7 +288,7 @@ void DownloadManagerDelegateQt::ChooseSavePath(content::WebContents *web_content
acceptedByDefault,
false, /* paused */
false, /* done */
- ProfileAdapterClient::SavePage,
+ true, /* isSavePageDownload */
ProfileAdapterClient::NoReason,
adapterClient,
QFileInfo(suggestedFilePath).fileName(),
diff --git a/src/core/download_manager_delegate_qt.h b/src/core/download_manager_delegate_qt.h
index 7f4f33702..eda1e4f21 100644
--- a/src/core/download_manager_delegate_qt.h
+++ b/src/core/download_manager_delegate_qt.h
@@ -89,8 +89,6 @@ public:
void resumeDownload(quint32 downloadId);
void removeDownload(quint32 downloadId);
- void markNextDownloadAsUserRequested() { m_nextDownloadIsUserRequested = true; }
-
// Inherited from content::DownloadItem::Observer
void OnDownloadUpdated(download::DownloadItem *download) override;
void OnDownloadDestroyed(download::DownloadItem *download) override;
@@ -103,7 +101,6 @@ private:
uint32_t m_currentId;
base::WeakPtrFactory<DownloadManagerDelegateQt> m_weakPtrFactory;
- bool m_nextDownloadIsUserRequested;
friend class DownloadManagerDelegateInstance;
friend class ProfileAdapter;
diff --git a/src/core/extensions/component_extension_resource_manager_qt.h b/src/core/extensions/component_extension_resource_manager_qt.h
index b719c8960..992e9f87c 100644
--- a/src/core/extensions/component_extension_resource_manager_qt.h
+++ b/src/core/extensions/component_extension_resource_manager_qt.h
@@ -47,6 +47,7 @@
#include <map>
#include "base/files/file_path.h"
+#include "base/macros.h"
#include "extensions/browser/component_extension_resource_manager.h"
struct GritResourceMap;
diff --git a/src/core/extensions/extension_host_delegate_qt.cpp b/src/core/extensions/extension_host_delegate_qt.cpp
new file mode 100644
index 000000000..1a44dee7a
--- /dev/null
+++ b/src/core/extensions/extension_host_delegate_qt.cpp
@@ -0,0 +1,125 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#include "extension_host_delegate_qt.h"
+#include "extension_web_contents_observer_qt.h"
+#include "media_capture_devices_dispatcher.h"
+#include "extension_system_qt.h"
+
+#include "extensions/browser/extension_host.h"
+
+namespace extensions {
+
+ExtensionHostDelegateQt::ExtensionHostDelegateQt()
+{
+}
+
+void ExtensionHostDelegateQt::OnExtensionHostCreated(content::WebContents *web_contents)
+{
+ extensions::ExtensionWebContentsObserverQt::CreateForWebContents(web_contents);
+}
+
+void ExtensionHostDelegateQt::OnRenderViewCreatedForBackgroundPage(ExtensionHost *host)
+{
+ Q_UNUSED(host);
+}
+
+content::JavaScriptDialogManager *ExtensionHostDelegateQt::GetJavaScriptDialogManager()
+{
+ Q_UNREACHABLE();
+ return nullptr;
+}
+
+void ExtensionHostDelegateQt::CreateTab(std::unique_ptr<content::WebContents> web_contents,
+ const std::string &extension_id,
+ WindowOpenDisposition disposition,
+ const gfx::Rect &initial_rect,
+ bool user_gesture)
+{
+ Q_UNUSED(web_contents);
+ Q_UNUSED(extension_id);
+ Q_UNUSED(disposition);
+ Q_UNUSED(initial_rect);
+ Q_UNUSED(user_gesture);
+
+ Q_UNREACHABLE();
+}
+
+void ExtensionHostDelegateQt::ProcessMediaAccessRequest(content::WebContents *web_contents,
+ const content::MediaStreamRequest &request,
+ content::MediaResponseCallback callback,
+ const Extension *extension)
+{
+ Q_UNUSED(extension);
+
+ QtWebEngineCore::MediaCaptureDevicesDispatcher::GetInstance()->processMediaAccessRequest(web_contents, request, std::move(callback));
+}
+
+bool ExtensionHostDelegateQt::CheckMediaAccessPermission(content::RenderFrameHost *render_frame_host,
+ const GURL &security_origin,
+ blink::mojom::MediaStreamType type,
+ const Extension *extension)
+{
+ Q_UNUSED(render_frame_host);
+ Q_UNUSED(security_origin);
+ Q_UNUSED(type);
+ Q_UNUSED(extension);
+
+ Q_UNREACHABLE();
+ return false;
+}
+
+content::PictureInPictureResult ExtensionHostDelegateQt::EnterPictureInPicture(content::WebContents *web_contents,
+ const viz::SurfaceId &surface_id,
+ const gfx::Size &natural_size)
+{
+ Q_UNUSED(web_contents);
+ Q_UNUSED(surface_id);
+ Q_UNUSED(natural_size);
+
+ Q_UNREACHABLE();
+ return content::PictureInPictureResult::kNotSupported;
+}
+
+void ExtensionHostDelegateQt::ExitPictureInPicture()
+{
+ Q_UNREACHABLE();
+}
+
+} // namespace extensions
diff --git a/src/core/compositor/display_producer.h b/src/core/extensions/extension_host_delegate_qt.h
index 5de09d2d2..42ff56a53 100644
--- a/src/core/compositor/display_producer.h
+++ b/src/core/extensions/extension_host_delegate_qt.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2019 The Qt Company Ltd.
+** 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.
@@ -37,33 +37,41 @@
**
****************************************************************************/
-#ifndef DISPLAY_PRODUCER_H
-#define DISPLAY_PRODUCER_H
+#ifndef EXTENSION_HOST_DELEGATE_QT_H
+#define EXTENSION_HOST_DELEGATE_QT_H
-#include "qtwebenginecoreglobal_p.h"
+#include "extensions/browser/extension_host_delegate.h"
-QT_BEGIN_NAMESPACE
-class QSGNode;
-QT_END_NAMESPACE
+namespace extensions {
-namespace QtWebEngineCore {
-class RenderWidgetHostViewQtDelegate;
-
-// Produces composited frames for display.
-class DisplayProducer
+class ExtensionHostDelegateQt : public ExtensionHostDelegate
{
public:
- // Generate scene graph nodes for the current frame.
- //
- // If this is a scheduled update (that is, scheduleUpdate was called
- // earlier), then updatePaintNode will generate nodes for a new frame.
- // Otherwise, it will just regenerate nodes for the old frame.
- virtual QSGNode *updatePaintNode(QSGNode *oldNode, RenderWidgetHostViewQtDelegate *delegate) = 0;
+ ExtensionHostDelegateQt();
-protected:
- ~DisplayProducer() {}
+ // EtensionHostDelegate implementation.
+ void OnExtensionHostCreated(content::WebContents *web_contents) override;
+ void OnRenderViewCreatedForBackgroundPage(ExtensionHost *host) override;
+ content::JavaScriptDialogManager *GetJavaScriptDialogManager() override;
+ void CreateTab(std::unique_ptr<content::WebContents> web_contents,
+ const std::string &extension_id,
+ WindowOpenDisposition disposition,
+ const gfx::Rect &initial_rect,
+ bool user_gesture) override;
+ void ProcessMediaAccessRequest(content::WebContents *web_contents,
+ const content::MediaStreamRequest &request,
+ content::MediaResponseCallback callback,
+ const Extension *extension) override;
+ bool CheckMediaAccessPermission(content::RenderFrameHost *render_frame_host,
+ 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;
+ void ExitPictureInPicture() override;
};
-} // namespace QtWebEngineCore
+} // namespace extensions
-#endif // !DISPLAY_PRODUCER_H
+#endif // EXTENSION_HOST_DELEGATE_QT_H
diff --git a/src/core/extensions/extension_system_qt.cpp b/src/core/extensions/extension_system_qt.cpp
index 96532d9f6..9c080e9aa 100644
--- a/src/core/extensions/extension_system_qt.cpp
+++ b/src/core/extensions/extension_system_qt.cpp
@@ -61,6 +61,7 @@
#include "base/time/time.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
+#include "chrome/common/buildflags.h"
#include "components/crx_file/id_util.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_task_traits.h"
@@ -83,11 +84,10 @@
#include "extensions/browser/quota_service.h"
#include "extensions/browser/renderer_startup_helper.h"
#include "extensions/browser/runtime_data.h"
-#include "extensions/browser/shared_user_script_master.h"
+#include "extensions/browser/shared_user_script_manager.h"
#include "extensions/browser/service_worker_manager.h"
#include "extensions/browser/value_store/value_store_factory_impl.h"
#include "extensions/common/constants.h"
-#include "extensions/common/extension_messages.h"
#include "extensions/common/manifest_constants.h"
#include "extensions/common/manifest_handlers/mime_types_handler.h"
#include "extensions/common/manifest_url_handlers.h"
@@ -278,9 +278,9 @@ ManagementPolicy *ExtensionSystemQt::management_policy()
return nullptr;
}
-SharedUserScriptMaster *ExtensionSystemQt::shared_user_script_master()
+SharedUserScriptManager *ExtensionSystemQt::shared_user_script_manager()
{
- return shared_user_script_master_.get();
+ return shared_user_script_manager_.get();
}
StateStore *ExtensionSystemQt::state_store()
@@ -349,8 +349,8 @@ void ExtensionSystemQt::Init(bool extensions_enabled)
quota_service_.reset(new QuotaService);
app_sorting_.reset(new NullAppSorting);
- shared_user_script_master_ =
- std::make_unique<SharedUserScriptMaster>(browser_context_);
+ shared_user_script_manager_ =
+ std::make_unique<SharedUserScriptManager>(browser_context_);
// Make the chrome://extension-icon/ resource available.
// content::URLDataSource::Add(browser_context_, new ExtensionIconSource(browser_context_));
@@ -358,20 +358,30 @@ void ExtensionSystemQt::Init(bool extensions_enabled)
if (extensions_enabled) {
// Inform the rest of the extensions system to start.
ready_.Signal();
- content::NotificationService::current()->Notify(
- NOTIFICATION_EXTENSIONS_READY_DEPRECATED,
- content::Source<content::BrowserContext>(browser_context_),
- content::NotificationService::NoDetails());
-
- std::string pdf_manifest = ui::ResourceBundle::GetSharedInstance().GetRawDataResource(IDR_PDF_MANIFEST).as_string();
- base::ReplaceFirstSubstringAfterOffset(&pdf_manifest, 0, "<NAME>", "chromium-pdf");
-
- std::unique_ptr<base::DictionaryValue> pdfManifestDict = ParseManifest(pdf_manifest);
- base::FilePath path;
- base::PathService::Get(base::DIR_QT_LIBRARY_DATA, &path);
- path = path.Append(base::FilePath(FILE_PATH_LITERAL("pdf")));
- std::string id = GenerateId(pdfManifestDict.get(), path);
- LoadExtension(id, std::move(pdfManifestDict), path);
+
+ {
+ std::string pdf_manifest = ui::ResourceBundle::GetSharedInstance().GetRawDataResource(IDR_PDF_MANIFEST).as_string();
+ base::ReplaceFirstSubstringAfterOffset(&pdf_manifest, 0, "<NAME>", "chromium-pdf");
+
+ std::unique_ptr<base::DictionaryValue> pdfManifestDict = ParseManifest(pdf_manifest);
+ base::FilePath path;
+ base::PathService::Get(base::DIR_QT_LIBRARY_DATA, &path);
+ path = path.Append(base::FilePath(FILE_PATH_LITERAL("pdf")));
+ std::string id = GenerateId(pdfManifestDict.get(), path);
+ LoadExtension(id, std::move(pdfManifestDict), path);
+ }
+
+#if BUILDFLAG(ENABLE_HANGOUT_SERVICES_EXTENSION)
+ {
+ std::string hangout_manifest = ui::ResourceBundle::GetSharedInstance().GetRawDataResource(IDR_HANGOUT_SERVICES_MANIFEST).as_string();
+ std::unique_ptr<base::DictionaryValue> hangoutManifestDict = ParseManifest(hangout_manifest);
+ base::FilePath path;
+ base::PathService::Get(base::DIR_QT_LIBRARY_DATA, &path);
+ path = path.Append(base::FilePath(FILE_PATH_LITERAL("hangout_services")));
+ std::string id = GenerateId(hangoutManifestDict.get(), path);
+ LoadExtension(id, std::move(hangoutManifestDict), path);
+ }
+#endif // BUILDFLAG(ENABLE_HANGOUT_SERVICES_EXTENSION)
}
}
@@ -390,19 +400,6 @@ std::unique_ptr<ExtensionSet> ExtensionSystemQt::GetDependentExtensions(const Ex
return base::WrapUnique(new ExtensionSet());
}
-#if !defined(TOOLKIT_QT)
-void ExtensionSystemQt::InstallUpdate(const std::string &extension_id,
- const std::string &public_key,
- const base::FilePath &unpacked_dir,
- bool install_immediately,
- InstallUpdateCallback install_update_callback)
-{
- NOTREACHED() << "Not yet implemented";
- base::DeleteFile(unpacked_dir, true /* recursive */);
- std::move(install_update_callback).Run(CrxInstallError(CrxInstallErrorType::DECLINED, CrxInstallErrorDetail::DISALLOWED_BY_POLICY));
-}
-#endif
-
void ExtensionSystemQt::RegisterExtensionWithRequestContexts(const Extension *extension,
base::OnceClosure callback)
{
@@ -426,4 +423,10 @@ void ExtensionSystemQt::UnregisterExtensionWithRequestContexts(const std::string
FROM_HERE, {BrowserThread::IO},
base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason));
}
+
+bool ExtensionSystemQt::is_ready() const
+{
+ return ready_.is_signaled();
+}
+
} // namespace extensions
diff --git a/src/core/extensions/extension_system_qt.h b/src/core/extensions/extension_system_qt.h
index e3762e8a6..59835657a 100644
--- a/src/core/extensions/extension_system_qt.h
+++ b/src/core/extensions/extension_system_qt.h
@@ -89,7 +89,7 @@ public:
RuntimeData *runtime_data() override;
ManagementPolicy *management_policy() override;
ServiceWorkerManager *service_worker_manager() override;
- SharedUserScriptMaster *shared_user_script_master() override;
+ SharedUserScriptManager *shared_user_script_manager() override;
StateStore *state_store() override;
StateStore *rules_store() override;
scoped_refptr<ValueStoreFactory> store_factory() override;
@@ -106,20 +106,14 @@ public:
ContentVerifier *content_verifier() override;
std::unique_ptr<ExtensionSet> GetDependentExtensions(const Extension *extension) override;
-#if !defined(TOOLKIT_QT)
- void InstallUpdate(const std::string &extension_id,
- const std::string &public_key,
- const base::FilePath &unpacked_dir,
- bool install_immediately,
- InstallUpdateCallback install_update_callback) override;
-#endif // TOOLKIT_QT
- //friend class ExtensionSystemSharedFactory;
-
bool FinishDelayedInstallationIfReady(const std::string &extension_id, bool install_immediately) override;
void Init(bool extensions_enabled);
const base::OneShotEvent &ready() const override { return ready_; }
+ bool is_ready() const override;
+
+ void PerformActionBasedOnOmahaAttributes(const std::string &, const base::Value &) override { /* fixme? */}
private:
void OnExtensionRegisteredWithRequestContexts(scoped_refptr<const extensions::Extension> extension);
@@ -135,7 +129,7 @@ private:
std::unique_ptr<RuntimeData> runtime_data_;
std::unique_ptr<QuotaService> quota_service_;
std::unique_ptr<AppSorting> app_sorting_;
- std::unique_ptr<SharedUserScriptMaster> shared_user_script_master_;
+ std::unique_ptr<SharedUserScriptManager> shared_user_script_manager_;
// For verifying the contents of extensions read from disk.
diff --git a/src/core/extensions/extensions_api_client_qt.cpp b/src/core/extensions/extensions_api_client_qt.cpp
index 731b79a63..81d9efde2 100644
--- a/src/core/extensions/extensions_api_client_qt.cpp
+++ b/src/core/extensions/extensions_api_client_qt.cpp
@@ -43,13 +43,13 @@
// found in the LICENSE file.
#include "extensions_api_client_qt.h"
+#include "messaging_delegate_qt.h"
#include <memory>
-//#include "base/memory/ptr_util.h"
-#include "extension_web_contents_observer_qt.h"
#include "components/pdf/browser/pdf_web_contents_helper.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 "extension_web_contents_observer_qt.h"
#include "printing/print_view_manager_qt.h"
namespace extensions {
@@ -82,4 +82,11 @@ void ExtensionsAPIClientQt::AttachWebContentsHelpers(content::WebContents *web_c
ExtensionWebContentsObserverQt::CreateForWebContents(web_contents);
}
+MessagingDelegate *ExtensionsAPIClientQt::GetMessagingDelegate()
+{
+ if (!m_messagingDelegate)
+ m_messagingDelegate = std::make_unique<MessagingDelegateQt>();
+ return m_messagingDelegate.get();
+}
+
} // namespace extensions
diff --git a/src/core/extensions/extensions_api_client_qt.h b/src/core/extensions/extensions_api_client_qt.h
index 2fa69f539..b1b6356e8 100644
--- a/src/core/extensions/extensions_api_client_qt.h
+++ b/src/core/extensions/extensions_api_client_qt.h
@@ -49,6 +49,8 @@
namespace extensions {
+class MessagingDelegate;
+
class ExtensionsAPIClientQt : public ExtensionsAPIClient
{
public:
@@ -61,6 +63,10 @@ public:
std::unique_ptr<MimeHandlerViewGuestDelegate>
CreateMimeHandlerViewGuestDelegate(MimeHandlerViewGuest *guest) const override;
void AttachWebContentsHelpers(content::WebContents *web_contents) const override;
+ MessagingDelegate *GetMessagingDelegate() override;
+
+private:
+ std::unique_ptr<MessagingDelegate> m_messagingDelegate;
};
} // namespace extensions
diff --git a/src/core/extensions/extensions_browser_client_qt.cpp b/src/core/extensions/extensions_browser_client_qt.cpp
index b285aadd8..6bcf37d85 100644
--- a/src/core/extensions/extensions_browser_client_qt.cpp
+++ b/src/core/extensions/extensions_browser_client_qt.cpp
@@ -49,25 +49,24 @@
#include "base/files/file_path.h"
#include "base/memory/weak_ptr.h"
#include "base/path_service.h"
-#include "base/strings/stringprintf.h"
#include "base/task/post_task.h"
#include "base/memory/ref_counted_memory.h"
+#include "chrome/browser/extensions/api/generated_api_registration.h"
#include "chrome/browser/profiles/profile.h"
#include "content/public/browser/browser_context.h"
-#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_frame_host.h"
#include "extensions/browser/api/extensions_api_client.h"
#include "extensions/browser/api/runtime/runtime_api_delegate.h"
-#include "extensions/browser/app_sorting.h"
#include "extensions/browser/core_extensions_browser_api_provider.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_host_delegate.h"
#include "extensions/browser/extension_protocols.h"
+#include "extensions/browser/extensions_browser_api_provider.h"
#include "extensions/browser/extensions_browser_interface_binders.h"
#include "extensions/browser/url_request_util.h"
#include "extensions/common/file_util.h"
-#include "net/base/completion_once_callback.h"
#include "net/base/mime_util.h"
+#include "qtwebengine/browser/extensions/api/generated_api_registration.h"
#include "services/network/public/mojom/url_loader.mojom.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "third_party/zlib/google/compression_utils.h"
@@ -78,10 +77,10 @@
#include "extension_web_contents_observer_qt.h"
#include "extensions_api_client_qt.h"
#include "extensions_browser_client_qt.h"
+#include "extension_host_delegate_qt.h"
#include "web_engine_library_info.h"
using content::BrowserContext;
-using content::BrowserThread;
namespace {
@@ -111,29 +110,13 @@ scoped_refptr<base::RefCountedMemory> GetResource(int resource_id, const std::st
extension_id)
: nullptr;
- bool is_gzipped = rb.IsGzipped(resource_id);
- if (!bytes->size() || (!replacements && !is_gzipped)) {
- return bytes;
- }
-
- base::StringPiece input(reinterpret_cast<const char *>(bytes->front()), bytes->size());
-
- std::string temp_str;
-
- base::StringPiece source = input;
- if (is_gzipped) {
- temp_str.resize(compression::GetUncompressedSize(input));
- source = temp_str;
- CHECK(compression::GzipUncompress(input, source));
- }
-
if (replacements) {
- temp_str = ui::ReplaceTemplateExpressions(source, *replacements);
+ base::StringPiece input(reinterpret_cast<const char *>(bytes->front()), bytes->size());
+ std::string temp_str = ui::ReplaceTemplateExpressions(input, *replacements);
+ DCHECK(!temp_str.empty());
+ return base::RefCountedString::TakeString(&temp_str);
}
-
- DCHECK(!temp_str.empty());
-
- return base::RefCountedString::TakeString(&temp_str);
+ return bytes;
}
// Loads an extension resource in a Chrome .pak file. These are used by
@@ -156,7 +139,9 @@ public:
// mojom::URLLoader implementation:
void FollowRedirect(const std::vector<std::string> &removed_headers,
- const net::HttpRequestHeaders &modified_headers, const base::Optional<GURL> &new_url) override
+ const net::HttpRequestHeaders &modified_headers,
+ const net::HttpRequestHeaders &modified_cors_exempt_headers,
+ const base::Optional<GURL> &new_url) override
{
NOTREACHED() << "No redirects for local file loads.";
}
@@ -210,11 +195,10 @@ private:
return;
}
head->headers = response_headers_;
- head->headers->AddHeader(base::StringPrintf("%s: %s", net::HttpRequestHeaders::kContentLength,
- base::NumberToString(head->content_length).c_str()));
+ head->headers->AddHeader(net::HttpRequestHeaders::kContentLength,
+ base::NumberToString(head->content_length).c_str());
if (!head->mime_type.empty()) {
- head->headers->AddHeader(
- base::StringPrintf("%s: %s", net::HttpRequestHeaders::kContentType, head->mime_type.c_str()));
+ head->headers->AddHeader(net::HttpRequestHeaders::kContentType, head->mime_type.c_str());
}
client_->OnReceiveResponse(std::move(head));
client_->OnStartLoadingResponseBody(std::move(pipe.consumer_handle));
@@ -266,11 +250,46 @@ private:
namespace extensions {
+// Copied from chrome/browser/extensions/chrome_extensions_browser_api_provider.(h|cc)
+class ChromeExtensionsBrowserAPIProvider : public ExtensionsBrowserAPIProvider
+{
+public:
+ ChromeExtensionsBrowserAPIProvider() = default;
+ ~ChromeExtensionsBrowserAPIProvider() override = default;
+
+ void RegisterExtensionFunctions(ExtensionFunctionRegistry *registry) override
+ {
+ // Generated APIs from Chrome.
+ api::ChromeGeneratedFunctionRegistry::RegisterAll(registry);
+ }
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(ChromeExtensionsBrowserAPIProvider);
+};
+
+class QtWebEngineExtensionsBrowserAPIProvider : public ExtensionsBrowserAPIProvider
+{
+public:
+ QtWebEngineExtensionsBrowserAPIProvider() = default;
+ ~QtWebEngineExtensionsBrowserAPIProvider() override = default;
+
+ void RegisterExtensionFunctions(ExtensionFunctionRegistry *registry) override
+ {
+ // Generated APIs from QtWebEngine.
+ api::QtWebEngineGeneratedFunctionRegistry::RegisterAll(registry);
+ }
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(QtWebEngineExtensionsBrowserAPIProvider);
+};
+
ExtensionsBrowserClientQt::ExtensionsBrowserClientQt()
: api_client_(new ExtensionsAPIClientQt)
, resource_manager_(new ComponentExtensionResourceManagerQt)
{
AddAPIProvider(std::make_unique<CoreExtensionsBrowserAPIProvider>());
+ AddAPIProvider(std::make_unique<ChromeExtensionsBrowserAPIProvider>());
+ AddAPIProvider(std::make_unique<QtWebEngineExtensionsBrowserAPIProvider>());
}
ExtensionsBrowserClientQt::~ExtensionsBrowserClientQt()
@@ -385,10 +404,13 @@ bool ExtensionsBrowserClientQt::AllowCrossRendererResourceLoad(const GURL &url,
const ExtensionSet &extensions,
const ProcessMap &process_map)
{
-
if (extension && extension->id() == extension_misc::kPdfExtensionId)
return true;
+ // hangout services id
+ if (extension && extension->id() == "nkeimhogjdpnpccoofpliimaahmaaome")
+ return true;
+
bool allowed = false;
if (url_request_util::AllowCrossRendererResourceLoad(url, resource_type,
page_transition, child_id,
@@ -417,9 +439,7 @@ ProcessManagerDelegate *ExtensionsBrowserClientQt::GetProcessManagerDelegate() c
std::unique_ptr<ExtensionHostDelegate> ExtensionsBrowserClientQt::CreateExtensionHostDelegate()
{
- // TODO(extensions): Implement to support Apps.
- NOTREACHED();
- return std::unique_ptr<ExtensionHostDelegate>();
+ return std::unique_ptr<ExtensionHostDelegate>(new ExtensionHostDelegateQt);
}
bool ExtensionsBrowserClientQt::DidVersionUpdate(BrowserContext *context)
@@ -448,7 +468,7 @@ ExtensionSystemProvider *ExtensionsBrowserClientQt::GetExtensionSystemFactory()
}
void ExtensionsBrowserClientQt::RegisterBrowserInterfaceBindersForFrame(
- service_manager::BinderMapWithContext<content::RenderFrameHost*> *binder_map,
+ mojo::BinderMapWithContext<content::RenderFrameHost*> *binder_map,
content::RenderFrameHost* render_frame_host,
const Extension* extension) const
{
diff --git a/src/core/extensions/extensions_browser_client_qt.h b/src/core/extensions/extensions_browser_client_qt.h
index b7f944635..5889694b7 100644
--- a/src/core/extensions/extensions_browser_client_qt.h
+++ b/src/core/extensions/extensions_browser_client_qt.h
@@ -93,8 +93,9 @@ public:
bool IsRunningInForcedAppMode() override;
bool IsLoggedInAsPublicAccount() override;
ExtensionSystemProvider *GetExtensionSystemFactory() override;
- void RegisterBrowserInterfaceBindersForFrame(service_manager::BinderMapWithContext<content::RenderFrameHost*> *,
+ void RegisterBrowserInterfaceBindersForFrame(mojo::BinderMapWithContext<content::RenderFrameHost*> *,
content::RenderFrameHost *, const extensions::Extension *) const override;
+
std::unique_ptr<RuntimeAPIDelegate> CreateRuntimeAPIDelegate(content::BrowserContext *context) const override;