summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/webenginewidgets/api/qwebengineurlrequestjob.cpp30
-rw-r--r--src/webenginewidgets/api/qwebengineurlschemehandler.cpp37
2 files changed, 67 insertions, 0 deletions
diff --git a/src/webenginewidgets/api/qwebengineurlrequestjob.cpp b/src/webenginewidgets/api/qwebengineurlrequestjob.cpp
index cb8b200a2..323cdcc72 100644
--- a/src/webenginewidgets/api/qwebengineurlrequestjob.cpp
+++ b/src/webenginewidgets/api/qwebengineurlrequestjob.cpp
@@ -42,21 +42,51 @@
QT_BEGIN_NAMESPACE
+/*!
+ \class QWebEngineUrlRequestJob
+ \brief The QWebEngineUrlRequestJob class represents a custom URL request.
+ \since 5.5
+ \internal
+
+ A QWebEngineUrlRequestJob is given to QWebEngineUrlSchemeHandler::requestStarted() and must
+ be handled by the derived implementations of class.
+
+ A job can be handled by calling setReply().
+
+ The class is owned by QtWebEngine and does not need to be deleted. Note QtWebEngine may delete
+ the job when it is no longer needed, so the signal QObject::destroyed() must be monitored if
+ a pointer to the object is stored.
+
+ \inmodule QtWebEngineWidgets
+*/
+
+/*!
+ \internal
+ */
QWebEngineUrlRequestJob::QWebEngineUrlRequestJob(QtWebEngineCore::URLRequestCustomJobDelegate * p)
: QObject(p) // owned by the jobdelegate and deleted when the job is done
, d_ptr(p)
{
}
+/*!
+ \internal
+ */
QWebEngineUrlRequestJob::~QWebEngineUrlRequestJob()
{
}
+/*!
+ Returns the url requested.
+ */
QUrl QWebEngineUrlRequestJob::requestUrl() const
{
return d_ptr->url();
}
+/*!
+ Sets the reply for the request to \a device with the mime-type \a contentType.
+ */
void QWebEngineUrlRequestJob::setReply(const QByteArray &contentType, QIODevice *device)
{
d_ptr->setReply(contentType, device);
diff --git a/src/webenginewidgets/api/qwebengineurlschemehandler.cpp b/src/webenginewidgets/api/qwebengineurlschemehandler.cpp
index 16ad220b2..65dd8f000 100644
--- a/src/webenginewidgets/api/qwebengineurlschemehandler.cpp
+++ b/src/webenginewidgets/api/qwebengineurlschemehandler.cpp
@@ -43,6 +43,23 @@
QT_BEGIN_NAMESPACE
+/*!
+ \class QWebEngineUrlSchemeHandler
+ \brief The QWebEngineUrlSchemeHandler Base class for handling custom URL schemes.
+ \since 5.5
+ \internal
+
+ To implement a custom URL scheme for QtWebEngine you must write a class derived from this class,
+ and reimplement requestStarted().
+
+ To install a custom URL scheme handler into a QtWebProfile, you only need to call the constructor
+ with the correct profile. Each instance of a QWebEngineUrlSchemeHandler can only handle requests
+ from a single profile.
+
+ \inmodule QtWebEngineWidgets
+
+*/
+
QWebEngineUrlSchemeHandlerPrivate::QWebEngineUrlSchemeHandlerPrivate(const QByteArray &scheme, QWebEngineUrlSchemeHandler *q, QWebEngineProfile *profile)
: CustomUrlSchemeHandler(scheme)
, q_ptr(q)
@@ -61,6 +78,12 @@ bool QWebEngineUrlSchemeHandlerPrivate::handleJob(QtWebEngineCore::URLRequestCus
return true;
}
+/*!
+ Constructs a new URL scheme handler.
+
+ The handler is created for \a scheme and for the \a profile.
+
+ */
QWebEngineUrlSchemeHandler::QWebEngineUrlSchemeHandler(const QByteArray &scheme, QWebEngineProfile *profile, QObject *parent)
: QObject(parent)
, d_ptr(new QWebEngineUrlSchemeHandlerPrivate(scheme, this, profile))
@@ -74,9 +97,23 @@ QWebEngineUrlSchemeHandler::~QWebEngineUrlSchemeHandler()
d_ptr->m_profile->d_func()->removeUrlSchemeHandler(this);
}
+/*!
+ Returns the custom URL scheme handled.
+*/
QByteArray QWebEngineUrlSchemeHandler::scheme() const
{
return d_ptr->scheme();
}
+/*!
+ \fn void QWebEngineUrlSchemeHandler::requestStarted(QWebEngineUrlRequestJob *request)
+
+ This method is called whenever a request for the registered scheme is started.
+
+ This method must be reimplemented by all custom URL scheme handlers.
+ The request is asynchronous and does not need to be handled right away.
+
+ \sa QWebEngineUrlRequestJob
+*/
+
QT_END_NAMESPACE