summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-09-04 10:18:44 +0200
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-09-06 19:26:45 +0000
commit6ef0a365124d435314113837dc77fa07b02ff86b (patch)
tree39e4dbe1637f564e61853a40389c38eeda61abfe /src/core
parent819279827a4ce05562909994468ec5604392c672 (diff)
Make request job and request info methods consistent
Changes the method names so the two request representation uses the same method name and the same style of naming of actions on the requests. Change-Id: I409ed1a5f6ac0835878f65ee978b6f224e42aa20 Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/api/qwebengineurlrequestinfo.cpp10
-rw-r--r--src/core/api/qwebengineurlrequestinfo.h8
-rw-r--r--src/core/api/qwebengineurlrequestjob.cpp22
-rw-r--r--src/core/api/qwebengineurlrequestjob.h8
-rw-r--r--src/core/url_request_custom_job_delegate.cpp5
-rw-r--r--src/core/url_request_custom_job_delegate.h1
6 files changed, 35 insertions, 19 deletions
diff --git a/src/core/api/qwebengineurlrequestinfo.cpp b/src/core/api/qwebengineurlrequestinfo.cpp
index 282361584..b769081f8 100644
--- a/src/core/api/qwebengineurlrequestinfo.cpp
+++ b/src/core/api/qwebengineurlrequestinfo.cpp
@@ -209,10 +209,10 @@ QWebEngineUrlRequestInfo::NavigationType QWebEngineUrlRequestInfo::navigationTyp
}
/*!
- Returns the request URL.
+ Returns the requested URL.
*/
-const QUrl &QWebEngineUrlRequestInfo::url() const
+QUrl QWebEngineUrlRequestInfo::requestUrl() const
{
Q_D(const QWebEngineUrlRequestInfo);
return d->url;
@@ -223,7 +223,7 @@ const QUrl &QWebEngineUrlRequestInfo::url() const
Returns the HTTP method of the request (for example, GET or POST).
*/
-const QByteArray &QWebEngineUrlRequestInfo::method() const
+QByteArray QWebEngineUrlRequestInfo::requestMethod() const
{
Q_D(const QWebEngineUrlRequestInfo);
return d->method;
@@ -234,7 +234,7 @@ const QByteArray &QWebEngineUrlRequestInfo::method() const
It is only possible to redirect requests that do not have payload data, such as GET requests.
*/
-void QWebEngineUrlRequestInfo::redirectTo(const QUrl &url)
+void QWebEngineUrlRequestInfo::redirect(const QUrl &url)
{
Q_D(QWebEngineUrlRequestInfo);
d->url = url;
@@ -246,7 +246,7 @@ void QWebEngineUrlRequestInfo::redirectTo(const QUrl &url)
This function can be used to prevent navigating away from a given domain, for example.
*/
-void QWebEngineUrlRequestInfo::blockRequest(bool shouldBlock)
+void QWebEngineUrlRequestInfo::block(bool shouldBlock)
{
Q_D(QWebEngineUrlRequestInfo);
d->shouldBlockRequest = shouldBlock;
diff --git a/src/core/api/qwebengineurlrequestinfo.h b/src/core/api/qwebengineurlrequestinfo.h
index dd1e57ebd..7c016d20d 100644
--- a/src/core/api/qwebengineurlrequestinfo.h
+++ b/src/core/api/qwebengineurlrequestinfo.h
@@ -85,11 +85,11 @@ public:
ResourceType resourceType() const;
NavigationType navigationType() const;
- const QUrl &url() const;
- const QByteArray &method() const;
+ QUrl requestUrl() const;
+ QByteArray requestMethod() const;
- void blockRequest(bool shouldBlock);
- void redirectTo(const QUrl &url);
+ void block(bool shouldBlock);
+ void redirect(const QUrl &url);
void setExtraHeader(const QByteArray &name, const QByteArray &value);
private:
diff --git a/src/core/api/qwebengineurlrequestjob.cpp b/src/core/api/qwebengineurlrequestjob.cpp
index f2a7f1619..d9f3833b9 100644
--- a/src/core/api/qwebengineurlrequestjob.cpp
+++ b/src/core/api/qwebengineurlrequestjob.cpp
@@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE
A QWebEngineUrlRequestJob is given to QWebEngineUrlSchemeHandler::requestStarted() and must
be handled by the derived implementations of the class.
- A job can be handled by calling either setReply(), redirect() or setError().
+ A job can be handled by calling either reply(), redirect() or fail().
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
@@ -76,17 +76,25 @@ QWebEngineUrlRequestJob::~QWebEngineUrlRequestJob()
}
/*!
- Returns the url requested.
- */
+ Returns the requested URL.
+*/
QUrl QWebEngineUrlRequestJob::requestUrl() const
{
return d_ptr->url();
}
/*!
- Sets the reply for the request to \a device with the mime-type \a contentType.
+ Returns the HTTP method of the request (for example, GET or POST).
+*/
+QByteArray QWebEngineUrlRequestJob::requestMethod() const
+{
+ return d_ptr->method();
+}
+
+/*!
+ Replies the request with \a device with the mime-type \a contentType.
*/
-void QWebEngineUrlRequestJob::setReply(const QByteArray &contentType, QIODevice *device)
+void QWebEngineUrlRequestJob::reply(const QByteArray &contentType, QIODevice *device)
{
d_ptr->setReply(contentType, device);
}
@@ -94,7 +102,7 @@ void QWebEngineUrlRequestJob::setReply(const QByteArray &contentType, QIODevice
/*!
Fails the request with error \a error.
*/
-void QWebEngineUrlRequestJob::setError(Error r)
+void QWebEngineUrlRequestJob::fail(Error r)
{
d_ptr->fail((URLRequestCustomJobDelegate::Error)r);
}
@@ -102,7 +110,7 @@ void QWebEngineUrlRequestJob::setError(Error r)
/*!
Tell the request is redirected to \a url.
*/
-void QWebEngineUrlRequestJob::setRedirect(const QUrl &url)
+void QWebEngineUrlRequestJob::redirect(const QUrl &url)
{
d_ptr->redirect(url);
}
diff --git a/src/core/api/qwebengineurlrequestjob.h b/src/core/api/qwebengineurlrequestjob.h
index 1be3808fa..098d46c93 100644
--- a/src/core/api/qwebengineurlrequestjob.h
+++ b/src/core/api/qwebengineurlrequestjob.h
@@ -78,9 +78,11 @@ public:
Q_ENUM(Error)
QUrl requestUrl() const;
- void setReply(const QByteArray &contentType, QIODevice *device);
- void setError(Error error);
- void setRedirect(const QUrl &url);
+ QByteArray requestMethod() const;
+
+ void reply(const QByteArray &contentType, QIODevice *device);
+ void fail(Error error);
+ void redirect(const QUrl &url);
private:
QWebEngineUrlRequestJob(QtWebEngineCore::URLRequestCustomJobDelegate *);
diff --git a/src/core/url_request_custom_job_delegate.cpp b/src/core/url_request_custom_job_delegate.cpp
index 8d344c862..0650242c8 100644
--- a/src/core/url_request_custom_job_delegate.cpp
+++ b/src/core/url_request_custom_job_delegate.cpp
@@ -58,6 +58,11 @@ QUrl URLRequestCustomJobDelegate::url() const
return toQt(m_job->request()->url());
}
+QByteArray URLRequestCustomJobDelegate::method() const
+{
+ return QByteArray::fromStdString(m_job->request()->method());
+}
+
void URLRequestCustomJobDelegate::setReply(const QByteArray &contentType, QIODevice *device)
{
m_job->setReplyMimeType(contentType.toStdString());
diff --git a/src/core/url_request_custom_job_delegate.h b/src/core/url_request_custom_job_delegate.h
index 6c1600592..5b6137820 100644
--- a/src/core/url_request_custom_job_delegate.h
+++ b/src/core/url_request_custom_job_delegate.h
@@ -63,6 +63,7 @@ public:
};
QUrl url() const;
+ QByteArray method() const;
void setReply(const QByteArray &contentType, QIODevice *device);
void redirect(const QUrl& url);