Reviewed by Eric.
authormjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 16 Mar 2006 23:00:38 +0000 (23:00 +0000)
committermjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 16 Mar 2006 23:00:38 +0000 (23:00 +0000)
        - renamed URLArgs to ResourceRequest, split it into its own header
        - moved methods to get and set ResourceRequest to Frame

        * WebCore.xcodeproj/project.pbxproj:
        * bridge/BrowserExtension.h:
        * bridge/mac/BrowserExtensionMac.h:
        * bridge/mac/BrowserExtensionMac.mm:
        (WebCore::BrowserExtensionMac::openURLRequest):
        (WebCore::BrowserExtensionMac::createNewWindow):
        * bridge/mac/MacFrame.h:
        * bridge/mac/MacFrame.mm:
        (WebCore::MacFrame::openURLRequest):
        (WebCore::MacFrame::submitForm):
        (WebCore::MacFrame::urlSelected):
        * bridge/mac/WebCoreFrameBridge.mm:
        (-[WebCoreFrameBridge openURL:reload:contentType:refresh:lastModified:pageCache:]):
        * khtml/ecma/kjs_window.cpp:
        (KJS::createNewWindow):
        (KJS::WindowFunc::callAsFunction):
        * page/Frame.cpp:
        (WebCore::Frame::didOpenURL):
        (WebCore::Frame::receivedFirstData):
        (WebCore::Frame::setResourceRequest):
        (WebCore::Frame::resourceRequest):
        (WebCore::Frame::begin):
        (WebCore::Frame::changeLocation):
        (WebCore::Frame::urlSelected):
        (WebCore::Frame::requestFrame):
        (WebCore::Frame::submitForm):
        * page/Frame.h:
        * page/FramePrivate.h:
        * page/ResourceRequest.h: Added.
        (WebCore::ResourceRequest::ResourceRequest):
        (WebCore::ResourceRequest::contentType):
        (WebCore::ResourceRequest::setContentType):
        (WebCore::ResourceRequest::doPost):
        (WebCore::ResourceRequest::setDoPost):
        (WebCore::ResourceRequest::lockHistory):
        (WebCore::ResourceRequest::setLockHistory):
        (WebCore::ResourceRequest::metaData):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@13337 268f45cc-cd09-0410-ab3c-d52691b4dbfc

13 files changed:
WebCore/ChangeLog
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/bridge/BrowserExtension.h
WebCore/bridge/mac/BrowserExtensionMac.h
WebCore/bridge/mac/BrowserExtensionMac.mm
WebCore/bridge/mac/MacFrame.h
WebCore/bridge/mac/MacFrame.mm
WebCore/bridge/mac/WebCoreFrameBridge.mm
WebCore/khtml/ecma/kjs_window.cpp
WebCore/page/Frame.cpp
WebCore/page/Frame.h
WebCore/page/FramePrivate.h
WebCore/page/ResourceRequest.h [new file with mode: 0644]

index 6d54adb7f614d6d9ed302f1daf832f912287e6eb..2442beea7bd2ef1c4a384cd652d3b20c1dce22a9 100644 (file)
@@ -1,3 +1,48 @@
+2006-03-16  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Eric.
+
+        - renamed URLArgs to ResourceRequest, split it into its own header
+        - moved methods to get and set ResourceRequest to Frame
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * bridge/BrowserExtension.h:
+        * bridge/mac/BrowserExtensionMac.h:
+        * bridge/mac/BrowserExtensionMac.mm:
+        (WebCore::BrowserExtensionMac::openURLRequest):
+        (WebCore::BrowserExtensionMac::createNewWindow):
+        * bridge/mac/MacFrame.h:
+        * bridge/mac/MacFrame.mm:
+        (WebCore::MacFrame::openURLRequest):
+        (WebCore::MacFrame::submitForm):
+        (WebCore::MacFrame::urlSelected):
+        * bridge/mac/WebCoreFrameBridge.mm:
+        (-[WebCoreFrameBridge openURL:reload:contentType:refresh:lastModified:pageCache:]):
+        * khtml/ecma/kjs_window.cpp:
+        (KJS::createNewWindow):
+        (KJS::WindowFunc::callAsFunction):
+        * page/Frame.cpp:
+        (WebCore::Frame::didOpenURL):
+        (WebCore::Frame::receivedFirstData):
+        (WebCore::Frame::setResourceRequest):
+        (WebCore::Frame::resourceRequest):
+        (WebCore::Frame::begin):
+        (WebCore::Frame::changeLocation):
+        (WebCore::Frame::urlSelected):
+        (WebCore::Frame::requestFrame):
+        (WebCore::Frame::submitForm):
+        * page/Frame.h:
+        * page/FramePrivate.h:
+        * page/ResourceRequest.h: Added.
+        (WebCore::ResourceRequest::ResourceRequest):
+        (WebCore::ResourceRequest::contentType):
+        (WebCore::ResourceRequest::setContentType):
+        (WebCore::ResourceRequest::doPost):
+        (WebCore::ResourceRequest::setDoPost):
+        (WebCore::ResourceRequest::lockHistory):
+        (WebCore::ResourceRequest::setLockHistory):
+        (WebCore::ResourceRequest::metaData):
+
 2006-03-16  Darin Adler  <darin@apple.com>
 
         - need to touch one more file to fix the build
index cf4149e68addf1abba58df980f78443b77a62698..2ec5264369f2492ae0a49b1e11a8266020af30d2 100644 (file)
@@ -18,6 +18,7 @@
                651B4D8509AC83370029F1EF /* QStringList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 651B4D8309AC83370029F1EF /* QStringList.cpp */; };
                651B4D8609AC83370029F1EF /* QStringList.h in Headers */ = {isa = PBXBuildFile; fileRef = 651B4D8409AC83370029F1EF /* QStringList.h */; };
                651B4D8F09AC859F0029F1EF /* QStringListMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 651B4D8E09AC859F0029F1EF /* QStringListMac.mm */; };
+               6522BCDF09C9DAA800C9BA7A /* ResourceRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 6522BCDE09C9DAA800C9BA7A /* ResourceRequest.h */; };
                6545F67009B82FED0013006F /* TransferJob.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6545F66C09B82FED0013006F /* TransferJob.cpp */; };
                6545F67109B82FED0013006F /* TransferJob.h in Headers */ = {isa = PBXBuildFile; fileRef = 6545F66D09B82FED0013006F /* TransferJob.h */; };
                6545F67209B82FED0013006F /* TransferJobClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 6545F66E09B82FED0013006F /* TransferJobClient.h */; };
                651B4D8309AC83370029F1EF /* QStringList.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = QStringList.cpp; path = platform/QStringList.cpp; sourceTree = "<group>"; };
                651B4D8409AC83370029F1EF /* QStringList.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = QStringList.h; path = platform/QStringList.h; sourceTree = "<group>"; };
                651B4D8E09AC859F0029F1EF /* QStringListMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = QStringListMac.mm; sourceTree = "<group>"; };
+               6522BCDE09C9DAA800C9BA7A /* ResourceRequest.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ResourceRequest.h; sourceTree = "<group>"; };
                6545F66C09B82FED0013006F /* TransferJob.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = TransferJob.cpp; path = platform/TransferJob.cpp; sourceTree = "<group>"; };
                6545F66D09B82FED0013006F /* TransferJob.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = TransferJob.h; path = platform/TransferJob.h; sourceTree = "<group>"; };
                6545F66E09B82FED0013006F /* TransferJobClient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = TransferJobClient.h; path = platform/TransferJobClient.h; sourceTree = "<group>"; };
                65BF02180974806300C43196 /* page */ = {
                        isa = PBXGroup;
                        children = (
+                               6522BCDE09C9DAA800C9BA7A /* ResourceRequest.h */,
                                65BF02290974816300C43196 /* Frame.cpp */,
                                65BF022A0974816300C43196 /* Frame.h */,
                                65BF022B0974816300C43196 /* FramePrivate.h */,
                                93EEC20409C2877700C515D1 /* CanvasPattern.h in Headers */,
                                930CAD1509C4F3C300229C04 /* JSCanvasRenderingContext2DBase.h in Headers */,
                                D0B0556809C6700100307E43 /* CreateLinkCommand.h in Headers */,
+                               6522BCDF09C9DAA800C9BA7A /* ResourceRequest.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index a354a4ec29f14657e3ec6b7da754f11cc337ca4f..f74332957c4393363416fd76f7c453fee280fb97 100644 (file)
@@ -29,6 +29,7 @@
 #include "PlatformString.h"
 #include "formdata.h"
 #include <kxmlcore/HashMap.h>
+#include "ResourceRequest.h"
 
 class KURL;
 
@@ -36,36 +37,6 @@ namespace WebCore {
 
 class Frame;
 
-struct URLArgs {
-
-    QString frameName;
-    FormData postData;
-    bool reload;
-    QString serviceType;
-    int xOffset;
-    int yOffset;
-
-    URLArgs() : reload(false), xOffset(0), yOffset(0), m_doPost(false), m_lockHistory(false) { }
-    
-    QString contentType() const { return m_contentType; }
-    void setContentType(const QString &t) { m_contentType = t; }
-
-    bool doPost() const { return m_doPost; }
-    void setDoPost(bool post) { m_doPost = post; }
-    
-    bool lockHistory() const { return m_lockHistory; }
-    void setLockHistory(bool lock) { m_lockHistory = lock; }
-
-    HashMap<DOMString, DOMString>& metaData() { return m_metadata; }
-    const HashMap<DOMString, DOMString>& metaData() const { return m_metadata; }
-
-private:
-    QString m_contentType;
-    bool m_doPost;
-    bool m_lockHistory;
-    HashMap<DOMString, DOMString> m_metadata;
-};
-
 struct WindowArgs {
     int x;
     bool xSet;
@@ -91,15 +62,15 @@ class BrowserExtension {
 public:
     virtual ~BrowserExtension() { }
 
-    virtual void openURLRequest(const KURL &, const URLArgs &args = URLArgs()) = 0;
+    virtual void openURLRequest(const KURL&, const ResourceRequest& request = ResourceRequest()) = 0;
     virtual void openURLNotify() = 0;
     
     virtual void createNewWindow(const KURL &url, 
-                                 const URLArgs &urlArgs = URLArgs()) = 0;
+                                 const ResourceRequest& request = ResourceRequest()) = 0;
     
-    virtual void createNewWindow(const KURL &url, 
-                                 const URLArgs &urlArgs
-                                 const WindowArgs &winArgs, 
+    virtual void createNewWindow(const KURLurl, 
+                                 const ResourceRequest& request
+                                 const WindowArgswinArgs, 
                                  Frame*& part) = 0;
     
     virtual void setIconURL(const KURL &url) = 0;
@@ -108,9 +79,6 @@ public:
     virtual int getHistoryLength() = 0;
     virtual void goBackOrForward(int distance) = 0;
     
-    void setURLArgs(const URLArgs &args) { m_args = args; }
-    URLArgs urlArgs() const { return m_args; }
-
     virtual bool canRunModal() = 0;
     virtual bool canRunModalNow() = 0;
     virtual void runModal() = 0;
@@ -118,8 +86,6 @@ public:
 protected:
     BrowserExtension() {};
 
-private:
-    URLArgs m_args;
 };
 
 }
index f5c4e22bc3f056520fb2f1c4cb374191c03b5d14..829a7a4e886ff361dd2b047de6668b446a86f83e 100644 (file)
@@ -34,19 +34,19 @@ class BrowserExtensionMac : public BrowserExtension {
 public:
     BrowserExtensionMac(Frame *);
  
-    virtual void openURLRequest(const KURL &, 
-                                const URLArgs &args = URLArgs());
+    virtual void openURLRequest(const KURL&, 
+                                const ResourceRequest& request = ResourceRequest());
     virtual void openURLNotify();
      
-    virtual void createNewWindow(const KURL &url, 
-                                 const URLArgs &urlArgs = URLArgs());
+    virtual void createNewWindow(const KURLurl, 
+                                 const ResourceRequest& request = ResourceRequest());
     virtual void createNewWindow(const KURL& url,
-                                 const URLArgs& urlArgs
+                                 const ResourceRequest& request
                                  const WindowArgs& winArgs, 
                                  Frame*& part);
 
-    virtual void setIconURL(const KURL &url);
-    virtual void setTypedIconURL(const KURL &url, const QString &type);
+    virtual void setIconURL(const KURL& request);
+    virtual void setTypedIconURL(const KURL& url, const QString& type);
 
     virtual int getHistoryLength();
     virtual void goBackOrForward(int distance);
@@ -56,9 +56,9 @@ public:
     virtual void runModal();
     
 private:
-     void createNewWindow(const KURL &url, 
-                          const URLArgs &urlArgs
-                          const WindowArgs &winArgs, 
+     void createNewWindow(const KURLurl, 
+                          const ResourceRequest& request
+                          const WindowArgswinArgs, 
                           Frame** part);
 
      MacFrame *m_frame;
index 44e55acd6896262662d26ce0773fec1156f2d45e..8905259959fdf572fb25709f6e193fcd2f0d2f36 100644 (file)
@@ -40,13 +40,13 @@ BrowserExtensionMac::BrowserExtensionMac(Frame *frame)
 {
 }
 
-void BrowserExtensionMac::openURLRequest(const KURL& url, const URLArgs& args)
+void BrowserExtensionMac::openURLRequest(const KURL& url, const ResourceRequest& request)
 {
     if (url.protocol().lower() == "javascript") {
        m_frame->createEmptyDocument();
        m_frame->replaceContentsWithScriptResult(url);
      } else {
-       m_frame->openURLRequest(url, args);
+       m_frame->openURLRequest(url, request);
     }
 }
 
@@ -54,37 +54,37 @@ void BrowserExtensionMac::openURLNotify()
 {
 }
 
-void BrowserExtensionMac::createNewWindow(const KURL &url, const URLArgs &urlArgs
+void BrowserExtensionMac::createNewWindow(const KURL& url, const ResourceRequest& request
 {
-    createNewWindow(url, urlArgs, WindowArgs(), NULL);
+    createNewWindow(url, request, WindowArgs(), NULL);
 }
 
-void BrowserExtensionMac::createNewWindow(const KURL &url, 
-                                               const URLArgs &urlArgs
-                                               const WindowArgs &winArgs, 
-                                               Frame*& part)
+void BrowserExtensionMac::createNewWindow(const KURLurl, 
+                                          const ResourceRequest& request
+                                          const WindowArgs& winArgs, 
+                                          Frame*& part)
 {
-    createNewWindow(url, urlArgs, winArgs, &part);
+    createNewWindow(url, request, winArgs, &part);
 }
 
-void BrowserExtensionMac::createNewWindow(const KURL &url, 
-                                               const URLArgs &urlArgs
-                                               const WindowArgs &winArgs, 
-                                               Frame** partResult)
+void BrowserExtensionMac::createNewWindow(const KURLurl, 
+                                          const ResourceRequest& request
+                                          const WindowArgs& winArgs, 
+                                          Frame** partResult)
 { 
     KWQ_BLOCK_EXCEPTIONS;
 
-    ASSERT(!winArgs.dialog || urlArgs.frameName.isEmpty());
+    ASSERT(!winArgs.dialog || request.frameName.isEmpty());
 
     if (partResult)
        *partResult = NULL;
 
-    NSString *frameName = urlArgs.frameName.length() == 0 ? nil : urlArgs.frameName.getNSString();
+    NSString *frameName = request.frameName.length() == 0 ? nil : request.frameName.getNSString();
     if (frameName) {
         // FIXME: Can't we just use m_frame->findFrame?
         if (WebCoreFrameBridge *bridge = [m_frame->bridge() findFrameNamed:frameName]) {
             if (!url.isEmpty()) {
-                DOMString argsReferrer = urlArgs.metaData().get("referrer");
+                DOMString argsReferrer = request.metaData().get("referrer");
                 NSString *referrer;
                 if (!argsReferrer.isEmpty())
                     referrer = argsReferrer;
@@ -93,7 +93,7 @@ void BrowserExtensionMac::createNewWindow(const KURL &url,
 
                 [bridge loadURL:url.getNSURL() 
                        referrer:referrer 
-                         reload:urlArgs.reload 
+                         reload:request.reload 
                     userGesture:true 
                          target:nil 
                 triggeringEvent:nil 
@@ -120,7 +120,7 @@ void BrowserExtensionMac::createNewWindow(const KURL &url,
     
     WebCoreFrameBridge *bridge = [page mainFrame];
     if ([bridge impl])
-       [bridge impl]->tree()->setName(urlArgs.frameName);
+       [bridge impl]->tree()->setName(request.frameName);
     
     if (partResult)
        *partResult = [bridge impl];
index 4435d3e8eeb326d9d2919ce48e57f42617bcb444..a2f3100db5e88657db70d7e344e9b9732d66cdd3 100644 (file)
@@ -129,15 +129,15 @@ public:
 
     virtual bool openURL(const KURL &);
     
-    virtual void openURLRequest(const KURL &, const URLArgs &);
-    virtual void submitForm(const KURL &, const URLArgs &);
+    virtual void openURLRequest(const KURL&, const ResourceRequest&);
+    virtual void submitForm(const KURL&, const ResourceRequest&);
 
     QString advanceToNextMisspelling(bool startBeforeSelection = false);
     
     virtual void setTitle(const DOMString &);
     virtual void setStatusBarText(const String&);
 
-    virtual void urlSelected(const KURL&, const URLArgs&);
+    virtual void urlSelected(const KURL&, const ResourceRequest&);
 
     virtual ObjectContentType objectContentType(const KURL& url, const QString& mimeType);
     virtual Plugin* createPlugin(const KURL& url, const QStringList& paramNames, const QStringList& paramValues, const QString& mimeType);
index 7de074e5cb5f7a4e2bd724f71743b75504b0819e..d8e06ebd8d15096e6794026deee275b9594d0687 100644 (file)
@@ -174,12 +174,12 @@ bool MacFrame::openURL(const KURL &url)
     return true;
 }
 
-void MacFrame::openURLRequest(const KURL &url, const URLArgs &args)
+void MacFrame::openURLRequest(const KURL &url, const ResourceRequest& request)
 {
     KWQ_BLOCK_EXCEPTIONS;
 
     NSString *referrer;
-    DOMString argsReferrer = args.metaData().get("referrer");
+    DOMString argsReferrer = request.metaData().get("referrer");
     if (!argsReferrer.isEmpty())
         referrer = argsReferrer;
     else
@@ -187,9 +187,9 @@ void MacFrame::openURLRequest(const KURL &url, const URLArgs &args)
 
     [_bridge loadURL:url.getNSURL()
             referrer:referrer
-              reload:args.reload
+              reload:request.reload
          userGesture:userGestureHint()
-              target:args.frameName.getNSString()
+              target:request.frameName.getNSString()
      triggeringEvent:nil
                 form:nil
           formValues:nil];
@@ -472,7 +472,7 @@ void MacFrame::recordFormValue(const QString &name, const QString &value, HTMLFo
     [_formValuesAboutToBeSubmitted setObject:value.getNSString() forKey:name.getNSString()];
 }
 
-void MacFrame::submitForm(const KURL &url, const URLArgs &args)
+void MacFrame::submitForm(const KURL& url, const ResourceRequest& request)
 {
     KWQ_BLOCK_EXCEPTIONS;
 
@@ -486,7 +486,7 @@ void MacFrame::submitForm(const KURL &url, const URLArgs &args)
     // FIXME: Frame targeting is only one of the ways the submission could end up doing something other
     // than replacing this frame's content, so this check is flawed. On the other hand, the check is hardly
     // needed any more now that we reset _submittedFormURL on each mouse or key down event.
-    WebCoreFrameBridge *target = args.frameName.isEmpty() ? _bridge : [_bridge findFrameNamed:args.frameName.getNSString()];
+    WebCoreFrameBridge *target = request.frameName.isEmpty() ? _bridge : [_bridge findFrameNamed:request.frameName.getNSString()];
     Frame *targetPart = [target impl];
     bool willReplaceThisFrame = false;
     for (Frame *p = this; p; p = p->tree()->parent()) {
@@ -502,22 +502,22 @@ void MacFrame::submitForm(const KURL &url, const URLArgs &args)
         _submittedFormURL = url;
     }
 
-    if (!args.doPost()) {
+    if (!request.doPost()) {
         [_bridge loadURL:url.getNSURL()
                 referrer:[_bridge referrer] 
-                  reload:args.reload
+                  reload:request.reload
              userGesture:true
-                  target:args.frameName.getNSString()
+                  target:request.frameName.getNSString()
          triggeringEvent:_currentEvent
                     form:_formAboutToBeSubmitted
               formValues:_formValuesAboutToBeSubmitted];
     } else {
-        ASSERT(args.contentType().startsWith("Content-Type: "));
+        ASSERT(request.contentType().startsWith("Content-Type: "));
         [_bridge postWithURL:url.getNSURL()
                     referrer:[_bridge referrer] 
-                      target:args.frameName.getNSString()
-                        data:arrayFromFormData(args.postData)
-                 contentType:args.contentType().mid(14).getNSString()
+                      target:request.frameName.getNSString()
+                        data:arrayFromFormData(request.postData)
+                 contentType:request.contentType().mid(14).getNSString()
              triggeringEvent:_currentEvent
                         form:_formAboutToBeSubmitted
                   formValues:_formValuesAboutToBeSubmitted];
@@ -536,12 +536,12 @@ void MacFrame::frameDetached()
     KWQ_UNBLOCK_EXCEPTIONS;
 }
 
-void MacFrame::urlSelected(const KURL& url, const URLArgs& args)
+void MacFrame::urlSelected(const KURL& url, const ResourceRequest& request)
 {
     KWQ_BLOCK_EXCEPTIONS;
 
     NSString* referrer;
-    DOMString argsReferrer = args.metaData().get("referrer");
+    DOMString argsReferrer = request.metaData().get("referrer");
     if (!argsReferrer.isEmpty())
         referrer = argsReferrer;
     else
@@ -549,9 +549,9 @@ void MacFrame::urlSelected(const KURL& url, const URLArgs& args)
 
     [_bridge loadURL:url.getNSURL()
             referrer:referrer
-              reload:args.reload
+              reload:request.reload
          userGesture:true
-              target:args.frameName.getNSString()
+              target:request.frameName.getNSString()
      triggeringEvent:_currentEvent
                 form:nil
           formValues:nil];
index 20ebe33491ad0eb0f791a74e580fcdf2a0bf683f..22abbfd2b9d205239300c88450b14bc758bca26a 100644 (file)
@@ -528,12 +528,11 @@ static inline WebCoreFrameBridge *bridge(Frame *frame)
     }
         
     // arguments
-    URLArgs args(m_frame->browserExtension()->urlArgs());
-    args.reload = reload;
-    if (contentType) {
-        args.serviceType = QString::fromNSString(contentType);
-    }
-    m_frame->browserExtension()->setURLArgs(args);
+    ResourceRequest request(m_frame->resourceRequest());
+    request.reload = reload;
+    if (contentType)
+        request.serviceType = QString::fromNSString(contentType);
+    m_frame->setResourceRequest(request);
 
     // opening the URL
     if (m_frame->didOpenURL(URL)) {
index 0b5821f750c5020b79b284986219d8f0a1a3a30d..f0016a95796a9601accc883b35b499fea8e57daf 100644 (file)
@@ -535,12 +535,12 @@ static Frame *createNewWindow(ExecState *exec, Window *openerWindow, const QStri
     Frame* openerPart = openerWindow->frame();
     Frame* activePart = Window::retrieveActive(exec)->frame();
 
-    URLArgs uargs;
+    ResourceRequest request;
 
-    uargs.frameName = frameName;
+    request.frameName = frameName;
     if (activePart)
-        uargs.metaData().set("referrer", activePart->referrer());
-    uargs.serviceType = "text/html";
+        request.metaData().set("referrer", activePart->referrer());
+    request.serviceType = "text/html";
 
     // FIXME: It's much better for client API if a new window starts with a URL, here where we
     // know what URL we are going to open. Unfortunately, this code passes the empty string
@@ -550,7 +550,7 @@ static Frame *createNewWindow(ExecState *exec, Window *openerWindow, const QStri
     // We'd have to resolve all those issues to pass the URL instead of "".
 
     Frame* newFrame = 0;
-    openerPart->browserExtension()->createNewWindow("", uargs, windowArgs, newFrame);
+    openerPart->browserExtension()->createNewWindow("", request, windowArgs, newFrame);
 
     if (!newFrame)
         return 0;
@@ -1590,9 +1590,9 @@ JSValue *WindowFunc::callAsFunction(ExecState *exec, JSObject *thisObj, const Li
       if (!str.isEmpty() && activePart)
           url = activePart->document()->completeURL(str.qstring());
 
-      URLArgs uargs;
-      uargs.frameName = frameName.qstring();
-      if (uargs.frameName == "_top") {
+      ResourceRequest request;
+      request.frameName = frameName.qstring();
+      if (request.frameName == "_top") {
           while (frame->tree()->parent())
               frame = frame->tree()->parent();
           
@@ -1603,7 +1603,7 @@ JSValue *WindowFunc::callAsFunction(ExecState *exec, JSObject *thisObj, const Li
           }
           return Window::retrieve(frame);
       }
-      if (uargs.frameName == "_parent") {
+      if (request.frameName == "_parent") {
           if (frame->tree()->parent())
               frame = frame->tree()->parent();
           
@@ -1614,12 +1614,12 @@ JSValue *WindowFunc::callAsFunction(ExecState *exec, JSObject *thisObj, const Li
           }
           return Window::retrieve(frame);
       }
-      uargs.serviceType = "text/html";
+      request.serviceType = "text/html";
       
       // request window (new or existing if framename is set)
       Frame* newFrame = 0;
-      uargs.metaData().set("referrer", activePart->referrer());
-      frame->browserExtension()->createNewWindow("", uargs, windowArgs, newFrame);
+      request.metaData().set("referrer", activePart->referrer());
+      frame->browserExtension()->createNewWindow("", request, windowArgs, newFrame);
       if (!newFrame)
           return jsUndefined();
       newFrame->setOpener(frame);
index 242b268dd75bb7c96fff4b2df70d95e40c952a9f..aad075cd824fd46d50a12d85a7d5fd2617f46ce9 100644 (file)
@@ -232,22 +232,20 @@ bool Frame::didOpenURL(const KURL &url)
   // clear last edit command
   d->m_lastEditCommand = EditCommandPtr();
   
-  URLArgs args( d->m_extension->urlArgs() );
-
   closeURL();
 
-  if (args.reload)
+  if (d->m_request.reload)
      d->m_cachePolicy = KIO::CC_Refresh;
   else
      d->m_cachePolicy = KIO::CC_Verify;
 
-  if (args.doPost() && url.protocol().startsWith("http")) {
-      d->m_job = new TransferJob(this, "POST", url, args.postData);
-      d->m_job->addMetaData("content-type", args.contentType() );
+  if (d->m_request.doPost() && url.protocol().startsWith("http")) {
+      d->m_job = new TransferJob(this, "POST", url, d->m_request.postData);
+      d->m_job->addMetaData("content-type", d->m_request.contentType());
   } else
       d->m_job = new TransferJob(this, "GET", url);
 
-  d->m_job->addMetaData(args.metaData());
+  d->m_job->addMetaData(d->m_request.metaData());
 
   d->m_bComplete = false;
   d->m_bLoadingMainResource = true;
@@ -297,7 +295,7 @@ void Frame::stopLoading(bool sendUnload)
 
   if (sendUnload) {
     if (d->m_doc) {
-      if (d->m_bLoadEventEmitted && !d->m_bUnloadEventEmitted ) {
+      if (d->m_bLoadEventEmitted && !d->m_bUnloadEventEmitted) {
         d->m_doc->dispatchWindowEvent(unloadEvent, false, false);
         if (d->m_doc)
           d->m_doc->updateRendering();
@@ -514,7 +512,7 @@ void Frame::setDocument(DocumentImpl* newDoc)
 
 void Frame::receivedFirstData()
 {
-    begin( d->m_workingURL, d->m_extension->urlArgs().xOffset, d->m_extension->urlArgs().yOffset );
+    begin(d->m_workingURL, d->m_request.xOffset, d->m_request.yOffset);
 
     d->m_doc->docLoader()->setCachePolicy(d->m_cachePolicy);
     d->m_workingURL = KURL();
@@ -593,7 +591,17 @@ void Frame::childBegin()
     d->m_bComplete = false;
 }
 
-void Frame::begin( const KURL &url, int xOffset, int yOffset )
+void Frame::setResourceRequest(const ResourceRequest& request)
+{
+    d->m_request = request;
+}
+
+const ResourceRequest& Frame::resourceRequest() const
+{
+    return d->m_request;
+}
+
+void Frame::begin(const KURL &url, int xOffset, int yOffset)
 {
   if (d->m_workingURL.isEmpty())
     createEmptyDocument(); // Creates an empty document if we don't have one already
@@ -606,10 +614,8 @@ void Frame::begin( const KURL &url, int xOffset, int yOffset )
   d->m_bLoadEventEmitted = false;
   d->m_bLoadingMainResource = true;
 
-  URLArgs args( d->m_extension->urlArgs() );
-  args.xOffset = xOffset;
-  args.yOffset = yOffset;
-  d->m_extension->setURLArgs( args );
+  d->m_request.xOffset = xOffset;
+  d->m_request.yOffset = yOffset;
 
   KURL ref(url);
   ref.setUser(QSTRING_NULL);
@@ -623,7 +629,7 @@ void Frame::begin( const KURL &url, int xOffset, int yOffset )
   if (!d->m_url.isEmpty())
     baseurl = d->m_url;
 
-  if (DOMImplementationImpl::isXMLMIMEType(args.serviceType))
+  if (DOMImplementationImpl::isXMLMIMEType(d->m_request.serviceType))
     d->m_doc = DOMImplementationImpl::instance()->createDocument(d->m_view.get());
   else
     d->m_doc = DOMImplementationImpl::instance()->createHTMLDocument(d->m_view.get());
@@ -981,13 +987,13 @@ void Frame::changeLocation(const QString &URL, const QString &referrer, bool loc
         return;
     }
 
-    URLArgs args;
+    ResourceRequest request;
 
-    args.setLockHistory(lockHistory);
+    request.setLockHistory(lockHistory);
     if (!referrer.isEmpty())
-        args.metaData().set("referrer", referrer);
+        request.metaData().set("referrer", referrer);
 
-    urlSelected(URL, "_self", args);
+    urlSelected(URL, "_self", request);
 }
 
 void Frame::redirectionTimerFired(Timer<Frame>*)
@@ -1318,7 +1324,7 @@ void Frame::paintDragCaret(GraphicsContext* p, const IntRect &rect) const
     d->m_dragCaret.paintCaret(p, rect);
 }
 
-void Frame::urlSelected(const QString &url, const QString& _target, const URLArgs& args )
+void Frame::urlSelected(const QString& url, const QString& _target, const ResourceRequest& request)
 {
   QString target = _target;
   if (target.isEmpty() && d->m_doc)
@@ -1334,7 +1340,7 @@ void Frame::urlSelected(const QString &url, const QString& _target, const URLArg
     // ### ERROR HANDLING
     return;
 
-  URLArgs argsCopy = args;
+  ResourceRequest argsCopy = request;
   argsCopy.frameName = target;
 
   if (d->m_bHTTPRefresh) {
@@ -1361,10 +1367,10 @@ bool Frame::requestFrame(RenderPart* renderer, const QString& _url, const QStrin
 
     Frame* frame = tree()->child(frameName);
     if (frame) {
-        URLArgs args;
-        args.metaData().set("referrer", d->m_referrer);
-        args.reload = (d->m_cachePolicy == KIO::CC_Reload) || (d->m_cachePolicy == KIO::CC_Refresh);
-        frame->openURLRequest(url, args);
+        ResourceRequest request;
+        request.metaData().set("referrer", d->m_referrer);
+        request.reload = (d->m_cachePolicy == KIO::CC_Reload) || (d->m_cachePolicy == KIO::CC_Refresh);
+        frame->openURLRequest(url, request);
     } else
         frame = loadSubframe(renderer, url, frameName, d->m_referrer);
     
@@ -1488,12 +1494,12 @@ void Frame::submitForm( const char *action, const QString &url, const FormData &
     return;
   }
 
-  URLArgs args;
+  ResourceRequest request;
 
   if (!d->m_referrer.isEmpty())
-     args.metaData().set("referrer", d->m_referrer);
+     request.metaData().set("referrer", d->m_referrer);
 
-  args.frameName = _target.isEmpty() ? d->m_doc->baseTarget() : _target ;
+  request.frameName = _target.isEmpty() ? d->m_doc->baseTarget() : _target ;
 
   // Handle mailto: forms
   if (u.protocol() == "mailto") {
@@ -1534,20 +1540,20 @@ void Frame::submitForm( const char *action, const QString &url, const FormData &
       u.setQuery(q);
   } 
 
-  if ( strcmp( action, "get" ) == 0 ) {
+  if (strcmp(action, "get") == 0) {
     if (u.protocol() != "mailto")
-       u.setQuery( formData.flattenToString() );
-    args.setDoPost( false );
+       u.setQuery(formData.flattenToString());
+    request.setDoPost(false);
   }
   else {
-    args.postData = formData;
-    args.setDoPost( true );
+    request.postData = formData;
+    request.setDoPost(true);
 
     // construct some user headers if necessary
     if (contentType.isNull() || contentType == "application/x-www-form-urlencoded")
-      args.setContentType( "Content-Type: application/x-www-form-urlencoded" );
+      request.setContentType("Content-Type: application/x-www-form-urlencoded");
     else // contentType must be "multipart/form-data"
-      args.setContentType( "Content-Type: " + contentType + "; boundary=" + boundary );
+      request.setContentType("Content-Type: " + contentType + "; boundary=" + boundary);
   }
 
   if ( d->m_doc->parsing() || d->m_runningScripts > 0 ) {
@@ -1562,7 +1568,7 @@ void Frame::submitForm( const char *action, const QString &url, const FormData &
     d->m_submitForm->submitBoundary = boundary;
   }
   else
-    submitForm(u, args);
+    submitForm(u, request);
 }
 
 
index 284cd9d0f75df9d8c862087341c920536cb62671..bdf0755bca57adf11abb416d34c65f793b722a9d 100644 (file)
@@ -549,7 +549,7 @@ public:
   
   void selectClosestWordFromMouseEvent(MouseEvent*, NodeImpl* innerNode, int x, int y);
 
-  virtual void urlSelected(const QString& url, const QString& target, const URLArgs& args = URLArgs());
+  virtual void urlSelected(const QString& url, const QString& target, const ResourceRequest& request = ResourceRequest());
 
 
   // Methods with platform-specific overrides (and no base class implementation).
@@ -595,10 +595,10 @@ public:
   virtual void saveDocumentState() = 0;
   virtual void restoreDocumentState() = 0;
   virtual bool canGoBackOrForward(int distance) const = 0;
-  virtual void openURLRequest(const KURL &, const URLArgs &) = 0;
-  virtual void submitForm(const KURL &, const URLArgs &) = 0;
-  virtual void urlSelected(const KURL&, const URLArgs& args) = 0;
-  virtual bool passSubframeEventToSubframe(MouseEventWithHitTestResults &) = 0;
+  virtual void openURLRequest(const KURL&, const ResourceRequest&) = 0;
+  virtual void submitForm(const KURL&, const ResourceRequest&) = 0;
+  virtual void urlSelected(const KURL&, const ResourceRequest&) = 0;
+  virtual bool passSubframeEventToSubframe(MouseEventWithHitTestResults&) = 0;
   virtual bool passWheelEventToChildWidget(NodeImpl *) = 0;
   virtual bool lastEventIsMouseUp() const = 0;
   virtual QString overrideMediaType() const = 0;
@@ -823,6 +823,8 @@ public:
   void updateBaseURLForEmptyDocument();
 
   KURL url() const;
+  void setResourceRequest(const ResourceRequest& request);
+  const ResourceRequest& resourceRequest() const;
 
   // split out controller objects
   FrameTree* tree() const;
index bb156327158d724b719fe139d78e9b696289dfc6..92f0ce647a0aaa0d08f43bab3ee882ef099d7873 100644 (file)
@@ -145,6 +145,7 @@ namespace WebCore {
 
         KURL m_url;
         KURL m_workingURL;
+        ResourceRequest m_request;
 
         KIO::CacheControl m_cachePolicy;
         Timer<Frame> m_redirectionTimer;
diff --git a/WebCore/page/ResourceRequest.h b/WebCore/page/ResourceRequest.h
new file mode 100644 (file)
index 0000000..e4edf4a
--- /dev/null
@@ -0,0 +1,68 @@
+// -*- mode: c++; c-basic-offset: 4 -*-
+/*
+ * Copyright (C) 2003, 2006 Apple Computer, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef ResourceRequest_H_
+#define ResourceRequest_H_
+
+#include "PlatformString.h"
+#include "formdata.h"
+#include <kxmlcore/HashMap.h>
+
+namespace WebCore {
+
+    struct ResourceRequest {
+        
+        QString frameName;
+        FormData postData;
+        bool reload;
+        QString serviceType;
+        int xOffset;
+        int yOffset;
+        
+        ResourceRequest() : reload(false), xOffset(0), yOffset(0), m_doPost(false), m_lockHistory(false) { }
+        
+        QString contentType() const { return m_contentType; }
+        void setContentType(const QString &t) { m_contentType = t; }
+        
+        bool doPost() const { return m_doPost; }
+        void setDoPost(bool post) { m_doPost = post; }
+        
+        bool lockHistory() const { return m_lockHistory; }
+        void setLockHistory(bool lock) { m_lockHistory = lock; }
+        
+        HashMap<DOMString, DOMString>& metaData() { return m_metadata; }
+        const HashMap<DOMString, DOMString>& metaData() const { return m_metadata; }
+        
+    private:
+        QString m_contentType;
+        bool m_doPost;
+        bool m_lockHistory;
+        HashMap<String, String> m_metadata;
+    };
+
+}
+
+#endif