Use QWebNetworkRequest for QWebPage::navigationRequested.
authorhausmann <hausmann@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Jun 2007 13:04:19 +0000 (13:04 +0000)
committerhausmann <hausmann@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Jun 2007 13:04:19 +0000 (13:04 +0000)
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@23494 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKitQt/Api/qwebnetworkinterface.cpp
WebKitQt/Api/qwebnetworkinterface.h
WebKitQt/Api/qwebpage.cpp
WebKitQt/Api/qwebpage.h
WebKitQt/Api/qwebpage_p.h
WebKitQt/ChangeLog
WebKitQt/WebCoreSupport/FrameLoaderClientQt.cpp

index 277a9fd5227ce9cda8b0da848cc4049a8861ffa6..eb6dd175bbefe30666ac7c2a157eb28c1bebdade 100644 (file)
@@ -129,11 +129,23 @@ QWebNetworkRequest &QWebNetworkRequest::operator=(const QWebNetworkRequest &othe
     return *this;
 }
 
+/*!
+  \internal
+*/
 QWebNetworkRequest::QWebNetworkRequest(QWebNetworkRequestPrivate *priv)
     : d(new QWebNetworkRequestPrivate(*priv))
 {
 }
 
+/*!
+  \internal
+*/
+QWebNetworkRequest::QWebNetworkRequest(const WebCore::ResourceRequest &request)
+    : d(new QWebNetworkRequestPrivate)
+{
+    d->init(request);
+}
+
 QWebNetworkRequest::~QWebNetworkRequest()
 {
     delete d;
index dc6e719aa27b853967bbb867d93475fa2bee2de2..36d19c4d09a8f90b9f79978096503b47845b0a4c 100644 (file)
@@ -35,6 +35,8 @@ class QWebObjectPluginConnector;
 
 namespace WebCore {
     class WebCoreHttp;
+    class ResourceRequest;
+    class FrameLoaderClientQt;
 }
 
 struct QWebNetworkRequestPrivate;
@@ -49,6 +51,7 @@ public:
 
     QWebNetworkRequest();
     QWebNetworkRequest(const QWebNetworkRequest &other);
+
     QWebNetworkRequest &operator=(const QWebNetworkRequest &other);
     ~QWebNetworkRequest();
 
@@ -63,8 +66,11 @@ public:
 
 private:
     explicit QWebNetworkRequest(QWebNetworkRequestPrivate *priv);
-    QWebNetworkRequestPrivate *d;
+    explicit QWebNetworkRequest(const WebCore::ResourceRequest &request);
     friend class QWebNetworkJob;
+    friend class WebCore::FrameLoaderClientQt;
+
+    QWebNetworkRequestPrivate *d;
 };
 
 class QWEBKIT_EXPORT QWebNetworkJob
index 585e08f59e0693e0cd800bac743fd0e0ca37e76a..c34857c08c42c26ced9b6e26cb397ed1ee26c46a 100644 (file)
@@ -76,12 +76,12 @@ QWebPagePrivate::~QWebPagePrivate()
     delete page;
 }
 
-QWebPage::NavigationRequestResponse QWebPagePrivate::navigationRequested(QWebFrame *frame, const QUrl &url, const QHttpRequestHeader &request, const QByteArray &postData)
+QWebPage::NavigationRequestResponse QWebPagePrivate::navigationRequested(QWebFrame *frame, const QWebNetworkRequest &request)
 {
     if (insideOpenCall
         && frame == mainFrame)
         return QWebPage::AcceptNavigationRequest;
-    return q->navigationRequested(frame, url, request, postData);
+    return q->navigationRequested(frame, request);
 }
 
 void QWebPagePrivate::createMainFrame()
@@ -221,12 +221,9 @@ QWebPage *QWebPage::createWindow()
     return 0;
 }
 
-QWebPage::NavigationRequestResponse QWebPage::navigationRequested(QWebFrame *frame, const QUrl &url, const QHttpRequestHeader &request, const QByteArray &postData)
+QWebPage::NavigationRequestResponse QWebPage::navigationRequested(QWebFrame *frame, const QWebNetworkRequest &request)
 {
-    Q_UNUSED(frame)
-    Q_UNUSED(url)
     Q_UNUSED(request)
-    Q_UNUSED(postData)
     return AcceptNavigationRequest;
 }
 
index 2bd6f33d0a4bee284ca3377b7ac5e6cde920a191..257f80c16d5102c574d589a637bc8aaa49a3e210 100644 (file)
@@ -33,6 +33,7 @@ class QWebFrame;
 class QUndoStack;
 class QUrl;
 class QHttpRequestHeader;
+class QWebNetworkRequest;
 
 class QWebPagePrivate;
 class QWebFrameData;
@@ -142,7 +143,7 @@ protected:
     virtual QWebFrame *createFrame(QWebFrame *parentFrame, QWebFrameData *frameData);
     virtual QWebPage *createWindow();
 
-    virtual NavigationRequestResponse navigationRequested(QWebFrame *frame, const QUrl &url, const QHttpRequestHeader &request, const QByteArray &postData);
+    virtual NavigationRequestResponse navigationRequested(QWebFrame *frame, const QWebNetworkRequest &request);
 
 private:
     friend class QWebFrame;
index 219a670f83456aaa28a367a8ddf1038ff06f9505..ca8c2f5c6f5f32041904479ce9bdc026ea0718eb 100644 (file)
@@ -61,7 +61,7 @@ public:
     bool modified;
 
     bool insideOpenCall;
-    QWebPage::NavigationRequestResponse navigationRequested(QWebFrame *frame, const QUrl &url, const QHttpRequestHeader &request, const QByteArray &postData);
+    QWebPage::NavigationRequestResponse navigationRequested(QWebFrame *frame, const QWebNetworkRequest &request);
 };
 
 #endif
index 0a6c95bc3c32ed0adcda7072126fe80bfdfe7bce..7ac450b577797c5015ab5a07630c348d5cd146ee 100644 (file)
@@ -1,3 +1,19 @@
+2007-06-13  Simon Hausmann  <hausmann@kde.org>
+
+        Reviewed by Lars.
+
+        Use QWebNetworkRequest for QWebPage::navigationRequested.
+
+        * Api/qwebnetworkinterface.cpp:
+        * Api/qwebnetworkinterface.h:
+        * Api/qwebpage.cpp:
+        (QWebPagePrivate::navigationRequested):
+        (QWebPage::navigationRequested):
+        * Api/qwebpage.h:
+        * Api/qwebpage_p.h:
+        * WebCoreSupport/FrameLoaderClientQt.cpp:
+        (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction):
+
 2007-06-13  Simon Hausmann  <hausmann@kde.org>
 
         Reviewed by Lars.
index 6560ba39b3de0a62258c6208ec5d27f7095f865f..ebdd46a3d3555c7e6867b3adc5dddb480b4263e8 100644 (file)
@@ -811,11 +811,10 @@ void FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction(FramePolicyFun
     Q_ASSERT(!m_policyFunction);
     m_policyFunction = function;
     if (m_webFrame) {
-        QWebNetworkRequestPrivate r;
-        r.init(request);
+        QWebNetworkRequest r(request);
         QWebPage *page = m_webFrame->page();
 
-        if (page->d->navigationRequested(m_webFrame, r.url, r.httpHeader, r.postData) == QWebPage::IgnoreNavigationRequest) {
+        if (page->d->navigationRequested(m_webFrame, r) == QWebPage::IgnoreNavigationRequest) {
             slotCallPolicyFunction(PolicyIgnore);
             return;
         }