Commit 7c04428b authored by hausmann's avatar hausmann
Browse files

Introduce QWebNetworkRequest in the public API.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@23490 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent c27c031f
......@@ -57,14 +57,14 @@ static bool operator==(const HostInfo &i1, const HostInfo &i2)
return i1.port == i2.port && i1.host == i2.host;
}
void QWebNetworkRequest::init(const WebCore::ResourceRequest &resourceRequest)
void QWebNetworkRequestPrivate::init(const WebCore::ResourceRequest &resourceRequest)
{
KURL url = resourceRequest.url();
QUrl qurl = QString(url.url());
init(resourceRequest.httpMethod(), qurl, &resourceRequest);
}
void QWebNetworkRequest::init(const QString &method, const QUrl &url, const WebCore::ResourceRequest *resourceRequest)
void QWebNetworkRequestPrivate::init(const QString &method, const QUrl &url, const WebCore::ResourceRequest *resourceRequest)
{
httpHeader = QHttpRequestHeader(method, url.toEncoded(QUrl::RemoveScheme|QUrl::RemoveAuthority));
httpHeader.setValue(QLatin1String("User-Agent"),
......@@ -95,7 +95,7 @@ void QWebNetworkRequest::init(const QString &method, const QUrl &url, const WebC
}
}
void QWebNetworkRequest::setURL(const QUrl &u)
void QWebNetworkRequestPrivate::setURL(const QUrl &u)
{
url = u;
int port = url.port();
......@@ -105,6 +105,57 @@ void QWebNetworkRequest::setURL(const QUrl &u)
httpHeader.setValue(QLatin1String("Host"), url.host());
}
QWebNetworkRequest::QWebNetworkRequest()
: d(new QWebNetworkRequestPrivate)
{
}
QWebNetworkRequest::QWebNetworkRequest(const QWebNetworkRequest &other)
: d(new QWebNetworkRequestPrivate(*other.d))
{
}
QWebNetworkRequest &QWebNetworkRequest::operator=(const QWebNetworkRequest &other)
{
*d = *other.d;
return *this;
}
QWebNetworkRequest::~QWebNetworkRequest()
{
delete d;
}
QUrl QWebNetworkRequest::url() const
{
return d->url;
}
void QWebNetworkRequest::setUrl(const QUrl &url)
{
d->setURL(url);
}
QHttpRequestHeader QWebNetworkRequest::httpHeader() const
{
return d->httpHeader;
}
void QWebNetworkRequest::setHttpHeader(const QHttpRequestHeader &header) const
{
d->httpHeader = header;
}
QByteArray QWebNetworkRequest::postData() const
{
return d->postData;
}
void QWebNetworkRequest::setPostData(const QByteArray &data)
{
d->postData = data;
}
/*!
\class QWebNetworkJob
......
......@@ -37,6 +37,28 @@ namespace WebCore {
class WebCoreHttp;
}
struct QWebNetworkRequestPrivate;
class QWEBKIT_EXPORT QWebNetworkRequest
{
public:
QWebNetworkRequest();
QWebNetworkRequest(const QWebNetworkRequest &other);
QWebNetworkRequest &operator=(const QWebNetworkRequest &other);
~QWebNetworkRequest();
QUrl url() const;
void setUrl(const QUrl &url);
QHttpRequestHeader httpHeader() const;
void setHttpHeader(const QHttpRequestHeader &header) const;
QByteArray postData() const;
void setPostData(const QByteArray &data);
private:
QWebNetworkRequestPrivate *d;
};
class QWEBKIT_EXPORT QWebNetworkJob
{
public:
......
......@@ -36,7 +36,7 @@ namespace WebCore {
class ResourceHandle;
}
struct QWebNetworkRequest
struct QWebNetworkRequestPrivate
{
QUrl url;
QHttpRequestHeader httpHeader;
......@@ -59,7 +59,7 @@ public:
{}
int ref;
QWebNetworkRequest request;
QWebNetworkRequestPrivate request;
QHttpResponseHeader response;
WebCore::ResourceHandle *resourceHandle;
......
2007-06-13 Simon Hausmann <hausmann@kde.org>
Reviewed by Lars.
Introduce QWebNetworkRequest in the public API.
* Api/qwebnetworkinterface.cpp:
(QWebNetworkRequestPrivate::init):
* Api/qwebnetworkinterface.h:
* Api/qwebnetworkinterface_p.h:
* WebCoreSupport/FrameLoaderClientQt.cpp:
(WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction):
2007-06-13 Simon Hausmann <hausmann@kde.org>
Reviewed by Lars.
......
......@@ -811,7 +811,7 @@ void FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction(FramePolicyFun
Q_ASSERT(!m_policyFunction);
m_policyFunction = function;
if (m_webFrame) {
QWebNetworkRequest r;
QWebNetworkRequestPrivate r;
r.init(request);
QWebPage *page = m_webFrame->page();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment