diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-04-26 18:00:58 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-04-26 18:00:58 +0200 |
commit | 911c676aa66db46176cfc8da19555d928ce0bd50 (patch) | |
tree | 003c4d417ddc63561fcc7c1a65e24270598ac989 /src | |
parent | c8e0e6a9d375c76a6dbace4f14931be507307e1a (diff) | |
parent | b3b95a5bf3f04c18182fcc4519ec8285e290037d (diff) |
Merge remote-tracking branch 'origin/5.11' into dev
Change-Id: I6bcff15b5e36f2ecfe2f01c93d751761ef0c0d28
Diffstat (limited to 'src')
42 files changed, 384 insertions, 258 deletions
diff --git a/src/3rdparty b/src/3rdparty -Subproject e173cb17d97aa3c2065189275c85db79eb7d174 +Subproject de120c712b755a45687b4f3a7fd01bb7d334669 diff --git a/src/core/api/core_api.pro b/src/core/api/core_api.pro index 637a2ffa0..632034a9d 100644 --- a/src/core/api/core_api.pro +++ b/src/core/api/core_api.pro @@ -37,8 +37,8 @@ HEADERS = \ qwebenginecookiestore.h \ qwebenginecookiestore_p.h \ qwebenginehttprequest.h \ - qwebenginequotapermissionrequest.h \ - qwebengineregisterprotocolhandlerpermissionrequest.h \ + qwebenginequotarequest.h \ + qwebengineregisterprotocolhandlerrequest.h \ qwebengineurlrequestinterceptor.h \ qwebengineurlrequestinfo.h \ qwebengineurlrequestinfo_p.h \ @@ -50,8 +50,8 @@ SOURCES = \ qwebenginebrowsercontext.cpp \ qwebenginecookiestore.cpp \ qwebenginehttprequest.cpp \ - qwebenginequotapermissionrequest.cpp \ - qwebengineregisterprotocolhandlerpermissionrequest.cpp \ + qwebenginequotarequest.cpp \ + qwebengineregisterprotocolhandlerrequest.cpp \ qwebengineurlrequestinfo.cpp \ qwebengineurlrequestjob.cpp \ qwebengineurlschemehandler.cpp diff --git a/src/core/api/qwebenginequotapermissionrequest.cpp b/src/core/api/qwebenginequotarequest.cpp index 86ed65326..49c9f041f 100644 --- a/src/core/api/qwebenginequotapermissionrequest.cpp +++ b/src/core/api/qwebenginequotarequest.cpp @@ -37,32 +37,32 @@ ** ****************************************************************************/ -#include "qwebenginequotapermissionrequest.h" +#include "qwebenginequotarequest.h" -#include "quota_permission_controller.h" +#include "quota_request_controller.h" QT_BEGIN_NAMESPACE /*! - \class QWebEngineQuotaPermissionRequest - \brief The QWebEngineQuotaPermissionRequest class enables accepting or rejecting - requests for larger persistent storage than the application's current allocation - in File System API. + \class QWebEngineQuotaRequest + \brief The QWebEngineQuotaRequest class enables accepting or rejecting + requests for larger persistent storage than the application's current + allocation in File System API. \since 5.11 \inmodule QtWebEngineCore - This class is used by the QWebEnginePage::quotaPermissionRequested() signal - to \l accept() or \l reject() a request for an increase in the persistent - storage allocated to the application. The default quota is 0 bytes. + This class is used by the QWebEnginePage::quotaRequested() signal to \l + accept() or \l reject() a request for an increase in the persistent storage + allocated to the application. The default quota is 0 bytes. */ -/*! \fn QWebEngineQuotaPermissionRequest::QWebEngineQuotaPermissionRequest() +/*! \fn QWebEngineQuotaRequest::QWebEngineQuotaRequest() \internal */ /*! \internal */ -QWebEngineQuotaPermissionRequest::QWebEngineQuotaPermissionRequest(QSharedPointer<QtWebEngineCore::QuotaPermissionController> controller) +QWebEngineQuotaRequest::QWebEngineQuotaRequest(QSharedPointer<QtWebEngineCore::QuotaRequestController> controller) : d_ptr(controller) { } @@ -70,7 +70,7 @@ QWebEngineQuotaPermissionRequest::QWebEngineQuotaPermissionRequest(QSharedPointe /*! Rejects a request for larger persistent storage. */ -void QWebEngineQuotaPermissionRequest::reject() +void QWebEngineQuotaRequest::reject() { d_ptr->reject(); } @@ -78,39 +78,37 @@ void QWebEngineQuotaPermissionRequest::reject() /*! Accepts a request for larger persistent storage. */ -void QWebEngineQuotaPermissionRequest::accept() +void QWebEngineQuotaRequest::accept() { d_ptr->accept(); } /*! - \property QWebEngineQuotaPermissionRequest::origin - \brief The URL of the web page that issued the quota permission request. + \property QWebEngineQuotaRequest::origin + \brief The URL of the web page that issued the quota request. */ -QUrl QWebEngineQuotaPermissionRequest::origin() const +QUrl QWebEngineQuotaRequest::origin() const { return d_ptr->origin(); } /*! - \property QWebEngineQuotaPermissionRequest::requestedSize + \property QWebEngineQuotaRequest::requestedSize \brief Contains the size of the requested disk space in bytes. */ -qint64 QWebEngineQuotaPermissionRequest::requestedSize() const +qint64 QWebEngineQuotaRequest::requestedSize() const { return d_ptr->requestedSize(); } -/*! \fn bool QWebEngineQuotaPermissionRequest::operator==(const QWebEngineQuotaPermissionRequest &that) const - Returns \c true if \a that points to the same object as this quota - permission request. +/*! \fn bool QWebEngineQuotaRequest::operator==(const QWebEngineQuotaRequest &that) const + Returns \c true if \a that points to the same object as this quota request. */ -/*! \fn bool QWebEngineQuotaPermissionRequest::operator!=(const QWebEngineQuotaPermissionRequest &that) const - Returns \c true if \a that points to a different object than this quota - permission request. +/*! \fn bool QWebEngineQuotaRequest::operator!=(const QWebEngineQuotaRequest &that) const + Returns \c true if \a that points to a different object than this request. */ QT_END_NAMESPACE diff --git a/src/core/api/qwebenginequotapermissionrequest.h b/src/core/api/qwebenginequotarequest.h index 5c6e6c007..be71635c1 100644 --- a/src/core/api/qwebenginequotapermissionrequest.h +++ b/src/core/api/qwebenginequotarequest.h @@ -37,36 +37,38 @@ ** ****************************************************************************/ -#ifndef QWEBENGINEQUOTAPERMISSIONREQUEST_H -#define QWEBENGINEQUOTAPERMISSIONREQUEST_H +#ifndef QWEBENGINEQUOTAREQUEST_H +#define QWEBENGINEQUOTAREQUEST_H #include <QtCore/qsharedpointer.h> #include <QtCore/qurl.h> #include <QtWebEngineCore/qtwebenginecoreglobal.h> namespace QtWebEngineCore { - class QuotaPermissionController; +class QuotaPermissionContextQt; +class QuotaRequestController; } QT_BEGIN_NAMESPACE -class QWEBENGINE_EXPORT QWebEngineQuotaPermissionRequest { +class QWEBENGINE_EXPORT QWebEngineQuotaRequest { Q_GADGET Q_PROPERTY(QUrl origin READ origin CONSTANT FINAL) Q_PROPERTY(qint64 requestedSize READ requestedSize CONSTANT FINAL) public: - QWebEngineQuotaPermissionRequest() {} - QWebEngineQuotaPermissionRequest(QSharedPointer<QtWebEngineCore::QuotaPermissionController>); + QWebEngineQuotaRequest() {} Q_INVOKABLE void accept(); Q_INVOKABLE void reject(); QUrl origin() const; qint64 requestedSize() const; - bool operator==(const QWebEngineQuotaPermissionRequest &that) const { return d_ptr == that.d_ptr; } - bool operator!=(const QWebEngineQuotaPermissionRequest &that) const { return d_ptr != that.d_ptr; } + bool operator==(const QWebEngineQuotaRequest &that) const { return d_ptr == that.d_ptr; } + bool operator!=(const QWebEngineQuotaRequest &that) const { return d_ptr != that.d_ptr; } private: - QSharedPointer<QtWebEngineCore::QuotaPermissionController> d_ptr; + QWebEngineQuotaRequest(QSharedPointer<QtWebEngineCore::QuotaRequestController>); + friend QtWebEngineCore::QuotaPermissionContextQt; + QSharedPointer<QtWebEngineCore::QuotaRequestController> d_ptr; }; QT_END_NAMESPACE -#endif // QWEBENGINEQUOTAPERMISSIONREQUEST_H +#endif // QWEBENGINEQUOTAREQUEST_H diff --git a/src/core/api/qwebengineregisterprotocolhandlerpermissionrequest.cpp b/src/core/api/qwebengineregisterprotocolhandlerrequest.cpp index b045a2823..1921f78f4 100644 --- a/src/core/api/qwebengineregisterprotocolhandlerpermissionrequest.cpp +++ b/src/core/api/qwebengineregisterprotocolhandlerrequest.cpp @@ -37,29 +37,29 @@ ** ****************************************************************************/ -#include "qwebengineregisterprotocolhandlerpermissionrequest.h" +#include "qwebengineregisterprotocolhandlerrequest.h" -#include "register_protocol_handler_permission_controller.h" +#include "register_protocol_handler_request_controller.h" QT_BEGIN_NAMESPACE /*! - \class QWebEngineRegisterProtocolHandlerPermissionRequest + \class QWebEngineRegisterProtocolHandlerRequest \inmodule QtWebEngineCore \since 5.11 - \brief The QWebEngineRegisterProtocolHandlerPermissionRequest class enables + \brief The QWebEngineRegisterProtocolHandlerRequest class enables accepting or rejecting requests from the \l registerProtocolHandler API. - \sa QWebEnginePage::registerProtocolHandlerPermissionRequested + \sa QWebEnginePage::registerProtocolHandlerRequested */ -/*! \fn QWebEngineRegisterProtocolHandlerPermissionRequest::QWebEngineRegisterProtocolHandlerPermissionRequest() +/*! \fn QWebEngineRegisterProtocolHandlerRequest::QWebEngineRegisterProtocolHandlerRequest() \internal */ /*! \internal */ -QWebEngineRegisterProtocolHandlerPermissionRequest::QWebEngineRegisterProtocolHandlerPermissionRequest( - QSharedPointer<QtWebEngineCore::RegisterProtocolHandlerPermissionController> d_ptr) +QWebEngineRegisterProtocolHandlerRequest::QWebEngineRegisterProtocolHandlerRequest( + QSharedPointer<QtWebEngineCore::RegisterProtocolHandlerRequestController> d_ptr) : d_ptr(std::move(d_ptr)) {} @@ -68,7 +68,7 @@ QWebEngineRegisterProtocolHandlerPermissionRequest::QWebEngineRegisterProtocolHa Subsequent calls to accept() and reject() are ignored. */ -void QWebEngineRegisterProtocolHandlerPermissionRequest::reject() +void QWebEngineRegisterProtocolHandlerRequest::reject() { d_ptr->reject(); } @@ -78,41 +78,39 @@ void QWebEngineRegisterProtocolHandlerPermissionRequest::reject() Subsequent calls to accept() and reject() are ignored. */ -void QWebEngineRegisterProtocolHandlerPermissionRequest::accept() +void QWebEngineRegisterProtocolHandlerRequest::accept() { d_ptr->accept(); } /*! - \property QWebEngineRegisterProtocolHandlerPermissionRequest::origin + \property QWebEngineRegisterProtocolHandlerRequest::origin \brief The URL template for the protocol handler. This is the second parameter from the \l registerProtocolHandler call. */ -QUrl QWebEngineRegisterProtocolHandlerPermissionRequest::origin() const +QUrl QWebEngineRegisterProtocolHandlerRequest::origin() const { return d_ptr->origin(); } /*! - \property QWebEngineRegisterProtocolHandlerPermissionRequest::scheme + \property QWebEngineRegisterProtocolHandlerRequest::scheme \brief The URL scheme for the protocol handler. This is the first parameter from the \l registerProtocolHandler call. */ -QString QWebEngineRegisterProtocolHandlerPermissionRequest::scheme() const +QString QWebEngineRegisterProtocolHandlerRequest::scheme() const { return d_ptr->scheme(); } -/*! \fn bool QWebEngineRegisterProtocolHandlerPermissionRequest::operator==(const QWebEngineRegisterProtocolHandlerPermissionRequest &that) const - Returns \c true if \a that points to the same object as this protocol - handler permission request. +/*! \fn bool QWebEngineRegisterProtocolHandlerRequest::operator==(const QWebEngineRegisterProtocolHandlerRequest &that) const + Returns \c true if \a that points to the same object as this request. */ -/*! \fn bool QWebEngineRegisterProtocolHandlerPermissionRequest::operator!=(const QWebEngineRegisterProtocolHandlerPermissionRequest &that) const - Returns \c true if \a that points to a different object than this protocol - handler permission request. +/*! \fn bool QWebEngineRegisterProtocolHandlerRequest::operator!=(const QWebEngineRegisterProtocolHandlerRequest &that) const + Returns \c true if \a that points to a different object than this request. */ QT_END_NAMESPACE diff --git a/src/core/api/qwebengineregisterprotocolhandlerpermissionrequest.h b/src/core/api/qwebengineregisterprotocolhandlerrequest.h index 254f26508..b3707bc59 100644 --- a/src/core/api/qwebengineregisterprotocolhandlerpermissionrequest.h +++ b/src/core/api/qwebengineregisterprotocolhandlerrequest.h @@ -37,37 +37,39 @@ ** ****************************************************************************/ -#ifndef QWEBENGINEREGISTERPROTOCOLHANDLERPERMISSIONREQUEST_H -#define QWEBENGINEREGISTERPROTOCOLHANDLERPERMISSIONREQUEST_H +#ifndef QWEBENGINEREGISTERPROTOCOLHANDLERREQUEST_H +#define QWEBENGINEREGISTERPROTOCOLHANDLERREQUEST_H #include <QtCore/qsharedpointer.h> #include <QtCore/qurl.h> #include <QtWebEngineCore/qtwebenginecoreglobal.h> namespace QtWebEngineCore { - class RegisterProtocolHandlerPermissionController; +class RegisterProtocolHandlerRequestController; +class WebContentsDelegateQt; } QT_BEGIN_NAMESPACE -class QWEBENGINE_EXPORT QWebEngineRegisterProtocolHandlerPermissionRequest { +class QWEBENGINE_EXPORT QWebEngineRegisterProtocolHandlerRequest { Q_GADGET Q_PROPERTY(QUrl origin READ origin CONSTANT FINAL) Q_PROPERTY(QString scheme READ scheme CONSTANT FINAL) public: - QWebEngineRegisterProtocolHandlerPermissionRequest() {} - QWebEngineRegisterProtocolHandlerPermissionRequest( - QSharedPointer<QtWebEngineCore::RegisterProtocolHandlerPermissionController>); + QWebEngineRegisterProtocolHandlerRequest() {} Q_INVOKABLE void accept(); Q_INVOKABLE void reject(); QUrl origin() const; QString scheme() const; - bool operator==(const QWebEngineRegisterProtocolHandlerPermissionRequest &that) const { return d_ptr == that.d_ptr; } - bool operator!=(const QWebEngineRegisterProtocolHandlerPermissionRequest &that) const { return d_ptr != that.d_ptr; } + bool operator==(const QWebEngineRegisterProtocolHandlerRequest &that) const { return d_ptr == that.d_ptr; } + bool operator!=(const QWebEngineRegisterProtocolHandlerRequest &that) const { return d_ptr != that.d_ptr; } private: - QSharedPointer<QtWebEngineCore::RegisterProtocolHandlerPermissionController> d_ptr; + QWebEngineRegisterProtocolHandlerRequest( + QSharedPointer<QtWebEngineCore::RegisterProtocolHandlerRequestController>); + friend QtWebEngineCore::WebContentsDelegateQt; + QSharedPointer<QtWebEngineCore::RegisterProtocolHandlerRequestController> d_ptr; }; QT_END_NAMESPACE -#endif // QWEBENGINEREGISTERPROTOCOLHANDLERPERMISSIONREQUEST_H +#endif // QWEBENGINEREGISTERPROTOCOLHANDLERREQUEST_H diff --git a/src/core/config/common.pri b/src/core/config/common.pri index edc77d83d..3441d9623 100644 --- a/src/core/config/common.pri +++ b/src/core/config/common.pri @@ -94,3 +94,4 @@ qtConfig(webengine-v8-snapshot) { gn_args += v8_use_snapshot=false } +!msvc: gn_args += enable_iterator_debugging=false diff --git a/src/core/core_chromium.pri b/src/core/core_chromium.pri index 3d23f44b7..73e07c156 100644 --- a/src/core/core_chromium.pri +++ b/src/core/core_chromium.pri @@ -90,8 +90,8 @@ SOURCES = \ permission_manager_qt.cpp \ process_main.cpp \ quota_permission_context_qt.cpp \ - quota_permission_controller_impl.cpp \ - register_protocol_handler_permission_controller_impl.cpp \ + quota_request_controller_impl.cpp \ + register_protocol_handler_request_controller_impl.cpp \ render_view_context_menu_qt.cpp \ render_view_observer_host_qt.cpp \ render_widget_host_view_qt.cpp \ @@ -174,15 +174,14 @@ HEADERS = \ ozone/ozone_platform_qt.h \ ozone/platform_window_qt.h \ ozone/surface_factory_qt.h \ - permission_controller.h \ permission_manager_qt.h \ process_main.h \ proxy_config_service_qt.h \ quota_permission_context_qt.h \ - quota_permission_controller.h \ - quota_permission_controller_impl.h \ - register_protocol_handler_permission_controller.h \ - register_protocol_handler_permission_controller_impl.h \ + quota_request_controller.h \ + quota_request_controller_impl.h \ + register_protocol_handler_request_controller.h \ + register_protocol_handler_request_controller_impl.h \ render_view_context_menu_qt.h \ render_view_observer_host_qt.h \ render_widget_host_view_qt.h \ @@ -196,6 +195,7 @@ HEADERS = \ renderer_host/resource_dispatcher_host_delegate_qt.h \ renderer_host/user_resource_controller_host.h \ renderer_host/web_channel_ipc_transport_host.h \ + request_controller.h \ resource_context_qt.h \ type_conversion.h \ user_script.h \ diff --git a/src/core/devtools_frontend_qt.cpp b/src/core/devtools_frontend_qt.cpp index 98008fa58..810235dba 100644 --- a/src/core/devtools_frontend_qt.cpp +++ b/src/core/devtools_frontend_qt.cpp @@ -44,6 +44,7 @@ #include "devtools_frontend_qt.h" +#include "browser_context_adapter.h" #include "browser_context_qt.h" #include "web_contents_adapter.h" @@ -153,6 +154,12 @@ DevToolsFrontendQt *DevToolsFrontendQt::Show(QSharedPointer<WebContentsAdapter> DCHECK(frontendAdapter); DCHECK(inspectedContents); + if (!frontendAdapter->isInitialized()) { + scoped_refptr<content::SiteInstance> site = + content::SiteInstance::CreateForURL(frontendAdapter->browserContext(), GURL(GetFrontendURL())); + frontendAdapter->initialize(site.get()); + } + content::WebContents *contents = frontendAdapter->webContents(); if (contents == inspectedContents) { qWarning() << "You can not inspect youself"; @@ -184,7 +191,7 @@ DevToolsFrontendQt::DevToolsFrontendQt(QSharedPointer<WebContentsAdapter> webCon { // We use a separate prefstore than BrowserContextQt, because that one is in-memory only, and this // needs to be stored or it will show introduction text on every load. - if (web_contents()->GetBrowserContext()->IsOffTheRecord()) + if (webContentsAdapter->browserContextAdapter()->isOffTheRecord()) m_prefStore = std::move(scoped_refptr<PersistentPrefStore>(new InMemoryPrefStore())); else CreateJsonPreferences(false); diff --git a/src/core/gl_surface_qt.cpp b/src/core/gl_surface_qt.cpp index 4e620af87..8bfbd865c 100644 --- a/src/core/gl_surface_qt.cpp +++ b/src/core/gl_surface_qt.cpp @@ -284,6 +284,7 @@ CreateOffscreenGLSurfaceWithFormat(const gfx::Size& size, GLSurfaceFormat format if (surface->Initialize(format)) return surface; } + LOG(ERROR) << "eglCreatePbufferSurface failed and surfaceless context not available"; LOG(WARNING) << "Failed to create offscreen GL surface"; break; } diff --git a/src/core/ozone/gl_surface_egl_qt.cpp b/src/core/ozone/gl_surface_egl_qt.cpp index 0f21b8dfe..6de9d20b5 100644 --- a/src/core/ozone/gl_surface_egl_qt.cpp +++ b/src/core/ozone/gl_surface_egl_qt.cpp @@ -89,15 +89,6 @@ bool GLSurfaceEGLQt::InitializeOneOff() return false; } - s_initialized = true; - return true; -} - -bool GLSurfaceEGLQt::InitializeExtensionSettingsOneOff() -{ - if (!s_initialized) - return false; - g_extensions = eglQueryString(g_display, EGL_EXTENSIONS); g_egl_surfaceless_context_supported = ExtensionsContain(g_extensions, "EGL_KHR_surfaceless_context"); if (g_egl_surfaceless_context_supported) { @@ -116,10 +107,15 @@ bool GLSurfaceEGLQt::InitializeExtensionSettingsOneOff() context->ReleaseCurrent(surface.get()); } } - + s_initialized = true; return true; } +bool GLSurfaceEGLQt::InitializeExtensionSettingsOneOff() +{ + return s_initialized; +} + bool GLSurfaceEGL::InitializeExtensionSettingsOneOff() { return GLSurfaceEGLQt::InitializeExtensionSettingsOneOff(); @@ -217,7 +213,7 @@ bool GLSurfaceEGLQt::Initialize(GLSurfaceFormat format) g_config, pbuffer_attributes); if (!m_surfaceBuffer) { - LOG(ERROR) << "eglCreatePbufferSurface failed with error " << GetLastEGLErrorString(); + VLOG(1) << "eglCreatePbufferSurface failed with error " << GetLastEGLErrorString(); Destroy(); return false; } diff --git a/src/core/quota_permission_context_qt.cpp b/src/core/quota_permission_context_qt.cpp index 0fdcef3b3..f00b2008a 100644 --- a/src/core/quota_permission_context_qt.cpp +++ b/src/core/quota_permission_context_qt.cpp @@ -42,7 +42,8 @@ #include "content/public/browser/browser_thread.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/web_contents.h" -#include "quota_permission_controller_impl.h" +#include "quota_request_controller_impl.h" +#include "qwebenginequotarequest.h" #include "web_contents_delegate_qt.h" #include "web_contents_view_qt.h" @@ -82,8 +83,9 @@ void QuotaPermissionContextQt::RequestQuotaPermission(const StorageQuotaParams & if (!client) return; - QSharedPointer<QuotaPermissionController> request(new QuotaPermissionControllerImpl(this, params, callback)); - client->runQuotaPermissionRequest(request); + QWebEngineQuotaRequest request( + QSharedPointer<QuotaRequestControllerImpl>::create(this, params, callback)); + client->runQuotaRequest(std::move(request)); } void QuotaPermissionContextQt::dispatchCallbackOnIOThread(const PermissionCallback &callback, diff --git a/src/core/quota_permission_controller.h b/src/core/quota_request_controller.h index be228f369..0bb0cbff3 100644 --- a/src/core/quota_permission_controller.h +++ b/src/core/quota_request_controller.h @@ -37,17 +37,17 @@ ** ****************************************************************************/ -#ifndef QUOTA_PERMISSION_CONTROLLER_H -#define QUOTA_PERMISSION_CONTROLLER_H +#ifndef QUOTA_REQUEST_CONTROLLER_H +#define QUOTA_REQUEST_CONTROLLER_H -#include "permission_controller.h" +#include "request_controller.h" namespace QtWebEngineCore { -class QWEBENGINE_EXPORT QuotaPermissionController : public PermissionController { +class QuotaRequestController : public RequestController { public: - QuotaPermissionController(QUrl origin, qint64 requestedSize) - : PermissionController(std::move(origin)) + QuotaRequestController(QUrl origin, qint64 requestedSize) + : RequestController(std::move(origin)) , m_requestedSize(requestedSize) {} @@ -59,4 +59,4 @@ private: } // namespace QtWebEngineCore -#endif // QUOTA_PERMISSION_CONTROLLER_H +#endif // QUOTA_REQUEST_CONTROLLER_H diff --git a/src/core/quota_permission_controller_impl.cpp b/src/core/quota_request_controller_impl.cpp index ebad4b2fb..ee94e1cdd 100644 --- a/src/core/quota_permission_controller_impl.cpp +++ b/src/core/quota_request_controller_impl.cpp @@ -37,29 +37,29 @@ ** ****************************************************************************/ -#include "quota_permission_controller_impl.h" +#include "quota_request_controller_impl.h" #include "type_conversion.h" namespace QtWebEngineCore { -QuotaPermissionControllerImpl::QuotaPermissionControllerImpl( +QuotaRequestControllerImpl::QuotaRequestControllerImpl( QuotaPermissionContextQt *context, const content::StorageQuotaParams ¶ms, const content::QuotaPermissionContext::PermissionCallback &callback) - : QuotaPermissionController( + : QuotaRequestController( toQt(params.origin_url), params.requested_size) , m_context(context) , m_callback(callback) {} -void QuotaPermissionControllerImpl::accepted() +void QuotaRequestControllerImpl::accepted() { m_context->dispatchCallbackOnIOThread(m_callback, QuotaPermissionContextQt::QUOTA_PERMISSION_RESPONSE_ALLOW); } -void QuotaPermissionControllerImpl::rejected() +void QuotaRequestControllerImpl::rejected() { m_context->dispatchCallbackOnIOThread(m_callback, QuotaPermissionContextQt::QUOTA_PERMISSION_RESPONSE_DISALLOW); } diff --git a/src/core/quota_permission_controller_impl.h b/src/core/quota_request_controller_impl.h index 297c6711b..dacdce72f 100644 --- a/src/core/quota_permission_controller_impl.h +++ b/src/core/quota_request_controller_impl.h @@ -37,17 +37,17 @@ ** ****************************************************************************/ -#ifndef QUOTA_PERMISSION_CONTROLLER_IMPL_H -#define QUOTA_PERMISSION_CONTROLLER_IMPL_H +#ifndef QUOTA_REQUEST_CONTROLLER_IMPL_H +#define QUOTA_REQUEST_CONTROLLER_IMPL_H -#include "quota_permission_controller.h" #include "quota_permission_context_qt.h" +#include "quota_request_controller.h" namespace QtWebEngineCore { -class QuotaPermissionControllerImpl final : public QuotaPermissionController { +class QuotaRequestControllerImpl final : public QuotaRequestController { public: - QuotaPermissionControllerImpl( + QuotaRequestControllerImpl( QuotaPermissionContextQt *context, const content::StorageQuotaParams ¶ms, const content::QuotaPermissionContext::PermissionCallback &callback); @@ -63,4 +63,4 @@ private: } // namespace QtWebEngineCore -#endif // QUOTA_PERMISSION_CONTROLLER_IMPL_H +#endif // QUOTA_REQUEST_CONTROLLER_IMPL_H diff --git a/src/core/register_protocol_handler_permission_controller.h b/src/core/register_protocol_handler_request_controller.h index ce1e84084..2f9c9fc49 100644 --- a/src/core/register_protocol_handler_permission_controller.h +++ b/src/core/register_protocol_handler_request_controller.h @@ -37,17 +37,17 @@ ** ****************************************************************************/ -#ifndef REGISTER_PROTOCOL_HANDLER_PERMISSION_CONTROLLER_H -#define REGISTER_PROTOCOL_HANDLER_PERMISSION_CONTROLLER_H +#ifndef REGISTER_PROTOCOL_HANDLER_REQUEST_CONTROLLER_H +#define REGISTER_PROTOCOL_HANDLER_REQUEST_CONTROLLER_H -#include "permission_controller.h" +#include "request_controller.h" namespace QtWebEngineCore { -class QWEBENGINE_EXPORT RegisterProtocolHandlerPermissionController : public PermissionController { +class RegisterProtocolHandlerRequestController : public RequestController { public: - RegisterProtocolHandlerPermissionController(QUrl origin, QString scheme) - : PermissionController(std::move(origin)) + RegisterProtocolHandlerRequestController(QUrl origin, QString scheme) + : RequestController(std::move(origin)) , m_scheme(std::move(scheme)) {} @@ -59,4 +59,4 @@ private: } // namespace QtWebEngineCore -#endif // REGISTER_PROTOCOL_HANDLER_PERMISSION_CONTROLLER_H +#endif // REGISTER_PROTOCOL_HANDLER_REQUEST_CONTROLLER_H diff --git a/src/core/register_protocol_handler_permission_controller_impl.cpp b/src/core/register_protocol_handler_request_controller_impl.cpp index 98d257e38..1e3a15c93 100644 --- a/src/core/register_protocol_handler_permission_controller_impl.cpp +++ b/src/core/register_protocol_handler_request_controller_impl.cpp @@ -36,7 +36,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "register_protocol_handler_permission_controller_impl.h" +#include "register_protocol_handler_request_controller_impl.h" #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" #include "content/public/browser/web_contents.h" @@ -44,17 +44,17 @@ namespace QtWebEngineCore { -RegisterProtocolHandlerPermissionControllerImpl::RegisterProtocolHandlerPermissionControllerImpl( +RegisterProtocolHandlerRequestControllerImpl::RegisterProtocolHandlerRequestControllerImpl( content::WebContents *webContents, ProtocolHandler handler) - : RegisterProtocolHandlerPermissionController( + : RegisterProtocolHandlerRequestController( toQt(handler.url()), toQt(handler.protocol())) , content::WebContentsObserver(webContents) , m_handler(handler) {} -ProtocolHandlerRegistry *RegisterProtocolHandlerPermissionControllerImpl::protocolHandlerRegistry() +ProtocolHandlerRegistry *RegisterProtocolHandlerRequestControllerImpl::protocolHandlerRegistry() { content::WebContents *webContents = web_contents(); if (!webContents) @@ -63,13 +63,13 @@ ProtocolHandlerRegistry *RegisterProtocolHandlerPermissionControllerImpl::protoc return ProtocolHandlerRegistryFactory::GetForBrowserContext(context); } -void RegisterProtocolHandlerPermissionControllerImpl::accepted() +void RegisterProtocolHandlerRequestControllerImpl::accepted() { if (ProtocolHandlerRegistry *registry = protocolHandlerRegistry()) registry->OnAcceptRegisterProtocolHandler(m_handler); } -void RegisterProtocolHandlerPermissionControllerImpl::rejected() +void RegisterProtocolHandlerRequestControllerImpl::rejected() { if (ProtocolHandlerRegistry *registry = protocolHandlerRegistry()) registry->OnIgnoreRegisterProtocolHandler(m_handler); diff --git a/src/core/register_protocol_handler_permission_controller_impl.h b/src/core/register_protocol_handler_request_controller_impl.h index 739b320c0..5ad64210c 100644 --- a/src/core/register_protocol_handler_permission_controller_impl.h +++ b/src/core/register_protocol_handler_request_controller_impl.h @@ -37,10 +37,10 @@ ** ****************************************************************************/ -#ifndef REGISTER_PROTOCOL_HANDLER_PERMISSION_CONTROLLER_IMPL_H -#define REGISTER_PROTOCOL_HANDLER_PERMISSION_CONTROLLER_IMPL_H +#ifndef REGISTER_PROTOCOL_HANDLER_REQUEST_CONTROLLER_IMPL_H +#define REGISTER_PROTOCOL_HANDLER_REQUEST_CONTROLLER_IMPL_H -#include "register_protocol_handler_permission_controller.h" +#include "register_protocol_handler_request_controller.h" #include "chrome/browser/custom_handlers/protocol_handler_registry.h" #include "chrome/common/custom_handlers/protocol_handler.h" @@ -50,10 +50,10 @@ class ProtocolHandlerRegistry; namespace QtWebEngineCore { -class RegisterProtocolHandlerPermissionControllerImpl final : public RegisterProtocolHandlerPermissionController, - private content::WebContentsObserver { +class RegisterProtocolHandlerRequestControllerImpl final : public RegisterProtocolHandlerRequestController, + private content::WebContentsObserver { public: - RegisterProtocolHandlerPermissionControllerImpl( + RegisterProtocolHandlerRequestControllerImpl( content::WebContents *webContents, ProtocolHandler handler); @@ -68,4 +68,4 @@ private: } // namespace QtWebEngineCore -#endif // REGISTER_PROTOCOL_HANDLER_PERMISSION_CONTROLLER_IMPL_H +#endif // REGISTER_PROTOCOL_HANDLER_REQUEST_CONTROLLER_IMPL_H diff --git a/src/core/permission_controller.h b/src/core/request_controller.h index 22dfeb77e..a15c601d7 100644 --- a/src/core/permission_controller.h +++ b/src/core/request_controller.h @@ -36,8 +36,8 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#ifndef PERMISSION_CONTROLLER_H -#define PERMISSION_CONTROLLER_H +#ifndef REQUEST_CONTROLLER_H +#define REQUEST_CONTROLLER_H #include "qtwebenginecoreglobal.h" @@ -45,30 +45,35 @@ namespace QtWebEngineCore { -class QWEBENGINE_EXPORT PermissionController { +class RequestController { public: - PermissionController(QUrl origin) + RequestController(QUrl origin) : m_answered(false) , m_origin(std::move(origin)) {} QUrl origin() const { return m_origin; } - void accept() { + void accept() + { if (!m_answered) { m_answered = true; accepted(); } } - void reject() { + void reject() + { if (!m_answered) { m_answered = true; rejected(); } } - virtual ~PermissionController() {} + virtual ~RequestController() + { + reject(); + } protected: virtual void accepted() = 0; @@ -81,4 +86,4 @@ private: } // namespace QtWebEngineCore -#endif // PERMISSION_CONTROLLER_H +#endif // !REQUEST_CONTROLLER_H diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 95bdaba53..4ebed8fc9 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -408,6 +408,10 @@ WebContentsAdapter::WebContentsAdapter(content::WebContents *webContents) WebContentsAdapter::~WebContentsAdapter() { + Q_D(WebContentsAdapter); + if (d->devToolsFrontend) + closeDevToolsFrontend(); + Q_ASSERT(!d->devToolsFrontend); } void WebContentsAdapter::setClient(WebContentsAdapterClient *adapterClient) @@ -1168,7 +1172,7 @@ void WebContentsAdapter::openDevToolsFrontend(QSharedPointer<WebContentsAdapter> { Q_D(WebContentsAdapter); Q_ASSERT(isInitialized()); - if (d->devToolsFrontend && + if (d->devToolsFrontend && frontendAdapter->webContents() && d->devToolsFrontend->frontendDelegate() == frontendAdapter->webContents()->GetDelegate()) return; @@ -1183,7 +1187,6 @@ void WebContentsAdapter::openDevToolsFrontend(QSharedPointer<WebContentsAdapter> void WebContentsAdapter::closeDevToolsFrontend() { Q_D(WebContentsAdapter); - CHECK_INITIALIZED(); if (d->devToolsFrontend) { d->devToolsFrontend->DisconnectFromTarget(); d->devToolsFrontend->Close(); @@ -1193,7 +1196,6 @@ void WebContentsAdapter::closeDevToolsFrontend() void WebContentsAdapter::devToolsFrontendDestroyed(DevToolsFrontendQt *frontend) { Q_D(WebContentsAdapter); - Q_ASSERT(isInitialized()); Q_ASSERT(frontend == d->devToolsFrontend); Q_UNUSED(frontend); d->devToolsFrontend = nullptr; @@ -1373,6 +1375,7 @@ void WebContentsAdapter::setWebChannel(QWebChannel *channel, uint worldId) channel->connectTo(d->webChannelTransport.get()); } +#if QT_CONFIG(draganddrop) static QMimeData *mimeDataFromDropData(const content::DropData &dropData) { QMimeData *mimeData = new QMimeData(); @@ -1633,6 +1636,7 @@ void WebContentsAdapter::leaveDrag() rvh->GetWidget()->DragTargetDragLeave(d->lastDragClientPos, d->lastDragScreenPos); d->currentDropData.reset(); } +#endif // QT_CONFIG(draganddrop) void WebContentsAdapter::replaceMisspelling(const QString &word) { diff --git a/src/core/web_contents_adapter.h b/src/core/web_contents_adapter.h index f42dea394..111100bba 100644 --- a/src/core/web_contents_adapter.h +++ b/src/core/web_contents_adapter.h @@ -42,6 +42,7 @@ #include "qtwebenginecoreglobal.h" #include "web_contents_adapter_client.h" +#include <QtGui/qtgui-config.h> #include <QtWebEngineCore/qwebenginehttprequest.h> #include <QScopedPointer> @@ -181,6 +182,7 @@ public: QPointF lastScrollOffset() const; QSizeF lastContentsSize() const; +#if QT_CONFIG(draganddrop) void startDragging(QObject *dragSource, const content::DropData &dropData, Qt::DropActions allowedActions, const QPixmap &pixmap, const QPoint &offset); void enterDrag(QDragEnterEvent *e, const QPointF &screenPos); @@ -188,6 +190,7 @@ public: void updateDragAction(int action); void endDragging(const QPointF &clientPos, const QPointF &screenPos); void leaveDrag(); +#endif // QT_CONFIG(draganddrop) void printToPDF(const QPageLayout&, const QString&); quint64 printToPDFCallbackResult(const QPageLayout &, bool colorMode = true, diff --git a/src/core/web_contents_adapter_client.h b/src/core/web_contents_adapter_client.h index 248a963b1..4c5133772 100644 --- a/src/core/web_contents_adapter_client.h +++ b/src/core/web_contents_adapter_client.h @@ -49,9 +49,11 @@ #include <QStringList> #include <QUrl> +QT_FORWARD_DECLARE_CLASS(CertificateErrorController) QT_FORWARD_DECLARE_CLASS(QKeyEvent) QT_FORWARD_DECLARE_CLASS(QVariant) -QT_FORWARD_DECLARE_CLASS(CertificateErrorController) +QT_FORWARD_DECLARE_CLASS(QWebEngineQuotaRequest) +QT_FORWARD_DECLARE_CLASS(QWebEngineRegisterProtocolHandlerRequest) namespace content { struct DropData; @@ -64,8 +66,6 @@ class BrowserContextAdapter; class ColorChooserController; class FilePickerController; class JavaScriptDialogController; -class QuotaPermissionController; -class RegisterProtocolHandlerPermissionController; class RenderWidgetHostViewQt; class RenderWidgetHostViewQtDelegate; class RenderWidgetHostViewQtDelegateClient; @@ -438,8 +438,8 @@ public: virtual void runGeolocationPermissionRequest(const QUrl &securityOrigin) = 0; virtual void runMediaAccessPermissionRequest(const QUrl &securityOrigin, MediaRequestFlags requestFlags) = 0; virtual void runMouseLockPermissionRequest(const QUrl &securityOrigin) = 0; - virtual void runQuotaPermissionRequest(QSharedPointer<QuotaPermissionController>) = 0; - virtual void runRegisterProtocolHandlerPermissionRequest(QSharedPointer<RegisterProtocolHandlerPermissionController>) = 0; + virtual void runQuotaRequest(QWebEngineQuotaRequest) = 0; + virtual void runRegisterProtocolHandlerRequest(QWebEngineRegisterProtocolHandlerRequest) = 0; virtual WebEngineSettings *webEngineSettings() const = 0; RenderProcessTerminationStatus renderProcessExitStatus(int); virtual void renderProcessTerminated(RenderProcessTerminationStatus terminationStatus, int exitCode) = 0; diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index 61aeda7bd..335c65880 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -51,6 +51,8 @@ #include "file_picker_controller.h" #include "media_capture_devices_dispatcher.h" #include "net/network_delegate_qt.h" +#include "qwebengineregisterprotocolhandlerrequest.h" +#include "register_protocol_handler_request_controller_impl.h" #include "render_widget_host_view_qt.h" #include "type_conversion.h" #include "visited_links_manager_qt.h" @@ -58,7 +60,6 @@ #include "web_contents_adapter_p.h" #include "web_engine_context.h" #include "web_engine_settings.h" -#include "register_protocol_handler_permission_controller_impl.h" #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" #include "components/web_cache/browser/web_cache_manager.h" @@ -185,7 +186,7 @@ void WebContentsDelegateQt::NavigationStateChanged(content::WebContents* source, // If there is a visible entry there are special cases when we dont wan't to use the actual URL if (entry && newUrl.isEmpty()) - newUrl = shouldUseActualURL(entry) ? toQt(entry->GetURL()) : toQt(source->GetVisibleURL()); + newUrl = shouldUseActualURL(entry) ? toQt(entry->GetURL()) : toQt(entry->GetVirtualURL()); if (m_url != newUrl) { m_url = newUrl; @@ -638,9 +639,9 @@ void WebContentsDelegateQt::RegisterProtocolHandler(content::WebContents *webCon if (registry->SilentlyHandleRegisterHandlerRequest(handler)) return; - QSharedPointer<RegisterProtocolHandlerPermissionController> controller( - new RegisterProtocolHandlerPermissionControllerImpl(webContents, handler)); - m_viewClient->runRegisterProtocolHandlerPermissionRequest(std::move(controller)); + QWebEngineRegisterProtocolHandlerRequest request( + QSharedPointer<RegisterProtocolHandlerRequestControllerImpl>::create(webContents, handler)); + m_viewClient->runRegisterProtocolHandlerRequest(std::move(request)); } void WebContentsDelegateQt::UnregisterProtocolHandler(content::WebContents *webContents, const std::string &protocol, const GURL &url, bool) diff --git a/src/core/web_contents_view_qt.cpp b/src/core/web_contents_view_qt.cpp index 1e7e718da..a7895d61c 100644 --- a/src/core/web_contents_view_qt.cpp +++ b/src/core/web_contents_view_qt.cpp @@ -229,6 +229,7 @@ void WebContentsViewQt::StartDragging(const content::DropData &drop_data, const content::DragEventSourceInfo &event_info, content::RenderWidgetHostImpl* source_rwh) { +#if QT_CONFIG(draganddrop) Q_UNUSED(event_info); QPixmap pixmap; @@ -240,11 +241,14 @@ void WebContentsViewQt::StartDragging(const content::DropData &drop_data, } m_client->startDragging(drop_data, toQtDropActions(allowed_ops), pixmap, hotspot); +#endif // QT_CONFIG(draganddrop) } void WebContentsViewQt::UpdateDragCursor(blink::WebDragOperation dragOperation) { +#if QT_CONFIG(draganddrop) m_client->webContentsAdapter()->updateDragAction(dragOperation); +#endif // QT_CONFIG(draganddrop) } void WebContentsViewQt::TakeFocus(bool reverse) diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 56410ecd4..35402cdb0 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -71,6 +71,7 @@ #include "content/utility/in_process_utility_thread.h" #include "gpu/command_buffer/service/gpu_switches.h" #include "gpu/ipc/host/gpu_switches.h" +#include "media/audio/audio_manager.h" #include "net/base/port_util.h" #include "ppapi/features/features.h" #include "services/service_manager/sandbox/switches.h" @@ -535,6 +536,10 @@ WebEngineContext::WebEngineContext() net::SetExplicitlyAllowedPorts(allowedPorts); } +#if defined(OS_LINUX) + media::AudioManager::SetGlobalAppName(QCoreApplication::applicationName().toStdString()); +#endif + #if BUILDFLAG(ENABLE_PLUGINS) // Creating pepper plugins from the page (which calls PluginService::GetPluginInfoArray) // might fail unless the page queried the list of available plugins at least once diff --git a/src/core/web_engine_library_info.cpp b/src/core/web_engine_library_info.cpp index 35b139602..515f763d2 100644 --- a/src/core/web_engine_library_info.cpp +++ b/src/core/web_engine_library_info.cpp @@ -163,9 +163,9 @@ QString subProcessPath() #else candidatePaths << QLibraryInfo::location(QLibraryInfo::LibraryExecutablesPath) % QLatin1Char('/') % processBinary; +#endif candidatePaths << QCoreApplication::applicationDirPath() % QLatin1Char('/') % processBinary; -#endif } Q_FOREACH (const QString &candidate, candidatePaths) { @@ -185,11 +185,13 @@ QString subProcessPath() QString localesPath() { + static bool initialized = false; + static QString potentialLocalesPath = #if defined(OS_MACOSX) && defined(QT_MAC_FRAMEWORK_BUILD) - return getResourcesPath(frameworkBundle()) % QLatin1String("/qtwebengine_locales"); + getResourcesPath(frameworkBundle()) % QLatin1String("/qtwebengine_locales"); #else - static bool initialized = false; - static QString potentialLocalesPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath) % QDir::separator() % QLatin1String("qtwebengine_locales"); + QLibraryInfo::location(QLibraryInfo::TranslationsPath) % QDir::separator() % QLatin1String("qtwebengine_locales"); +#endif if (!initialized) { initialized = true; @@ -204,7 +206,6 @@ QString localesPath() } return potentialLocalesPath; -#endif } #if BUILDFLAG(ENABLE_SPELLCHECK) @@ -257,11 +258,13 @@ QString dictionariesPath() QString icuDataPath() { + static bool initialized = false; + static QString potentialResourcesPath = #if defined(OS_MACOSX) && defined(QT_MAC_FRAMEWORK_BUILD) - return getResourcesPath(frameworkBundle()); + getResourcesPath(frameworkBundle()); #else - static bool initialized = false; - static QString potentialResourcesPath = QLibraryInfo::location(QLibraryInfo::DataPath) % QLatin1String("/resources"); + QLibraryInfo::location(QLibraryInfo::DataPath) % QLatin1String("/resources"); +#endif if (!initialized) { initialized = true; if (!QFileInfo::exists(potentialResourcesPath % QLatin1String("/icudtl.dat"))) { @@ -279,16 +282,17 @@ QString icuDataPath() } return potentialResourcesPath; -#endif } QString resourcesDataPath() { + static bool initialized = false; + static QString potentialResourcesPath = #if defined(OS_MACOSX) && defined(QT_MAC_FRAMEWORK_BUILD) - return getResourcesPath(frameworkBundle()); + getResourcesPath(frameworkBundle()); #else - static bool initialized = false; - static QString potentialResourcesPath = QLibraryInfo::location(QLibraryInfo::DataPath) % QLatin1String("/resources"); + QLibraryInfo::location(QLibraryInfo::DataPath) % QLatin1String("/resources"); +#endif if (!initialized) { initialized = true; if (!QFileInfo::exists(potentialResourcesPath % QLatin1String("/qtwebengine_resources.pak"))) { @@ -306,7 +310,6 @@ QString resourcesDataPath() } return potentialResourcesPath; -#endif } } // namespace diff --git a/src/tools/qwebengine_convert_dict/qwebengine_convert_dict.pro b/src/tools/qwebengine_convert_dict/qwebengine_convert_dict.pro index 47b7d4ff7..ced90655e 100644 --- a/src/tools/qwebengine_convert_dict/qwebengine_convert_dict.pro +++ b/src/tools/qwebengine_convert_dict/qwebengine_convert_dict.pro @@ -21,11 +21,6 @@ LIBS_PRIVATE += $$NINJA_LIB_DIRS $$NINJA_LIBS QMAKE_LFLAGS += $$NINJA_LFLAGS POST_TARGETDEPS += $$NINJA_TARGETDEPS -#ninja compiles with std::__debug -linux: CONFIG(debug, debug|release) { - DEFINES += _GLIBCXX_DEBUG -} - # Fixme: -Werror=unused-parameter in core QMAKE_CXXFLAGS_WARN_ON = diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index 18c54c263..fde7b40dc 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -56,8 +56,8 @@ #include "qquickwebengineprofile_p.h" #include "qquickwebenginesettings_p.h" #include "qquickwebenginescript_p.h" -#include "qwebenginequotapermissionrequest.h" -#include "qwebengineregisterprotocolhandlerpermissionrequest.h" +#include "qwebenginequotarequest.h" +#include "qwebengineregisterprotocolhandlerrequest.h" #ifdef ENABLE_QML_TESTSUPPORT_API #include "qquickwebenginetestsupport_p.h" @@ -590,18 +590,16 @@ void QQuickWebEngineViewPrivate::runMouseLockPermissionRequest(const QUrl &secur adapter->grantMouseLockPermission(false); } -void QQuickWebEngineViewPrivate::runQuotaPermissionRequest(QSharedPointer<QtWebEngineCore::QuotaPermissionController> controller) +void QQuickWebEngineViewPrivate::runQuotaRequest(QWebEngineQuotaRequest request) { Q_Q(QQuickWebEngineView); - QWebEngineQuotaPermissionRequest request(std::move(controller)); - Q_EMIT q->quotaPermissionRequested(request); + Q_EMIT q->quotaRequested(request); } -void QQuickWebEngineViewPrivate::runRegisterProtocolHandlerPermissionRequest(QSharedPointer<RegisterProtocolHandlerPermissionController> controller) +void QQuickWebEngineViewPrivate::runRegisterProtocolHandlerRequest(QWebEngineRegisterProtocolHandlerRequest request) { Q_Q(QQuickWebEngineView); - QWebEngineRegisterProtocolHandlerPermissionRequest request(std::move(controller)); - Q_EMIT q->registerProtocolHandlerPermissionRequested(request); + Q_EMIT q->registerProtocolHandlerRequested(request); } QObject *QQuickWebEngineViewPrivate::accessibilityParentObject() @@ -757,10 +755,9 @@ void QQuickWebEngineViewPrivate::initializationFinished() adapter->setWebChannel(m_webChannel, m_webChannelWorld); if (!qFuzzyCompare(adapter->currentZoomFactor(), m_defaultZoomFactor)) q->setZoomFactor(m_defaultZoomFactor); + if (devToolsView && devToolsView->d_ptr->adapter) adapter->openDevToolsFrontend(devToolsView->d_ptr->adapter); - else if (inspectedView && inspectedView->d_ptr->adapter) - inspectedView->d_ptr->adapter->openDevToolsFrontend(adapter); Q_FOREACH (QQuickWebEngineScript *script, m_userScripts) script->d_func()->bind(browserContextAdapter()->userResourceController(), adapter.data()); @@ -1005,7 +1002,14 @@ void QQuickWebEngineViewPrivate::startDragging(const content::DropData &dropData Qt::DropActions allowedActions, const QPixmap &pixmap, const QPoint &offset) { +#if !QT_CONFIG(draganddrop) + Q_UNUSED(dropData); + Q_UNUSED(allowedActions); + Q_UNUSED(pixmap); + Q_UNUSED(offset); +#else adapter->startDragging(q_ptr->window(), dropData, allowedActions, pixmap, offset); +#endif // QT_CONFIG(draganddrop) } bool QQuickWebEngineViewPrivate::isEnabled() const @@ -1272,10 +1276,12 @@ void QQuickWebEngineView::setDevToolsView(QQuickWebEngineView *devToolsView) d->devToolsView = devToolsView; if (devToolsView) devToolsView->setInspectedView(this); - if (devToolsView) - d->adapter->openDevToolsFrontend(devToolsView->d_ptr->adapter); - else - d->adapter->closeDevToolsFrontend(); + if (d->adapter->isInitialized()) { + if (devToolsView) + d->adapter->openDevToolsFrontend(devToolsView->d_ptr->adapter); + else + d->adapter->closeDevToolsFrontend(); + } Q_EMIT devToolsViewChanged(); } @@ -1365,6 +1371,7 @@ void QQuickWebEngineView::itemChange(ItemChange change, const ItemChangeData &va QQuickItem::itemChange(change, value); } +#if QT_CONFIG(draganddrop) static QPoint mapToScreen(const QQuickItem *item, const QPoint &clientPos) { return item->window()->position() + item->mapToScene(clientPos).toPoint(); @@ -1402,6 +1409,7 @@ void QQuickWebEngineView::dropEvent(QDropEvent *e) e->accept(); d->adapter->endDragging(e->pos(), mapToScreen(this, e->pos())); } +#endif // QT_CONFIG(draganddrop) void QQuickWebEngineView::triggerWebAction(WebAction action) { diff --git a/src/webengine/api/qquickwebengineview_p.h b/src/webengine/api/qquickwebengineview_p.h index ffa468eff..8d20740e6 100644 --- a/src/webengine/api/qquickwebengineview_p.h +++ b/src/webengine/api/qquickwebengineview_p.h @@ -76,8 +76,8 @@ class QQuickWebEngineProfile; class QQuickWebEngineSettings; class QQuickWebEngineFormValidationMessageRequest; class QQuickWebEngineViewPrivate; -class QWebEngineQuotaPermissionRequest; -class QWebEngineRegisterProtocolHandlerPermissionRequest; +class QWebEngineQuotaRequest; +class QWebEngineRegisterProtocolHandlerRequest; #ifdef ENABLE_QML_TESTSUPPORT_API class QQuickWebEngineTestSupport; @@ -541,11 +541,11 @@ Q_SIGNALS: Q_REVISION(4) void fileDialogRequested(QQuickWebEngineFileDialogRequest *request); Q_REVISION(4) void formValidationMessageRequested(QQuickWebEngineFormValidationMessageRequest *request); Q_REVISION(5) void pdfPrintingFinished(const QString &filePath, bool success); - Q_REVISION(7) void quotaPermissionRequested(const QWebEngineQuotaPermissionRequest &request); + Q_REVISION(7) void quotaRequested(const QWebEngineQuotaRequest &request); Q_REVISION(7) void geometryChangeRequested(const QRect &geometry, const QRect &frameGeometry); Q_REVISION(7) void inspectedViewChanged(); Q_REVISION(7) void devToolsViewChanged(); - Q_REVISION(7) void registerProtocolHandlerPermissionRequested(const QWebEngineRegisterProtocolHandlerPermissionRequest &request); + Q_REVISION(7) void registerProtocolHandlerRequested(const QWebEngineRegisterProtocolHandlerRequest &request); #ifdef ENABLE_QML_TESTSUPPORT_API void testSupportChanged(); @@ -554,10 +554,12 @@ Q_SIGNALS: protected: void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override; void itemChange(ItemChange, const ItemChangeData &) override; +#if QT_CONFIG(draganddrop) void dragEnterEvent(QDragEnterEvent *e) override; void dragLeaveEvent(QDragLeaveEvent *e) override; void dragMoveEvent(QDragMoveEvent *e) override; void dropEvent(QDropEvent *e) override; +#endif // QT_CONFIG(draganddrop) private: Q_DECLARE_PRIVATE(QQuickWebEngineView) diff --git a/src/webengine/api/qquickwebengineview_p_p.h b/src/webengine/api/qquickwebengineview_p_p.h index 7369a63be..73607aa59 100644 --- a/src/webengine/api/qquickwebengineview_p_p.h +++ b/src/webengine/api/qquickwebengineview_p_p.h @@ -132,8 +132,8 @@ public: void authenticationRequired(QSharedPointer<QtWebEngineCore::AuthenticationDialogController>) override; void runMediaAccessPermissionRequest(const QUrl &securityOrigin, MediaRequestFlags requestFlags) override; void runMouseLockPermissionRequest(const QUrl &securityOrigin) override; - void runQuotaPermissionRequest(QSharedPointer<QtWebEngineCore::QuotaPermissionController>) override; - void runRegisterProtocolHandlerPermissionRequest(QSharedPointer<QtWebEngineCore::RegisterProtocolHandlerPermissionController>) override; + void runQuotaRequest(QWebEngineQuotaRequest) override; + void runRegisterProtocolHandlerRequest(QWebEngineRegisterProtocolHandlerRequest) override; QObject *accessibilityParentObject() override; QtWebEngineCore::WebEngineSettings *webEngineSettings() const override; void allowCertificateError(const QSharedPointer<CertificateErrorController> &errorController) override; diff --git a/src/webengine/doc/src/qtwebengine-features.qdoc b/src/webengine/doc/src/qtwebengine-features.qdoc index 04c99bd21..96b5072ee 100644 --- a/src/webengine/doc/src/qtwebengine-features.qdoc +++ b/src/webengine/doc/src/qtwebengine-features.qdoc @@ -44,6 +44,7 @@ \li \l{Native Dialogs} \li \l{Pepper Plugin API} \li \l{Print to PDF} + \li \l{Process Models} \li \l{Spellchecker} \li \l{Touch} \li \l{View Source} @@ -280,6 +281,62 @@ Support for this feature was added in Qt 5.7.0. + \section1 Process Models + + Qt WebEngine uses multiple OS processes to isolate web sites from each other + and from the client application, improving security and robustness. The + following process models, or ways to divide web sites between OS processes, + are supported: + + \list + \li \l{Process per Site Instance} + \li \l{Process per Site} + \li \l{Single Process} + \endlist + + \section2 Process per Site Instance + + This is the default model. Pages from separate sites are put into separate + processes and separate visits to the same site are also isolated. + + Two web pages are considered as belonging to the same site if they originate + from the same registered domain name (for example, \c wikipedia.org) and + scheme (for example, \c https). This is similar to the same-origin policy + but subdomains are ignored. For example, both \c{https://en.wikipedia.org/} + and \c{https://de.wikipedia.org/} would belong to the same site. + + A site instance is a collection of web pages belonging to the same site. + When the application explicitly loads a URL into Qt WebEngine (via \l + QWebEnginePage::setUrl, for example), a new site instance is created for the + page. However, when the user clicks same-site links on the page, the + existing site instance is merely extended with more pages. + + For instance, in the \l{WebEngine Widgets Simple Browser Example}{Simple + Browser} example, when a user opens two tabs and explicitly enters + \c{https://en.wikipedia.org/} into the URL bars, both tabs will have their + own separate OS processes (because explicitly entering a URL creates a new + site instance). However, when the user then middle-clicks some same-site + links to open more tabs, these new tabs will share the same OS process + (because user interaction extends the existing site instance). + + \section2 Process per Site + + Pages from separate sites are put into separate processes. Unlike Process + per Site Instance, all visits to the same site will share an OS process. + + The benefit of this model is reduced memory consumption, because more web + pages will share processes. The drawbacks include reduced security, + robustness, and responsiveness. + + To enable this model, use the command-line argument \c{--process-per-site}. + See \l{Using Command-Line Arguments}. + + \section2 Single Process + + For debugging purposes only, a single process mode can be enabled using the + command-line argument \c{--single-process}. See \l{Using Command-Line + Arguments} and \l{Qt WebEngine Debugging and Profiling}. + \section1 Spellchecker Qt WebEngine supports integrating spellchecking support into HTML forms to diff --git a/src/webengine/doc/src/webengineview_lgpl.qdoc b/src/webengine/doc/src/webengineview_lgpl.qdoc index 1621d0821..a6a7c088b 100644 --- a/src/webengine/doc/src/webengineview_lgpl.qdoc +++ b/src/webengine/doc/src/webengineview_lgpl.qdoc @@ -1294,49 +1294,49 @@ */ /*! - \qmlsignal WebEngineView::quotaPermissionRequested(QuotaPermissionRequest request) + \qmlsignal WebEngineView::quotaRequested(QuotaRequest request) \since QtWebEngine 1.7 This signal is emitted when the web page requests larger persistent storage than the application's current allocation in File System API. The default quota is 0 bytes. - \sa QuotaPermissionRequest + \sa QuotaRequest */ /*! - \qmltype QuotaPermissionRequest - \instantiates QWebEngineQuotaPermissionRequest + \qmltype QuotaRequest + \instantiates QWebEngineQuotaRequest \inqmlmodule QtWebEngine \since QtWebEngine 1.7 - \brief A utility type for the WebEngineView::quotaPermissionRequested() signal. + \brief A utility type for the WebEngineView::quotaRequested() signal. - \sa WebEngineView::quotaPermissionRequested() + \sa WebEngineView::quotaRequested() */ /*! - \qmlproperty url QuotaPermissionRequest::origin + \qmlproperty url QuotaRequest::origin \readonly - The URL of the web page that issued the quota permission request. + The URL of the web page that issued the quota request. */ /*! - \qmlproperty qint64 QuotaPermissionRequest::requestedSize + \qmlproperty qint64 QuotaRequest::requestedSize \readonly Contains the size of the requested disk space in bytes. */ /*! - \qmlmethod void QuotaPermissionRequest::accept() + \qmlmethod void QuotaRequest::accept() - Accepts the quota permission request. + Accepts the quota request. \qml WebEngineView { - onQuotaPermissionRequested: function(request) { + onQuotaRequested: function(request) { if (request.requestedSize <= 5 * 1024 * 1024) request.accept(); else @@ -1347,54 +1347,54 @@ */ /*! - \qmlmethod void QuotaPermissionRequest::reject() - Rejects a quota permission request. + \qmlmethod void QuotaRequest::reject() + Rejects the quota request. */ /*! - \qmlsignal WebEngineView::registerProtocolHandlerPermissionRequested(RegisterProtocolHandlerPermissionRequest request) + \qmlsignal WebEngineView::registerProtocolHandlerRequested(RegisterProtocolHandlerRequest request) \since QtWebEngine 1.7 This signal is emitted when the web page tries to register a custom protocol using the \l registerProtocolHandler API. - \sa RegisterProtocolHandlerPermissionRequest + \sa RegisterProtocolHandlerRequest */ /*! - \qmltype RegisterProtocolHandlerPermissionRequest - \instantiates QWebEngineRegisterProtocolHandlerPermissionRequest + \qmltype RegisterProtocolHandlerRequest + \instantiates QWebEngineRegisterProtocolHandlerRequest \inqmlmodule QtWebEngine \since QtWebEngine 1.7 - \brief The RegisterProtocolHandlerPermissionRequest type enables accepting + \brief The RegisterProtocolHandlerRequest type enables accepting or rejecting requests from the \l registerProtocolHandler API. - \sa WebEngineView::registerProtocolHandlerPermissionRequested() + \sa WebEngineView::registerProtocolHandlerRequested() */ /*! - \qmlproperty url RegisterProtocolHandlerPermissionRequest::origin + \qmlproperty url RegisterProtocolHandlerRequest::origin \brief The URL template for the protocol handler. This is the second parameter from the \l registerProtocolHandler call. */ /*! - \qmlproperty string RegisterProtocolHandlerPermissionRequest::scheme + \qmlproperty string RegisterProtocolHandlerRequest::scheme \brief The URL scheme for the protocol handler. This is the first parameter from the \l registerProtocolHandler call. */ /*! - \qmlmethod void RegisterProtocolHandlerPermissionRequest::accept() + \qmlmethod void RegisterProtocolHandlerRequest::accept() \brief Accepts the request. Subsequent calls to accept() and reject() are ignored. */ /*! - \qmlmethod void RegisterProtocolHandlerPermissionRequest::reject() + \qmlmethod void RegisterProtocolHandlerRequest::reject() \brief Accepts the request. Subsequent calls to accept() and reject() are ignored. diff --git a/src/webengine/plugin/dependencies.json b/src/webengine/plugin/dependencies.json index 115ba72e7..ef26b3617 100644 --- a/src/webengine/plugin/dependencies.json +++ b/src/webengine/plugin/dependencies.json @@ -2,6 +2,6 @@ { "name": "QtQuick", "type": "module", - "version": "2.6" + "version": "2.8" } ] diff --git a/src/webengine/plugin/plugin.cpp b/src/webengine/plugin/plugin.cpp index c9c9555e9..d81b797fc 100644 --- a/src/webengine/plugin/plugin.cpp +++ b/src/webengine/plugin/plugin.cpp @@ -52,8 +52,8 @@ #include "qquickwebenginesettings_p.h" #include "qquickwebenginesingleton_p.h" #include "qquickwebengineview_p.h" -#include "qwebenginequotapermissionrequest.h" -#include "qwebengineregisterprotocolhandlerpermissionrequest.h" +#include "qwebenginequotarequest.h" +#include "qwebengineregisterprotocolhandlerrequest.h" #include "qtwebengineversion.h" QT_BEGIN_NAMESPACE @@ -141,12 +141,12 @@ public: msgUncreatableType("FileDialogRequest")); qmlRegisterUncreatableType<QQuickWebEngineFormValidationMessageRequest>(uri, 1, 4, "FormValidationMessageRequest", msgUncreatableType("FormValidationMessageRequest")); - qRegisterMetaType<QWebEngineQuotaPermissionRequest>(); - qmlRegisterUncreatableType<QWebEngineQuotaPermissionRequest>(uri, 1, 7, "QuotaPermissionRequest", - msgUncreatableType("QuotaPermissionRequest")); - qRegisterMetaType<QWebEngineRegisterProtocolHandlerPermissionRequest>(); - qmlRegisterUncreatableType<QWebEngineRegisterProtocolHandlerPermissionRequest>(uri, 1, 7, "RegisterProtocolHandlerPermissionRequest", - msgUncreatableType("RegisterProtocolHandlerPermissionRequest")); + qRegisterMetaType<QWebEngineQuotaRequest>(); + qmlRegisterUncreatableType<QWebEngineQuotaRequest>(uri, 1, 7, "QuotaRequest", + msgUncreatableType("QuotaRequest")); + qRegisterMetaType<QWebEngineRegisterProtocolHandlerRequest>(); + qmlRegisterUncreatableType<QWebEngineRegisterProtocolHandlerRequest>(uri, 1, 7, "RegisterProtocolHandlerRequest", + msgUncreatableType("RegisterProtocolHandlerRequest")); } diff --git a/src/webengine/plugin/plugins.qmltypes b/src/webengine/plugin/plugins.qmltypes index a1af20503..5c61ee8d0 100644 --- a/src/webengine/plugin/plugins.qmltypes +++ b/src/webengine/plugin/plugins.qmltypes @@ -7,7 +7,7 @@ import QtQuick.tooling 1.2 // 'qmlplugindump -defaultplatform -dependencies dependencies.json -nonrelocatable QtWebEngine 1.7' Module { - dependencies: ["QtQuick 2.6"] + dependencies: ["QtQuick 2.8"] Component { name: "QQuickWebEngineAuthenticationDialogRequest" prototype: "QObject" @@ -154,10 +154,11 @@ Module { "QtWebEngine/WebEngineDownloadItem 1.3", "QtWebEngine/WebEngineDownloadItem 1.4", "QtWebEngine/WebEngineDownloadItem 1.5", - "QtWebEngine/WebEngineDownloadItem 1.6" + "QtWebEngine/WebEngineDownloadItem 1.6", + "QtWebEngine/WebEngineDownloadItem 1.7" ] isCreatable: false - exportMetaObjectRevisions: [0, 1, 2, 3, 4, 5] + exportMetaObjectRevisions: [0, 1, 2, 3, 4, 5, 6] Enum { name: "DownloadState" values: { @@ -467,16 +468,6 @@ Module { Method { name: "clearHttpCache"; revision: 2 } } Component { - name: "QQuickWebEngineQuotaPermissionRequest" - exports: ["QtWebEngine/QuotaPermissionRequest 1.7"] - isCreatable: false - exportMetaObjectRevisions: [0] - Property { name: "origin"; type: "QUrl"; isReadonly: true } - Property { name: "requestedSize"; type: "qlonglong"; isReadonly: true } - Method { name: "accept" } - Method { name: "reject" } - } - Component { name: "QQuickWebEngineScript" prototype: "QObject" exports: ["QtWebEngine/WebEngineScript 1.1"] @@ -603,6 +594,7 @@ Module { Property { name: "unknownUrlSchemePolicy"; revision: 6; type: "UnknownUrlSchemePolicy" } Property { name: "playbackRequiresUserGesture"; revision: 6; type: "bool" } Property { name: "webRTCPublicInterfacesOnly"; revision: 6; type: "bool" } + Property { name: "javascriptCanPaste"; revision: 6; type: "bool" } Signal { name: "fullScreenSupportEnabledChanged"; revision: 1 } Signal { name: "screenCaptureEnabledChanged"; revision: 2 } Signal { name: "webGLEnabledChanged"; revision: 2 } @@ -618,6 +610,7 @@ Module { Signal { name: "unknownUrlSchemePolicyChanged"; revision: 6 } Signal { name: "playbackRequiresUserGestureChanged"; revision: 6 } Signal { name: "webRTCPublicInterfacesOnlyChanged"; revision: 6 } + Signal { name: "javascriptCanPasteChanged"; revision: 6 } } Component { name: "QQuickWebEngineSingleton" @@ -1096,9 +1089,9 @@ Module { Parameter { name: "success"; type: "bool" } } Signal { - name: "quotaPermissionRequested" + name: "quotaRequested" revision: 7 - Parameter { name: "request"; type: "QQuickWebEngineQuotaPermissionRequest" } + Parameter { name: "request"; type: "QWebEngineQuotaRequest" } } Signal { name: "geometryChangeRequested" @@ -1108,6 +1101,11 @@ Module { } Signal { name: "inspectedViewChanged"; revision: 7 } Signal { name: "devToolsViewChanged"; revision: 7 } + Signal { + name: "registerProtocolHandlerRequested" + revision: 7 + Parameter { name: "request"; type: "QWebEngineRegisterProtocolHandlerRequest" } + } Method { name: "runJavaScript" Parameter { type: "string" } @@ -1227,4 +1225,24 @@ Module { Parameter { name: "replacement"; type: "string" } } } + Component { + name: "QWebEngineQuotaRequest" + exports: ["QtWebEngine/QuotaRequest 1.7"] + isCreatable: false + exportMetaObjectRevisions: [0] + Property { name: "origin"; type: "QUrl"; isReadonly: true } + Property { name: "requestedSize"; type: "qlonglong"; isReadonly: true } + Method { name: "accept" } + Method { name: "reject" } + } + Component { + name: "QWebEngineRegisterProtocolHandlerRequest" + exports: ["QtWebEngine/RegisterProtocolHandlerRequest 1.7"] + isCreatable: false + exportMetaObjectRevisions: [0] + Property { name: "origin"; type: "QUrl"; isReadonly: true } + Property { name: "scheme"; type: "string"; isReadonly: true } + Method { name: "accept" } + Method { name: "reject" } + } } diff --git a/src/webenginewidgets/api/qwebenginecontextmenudata.h b/src/webenginewidgets/api/qwebenginecontextmenudata.h index 24fbd5c09..5834df31a 100644 --- a/src/webenginewidgets/api/qwebenginecontextmenudata.h +++ b/src/webenginewidgets/api/qwebenginecontextmenudata.h @@ -125,6 +125,9 @@ private: friend class QWebEnginePage; }; +Q_DECLARE_OPERATORS_FOR_FLAGS(QWebEngineContextMenuData::MediaFlags) +Q_DECLARE_OPERATORS_FOR_FLAGS(QWebEngineContextMenuData::EditFlags) + QT_END_NAMESPACE #endif // QWEBENGINECONTEXTDATA_H diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index 1c42628ee..8911c63c8 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -53,8 +53,8 @@ #include "qwebenginehistory_p.h" #include "qwebengineprofile.h" #include "qwebengineprofile_p.h" -#include "qwebenginequotapermissionrequest.h" -#include "qwebengineregisterprotocolhandlerpermissionrequest.h" +#include "qwebenginequotarequest.h" +#include "qwebengineregisterprotocolhandlerrequest.h" #include "qwebenginescriptcollection_p.h" #include "qwebenginesettings.h" #include "qwebengineview.h" @@ -234,8 +234,8 @@ QWebEnginePagePrivate::QWebEnginePagePrivate(QWebEngineProfile *_profile) { memset(actions, 0, sizeof(actions)); - qRegisterMetaType<QWebEngineQuotaPermissionRequest>(); - qRegisterMetaType<QWebEngineRegisterProtocolHandlerPermissionRequest>(); + qRegisterMetaType<QWebEngineQuotaRequest>(); + qRegisterMetaType<QWebEngineRegisterProtocolHandlerRequest>(); // See wasShown() and wasHidden(). wasShownTimer.setSingleShot(true); @@ -588,18 +588,16 @@ void QWebEnginePagePrivate::runMouseLockPermissionRequest(const QUrl &securityOr Q_EMIT q->featurePermissionRequested(securityOrigin, QWebEnginePage::MouseLock); } -void QWebEnginePagePrivate::runQuotaPermissionRequest(QSharedPointer<QtWebEngineCore::QuotaPermissionController> controller) +void QWebEnginePagePrivate::runQuotaRequest(QWebEngineQuotaRequest request) { Q_Q(QWebEnginePage); - QWebEngineQuotaPermissionRequest request(controller); - Q_EMIT q->quotaPermissionRequested(request); + Q_EMIT q->quotaRequested(request); } -void QWebEnginePagePrivate::runRegisterProtocolHandlerPermissionRequest(QSharedPointer<RegisterProtocolHandlerPermissionController> controller) +void QWebEnginePagePrivate::runRegisterProtocolHandlerRequest(QWebEngineRegisterProtocolHandlerRequest request) { Q_Q(QWebEnginePage); - QWebEngineRegisterProtocolHandlerPermissionRequest request(std::move(controller)); - Q_EMIT q->registerProtocolHandlerPermissionRequested(request); + Q_EMIT q->registerProtocolHandlerRequested(request); } QObject *QWebEnginePagePrivate::accessibilityParentObject() @@ -773,18 +771,18 @@ QWebEnginePage::QWebEnginePage(QObject* parent) */ /*! - \fn QWebEnginePage::quotaPermissionRequested(QWebEngineQuotaPermissionRequest quotaPermissionRequest) + \fn QWebEnginePage::quotaRequested(QWebEngineQuotaRequest quotaRequest) \since 5.11 This signal is emitted when the web page requests larger persistent storage than the application's current allocation in File System API. The default quota is 0 bytes. - The request object \a quotaPermissionRequest can be used to accept or reject the request. + The request object \a quotaRequest can be used to accept or reject the request. */ /*! - \fn QWebEnginePage::registerProtocolHandlerPermissionRequested(QWebEngineRegisterProtocolHandlerPermissionRequest request) + \fn QWebEnginePage::registerProtocolHandlerRequested(QWebEngineRegisterProtocolHandlerRequest request) \since 5.11 This signal is emitted when the web page tries to register a custom protocol @@ -792,7 +790,7 @@ QWebEnginePage::QWebEnginePage(QObject* parent) The request object \a request can be used to accept or reject the request: - \snippet webenginewidgets/simplebrowser/webpage.cpp registerProtocolHandlerPermissionRequested + \snippet webenginewidgets/simplebrowser/webpage.cpp registerProtocolHandlerRequested */ /*! @@ -1665,7 +1663,14 @@ void QWebEnginePagePrivate::startDragging(const content::DropData &dropData, Qt::DropActions allowedActions, const QPixmap &pixmap, const QPoint &offset) { +#if !QT_CONFIG(draganddrop) + Q_UNUSED(dropData); + Q_UNUSED(allowedActions); + Q_UNUSED(pixmap); + Q_UNUSED(offset); +#else adapter->startDragging(view, dropData, allowedActions, pixmap, offset); +#endif // QT_CONFIG(draganddrop) } bool QWebEnginePagePrivate::isEnabled() const diff --git a/src/webenginewidgets/api/qwebenginepage.h b/src/webenginewidgets/api/qwebenginepage.h index f81ba7373..3edfb96d0 100644 --- a/src/webenginewidgets/api/qwebenginepage.h +++ b/src/webenginewidgets/api/qwebenginepage.h @@ -65,8 +65,8 @@ class QWebEngineHistory; class QWebEnginePage; class QWebEnginePagePrivate; class QWebEngineProfile; -class QWebEngineQuotaPermissionRequest; -class QWebEngineRegisterProtocolHandlerPermissionRequest; +class QWebEngineQuotaRequest; +class QWebEngineRegisterProtocolHandlerRequest; class QWebEngineScriptCollection; class QWebEngineSettings; @@ -316,8 +316,8 @@ Q_SIGNALS: void featurePermissionRequested(const QUrl &securityOrigin, QWebEnginePage::Feature feature); void featurePermissionRequestCanceled(const QUrl &securityOrigin, QWebEnginePage::Feature feature); void fullScreenRequested(QWebEngineFullScreenRequest fullScreenRequest); - void quotaPermissionRequested(QWebEngineQuotaPermissionRequest quotaPermissionRequest); - void registerProtocolHandlerPermissionRequested(QWebEngineRegisterProtocolHandlerPermissionRequest request); + void quotaRequested(QWebEngineQuotaRequest quotaRequest); + void registerProtocolHandlerRequested(QWebEngineRegisterProtocolHandlerRequest request); void authenticationRequired(const QUrl &requestUrl, QAuthenticator *authenticator); void proxyAuthenticationRequired(const QUrl &requestUrl, QAuthenticator *authenticator, const QString &proxyHost); @@ -364,6 +364,7 @@ private: #endif // QT_NO_ACCESSIBILITY }; +Q_DECLARE_OPERATORS_FOR_FLAGS(QWebEnginePage::FindFlags) QT_END_NAMESPACE diff --git a/src/webenginewidgets/api/qwebenginepage_p.h b/src/webenginewidgets/api/qwebenginepage_p.h index fd7928006..dc7d02b73 100644 --- a/src/webenginewidgets/api/qwebenginepage_p.h +++ b/src/webenginewidgets/api/qwebenginepage_p.h @@ -131,8 +131,8 @@ public: void runMediaAccessPermissionRequest(const QUrl &securityOrigin, MediaRequestFlags requestFlags) override; void runGeolocationPermissionRequest(const QUrl &securityOrigin) override; void runMouseLockPermissionRequest(const QUrl &securityOrigin) override; - void runQuotaPermissionRequest(QSharedPointer<QtWebEngineCore::QuotaPermissionController>) override; - void runRegisterProtocolHandlerPermissionRequest(QSharedPointer<QtWebEngineCore::RegisterProtocolHandlerPermissionController>) override; + void runQuotaRequest(QWebEngineQuotaRequest) override; + void runRegisterProtocolHandlerRequest(QWebEngineRegisterProtocolHandlerRequest) override; QObject *accessibilityParentObject() override; QtWebEngineCore::WebEngineSettings *webEngineSettings() const override; void allowCertificateError(const QSharedPointer<CertificateErrorController> &controller) override; diff --git a/src/webenginewidgets/api/qwebengineview.cpp b/src/webenginewidgets/api/qwebengineview.cpp index 649ccb938..80c60e1a8 100644 --- a/src/webenginewidgets/api/qwebengineview.cpp +++ b/src/webenginewidgets/api/qwebengineview.cpp @@ -362,6 +362,7 @@ void QWebEngineView::hideEvent(QHideEvent *event) page()->d_ptr->wasHidden(); } +#if QT_CONFIG(draganddrop) /*! \reimp */ @@ -418,6 +419,7 @@ void QWebEngineView::dropEvent(QDropEvent *e) d->page->d_ptr->adapter->endDragging(e->pos(), mapToGlobal(e->pos())); d->m_dragEntered = false; } +#endif // QT_CONFIG(draganddrop) #ifndef QT_NO_ACCESSIBILITY int QWebEngineViewAccessible::childCount() const diff --git a/src/webenginewidgets/api/qwebengineview.h b/src/webenginewidgets/api/qwebengineview.h index 6abbc1342..77d26b8ec 100644 --- a/src/webenginewidgets/api/qwebengineview.h +++ b/src/webenginewidgets/api/qwebengineview.h @@ -124,10 +124,12 @@ protected: bool event(QEvent*) override; void showEvent(QShowEvent *) override; void hideEvent(QHideEvent *) override; +#if QT_CONFIG(draganddrop) void dragEnterEvent(QDragEnterEvent *e) override; void dragLeaveEvent(QDragLeaveEvent *e) override; void dragMoveEvent(QDragMoveEvent *e) override; void dropEvent(QDropEvent *e) override; +#endif // QT_CONFIG(draganddrop) private: Q_DISABLE_COPY(QWebEngineView) diff --git a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp index 9e2f6ed99..16ea216f2 100644 --- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp +++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp @@ -269,6 +269,7 @@ void RenderWidgetHostViewQtDelegateWidget::unlockMouse() void RenderWidgetHostViewQtDelegateWidget::show() { + m_rootItem->setVisible(true); // Check if we're attached to a QWebEngineView, we don't // want to show anything else than popups as top-level. if (parent() || m_isPopup) { @@ -278,12 +279,12 @@ void RenderWidgetHostViewQtDelegateWidget::show() void RenderWidgetHostViewQtDelegateWidget::hide() { - QQuickWidget::hide(); + m_rootItem->setVisible(false); } bool RenderWidgetHostViewQtDelegateWidget::isVisible() const { - return QQuickWidget::isVisible(); + return QQuickWidget::isVisible() && m_rootItem->isVisible(); } QWindow* RenderWidgetHostViewQtDelegateWidget::window() const |