summaryrefslogtreecommitdiffstats
path: root/src/core/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/api')
-rw-r--r--src/core/api/core_api.pro4
-rw-r--r--src/core/api/qtwebenginecoreglobal.cpp6
-rw-r--r--src/core/api/qtwebenginecoreglobal.h4
-rw-r--r--src/core/api/qtwebenginecoreglobal_p.h2
-rw-r--r--src/core/api/qwebenginecallback.h20
-rw-r--r--src/core/api/qwebenginecallback_p.h85
-rw-r--r--src/core/api/qwebengineclientcertificatestore.cpp120
-rw-r--r--src/core/api/qwebengineclientcertificatestore.h79
-rw-r--r--src/core/api/qwebenginecookiestore.cpp21
-rw-r--r--src/core/api/qwebenginecookiestore.h6
-rw-r--r--src/core/api/qwebenginecookiestore_p.h6
-rw-r--r--src/core/api/qwebenginehttprequest.cpp42
-rw-r--r--src/core/api/qwebenginehttprequest.h19
-rw-r--r--src/core/api/qwebenginemessagepumpscheduler_p.h3
-rw-r--r--src/core/api/qwebenginenotification.cpp323
-rw-r--r--src/core/api/qwebenginenotification.h99
-rw-r--r--src/core/api/qwebenginequotarequest.cpp3
-rw-r--r--src/core/api/qwebenginequotarequest.h5
-rw-r--r--src/core/api/qwebengineregisterprotocolhandlerrequest.cpp2
-rw-r--r--src/core/api/qwebengineregisterprotocolhandlerrequest.h8
-rw-r--r--src/core/api/qwebengineurlrequestinfo.cpp41
-rw-r--r--src/core/api/qwebengineurlrequestinfo.h9
-rw-r--r--src/core/api/qwebengineurlrequestinfo_p.h11
-rw-r--r--src/core/api/qwebengineurlrequestinterceptor.h8
-rw-r--r--src/core/api/qwebengineurlrequestjob.cpp14
-rw-r--r--src/core/api/qwebengineurlrequestjob.h7
-rw-r--r--src/core/api/qwebengineurlscheme.cpp10
-rw-r--r--src/core/api/qwebengineurlscheme.h6
-rw-r--r--src/core/api/qwebengineurlschemehandler.cpp1
-rw-r--r--src/core/api/qwebengineurlschemehandler.h9
30 files changed, 791 insertions, 182 deletions
diff --git a/src/core/api/core_api.pro b/src/core/api/core_api.pro
index 4b69b348a..326d4481f 100644
--- a/src/core/api/core_api.pro
+++ b/src/core/api/core_api.pro
@@ -32,12 +32,14 @@ gcc: QMAKE_CXXFLAGS_WARN_ON = -Wno-unused-parameter
HEADERS = \
qwebenginecallback.h \
qwebenginecallback_p.h \
+ qwebengineclientcertificatestore.h \
qtwebenginecoreglobal.h \
qtwebenginecoreglobal_p.h \
qwebenginecookiestore.h \
qwebenginecookiestore_p.h \
qwebenginehttprequest.h \
qwebenginemessagepumpscheduler_p.h \
+ qwebenginenotification.h \
qwebenginequotarequest.h \
qwebengineregisterprotocolhandlerrequest.h \
qwebengineurlrequestinterceptor.h \
@@ -49,9 +51,11 @@ HEADERS = \
SOURCES = \
qtwebenginecoreglobal.cpp \
+ qwebengineclientcertificatestore.cpp \
qwebenginecookiestore.cpp \
qwebenginehttprequest.cpp \
qwebenginemessagepumpscheduler.cpp \
+ qwebenginenotification.cpp \
qwebenginequotarequest.cpp \
qwebengineregisterprotocolhandlerrequest.cpp \
qwebengineurlrequestinfo.cpp \
diff --git a/src/core/api/qtwebenginecoreglobal.cpp b/src/core/api/qtwebenginecoreglobal.cpp
index 5a634641b..25d0bd3be 100644
--- a/src/core/api/qtwebenginecoreglobal.cpp
+++ b/src/core/api/qtwebenginecoreglobal.cpp
@@ -58,7 +58,8 @@ QT_END_NAMESPACE
#ifndef QT_NO_OPENGL
#ifdef Q_OS_MACOS
-static bool needsOfflineRendererWorkaround() {
+static bool needsOfflineRendererWorkaround()
+{
size_t hwmodelsize = 0;
if (sysctlbyname("hw.model", nullptr, &hwmodelsize, nullptr, 0) == -1)
@@ -91,7 +92,7 @@ static void deleteShareContext()
// after the QGuiApplication creation, when AA_ShareOpenGLContexts fills
// the same need but the flag has to be set earlier.
-QWEBENGINECORE_PRIVATE_EXPORT void initialize()
+Q_WEBENGINECORE_PRIVATE_EXPORT void initialize()
{
#ifndef QT_NO_OPENGL
#ifdef Q_OS_WIN32
@@ -133,4 +134,3 @@ QWEBENGINECORE_PRIVATE_EXPORT void initialize()
#endif // QT_NO_OPENGL
}
} // namespace QtWebEngineCore
-
diff --git a/src/core/api/qtwebenginecoreglobal.h b/src/core/api/qtwebenginecoreglobal.h
index bcff622b7..c425d1478 100644
--- a/src/core/api/qtwebenginecoreglobal.h
+++ b/src/core/api/qtwebenginecoreglobal.h
@@ -46,9 +46,9 @@
QT_BEGIN_NAMESPACE
#if defined(BUILDING_CHROMIUM)
-# define QWEBENGINECORE_EXPORT Q_DECL_EXPORT
+# define Q_WEBENGINECORE_EXPORT Q_DECL_EXPORT
#else
-# define QWEBENGINECORE_EXPORT Q_DECL_IMPORT
+# define Q_WEBENGINECORE_EXPORT Q_DECL_IMPORT
#endif
#define ASSERT_ENUMS_MATCH(A, B) Q_STATIC_ASSERT_X(static_cast<int>(A) == static_cast<int>(B), "The enum values must match");
diff --git a/src/core/api/qtwebenginecoreglobal_p.h b/src/core/api/qtwebenginecoreglobal_p.h
index 27bf2d9f9..655b2a814 100644
--- a/src/core/api/qtwebenginecoreglobal_p.h
+++ b/src/core/api/qtwebenginecoreglobal_p.h
@@ -63,6 +63,6 @@
#define QT_NOT_USED Q_UNREACHABLE(); // This will assert in debug.
#endif
-#define QWEBENGINECORE_PRIVATE_EXPORT QWEBENGINECORE_EXPORT
+#define Q_WEBENGINECORE_PRIVATE_EXPORT Q_WEBENGINECORE_EXPORT
#endif // QTWEBENGINECOREGLOBAL_P_H
diff --git a/src/core/api/qwebenginecallback.h b/src/core/api/qwebenginecallback.h
index b981b2afb..49efc50b2 100644
--- a/src/core/api/qwebenginecallback.h
+++ b/src/core/api/qwebenginecallback.h
@@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE
namespace QtWebEnginePrivate {
-template <typename T>
+template<typename T>
class QWebEngineCallbackPrivateBase : public QSharedData {
public:
QWebEngineCallbackPrivateBase() {}
@@ -62,32 +62,32 @@ public:
virtual void operator()(T) = 0;
};
-template <typename T, typename F>
+template<typename T, typename F>
class QWebEngineCallbackPrivate : public QWebEngineCallbackPrivateBase<T> {
public:
- QWebEngineCallbackPrivate(F callable)
- : m_callable(callable)
- {}
+ QWebEngineCallbackPrivate(F callable) : m_callable(callable) {}
void operator()(T value) override { m_callable(value); }
+
private:
F m_callable;
};
} // namespace QtWebEnginePrivate
-template <typename T>
+template<typename T>
class QWebEngineCallback {
public:
- template <typename F>
+ template<typename F>
QWebEngineCallback(F f)
: d(new QtWebEnginePrivate::QWebEngineCallbackPrivate<T, F>(f))
- { }
- QWebEngineCallback() { }
+ {}
+ QWebEngineCallback() {}
void swap(QWebEngineCallback &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
operator bool() const { return d; }
+
private:
friend class QtWebEngineCore::CallbackDirectory;
- QExplicitlySharedDataPointer<QtWebEnginePrivate::QWebEngineCallbackPrivateBase<T> > d;
+ QExplicitlySharedDataPointer<QtWebEnginePrivate::QWebEngineCallbackPrivateBase<T>> d;
};
Q_DECLARE_SHARED(QWebEngineCallback<int>)
diff --git a/src/core/api/qwebenginecallback_p.h b/src/core/api/qwebenginecallback_p.h
index 24b4495df..133a86f6d 100644
--- a/src/core/api/qwebenginecallback_p.h
+++ b/src/core/api/qwebenginecallback_p.h
@@ -62,11 +62,11 @@
#include <type_traits>
// keep in sync with Q_DECLARE_SHARED... in qwebenginecallback.h
-#define FOR_EACH_TYPE(F) \
- F(bool) \
- F(int) \
- F(const QString &) \
- F(const QByteArray &) \
+#define FOR_EACH_TYPE(F) \
+ F(bool) \
+ F(int) \
+ F(const QString &) \
+ F(const QByteArray &) \
F(const QVariant &)
namespace QtWebEngineCore {
@@ -82,7 +82,7 @@ public:
{
// "Cancel" pending callbacks by calling them with an invalid value.
// This guarantees that each callback is called exactly once.
- for (CallbackSharedDataPointerBase * const sharedPtrBase: m_callbackMap) {
+ for (CallbackSharedDataPointerBase *const sharedPtrBase : m_callbackMap) {
Q_ASSERT(sharedPtrBase);
sharedPtrBase->invokeEmpty();
delete sharedPtrBase;
@@ -106,20 +106,18 @@ public:
template<typename T>
void invokeEmpty(const QWebEngineCallback<T> &callback);
-#define DEFINE_INVOKE_FOR_TYPE(Type) \
- void invoke(quint64 callbackId, Type result) { \
- invokeInternal<Type>(callbackId, std::forward<Type>(result)); \
- }
+#define DEFINE_INVOKE_FOR_TYPE(Type) \
+ void invoke(quint64 callbackId, Type result) { invokeInternal<Type>(callbackId, std::forward<Type>(result)); }
FOR_EACH_TYPE(DEFINE_INVOKE_FOR_TYPE)
#undef DEFINE_INVOKE_FOR_TYPE
- template <typename A>
+ template<typename A>
void invokeDirectly(const QWebEngineCallback<typename std::remove_reference<A>::type &> &callback, A &argument)
{
return callback.d.data()->operator()(argument);
}
- template <typename A>
+ template<typename A>
void invokeDirectly(const QWebEngineCallback<typename std::remove_reference<A>::type> &callback, const A &argument)
{
return callback.d.data()->operator()(std::forward<const A &>(argument));
@@ -127,39 +125,45 @@ public:
private:
struct CallbackSharedDataPointerBase {
- virtual ~CallbackSharedDataPointerBase() { }
+ virtual ~CallbackSharedDataPointerBase() {}
virtual void invokeEmpty() = 0;
virtual void doRef() = 0;
virtual void doDeref() = 0;
- virtual operator bool () const = 0;
+ virtual operator bool() const = 0;
};
- template <typename T>
+ template<typename T>
struct CallbackSharedDataPointer : public CallbackSharedDataPointerBase {
- CallbackDirectory* parent;
+ CallbackDirectory *parent;
QtWebEnginePrivate::QWebEngineCallbackPrivateBase<T> *callback;
~CallbackSharedDataPointer() { doDeref(); }
- CallbackSharedDataPointer() : parent(0), callback(0) { }
+ CallbackSharedDataPointer() : parent(0), callback(0) {}
CallbackSharedDataPointer(const CallbackSharedDataPointer<T> &other)
- : parent(other.parent), callback(other.callback) { doRef(); }
+ : parent(other.parent), callback(other.callback)
+ {
+ doRef();
+ }
CallbackSharedDataPointer(CallbackDirectory *p, QtWebEnginePrivate::QWebEngineCallbackPrivateBase<T> *c)
- : parent(p), callback(c) { Q_ASSERT(callback); doRef(); }
+ : parent(p), callback(c)
+ {
+ Q_ASSERT(callback);
+ doRef();
+ }
void invokeEmpty() override;
- operator bool () const override { return callback; }
+ operator bool() const override { return callback; }
private:
void doRef() override;
void doDeref() override;
};
- QHash<quint64, CallbackSharedDataPointerBase*> m_callbackMap;
+ QHash<quint64, CallbackSharedDataPointerBase *> m_callbackMap;
};
template<typename T>
-inline
-void CallbackDirectory::registerCallback(quint64 callbackId, const QWebEngineCallback<T> &callback)
+inline void CallbackDirectory::registerCallback(quint64 callbackId, const QWebEngineCallback<T> &callback)
{
if (!callback.d)
return;
@@ -167,10 +171,9 @@ void CallbackDirectory::registerCallback(quint64 callbackId, const QWebEngineCal
}
template<typename T>
-inline
-void CallbackDirectory::invokeInternal(quint64 callbackId, T result)
+inline void CallbackDirectory::invokeInternal(quint64 callbackId, T result)
{
- CallbackSharedDataPointerBase * const sharedPtrBase = m_callbackMap.take(callbackId);
+ CallbackSharedDataPointerBase *const sharedPtrBase = m_callbackMap.take(callbackId);
if (!sharedPtrBase)
return;
@@ -181,8 +184,7 @@ void CallbackDirectory::invokeInternal(quint64 callbackId, T result)
}
template<typename T>
-inline
-void CallbackDirectory::invokeEmptyInternal(QtWebEnginePrivate::QWebEngineCallbackPrivateBase<T> *callback)
+inline void CallbackDirectory::invokeEmptyInternal(QtWebEnginePrivate::QWebEngineCallbackPrivateBase<T> *callback)
{
Q_ASSERT(callback);
using NoRefT = typename std::remove_reference<T>::type;
@@ -192,24 +194,21 @@ void CallbackDirectory::invokeEmptyInternal(QtWebEnginePrivate::QWebEngineCallba
}
template<>
-inline
-void CallbackDirectory::invokeEmptyInternal(QtWebEnginePrivate::QWebEngineCallbackPrivateBase<bool> *callback)
+inline void CallbackDirectory::invokeEmptyInternal(QtWebEnginePrivate::QWebEngineCallbackPrivateBase<bool> *callback)
{
Q_ASSERT(callback);
(*callback)(false);
}
template<>
-inline
-void CallbackDirectory::invokeEmptyInternal(QtWebEnginePrivate::QWebEngineCallbackPrivateBase<int> *callback)
+inline void CallbackDirectory::invokeEmptyInternal(QtWebEnginePrivate::QWebEngineCallbackPrivateBase<int> *callback)
{
Q_ASSERT(callback);
(*callback)(0);
}
template<typename T>
-inline
-void CallbackDirectory::invokeEmpty(const QWebEngineCallback<T> &callback)
+inline void CallbackDirectory::invokeEmpty(const QWebEngineCallback<T> &callback)
{
if (!callback.d)
return;
@@ -217,9 +216,8 @@ void CallbackDirectory::invokeEmpty(const QWebEngineCallback<T> &callback)
invokeEmptyInternal(callback.d.data());
}
-template <typename T>
-inline
-void CallbackDirectory::CallbackSharedDataPointer<T>::doRef()
+template<typename T>
+inline void CallbackDirectory::CallbackSharedDataPointer<T>::doRef()
{
if (!callback)
return;
@@ -227,9 +225,8 @@ void CallbackDirectory::CallbackSharedDataPointer<T>::doRef()
callback->ref.ref();
}
-template <typename T>
-inline
-void CallbackDirectory::CallbackSharedDataPointer<T>::doDeref()
+template<typename T>
+inline void CallbackDirectory::CallbackSharedDataPointer<T>::doDeref()
{
if (!callback)
return;
@@ -237,9 +234,8 @@ void CallbackDirectory::CallbackSharedDataPointer<T>::doDeref()
delete callback;
}
-template <typename T>
-inline
-void CallbackDirectory::CallbackSharedDataPointer<T>::invokeEmpty()
+template<typename T>
+inline void CallbackDirectory::CallbackSharedDataPointer<T>::invokeEmpty()
{
if (!callback)
return;
@@ -248,8 +244,7 @@ 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((QTypeInfoQuery<QWebEngineCallback<x>>::isRelocatable));
FOR_EACH_TYPE(CHECK_RELOCATABLE)
#undef CHECK_RELOCATABLE
diff --git a/src/core/api/qwebengineclientcertificatestore.cpp b/src/core/api/qwebengineclientcertificatestore.cpp
new file mode 100644
index 000000000..84f273328
--- /dev/null
+++ b/src/core/api/qwebengineclientcertificatestore.cpp
@@ -0,0 +1,120 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qwebengineclientcertificatestore.h"
+
+#include "net/client_cert_store_data.h"
+
+#include <QByteArray>
+#include <QList>
+
+QT_BEGIN_NAMESPACE
+
+#if QT_CONFIG(ssl)
+
+/*!
+ \class QWebEngineClientCertificateStore
+ \inmodule QtWebEngineCore
+ \since 5.13
+ \brief The QWebEngineClientCertificateStore class provides an in-memory store for client certificates.
+
+ The class allows to store client certificates in an in-memory store.
+ When a web site requests an SSL client certificate, the QWebEnginePage::selectClientCertificate
+ signal is emitted with matching certificates from the native certificate store or the in-memory store.
+ The getInstance() method can be used to access the single instance of the class.
+*/
+
+QWebEngineClientCertificateStore::QWebEngineClientCertificateStore(QtWebEngineCore::ClientCertificateStoreData *storeData)
+ : m_storeData(storeData)
+{}
+
+/*!
+ Destroys this QWebEngineClientCertificateStore object.
+*/
+
+QWebEngineClientCertificateStore::~QWebEngineClientCertificateStore()
+{
+ // Just in case user has not deleted in-memory certificates
+ clear();
+}
+
+/*!
+ Adds a \a certificate with the \a privateKey to the in-memory client certificate store.
+*/
+
+void QWebEngineClientCertificateStore::add(const QSslCertificate &certificate, const QSslKey &privateKey)
+{
+ m_storeData->add(certificate, privateKey);
+}
+
+/*!
+ Returns a list of the client certificates in the in-memory store.
+ Returns an empty list if the store does not contain any certificates.
+*/
+
+QVector<QSslCertificate> QWebEngineClientCertificateStore::certificates() const
+{
+ QVector<QSslCertificate> certificateList;
+ for (auto data : qAsConst(m_storeData->extraCerts))
+ certificateList.append(data->certificate);
+ return certificateList;
+}
+
+/*!
+ Deletes all the instances of the client certificate in the in-memory client certificate store
+ that matches the certificate \a certificate.
+*/
+
+void QWebEngineClientCertificateStore::remove(const QSslCertificate &certificate)
+{
+ m_storeData->remove(certificate);
+}
+
+/*!
+ Clears all the client certificates from the in-memory store.
+*/
+
+void QWebEngineClientCertificateStore::clear()
+{
+ m_storeData->clear();
+}
+
+#endif // QT_CONFIG(ssl)
+
+QT_END_NAMESPACE
diff --git a/src/core/api/qwebengineclientcertificatestore.h b/src/core/api/qwebengineclientcertificatestore.h
new file mode 100644
index 000000000..a4c83bb2e
--- /dev/null
+++ b/src/core/api/qwebengineclientcertificatestore.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWEBENGINECLIENTCERTIFICATESTORE_H
+#define QWEBENGINECLIENTCERTIFICATESTORE_H
+
+#include <QtWebEngineCore/qtwebenginecoreglobal.h>
+
+#include <QtCore/qvector.h>
+#include <QtNetwork/qsslcertificate.h>
+#include <QtNetwork/qsslkey.h>
+
+namespace QtWebEngineCore {
+struct ClientCertificateStoreData;
+class ProfileAdapter;
+} // namespace QtWebEngineCore
+
+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;
+ void remove(const QSslCertificate &certificate);
+ void clear();
+
+private:
+ friend class QtWebEngineCore::ProfileAdapter;
+ Q_DISABLE_COPY(QWebEngineClientCertificateStore)
+
+ QWebEngineClientCertificateStore(QtWebEngineCore::ClientCertificateStoreData *storeData);
+ ~QWebEngineClientCertificateStore();
+ QtWebEngineCore::ClientCertificateStoreData *m_storeData;
+};
+
+#endif // QT_CONFIG(ssl)
+
+QT_END_NAMESPACE
+
+#endif // QWebEngineClientCertificateStore_H
diff --git a/src/core/api/qwebenginecookiestore.cpp b/src/core/api/qwebenginecookiestore.cpp
index 3897fb128..40594b9c0 100644
--- a/src/core/api/qwebenginecookiestore.cpp
+++ b/src/core/api/qwebenginecookiestore.cpp
@@ -47,15 +47,14 @@
#include <QByteArray>
#include <QUrl>
-
namespace {
-inline GURL toGurl(const QUrl& url)
+inline GURL toGurl(const QUrl &url)
{
return GURL(url.toString().toStdString());
}
-}
+} // namespace
QT_BEGIN_NAMESPACE
@@ -68,8 +67,7 @@ QWebEngineCookieStorePrivate::QWebEngineCookieStorePrivate(QWebEngineCookieStore
, m_deleteAllCookiesPending(false)
, m_getAllCookiesPending(false)
, delegate(0)
-{
-}
+{}
void QWebEngineCookieStorePrivate::processPendingUserCookies()
{
@@ -112,7 +110,8 @@ void QWebEngineCookieStorePrivate::rejectPendingUserCookies()
m_pendingUserCookies.clear();
}
-void QWebEngineCookieStorePrivate::setCookie(const QWebEngineCallback<bool> &callback, const QNetworkCookie &cookie, const QUrl &origin)
+void QWebEngineCookieStorePrivate::setCookie(const QWebEngineCallback<bool> &callback, const QNetworkCookie &cookie,
+ const QUrl &origin)
{
const quint64 currentCallbackId = callback ? m_nextCallbackId++ : static_cast<quint64>(CallbackDirectory::NoCallbackId);
@@ -201,7 +200,7 @@ bool QWebEngineCookieStorePrivate::canAccessCookies(const QUrl &firstPartyUrl, c
toGurl(firstPartyUrl),
net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES);
- QWebEngineCookieStore::FilterRequest request = { firstPartyUrl, url, thirdParty, false, 0};
+ QWebEngineCookieStore::FilterRequest request = { firstPartyUrl, url, thirdParty, false, 0 };
return filterCallback(request);
}
@@ -249,10 +248,7 @@ QWebEngineCookieStore::QWebEngineCookieStore(QObject *parent)
Destroys this QWebEngineCookieStore object.
*/
-QWebEngineCookieStore::~QWebEngineCookieStore()
-{
-
-}
+QWebEngineCookieStore::~QWebEngineCookieStore() {}
/*!
Adds \a cookie to the cookie store.
@@ -298,7 +294,8 @@ void QWebEngineCookieStore::loadAllCookies()
//TODO: use callbacks or delete dummy ones
if (d_ptr->m_getAllCookiesPending)
return;
- d_ptr->callbackDirectory.registerCallback(CallbackDirectory::GetAllCookiesCallbackId, QWebEngineCallback<const QByteArray&>());
+ d_ptr->callbackDirectory.registerCallback(CallbackDirectory::GetAllCookiesCallbackId,
+ QWebEngineCallback<const QByteArray &>());
//this will trigger cookieAdded signal
d_ptr->getAllCookies();
}
diff --git a/src/core/api/qwebenginecookiestore.h b/src/core/api/qwebenginecookiestore.h
index 89e72dfb0..3d313ac23 100644
--- a/src/core/api/qwebenginecookiestore.h
+++ b/src/core/api/qwebenginecookiestore.h
@@ -52,12 +52,12 @@
namespace QtWebEngineCore {
class ProfileAdapter;
class CookieMonsterDelegateQt;
-}
+} // namespace QtWebEngineCore
QT_BEGIN_NAMESPACE
class QWebEngineCookieStorePrivate;
-class QWEBENGINECORE_EXPORT QWebEngineCookieStore : public QObject {
+class Q_WEBENGINECORE_EXPORT QWebEngineCookieStore : public QObject {
Q_OBJECT
public:
@@ -93,6 +93,6 @@ private:
QT_END_NAMESPACE
-Q_DECLARE_METATYPE(QWebEngineCookieStore*)
+Q_DECLARE_METATYPE(QWebEngineCookieStore *)
#endif // QWEBENGINECOOKIESTORE_H
diff --git a/src/core/api/qwebenginecookiestore_p.h b/src/core/api/qwebenginecookiestore_p.h
index 93198d8ed..a79e2b095 100644
--- a/src/core/api/qwebenginecookiestore_p.h
+++ b/src/core/api/qwebenginecookiestore_p.h
@@ -66,8 +66,7 @@ class CookieMonsterDelegateQt;
QT_BEGIN_NAMESPACE
-class QWEBENGINECORE_PRIVATE_EXPORT QWebEngineCookieStorePrivate
-{
+class Q_WEBENGINECORE_PRIVATE_EXPORT QWebEngineCookieStorePrivate {
Q_DECLARE_PUBLIC(QWebEngineCookieStore)
struct CookieData {
quint64 callbackId;
@@ -76,9 +75,10 @@ class QWEBENGINECORE_PRIVATE_EXPORT QWebEngineCookieStorePrivate
};
friend class QTypeInfo<CookieData>;
QWebEngineCookieStore *q_ptr;
+
public:
QtWebEngineCore::CallbackDirectory callbackDirectory;
- std::function<bool(const QWebEngineCookieStore::FilterRequest&)> filterCallback;
+ std::function<bool(const QWebEngineCookieStore::FilterRequest &)> filterCallback;
QVector<CookieData> m_pendingUserCookies;
quint64 m_nextCallbackId;
bool m_deleteSessionCookiesPending;
diff --git a/src/core/api/qwebenginehttprequest.cpp b/src/core/api/qwebenginehttprequest.cpp
index b64af4466..3395cc99f 100644
--- a/src/core/api/qwebenginehttprequest.cpp
+++ b/src/core/api/qwebenginehttprequest.cpp
@@ -67,8 +67,7 @@ QT_BEGIN_NAMESPACE
\value Post The POST method.
*/
-class QWebEngineHttpRequestPrivate : public QSharedData
-{
+class QWebEngineHttpRequestPrivate : public QSharedData {
public:
QUrl url;
QWebEngineHttpRequest::Method method;
@@ -77,23 +76,18 @@ public:
Headers headers;
QByteArray postData;
- inline QWebEngineHttpRequestPrivate()
- {
- }
+ QWebEngineHttpRequestPrivate() {}
- ~QWebEngineHttpRequestPrivate()
- {
- }
+ ~QWebEngineHttpRequestPrivate() {}
- QWebEngineHttpRequestPrivate(const QWebEngineHttpRequestPrivate &other)
- : QSharedData(other)
+ QWebEngineHttpRequestPrivate(const QWebEngineHttpRequestPrivate &other) : QSharedData(other)
{
method = other.method;
url = other.url;
headers = other.headers;
}
- inline bool operator==(const QWebEngineHttpRequestPrivate &other) const
+ bool operator==(const QWebEngineHttpRequestPrivate &other) const
{
return method == other.method
&& url == other.url
@@ -128,10 +122,7 @@ QWebEngineHttpRequest::QWebEngineHttpRequest(const QUrl &url,
/*!
Creates a copy of \a other.
*/
-QWebEngineHttpRequest::QWebEngineHttpRequest(const QWebEngineHttpRequest &other)
- : d(other.d)
-{
-}
+QWebEngineHttpRequest::QWebEngineHttpRequest(const QWebEngineHttpRequest &other) : d(other.d) {}
/*!
Disposes of the QWebEngineHttpRequest object.
@@ -207,7 +198,6 @@ QWebEngineHttpRequest QWebEngineHttpRequest::postRequest(const QUrl &url,
return result;
}
-
/*!
Returns the method this WebEngine request is using.
@@ -291,8 +281,7 @@ bool QWebEngineHttpRequest::hasHeader(const QByteArray &headerName) const
*/
QByteArray QWebEngineHttpRequest::header(const QByteArray &headerName) const
{
- QWebEngineHttpRequestPrivate::Headers::ConstIterator it =
- d->findHeader(headerName);
+ QWebEngineHttpRequestPrivate::Headers::ConstIterator it = d->findHeader(headerName);
if (it != d->headers.constEnd())
return it->second;
return QByteArray();
@@ -334,16 +323,15 @@ void QWebEngineHttpRequest::unsetHeader(const QByteArray &key)
d->setHeader(key, QByteArray());
}
-QWebEngineHttpRequestPrivate::Headers::ConstIterator
-QWebEngineHttpRequestPrivate::findHeader(const QByteArray &key) const
+QWebEngineHttpRequestPrivate::Headers::ConstIterator QWebEngineHttpRequestPrivate::findHeader(const QByteArray &key) const
{
Headers::ConstIterator it = headers.constBegin();
Headers::ConstIterator end = headers.constEnd();
- for ( ; it != end; ++it)
+ for (; it != end; ++it)
if (qstricmp(it->first.constData(), key.constData()) == 0)
return it;
- return end; // not found
+ return end; // not found
}
QWebEngineHttpRequestPrivate::Headers QWebEngineHttpRequestPrivate::allHeaders() const
@@ -355,9 +343,8 @@ QVector<QByteArray> QWebEngineHttpRequestPrivate::headersKeys() const
{
QVector<QByteArray> result;
result.reserve(headers.size());
- Headers::ConstIterator it = headers.constBegin(),
- end = headers.constEnd();
- for ( ; it != end; ++it)
+ Headers::ConstIterator it = headers.constBegin(), end = headers.constEnd();
+ for (; it != end; ++it)
result << it->first;
return result;
@@ -385,8 +372,7 @@ void QWebEngineHttpRequestPrivate::unsetHeader(const QByteArray &key)
auto firstEqualsKey = [&key](const HeaderPair &header) {
return qstricmp(header.first.constData(), key.constData()) == 0;
};
- headers.erase(std::remove_if(headers.begin(), headers.end(), firstEqualsKey),
- headers.end());
+ headers.erase(std::remove_if(headers.begin(), headers.end(), firstEqualsKey), headers.end());
}
/*!
@@ -408,7 +394,7 @@ void QWebEngineHttpRequestPrivate::setHeaderInternal(const QByteArray &key, cons
unsetHeader(key);
if (value.isNull())
- return; // only wanted to erase key
+ return; // only wanted to erase key
HeaderPair pair;
pair.first = key;
diff --git a/src/core/api/qwebenginehttprequest.h b/src/core/api/qwebenginehttprequest.h
index c6b5a6b63..1c4d7837b 100644
--- a/src/core/api/qwebenginehttprequest.h
+++ b/src/core/api/qwebenginehttprequest.h
@@ -49,11 +49,9 @@
QT_BEGIN_NAMESPACE
-
class QWebEngineHttpRequestPrivate;
-class QWEBENGINECORE_EXPORT QWebEngineHttpRequest
-{
+class Q_WEBENGINECORE_EXPORT QWebEngineHttpRequest {
public:
enum Method {
Get,
@@ -61,22 +59,23 @@ public:
};
explicit QWebEngineHttpRequest(const QUrl &url = QUrl(),
- const QWebEngineHttpRequest::Method &method = QWebEngineHttpRequest::Get);
+ const QWebEngineHttpRequest::Method &method = QWebEngineHttpRequest::Get);
QWebEngineHttpRequest(const QWebEngineHttpRequest &other);
~QWebEngineHttpRequest();
#ifdef Q_COMPILER_RVALUE_REFS
- QWebEngineHttpRequest &operator=(QWebEngineHttpRequest &&other) Q_DECL_NOTHROW { swap(other);
- return *this; }
+ QWebEngineHttpRequest &operator=(QWebEngineHttpRequest &&other) Q_DECL_NOTHROW
+ {
+ swap(other);
+ return *this;
+ }
#endif
QWebEngineHttpRequest &operator=(const QWebEngineHttpRequest &other);
- static QWebEngineHttpRequest postRequest(const QUrl &url,
- const QMap<QString, QString> &postData);
+ static QWebEngineHttpRequest postRequest(const QUrl &url, const QMap<QString, QString> &postData);
void swap(QWebEngineHttpRequest &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
bool operator==(const QWebEngineHttpRequest &other) const;
- inline bool operator!=(const QWebEngineHttpRequest &other) const
- { return !operator==(other); }
+ inline bool operator!=(const QWebEngineHttpRequest &other) const { return !operator==(other); }
Method method() const;
void setMethod(QWebEngineHttpRequest::Method method);
diff --git a/src/core/api/qwebenginemessagepumpscheduler_p.h b/src/core/api/qwebenginemessagepumpscheduler_p.h
index 4c9e4d600..07b2ca203 100644
--- a/src/core/api/qwebenginemessagepumpscheduler_p.h
+++ b/src/core/api/qwebenginemessagepumpscheduler_p.h
@@ -59,8 +59,7 @@
QT_BEGIN_NAMESPACE
-class QWEBENGINECORE_PRIVATE_EXPORT QWebEngineMessagePumpScheduler : public QObject
-{
+class Q_WEBENGINECORE_PRIVATE_EXPORT QWebEngineMessagePumpScheduler : public QObject {
Q_OBJECT
public:
QWebEngineMessagePumpScheduler(std::function<void()> callback);
diff --git a/src/core/api/qwebenginenotification.cpp b/src/core/api/qwebenginenotification.cpp
new file mode 100644
index 000000000..abc63fed2
--- /dev/null
+++ b/src/core/api/qwebenginenotification.cpp
@@ -0,0 +1,323 @@
+/****************************************************************************
+**
+** 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 "qwebenginenotification.h"
+
+#include "user_notification_controller.h"
+
+#include <QExplicitlySharedDataPointer>
+
+QT_BEGIN_NAMESPACE
+
+using QtWebEngineCore::UserNotificationController;
+
+/*!
+ \qmltype WebEngineNotification
+ \instantiates QWebEngineNotification
+ \inqmlmodule QtWebEngine
+ \since QtWebEngine 1.9
+ \brief Encapsulates the data of an HTML5 web notification.
+
+ This type contains the information and API for HTML5 desktop and push notifications.
+
+ Web engine notifications are passed to the user in the
+ \l WebEngineProfile::presentNotification() signal.
+
+ For more information about how to handle web notification, see the
+ \l{WebEngine Notifications Example}{Notification Example}.
+*/
+
+/*!
+ \class QWebEngineNotification
+ \brief The QWebEngineNotification class encapsulates the data of an HTML5 web notification.
+ \since 5.13
+
+ \inmodule QtWebEngineCore
+
+ This class contains the information and API for HTML5 desktop and push notifications.
+
+ Web engine notifications are passed to the user through the custom handler
+ provided with the \l QWebEngineProfile::setNotificationPresenter() call.
+
+ For more information about how to handle web notification, see the
+ \l{WebEngine Notifications Example}{Notification Example}.
+*/
+
+class QWebEngineNotificationPrivate : public UserNotificationController::Client {
+public:
+ QWebEngineNotificationPrivate(QWebEngineNotification *q, const QSharedPointer<UserNotificationController> &controller)
+ : controller(controller)
+ , q(q)
+ {
+ controller->setClient(this);
+ }
+ ~QWebEngineNotificationPrivate() override
+ {
+ if (controller->client() == this)
+ controller->setClient(0);
+ }
+
+ // UserNotificationController::Client:
+ virtual void notificationClosed(const UserNotificationController *) override
+ {
+ Q_EMIT q->closed();
+ }
+
+ QSharedPointer<UserNotificationController> controller;
+ QWebEngineNotification *q;
+};
+
+/*! \internal
+*/
+QWebEngineNotification::QWebEngineNotification(const QSharedPointer<UserNotificationController> &controller)
+ : d_ptr(new QWebEngineNotificationPrivate(this, controller))
+{}
+
+/*! \internal
+*/
+QWebEngineNotification::~QWebEngineNotification() {}
+
+/*!
+ Returns \c true if the two notifications belong to the same message chain.
+ That is, if their tag() and origin() are the same. This means one is
+ a replacement or an update of the \a other.
+
+ \sa tag(), origin()
+*/
+bool QWebEngineNotification::matches(const QWebEngineNotification *other) const
+{
+ if (!other)
+ return false;
+ if (!d_ptr)
+ return !other->d_ptr;
+ if (!other->d_ptr)
+ return false;
+ return tag() == other->tag() && origin() == other->origin();
+}
+
+/*!
+ \qmlproperty bool WebEngineNotification::title
+ \brief The title of the notification.
+*/
+/*!
+ \property QWebEngineNotification::title
+ \brief The title of the notification.
+ \sa message()
+*/
+QString QWebEngineNotification::title() const
+{
+ Q_D(const QWebEngineNotification);
+ return d ? d->controller->title() : QString();
+}
+
+/*!
+ \qmlproperty string WebEngineNotification::message
+ \brief The body of the notification message.
+*/
+/*!
+ \property QWebEngineNotification::message
+ \brief The body of the notification message.
+ \sa title()
+*/
+
+QString QWebEngineNotification::message() const
+{
+ Q_D(const QWebEngineNotification);
+ return d ? d->controller->body() : QString();
+}
+
+/*!
+ \qmlproperty string WebEngineNotification::tag
+ \brief The tag of the notification message.
+
+ New notifications that have the same tag and origin URL as an existing
+ one should replace or update the old notification with the same tag.
+*/
+/*!
+ \property QWebEngineNotification::tag
+ \brief The tag of the notification message.
+
+ New notifications that have the same tag and origin URL as an existing
+ one should replace or update the old notification with the same tag.
+
+ \sa matches()
+*/
+QString QWebEngineNotification::tag() const
+{
+ Q_D(const QWebEngineNotification);
+ return d ? d->controller->tag() : QString();
+}
+
+/*!
+ \qmlproperty url WebEngineNotification::origin
+ \brief The URL of the page sending the notification.
+*/
+/*!
+ \property QWebEngineNotification::origin
+ \brief The URL of the page sending the notification.
+*/
+
+QUrl QWebEngineNotification::origin() const
+{
+ Q_D(const QWebEngineNotification);
+ return d ? d->controller->origin() : QUrl();
+}
+
+/*!
+ Returns the icon to be shown with the notification.
+
+ If no icon is set by the sender, a null QImage is returned.
+*/
+QImage QWebEngineNotification::icon() const
+{
+ Q_D(const QWebEngineNotification);
+ return d ? d->controller->icon() : QImage();
+}
+
+/*!
+ \qmlproperty string WebEngineNotification::language
+ \brief The primary language for the notification's title and body.
+
+ Its value is a valid BCP 47 language tag, or the empty string.
+*/
+/*!
+ \property QWebEngineNotification::language
+ \brief The primary language for the notification's title and body.
+
+ Its value is a valid BCP 47 language tag, or the empty string.
+
+ \sa title(), message()
+*/
+QString QWebEngineNotification::language() const
+{
+ Q_D(const QWebEngineNotification);
+ return d ? d->controller->language() : QString();
+}
+
+/*!
+ \qmlproperty enumeration WebEngineNotification::direction
+ \brief The text direction for the notification's title and body.
+
+ \value Qt.LeftToRight Items are laid out from left to right.
+ \value Qt.RightToLeft Items are laid out from right to left.
+ \value Qt.LayoutDirectionAuto The direction to lay out items is determined automatically.
+*/
+/*!
+ \property QWebEngineNotification::direction
+ \brief The text direction for the notification's title and body.
+ \sa title(), message()
+*/
+Qt::LayoutDirection QWebEngineNotification::direction() const
+{
+ Q_D(const QWebEngineNotification);
+ return d ? d->controller->direction() : Qt::LayoutDirectionAuto;
+}
+
+/*!
+ \qmlmethod void WebEngineNotification::show()
+ Creates and dispatches a JavaScript \e {show event} on notification.
+
+ Should be called by the notification platform when the notification has been shown to user.
+*/
+/*!
+ Creates and dispatches a JavaScript \e {show event} on notification.
+
+ Should be called by the notification platform when the notification has been shown to user.
+*/
+void QWebEngineNotification::show() const
+{
+ Q_D(const QWebEngineNotification);
+ if (d)
+ d->controller->notificationDisplayed();
+}
+
+/*!
+ \qmlmethod void WebEngineNotification::click()
+ Creates and dispatches a JavaScript \e {click event} on notification.
+
+ Should be called by the notification platform when the notification is activated by the user.
+*/
+/*!
+ Creates and dispatches a JavaScript \e {click event} on notification.
+
+ Should be called by the notification platform when the notification is activated by the user.
+*/
+void QWebEngineNotification::click() const
+{
+ Q_D(const QWebEngineNotification);
+ if (d)
+ d->controller->notificationClicked();
+}
+
+/*!
+ \qmlmethod void WebEngineNotification::close()
+ Creates and dispatches a JavaScript \e {close event} on notification.
+
+ Should be called by the notification platform when the notification is closed,
+ either by the underlying platform or by the user.
+*/
+/*!
+ Creates and dispatches a JavaScript \e {close event} on notification.
+
+ Should be called by the notification platform when the notification is closed,
+ either by the underlying platform or by the user.
+*/
+void QWebEngineNotification::close() const
+{
+ Q_D(const QWebEngineNotification);
+ if (d)
+ d->controller->notificationClosed();
+}
+
+/*!
+ \qmlsignal WebEngineNotification::closed()
+
+ This signal is emitted when the web page calls close steps for the notification,
+ and it no longer needs to be shown.
+*/
+/*!
+ \fn void QWebEngineNotification::closed()
+
+ This signal is emitted when the web page calls close steps for the notification,
+ and it no longer needs to be shown.
+*/
+
+QT_END_NAMESPACE
+
+#include "moc_qwebenginenotification.cpp"
diff --git a/src/core/api/qwebenginenotification.h b/src/core/api/qwebenginenotification.h
new file mode 100644
index 000000000..08fd629be
--- /dev/null
+++ b/src/core/api/qwebenginenotification.h
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef QWEBENGINENOTIFICATION_H
+#define QWEBENGINENOTIFICATION_H
+
+#include <QtWebEngineCore/qtwebenginecoreglobal.h>
+
+#include <QtCore/QObject>
+#include <QtCore/QScopedPointer>
+#include <QtCore/QSharedPointer>
+#include <QtCore/QUrl>
+
+namespace QtWebEngineCore {
+class UserNotificationController;
+}
+
+QT_BEGIN_NAMESPACE
+
+class QWebEngineNotificationPrivate;
+
+class Q_WEBENGINECORE_EXPORT QWebEngineNotification : public QObject {
+ Q_OBJECT
+ Q_PROPERTY(QUrl origin READ origin CONSTANT FINAL)
+ Q_PROPERTY(QString title READ title CONSTANT FINAL)
+ Q_PROPERTY(QString message READ message CONSTANT FINAL)
+ Q_PROPERTY(QString tag READ tag CONSTANT FINAL)
+ Q_PROPERTY(QString language READ language CONSTANT FINAL)
+ Q_PROPERTY(Qt::LayoutDirection direction READ direction CONSTANT FINAL)
+
+public:
+ virtual ~QWebEngineNotification() override;
+
+ bool matches(const QWebEngineNotification *other) const;
+
+ QUrl origin() const;
+ QImage icon() const;
+ QString title() const;
+ QString message() const;
+ QString tag() const;
+ QString language() const;
+ Qt::LayoutDirection direction() const;
+
+public Q_SLOTS:
+ void show() const;
+ void click() const;
+ void close() const;
+
+Q_SIGNALS:
+ void closed();
+
+private:
+ Q_DISABLE_COPY(QWebEngineNotification)
+ Q_DECLARE_PRIVATE(QWebEngineNotification)
+ QWebEngineNotification(const QSharedPointer<QtWebEngineCore::UserNotificationController> &controller);
+ QScopedPointer<QWebEngineNotificationPrivate> d_ptr;
+ friend class QQuickWebEngineProfilePrivate;
+ friend class QWebEngineProfilePrivate;
+};
+
+QT_END_NAMESPACE
+
+#endif // QWEBENGINENOTIFICATION_H
diff --git a/src/core/api/qwebenginequotarequest.cpp b/src/core/api/qwebenginequotarequest.cpp
index 49c9f041f..7686d0806 100644
--- a/src/core/api/qwebenginequotarequest.cpp
+++ b/src/core/api/qwebenginequotarequest.cpp
@@ -64,8 +64,7 @@ QT_BEGIN_NAMESPACE
/*! \internal */
QWebEngineQuotaRequest::QWebEngineQuotaRequest(QSharedPointer<QtWebEngineCore::QuotaRequestController> controller)
: d_ptr(controller)
-{
-}
+{}
/*!
Rejects a request for larger persistent storage.
diff --git a/src/core/api/qwebenginequotarequest.h b/src/core/api/qwebenginequotarequest.h
index a759f5bb6..da72116c8 100644
--- a/src/core/api/qwebenginequotarequest.h
+++ b/src/core/api/qwebenginequotarequest.h
@@ -47,11 +47,11 @@
namespace QtWebEngineCore {
class QuotaPermissionContextQt;
class QuotaRequestController;
-}
+} // namespace QtWebEngineCore
QT_BEGIN_NAMESPACE
-class QWEBENGINECORE_EXPORT QWebEngineQuotaRequest {
+class Q_WEBENGINECORE_EXPORT QWebEngineQuotaRequest {
Q_GADGET
Q_PROPERTY(QUrl origin READ origin CONSTANT FINAL)
Q_PROPERTY(qint64 requestedSize READ requestedSize CONSTANT FINAL)
@@ -63,6 +63,7 @@ public:
qint64 requestedSize() const;
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:
QWebEngineQuotaRequest(QSharedPointer<QtWebEngineCore::QuotaRequestController>);
friend QtWebEngineCore::QuotaPermissionContextQt;
diff --git a/src/core/api/qwebengineregisterprotocolhandlerrequest.cpp b/src/core/api/qwebengineregisterprotocolhandlerrequest.cpp
index 1921f78f4..a3960327d 100644
--- a/src/core/api/qwebengineregisterprotocolhandlerrequest.cpp
+++ b/src/core/api/qwebengineregisterprotocolhandlerrequest.cpp
@@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
/*! \internal */
QWebEngineRegisterProtocolHandlerRequest::QWebEngineRegisterProtocolHandlerRequest(
- QSharedPointer<QtWebEngineCore::RegisterProtocolHandlerRequestController> d_ptr)
+ QSharedPointer<QtWebEngineCore::RegisterProtocolHandlerRequestController> d_ptr)
: d_ptr(std::move(d_ptr))
{}
diff --git a/src/core/api/qwebengineregisterprotocolhandlerrequest.h b/src/core/api/qwebengineregisterprotocolhandlerrequest.h
index 12b1d6edf..67caf1590 100644
--- a/src/core/api/qwebengineregisterprotocolhandlerrequest.h
+++ b/src/core/api/qwebengineregisterprotocolhandlerrequest.h
@@ -47,11 +47,11 @@
namespace QtWebEngineCore {
class RegisterProtocolHandlerRequestController;
class WebContentsDelegateQt;
-}
+} // namespace QtWebEngineCore
QT_BEGIN_NAMESPACE
-class QWEBENGINECORE_EXPORT QWebEngineRegisterProtocolHandlerRequest {
+class Q_WEBENGINECORE_EXPORT QWebEngineRegisterProtocolHandlerRequest {
Q_GADGET
Q_PROPERTY(QUrl origin READ origin CONSTANT FINAL)
Q_PROPERTY(QString scheme READ scheme CONSTANT FINAL)
@@ -63,9 +63,9 @@ public:
QString scheme() const;
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:
- QWebEngineRegisterProtocolHandlerRequest(
- QSharedPointer<QtWebEngineCore::RegisterProtocolHandlerRequestController>);
+ QWebEngineRegisterProtocolHandlerRequest(QSharedPointer<QtWebEngineCore::RegisterProtocolHandlerRequestController>);
friend QtWebEngineCore::WebContentsDelegateQt;
QSharedPointer<QtWebEngineCore::RegisterProtocolHandlerRequestController> d_ptr;
};
diff --git a/src/core/api/qwebengineurlrequestinfo.cpp b/src/core/api/qwebengineurlrequestinfo.cpp
index 2b8a69c9a..3cbb4da17 100644
--- a/src/core/api/qwebengineurlrequestinfo.cpp
+++ b/src/core/api/qwebengineurlrequestinfo.cpp
@@ -68,8 +68,10 @@ ASSERT_ENUMS_MATCH(QWebEngineUrlRequestInfo::ResourceTypeLast, content::RESOURCE
ASSERT_ENUMS_MATCH(QtWebEngineCore::WebContentsAdapterClient::LinkNavigation, QWebEngineUrlRequestInfo::NavigationTypeLink)
ASSERT_ENUMS_MATCH(QtWebEngineCore::WebContentsAdapterClient::TypedNavigation, QWebEngineUrlRequestInfo::NavigationTypeTyped)
-ASSERT_ENUMS_MATCH(QtWebEngineCore::WebContentsAdapterClient::FormSubmittedNavigation, QWebEngineUrlRequestInfo::NavigationTypeFormSubmitted)
-ASSERT_ENUMS_MATCH(QtWebEngineCore::WebContentsAdapterClient::BackForwardNavigation, QWebEngineUrlRequestInfo::NavigationTypeBackForward)
+ASSERT_ENUMS_MATCH(QtWebEngineCore::WebContentsAdapterClient::FormSubmittedNavigation,
+ QWebEngineUrlRequestInfo::NavigationTypeFormSubmitted)
+ASSERT_ENUMS_MATCH(QtWebEngineCore::WebContentsAdapterClient::BackForwardNavigation,
+ QWebEngineUrlRequestInfo::NavigationTypeBackForward)
ASSERT_ENUMS_MATCH(QtWebEngineCore::WebContentsAdapterClient::ReloadNavigation, QWebEngineUrlRequestInfo::NavigationTypeReload)
ASSERT_ENUMS_MATCH(QtWebEngineCore::WebContentsAdapterClient::OtherNavigation, QWebEngineUrlRequestInfo::NavigationTypeOther)
@@ -96,8 +98,8 @@ ASSERT_ENUMS_MATCH(QtWebEngineCore::WebContentsAdapterClient::OtherNavigation, Q
interceptor on the profile enables intercepting, blocking, and modifying URL requests
before they reach the networking stack of Chromium.
- You can install the interceptor on a profile via QWebEngineProfile::setRequestInterceptor()
- or QQuickWebEngineProfile::setRequestInterceptor().
+ You can install the interceptor on a profile via QWebEngineProfile::setUrlRequestInterceptor()
+ or QQuickWebEngineProfile::setUrlRequestInterceptor().
When using the \l{Qt WebEngine Widgets Module}, \l{QWebEnginePage::acceptNavigationRequest()}
offers further options to accept or block requests.
@@ -115,8 +117,7 @@ ASSERT_ENUMS_MATCH(QtWebEngineCore::WebContentsAdapterClient::OtherNavigation, Q
\fn void QWebEngineUrlRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info)
Reimplementing this virtual function makes it possible to intercept URL
- requests. This function is executed on the IO thread, and therefore running
- long tasks here will block networking.
+ requests. This method will be stalling the URL request until handled.
\a info contains the information about the URL request and will track internally
whether its members have been altered.
@@ -125,8 +126,9 @@ ASSERT_ENUMS_MATCH(QtWebEngineCore::WebContentsAdapterClient::OtherNavigation, Q
execution of this function is finished.
*/
-
-QWebEngineUrlRequestInfoPrivate::QWebEngineUrlRequestInfoPrivate(QWebEngineUrlRequestInfo::ResourceType resource, QWebEngineUrlRequestInfo::NavigationType navigation, const QUrl &u, const QUrl &fpu, const QByteArray &m)
+QWebEngineUrlRequestInfoPrivate::QWebEngineUrlRequestInfoPrivate(QWebEngineUrlRequestInfo::ResourceType resource,
+ QWebEngineUrlRequestInfo::NavigationType navigation,
+ const QUrl &u, const QUrl &fpu, const QByteArray &m)
: resourceType(resource)
, navigationType(navigation)
, shouldBlockRequest(false)
@@ -134,24 +136,24 @@ QWebEngineUrlRequestInfoPrivate::QWebEngineUrlRequestInfoPrivate(QWebEngineUrlRe
, firstPartyUrl(fpu)
, method(m)
, changed(false)
-{
-}
+{}
/*!
\internal
*/
+QWebEngineUrlRequestInfo::QWebEngineUrlRequestInfo(QWebEngineUrlRequestInfo &&p) : d_ptr(p.d_ptr.take()) {}
-QWebEngineUrlRequestInfo::~QWebEngineUrlRequestInfo()
-{
+/*!
+ \internal
+*/
-}
+QWebEngineUrlRequestInfo::~QWebEngineUrlRequestInfo() {}
/*!
\internal
*/
-QWebEngineUrlRequestInfo::QWebEngineUrlRequestInfo(QWebEngineUrlRequestInfoPrivate *p)
- : d_ptr(p)
+QWebEngineUrlRequestInfo::QWebEngineUrlRequestInfo(QWebEngineUrlRequestInfoPrivate *p) : d_ptr(p)
{
d_ptr->q_ptr = this;
}
@@ -241,7 +243,6 @@ QUrl QWebEngineUrlRequestInfo::firstPartyUrl() const
return d_ptr->firstPartyUrl;
}
-
/*!
Returns the HTTP method of the request (for example, GET or POST).
*/
@@ -260,6 +261,14 @@ bool QWebEngineUrlRequestInfo::changed() const
}
/*!
+ \internal
+*/
+void QWebEngineUrlRequestInfo::resetChanged()
+{
+ d_ptr->changed = false;
+}
+
+/*!
Redirects this request to \a url.
It is only possible to redirect requests that do not have payload data, such as GET requests.
*/
diff --git a/src/core/api/qwebengineurlrequestinfo.h b/src/core/api/qwebengineurlrequestinfo.h
index 68c46dcf4..cf5a4801d 100644
--- a/src/core/api/qwebengineurlrequestinfo.h
+++ b/src/core/api/qwebengineurlrequestinfo.h
@@ -47,13 +47,14 @@
namespace QtWebEngineCore {
class NetworkDelegateQt;
-}
+class URLRequestNotification;
+} // namespace QtWebEngineCore
QT_BEGIN_NAMESPACE
class QWebEngineUrlRequestInfoPrivate;
-class QWEBENGINECORE_EXPORT QWebEngineUrlRequestInfo {
+class Q_WEBENGINECORE_EXPORT QWebEngineUrlRequestInfo {
public:
enum ResourceType {
ResourceTypeMainFrame = 0, // top level page
@@ -104,10 +105,14 @@ public:
private:
friend class QtWebEngineCore::NetworkDelegateQt;
+ friend class QtWebEngineCore::URLRequestNotification;
Q_DISABLE_COPY(QWebEngineUrlRequestInfo)
Q_DECLARE_PRIVATE(QWebEngineUrlRequestInfo)
+ void resetChanged();
+
QWebEngineUrlRequestInfo(QWebEngineUrlRequestInfoPrivate *p);
+ QWebEngineUrlRequestInfo(QWebEngineUrlRequestInfo &&p);
~QWebEngineUrlRequestInfo();
QScopedPointer<QWebEngineUrlRequestInfoPrivate> d_ptr;
};
diff --git a/src/core/api/qwebengineurlrequestinfo_p.h b/src/core/api/qwebengineurlrequestinfo_p.h
index 9afd04398..9d795b2b5 100644
--- a/src/core/api/qwebengineurlrequestinfo_p.h
+++ b/src/core/api/qwebengineurlrequestinfo_p.h
@@ -65,15 +65,12 @@ class URLRequest;
QT_BEGIN_NAMESPACE
-class QWebEngineUrlRequestInfoPrivate
-{
+class QWebEngineUrlRequestInfoPrivate {
Q_DECLARE_PUBLIC(QWebEngineUrlRequestInfo)
public:
- QWebEngineUrlRequestInfoPrivate(QWebEngineUrlRequestInfo::ResourceType resource
- , QWebEngineUrlRequestInfo::NavigationType navigation
- , const QUrl &u
- , const QUrl &fpu
- , const QByteArray &m);
+ QWebEngineUrlRequestInfoPrivate(QWebEngineUrlRequestInfo::ResourceType resource,
+ QWebEngineUrlRequestInfo::NavigationType navigation, const QUrl &u, const QUrl &fpu,
+ const QByteArray &m);
QWebEngineUrlRequestInfo::ResourceType resourceType;
QWebEngineUrlRequestInfo::NavigationType navigationType;
diff --git a/src/core/api/qwebengineurlrequestinterceptor.h b/src/core/api/qwebengineurlrequestinterceptor.h
index dc2a15ee3..4d3020306 100644
--- a/src/core/api/qwebengineurlrequestinterceptor.h
+++ b/src/core/api/qwebengineurlrequestinterceptor.h
@@ -50,15 +50,11 @@
QT_BEGIN_NAMESPACE
-class QWEBENGINECORE_EXPORT QWebEngineUrlRequestInterceptor : public QObject
-{
+class Q_WEBENGINECORE_EXPORT QWebEngineUrlRequestInterceptor : public QObject {
Q_OBJECT
Q_DISABLE_COPY(QWebEngineUrlRequestInterceptor)
public:
- explicit QWebEngineUrlRequestInterceptor(QObject *p = Q_NULLPTR)
- : QObject (p)
- {
- }
+ explicit QWebEngineUrlRequestInterceptor(QObject *p = nullptr) : QObject(p) {}
virtual void interceptRequest(QWebEngineUrlRequestInfo &info) = 0;
};
diff --git a/src/core/api/qwebengineurlrequestjob.cpp b/src/core/api/qwebengineurlrequestjob.cpp
index c3541598b..3bb9d1732 100644
--- a/src/core/api/qwebengineurlrequestjob.cpp
+++ b/src/core/api/qwebengineurlrequestjob.cpp
@@ -84,11 +84,10 @@ QT_BEGIN_NAMESPACE
/*!
\internal
*/
-QWebEngineUrlRequestJob::QWebEngineUrlRequestJob(URLRequestCustomJobDelegate * p)
+QWebEngineUrlRequestJob::QWebEngineUrlRequestJob(URLRequestCustomJobDelegate *p)
: QObject(p) // owned by the jobdelegate and deleted when the job is done
, d_ptr(p)
-{
-}
+{}
/*!
\internal
@@ -140,6 +139,15 @@ QUrl QWebEngineUrlRequestJob::initiator() const
}
/*!
+ \since 5.13
+ Returns any HTTP headers added to the request.
+*/
+QMap<QByteArray, QByteArray> QWebEngineUrlRequestJob::requestHeaders() const
+{
+ return d_ptr->requestHeaders();
+}
+
+/*!
Replies to the request with \a device and the MIME type \a contentType.
The user has to be aware that \a device will be used on another thread
diff --git a/src/core/api/qwebengineurlrequestjob.h b/src/core/api/qwebengineurlrequestjob.h
index 7ce8be7ec..6d4a9e734 100644
--- a/src/core/api/qwebengineurlrequestjob.h
+++ b/src/core/api/qwebengineurlrequestjob.h
@@ -49,13 +49,13 @@
namespace QtWebEngineCore {
class URLRequestCustomJobDelegate;
class URLRequestCustomJobProxy;
-} // namespace
+} // namespace QtWebEngineCore
QT_BEGIN_NAMESPACE
class QIODevice;
-class QWEBENGINECORE_EXPORT QWebEngineUrlRequestJob : public QObject {
+class Q_WEBENGINECORE_EXPORT QWebEngineUrlRequestJob : public QObject {
Q_OBJECT
public:
~QWebEngineUrlRequestJob();
@@ -73,6 +73,7 @@ public:
QUrl requestUrl() const;
QByteArray requestMethod() const;
QUrl initiator() const;
+ QMap<QByteArray, QByteArray> requestHeaders() const;
void reply(const QByteArray &contentType, QIODevice *device);
void fail(Error error);
@@ -82,7 +83,7 @@ private:
QWebEngineUrlRequestJob(QtWebEngineCore::URLRequestCustomJobDelegate *);
friend class QtWebEngineCore::URLRequestCustomJobProxy;
- QtWebEngineCore::URLRequestCustomJobDelegate* d_ptr;
+ QtWebEngineCore::URLRequestCustomJobDelegate *d_ptr;
};
QT_END_NAMESPACE
diff --git a/src/core/api/qwebengineurlscheme.cpp b/src/core/api/qwebengineurlscheme.cpp
index 9cc5b5056..f4efad717 100644
--- a/src/core/api/qwebengineurlscheme.cpp
+++ b/src/core/api/qwebengineurlscheme.cpp
@@ -48,8 +48,7 @@ QT_BEGIN_NAMESPACE
ASSERT_ENUMS_MATCH(QWebEngineUrlScheme::Syntax::Path, url::SCHEME_WITHOUT_AUTHORITY)
ASSERT_ENUMS_MATCH(QWebEngineUrlScheme::Syntax::Host, url::SCHEME_WITH_HOST)
ASSERT_ENUMS_MATCH(QWebEngineUrlScheme::Syntax::HostAndPort, url::SCHEME_WITH_HOST_AND_PORT)
-ASSERT_ENUMS_MATCH(QWebEngineUrlScheme::Syntax::HostPortAndUserInformation,
- url::SCHEME_WITH_HOST_PORT_AND_USER_INFORMATION)
+ASSERT_ENUMS_MATCH(QWebEngineUrlScheme::Syntax::HostPortAndUserInformation, url::SCHEME_WITH_HOST_PORT_AND_USER_INFORMATION)
ASSERT_ENUMS_MATCH(QWebEngineUrlScheme::PortUnspecified, url::PORT_UNSPECIFIED)
@@ -193,10 +192,7 @@ public:
Content-Security-Policy checks.
*/
-QWebEngineUrlScheme::QWebEngineUrlScheme(QWebEngineUrlSchemePrivate *d)
- : d(d)
-{
-}
+QWebEngineUrlScheme::QWebEngineUrlScheme(QWebEngineUrlSchemePrivate *d) : d(d) {}
/*!
Constructs a web engine URL scheme with default values.
@@ -399,7 +395,7 @@ void QWebEngineUrlScheme::registerScheme(const QWebEngineUrlScheme &scheme)
*/
QWebEngineUrlScheme QWebEngineUrlScheme::schemeByName(const QByteArray &name)
{
- base::StringPiece namePiece{name.data(), static_cast<size_t>(name.size())};
+ base::StringPiece namePiece{ name.data(), static_cast<size_t>(name.size()) };
if (const url::CustomScheme *cs = url::CustomScheme::FindScheme(namePiece))
return QWebEngineUrlScheme(new QWebEngineUrlSchemePrivate(*cs));
return QWebEngineUrlScheme();
diff --git a/src/core/api/qwebengineurlscheme.h b/src/core/api/qwebengineurlscheme.h
index da3010335..095b47320 100644
--- a/src/core/api/qwebengineurlscheme.h
+++ b/src/core/api/qwebengineurlscheme.h
@@ -46,13 +46,15 @@
#include <QtCore/qobjectdefs.h>
#include <QtCore/qshareddata.h>
-namespace QtWebEngineCore { class WebEngineContext; }
+namespace QtWebEngineCore {
+class WebEngineContext;
+}
QT_BEGIN_NAMESPACE
class QWebEngineUrlSchemePrivate;
-class QWEBENGINECORE_EXPORT QWebEngineUrlScheme {
+class Q_WEBENGINECORE_EXPORT QWebEngineUrlScheme {
Q_GADGET
public:
enum class Syntax {
diff --git a/src/core/api/qwebengineurlschemehandler.cpp b/src/core/api/qwebengineurlschemehandler.cpp
index b5912703d..aecee5044 100644
--- a/src/core/api/qwebengineurlschemehandler.cpp
+++ b/src/core/api/qwebengineurlschemehandler.cpp
@@ -111,7 +111,6 @@ QWebEngineUrlSchemeHandler::QWebEngineUrlSchemeHandler(QObject *parent)
*/
QWebEngineUrlSchemeHandler::~QWebEngineUrlSchemeHandler()
{
- Q_EMIT _q_destroyedUrlSchemeHandler(this);
}
/*!
diff --git a/src/core/api/qwebengineurlschemehandler.h b/src/core/api/qwebengineurlschemehandler.h
index 23fee4b95..09c5b08cb 100644
--- a/src/core/api/qwebengineurlschemehandler.h
+++ b/src/core/api/qwebengineurlschemehandler.h
@@ -52,18 +52,13 @@ QT_BEGIN_NAMESPACE
class QWebEngineUrlRequestJob;
-class QWEBENGINECORE_EXPORT QWebEngineUrlSchemeHandler : public QObject {
+class Q_WEBENGINECORE_EXPORT QWebEngineUrlSchemeHandler : public QObject {
Q_OBJECT
public:
QWebEngineUrlSchemeHandler(QObject *parent = Q_NULLPTR);
~QWebEngineUrlSchemeHandler();
- virtual void requestStarted(QWebEngineUrlRequestJob*) = 0;
-
-#ifndef Q_QDOC
-Q_SIGNALS:
- void _q_destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler*);
-#endif
+ virtual void requestStarted(QWebEngineUrlRequestJob *) = 0;
private:
Q_DISABLE_COPY(QWebEngineUrlSchemeHandler)