Introduce QWebNetworkRequest in the public API.
authorhausmann <hausmann@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Jun 2007 13:03:34 +0000 (13:03 +0000)
committerhausmann <hausmann@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Jun 2007 13:03:34 +0000 (13:03 +0000)
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@23490 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKitQt/Api/qwebnetworkinterface.cpp
WebKitQt/Api/qwebnetworkinterface.h
WebKitQt/Api/qwebnetworkinterface_p.h
WebKitQt/ChangeLog
WebKitQt/WebCoreSupport/FrameLoaderClientQt.cpp

index f07ae53e5c004834268cf36ea83e3e26c66a91e5..b18095006daa8e92cd8113ae208d84781dc0c737 100644 (file)
@@ -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
 
index 8d3f1e499854deb794442dfbc347ac7eeaa4bfb5..ad649442e2bc6da9120fa58805c562a5dc879e4a 100644 (file)
@@ -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:
index 3905fc1dd1740e83698bc209ea49735c6fd36209..66400ff0dd92b720b57e8f0c4f5b6f1620ad5ee7 100644 (file)
@@ -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;
index 66f048629b07b4b28ee2ac32377741057eee63bc..ae464ac08a2fb1a5ffde9dee968d63b9143d0f85 100644 (file)
@@ -1,3 +1,16 @@
+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.
index 6b9a88ccdf1524dbd83deefc62816eb24554bd16..6560ba39b3de0a62258c6208ec5d27f7095f865f 100644 (file)
@@ -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();