Reviewed by Darin.
authormjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Oct 2006 23:54:52 +0000 (23:54 +0000)
committermjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Oct 2006 23:54:52 +0000 (23:54 +0000)
        - split FrameLoadRequest off from ResourceRequest - it's a ResourceRequest plus frame name plus lockHistory bool

        * WebCore.xcodeproj/project.pbxproj:
        * bindings/js/kjs_window.cpp:
        (KJS::createNewWindow):
        (KJS::WindowFunc::callAsFunction):
        * bridge/BrowserExtension.h:
        * bridge/mac/BrowserExtensionMac.h:
        * bridge/mac/BrowserExtensionMac.mm:
        (WebCore::BrowserExtensionMac::createNewWindow):
        * bridge/mac/FrameMac.h:
        * bridge/mac/FrameMac.mm:
        (WebCore::FrameMac::submitForm):
        (WebCore::FrameMac::openURLRequest):
        (WebCore::FrameMac::urlSelected):
        * bridge/win/BrowserExtensionWin.h:
        * page/Frame.cpp:
        (WebCore::Frame::changeLocation):
        (WebCore::Frame::urlSelected):
        (WebCore::Frame::requestFrame):
        (WebCore::Frame::submitForm):
        * page/Frame.h:
        * page/FrameLoadRequest.h: Added.
        (WebCore::FrameLoadRequest::FrameLoadRequest):
        (WebCore::FrameLoadRequest::lockHistory):
        (WebCore::FrameLoadRequest::setLockHistory):
        * page/ResourceRequest.h:
        (WebCore::ResourceRequest::ResourceRequest):

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

13 files changed:
WebCore/ChangeLog
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/bindings/js/kjs_window.cpp
WebCore/bridge/BrowserExtension.h
WebCore/bridge/mac/BrowserExtensionMac.h
WebCore/bridge/mac/BrowserExtensionMac.mm
WebCore/bridge/mac/FrameMac.h
WebCore/bridge/mac/FrameMac.mm
WebCore/bridge/win/BrowserExtensionWin.h
WebCore/page/Frame.cpp
WebCore/page/Frame.h
WebCore/page/FrameLoadRequest.h [new file with mode: 0644]
WebCore/page/ResourceRequest.h

index 70c1666f2ec5693dd6217ce828b186315d70f13a..db8a8730f17b2c0cb15b53e88292b3e418509f7d 100644 (file)
@@ -1,3 +1,36 @@
+2006-10-13  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Darin.
+
+        - split FrameLoadRequest off from ResourceRequest - it's a ResourceRequest plus frame name plus lockHistory bool
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/kjs_window.cpp:
+        (KJS::createNewWindow):
+        (KJS::WindowFunc::callAsFunction):
+        * bridge/BrowserExtension.h:
+        * bridge/mac/BrowserExtensionMac.h:
+        * bridge/mac/BrowserExtensionMac.mm:
+        (WebCore::BrowserExtensionMac::createNewWindow):
+        * bridge/mac/FrameMac.h:
+        * bridge/mac/FrameMac.mm:
+        (WebCore::FrameMac::submitForm):
+        (WebCore::FrameMac::openURLRequest):
+        (WebCore::FrameMac::urlSelected):
+        * bridge/win/BrowserExtensionWin.h:
+        * page/Frame.cpp:
+        (WebCore::Frame::changeLocation):
+        (WebCore::Frame::urlSelected):
+        (WebCore::Frame::requestFrame):
+        (WebCore::Frame::submitForm):
+        * page/Frame.h:
+        * page/FrameLoadRequest.h: Added.
+        (WebCore::FrameLoadRequest::FrameLoadRequest):
+        (WebCore::FrameLoadRequest::lockHistory):
+        (WebCore::FrameLoadRequest::setLockHistory):
+        * page/ResourceRequest.h:
+        (WebCore::ResourceRequest::ResourceRequest):
+
 2006-10-13  John Sullivan  <sullivan@apple.com>
 
         Reviewed by Maciej
index f1bbf5cdc5f9ec8683fa3651268b4b2ce59bf2af..0604022c66aa0d7437c84264b2c8a66ff0442739 100644 (file)
                6582A16209999D6D00BEEB6D /* ScreenMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6582A15409999D6D00BEEB6D /* ScreenMac.mm */; };
                6582A16309999D6D00BEEB6D /* SystemTimeMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6582A15509999D6D00BEEB6D /* SystemTimeMac.cpp */; };
                6582A17809999EA000BEEB6D /* DeprecatedStringMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6582A17709999EA000BEEB6D /* DeprecatedStringMac.mm */; };
+               658436860AE01B7400E53753 /* FrameLoadRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 658436850AE01B7400E53753 /* FrameLoadRequest.h */; };
                65901A4409FC6039005BD752 /* WebCoreStringTruncator.h in Headers */ = {isa = PBXBuildFile; fileRef = 65901A4209FC6039005BD752 /* WebCoreStringTruncator.h */; settings = {ATTRIBUTES = (Private, ); }; };
                65901A4509FC6039005BD752 /* WebCoreStringTruncator.mm in Sources */ = {isa = PBXBuildFile; fileRef = 65901A4309FC6039005BD752 /* WebCoreStringTruncator.mm */; };
                6593923709AE4346002C531F /* KURL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6593923509AE4346002C531F /* KURL.cpp */; };
                6582A15409999D6D00BEEB6D /* ScreenMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = ScreenMac.mm; sourceTree = "<group>"; };
                6582A15509999D6D00BEEB6D /* SystemTimeMac.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SystemTimeMac.cpp; sourceTree = "<group>"; };
                6582A17709999EA000BEEB6D /* DeprecatedStringMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = DeprecatedStringMac.mm; sourceTree = "<group>"; };
+               658436850AE01B7400E53753 /* FrameLoadRequest.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FrameLoadRequest.h; sourceTree = "<group>"; };
                65901A4209FC6039005BD752 /* WebCoreStringTruncator.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebCoreStringTruncator.h; sourceTree = "<group>"; };
                65901A4309FC6039005BD752 /* WebCoreStringTruncator.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreStringTruncator.mm; sourceTree = "<group>"; };
                6593923509AE4346002C531F /* KURL.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = KURL.cpp; sourceTree = "<group>"; };
                                1403B90C09EB124500797C7F /* DOMWindow.idl */,
                                65BF02290974816300C43196 /* Frame.cpp */,
                                65BF022A0974816300C43196 /* Frame.h */,
+                               658436850AE01B7400E53753 /* FrameLoadRequest.h */,
                                65BF022B0974816300C43196 /* FramePrivate.h */,
                                65A21482097A3F5300B9050A /* FrameTree.cpp */,
                                65A21483097A3F5300B9050A /* FrameTree.h */,
                                93B77B1D0ADDA10700EA4B81 /* UChar.h in Headers */,
                                0668E18B0ADD9624004128E0 /* PopupMenu.h in Headers */,
                                6563A9A70ADF4094000ED2CD /* LoaderNSURLRequestExtras.h in Headers */,
+                               658436860AE01B7400E53753 /* FrameLoadRequest.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        mainGroup = 0867D691FE84028FC02AAC07 /* WebKit */;
                        productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
                        projectDirPath = "";
-                       projectRoot = "";
                        targets = (
                                93F198A508245E59001E9ABC /* WebCore */,
                                DD041FBE09D9DDBE0010AF2A /* Derived Sources */,
index 38e59a4d0891ed9abb284b19b7a741e9f0436f32..a8a8b214ae870ab2e22a483a764b019654ebfea7 100644 (file)
@@ -30,6 +30,7 @@
 #include "EventNames.h"
 #include "FloatRect.h"
 #include "Frame.h"
+#include "FrameLoadRequest.h"
 #include "FrameTree.h"
 #include "HTMLDocument.h"
 #include "JSCSSRule.h"
@@ -543,10 +544,11 @@ static Frame *createNewWindow(ExecState *exec, Window *openerWindow, const Depre
     Frame* openerPart = openerWindow->frame();
     Frame* activePart = Window::retrieveActive(exec)->frame();
 
-    ResourceRequest request(KURL(""));
-    request.frameName = frameName;
+    FrameLoadRequest frameRequest;
+    frameRequest.m_request = ResourceRequest(KURL(""));
+    frameRequest.m_frameName = frameName;
     if (activePart)
-        request.setReferrer(activePart->referrer());
+        frameRequest.m_request.setReferrer(activePart->referrer());
 
     // 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
@@ -556,7 +558,7 @@ static Frame *createNewWindow(ExecState *exec, Window *openerWindow, const Depre
     // We'd have to resolve all those issues to pass the URL instead of "".
 
     Frame* newFrame = 0;
-    openerPart->browserExtension()->createNewWindow(request, windowArgs, newFrame);
+    openerPart->browserExtension()->createNewWindow(frameRequest, windowArgs, newFrame);
 
     if (!newFrame)
         return 0;
@@ -1559,10 +1561,10 @@ JSValue *WindowFunc::callAsFunction(ExecState *exec, JSObject *thisObj, const Li
       if (!str.isEmpty() && activePart)
           url = activePart->document()->completeURL(str.deprecatedString());
 
-      ResourceRequest request;
-      request.setURL(url);
-      request.frameName = frameName.deprecatedString();
-      if (request.frameName == "_top") {
+      FrameLoadRequest frameRequest;
+      frameRequest.m_request.setURL(url);
+      frameRequest.m_frameName = frameName.deprecatedString();
+      if (frameRequest.m_frameName == "_top") {
           while (frame->tree()->parent())
               frame = frame->tree()->parent();
           
@@ -1573,7 +1575,7 @@ JSValue *WindowFunc::callAsFunction(ExecState *exec, JSObject *thisObj, const Li
           }
           return Window::retrieve(frame);
       }
-      if (request.frameName == "_parent") {
+      if (frameRequest.m_frameName == "_parent") {
           if (frame->tree()->parent())
               frame = frame->tree()->parent();
           
@@ -1587,8 +1589,8 @@ JSValue *WindowFunc::callAsFunction(ExecState *exec, JSObject *thisObj, const Li
       
       // request window (new or existing if framename is set)
       Frame* newFrame = 0;
-      request.setReferrer(activePart->referrer());
-      frame->browserExtension()->createNewWindow(request, windowArgs, newFrame);
+      frameRequest.m_request.setReferrer(activePart->referrer());
+      frame->browserExtension()->createNewWindow(frameRequest, windowArgs, newFrame);
       if (!newFrame)
           return jsUndefined();
       newFrame->setOpener(frame);
index 6012aa45cc620950fde63b006756f4524141abcb..9a645283a15bc60136161af518091838ce8297ff 100644 (file)
@@ -31,6 +31,7 @@
 namespace WebCore {
 
 class Frame;
+class FrameLoadRequest;
 
 struct WindowArgs {
     float x;
@@ -57,8 +58,8 @@ class BrowserExtension {
 public:
     virtual ~BrowserExtension() { }
 
-    virtual void createNewWindow(const ResourceRequest&) = 0;
-    virtual void createNewWindow(const ResourceRequest&, const WindowArgs&, Frame*&) = 0;
+    virtual void createNewWindow(const FrameLoadRequest&) = 0;
+    virtual void createNewWindow(const FrameLoadRequest&, const WindowArgs&, Frame*&) = 0;
 
     virtual int getHistoryLength() = 0;
     virtual void goBackOrForward(int distance) = 0;
index 4ca0af44c66a1d8ce5b729491a3ec2f87e220a8f..fe343e986d5fa1aa208513ad69f05ce3acc9cd24 100644 (file)
@@ -34,10 +34,8 @@ class BrowserExtensionMac : public BrowserExtension {
 public:
     BrowserExtensionMac(Frame *);
  
-    virtual void createNewWindow(const ResourceRequest&);
-    virtual void createNewWindow(const ResourceRequest&, 
-                                 const WindowArgs&, 
-                                 Frame*& part);
+    virtual void createNewWindow(const FrameLoadRequest&);
+    virtual void createNewWindow(const FrameLoadRequest&, const WindowArgs&, Frame*& part);
 
     virtual int getHistoryLength();
     virtual void goBackOrForward(int distance);
@@ -48,7 +46,7 @@ public:
     virtual void runModal();
     
 private:
-     void createNewWindow(const ResourceRequest&, 
+     void createNewWindow(const FrameLoadRequest&, 
                           const WindowArgs&, 
                           Frame** part);
 
index 93136401c0910d87a14b61711ae75ce941e95b0c..31c9533073219ee90a2a874093eaa099e5b2bc17 100644 (file)
@@ -29,6 +29,7 @@
 #import "BlockExceptions.h"
 #import "FloatRect.h"
 #import "FrameMac.h"
+#import "FrameLoadRequest.h"
 #import "FrameTree.h"
 #import "Page.h"
 #import "Screen.h"
@@ -42,37 +43,37 @@ BrowserExtensionMac::BrowserExtensionMac(Frame *frame)
 {
 }
 
-void BrowserExtensionMac::createNewWindow(const ResourceRequest& request) 
+void BrowserExtensionMac::createNewWindow(const FrameLoadRequest& request) 
 {
     createNewWindow(request, WindowArgs(), NULL);
 }
 
-void BrowserExtensionMac::createNewWindow(const ResourceRequest& request, 
+void BrowserExtensionMac::createNewWindow(const FrameLoadRequest& request, 
                                           const WindowArgs& winArgs, 
                                           Frame*& part)
 {
     createNewWindow(request, winArgs, &part);
 }
 
-void BrowserExtensionMac::createNewWindow(const ResourceRequest& request, 
+void BrowserExtensionMac::createNewWindow(const FrameLoadRequest& request, 
                                           const WindowArgs& winArgs, 
                                           Frame** partResult)
 { 
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
 
-    ASSERT(!winArgs.dialog || request.frameName.isEmpty());
+    ASSERT(!winArgs.dialog || request.m_frameName.isEmpty());
 
     if (partResult)
         *partResult = NULL;
     
-    const KURL& url = request.url();
+    const KURL& url = request.m_request.url();
 
-    NSString *frameName = request.frameName.isEmpty() ? nil : (NSString*)request.frameName;
+    NSString *frameName = request.m_frameName.isEmpty() ? nil : (NSString*)request.m_frameName;
     if (frameName) {
         // FIXME: Can't we just use m_frame->findFrame?
         if (WebCoreFrameBridge *frameBridge = [m_frame->bridge() findFrameNamed:frameName]) {
             if (!url.isEmpty()) {
-                String argsReferrer = request.referrer();
+                String argsReferrer = request.m_request.referrer();
                 NSString *referrer;
                 if (!argsReferrer.isEmpty())
                     referrer = argsReferrer;
@@ -81,7 +82,7 @@ void BrowserExtensionMac::createNewWindow(const ResourceRequest& request,
 
                 [frameBridge loadURL:url.getNSURL() 
                        referrer:referrer 
-                         reload:request.reload 
+                         reload:request.m_request.reload 
                     userGesture:true 
                          target:nil 
                 triggeringEvent:nil 
@@ -108,7 +109,7 @@ void BrowserExtensionMac::createNewWindow(const ResourceRequest& request,
     
     WebCoreFrameBridge *frameBridge = [pageBridge mainFrame];
     if ([frameBridge impl])
-        [frameBridge impl]->tree()->setName(AtomicString(request.frameName));
+        [frameBridge impl]->tree()->setName(AtomicString(request.m_frameName));
     
     if (partResult)
         *partResult = [frameBridge impl];
index 3bd9662a738274a0bd8e46d5259c7626e7717576..d10324a0483ab35f7ec85b08e24d2a503599b97b 100644 (file)
@@ -126,15 +126,15 @@ public:
 
     virtual bool openURL(const KURL&);
     
-    virtual void openURLRequest(const ResourceRequest&);
-    virtual void submitForm(const ResourceRequest&);
 
     String advanceToNextMisspelling(bool startBeforeSelection = false);
     
     virtual void setTitle(const String&);
     virtual void setStatusBarText(const String&);
 
-    virtual void urlSelected(const ResourceRequest&);
+    virtual void submitForm(const FrameLoadRequest&);
+    virtual void openURLRequest(const FrameLoadRequest&);
+    virtual void urlSelected(const FrameLoadRequest&);
 
     virtual ObjectContentType objectContentType(const KURL& url, const String& mimeType);
     virtual Plugin* createPlugin(Element* element, const KURL& url, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType);
index 14b56471f062cd233537a9a2883ad1bbd4ccf495..cef36be3cd5c0cfb5eee846af3dfec46883eb167 100644 (file)
@@ -43,6 +43,7 @@
 #import "FontData.h"
 #import "FoundationExtras.h"
 #import "FramePrivate.h"
+#import "FrameLoadRequest.h"
 #import "GraphicsContext.h"
 #import "HTMLDocument.h"
 #import "HTMLFormElement.h"
@@ -201,30 +202,6 @@ bool FrameMac::openURL(const KURL &url)
     return true;
 }
 
-void FrameMac::openURLRequest(const ResourceRequest& request)
-{
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-
-    NSString *referrer;
-    String argsReferrer = request.referrer();
-    if (!argsReferrer.isEmpty())
-        referrer = argsReferrer;
-    else
-        referrer = [_bridge referrer];
-
-    [_bridge loadURL:request.url().getNSURL()
-            referrer:referrer
-              reload:request.reload
-         userGesture:userGestureHint()
-              target:request.frameName
-     triggeringEvent:nil
-                form:nil
-          formValues:nil];
-
-    END_BLOCK_OBJC_EXCEPTIONS;
-}
-
-
 // Either get cached regexp or build one that matches any of the labels.
 // The regexp we build is of the form:  (STR1|STR2|STRN)
 RegularExpression *regExpForLabels(NSArray *labels)
@@ -414,7 +391,7 @@ NSString *FrameMac::matchLabelsAgainstElement(NSArray *labels, Element *element)
     return nil;
 }
 
-void FrameMac::submitForm(const ResourceRequest& request)
+void FrameMac::submitForm(const FrameLoadRequest& request)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
 
@@ -428,7 +405,7 @@ void FrameMac::submitForm(const ResourceRequest& request)
     // 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 d->m_submittedFormURL on each mouse or key down event.
-    WebCoreFrameBridge *target = request.frameName.isEmpty() ? _bridge : [_bridge findFrameNamed:request.frameName];
+    WebCoreFrameBridge *target = request.m_frameName.isEmpty() ? _bridge : [_bridge findFrameNamed:request.m_frameName];
     Frame *targetPart = [target impl];
     bool willReplaceThisFrame = false;
     for (Frame *p = this; p; p = p->tree()->parent()) {
@@ -438,30 +415,30 @@ void FrameMac::submitForm(const ResourceRequest& request)
         }
     }
     if (willReplaceThisFrame) {
-        if (d->m_submittedFormURL == request.url())
+        if (d->m_submittedFormURL == request.m_request.url())
             return;
-        d->m_submittedFormURL = request.url();
+        d->m_submittedFormURL = request.m_request.url();
     }
 
     ObjCDOMElement* submitForm = [DOMElement _elementWith:d->m_formAboutToBeSubmitted.get()];
     NSMutableDictionary* formValues = createNSDictionary(d->m_formValuesAboutToBeSubmitted);
     
-    if (!request.doPost()) {
-        [_bridge loadURL:request.url().getNSURL()
+    if (!request.m_request.doPost()) {
+        [_bridge loadURL:request.m_request.url().getNSURL()
                 referrer:[_bridge referrer] 
-                  reload:request.reload
+                  reload:request.m_request.reload
              userGesture:true
-                  target:request.frameName
+                  target:request.m_frameName
          triggeringEvent:_currentEvent
                     form:submitForm
               formValues:formValues];
     } else {
-        ASSERT(request.contentType().startsWith("Content-Type: "));
-        [_bridge postWithURL:request.url().getNSURL()
+        ASSERT(request.m_request.contentType().startsWith("Content-Type: "));
+        [_bridge postWithURL:request.m_request.url().getNSURL()
                     referrer:[_bridge referrer] 
-                      target:request.frameName
-                        data:arrayFromFormData(request.postData)
-                 contentType:request.contentType().substring(14)
+                      target:request.m_frameName
+                        data:arrayFromFormData(request.m_request.postData)
+                 contentType:request.m_request.contentType().substring(14)
              triggeringEvent:_currentEvent
                         form:submitForm
                   formValues:formValues];
@@ -481,22 +458,46 @@ void FrameMac::frameDetached()
     END_BLOCK_OBJC_EXCEPTIONS;
 }
 
-void FrameMac::urlSelected(const ResourceRequest& request)
+void FrameMac::openURLRequest(const FrameLoadRequest& request)
+{
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+    
+    NSString *referrer;
+    String argsReferrer = request.m_request.referrer();
+    if (!argsReferrer.isEmpty())
+        referrer = argsReferrer;
+    else
+        referrer = [_bridge referrer];
+    
+    [_bridge loadURL:request.m_request.url().getNSURL()
+            referrer:referrer
+              reload:request.m_request.reload
+         userGesture:userGestureHint()
+              target:request.m_frameName
+     triggeringEvent:nil
+                form:nil
+          formValues:nil];
+    
+    END_BLOCK_OBJC_EXCEPTIONS;
+}
+
+
+void FrameMac::urlSelected(const FrameLoadRequest& request)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
 
     NSString* referrer;
-    String argsReferrer = request.referrer();
+    String argsReferrer = request.m_request.referrer();
     if (!argsReferrer.isEmpty())
         referrer = argsReferrer;
     else
         referrer = [_bridge referrer];
 
-    [_bridge loadURL:request.url().getNSURL()
+    [_bridge loadURL:request.m_request.url().getNSURL()
             referrer:referrer
-              reload:request.reload
+              reload:request.m_request.reload
          userGesture:true
-              target:request.frameName
+              target:request.m_frameName
      triggeringEvent:_currentEvent
                 form:nil
           formValues:nil];
index 884e3fe8e337afc4787bd7f05bebe46b73861867..b3cedd1c2d530856ff319b9de5e9160e63b87536 100644 (file)
@@ -34,8 +34,8 @@ class BrowserExtensionWin : public BrowserExtension {
 public:
     BrowserExtensionWin(FrameWin*);
  
-    virtual void createNewWindow(const ResourceRequest&);
-    virtual void createNewWindow(const ResourceRequest&,
+    virtual void createNewWindow(const FrameLoadRequest&);
+    virtual void createNewWindow(const FrameLoadRequest&,
                                  const WindowArgs&, 
                                  Frame*& part);
 
index 28973637445d7f63a3d42084010f4b3c88475668..9a2e0dd1aebe4c5f5e0d4bb019e6949e32b48b34 100644 (file)
@@ -45,6 +45,7 @@
 #include "EventNames.h"
 #include "FloatRect.h"
 #include "Frame.h"
+#include "FrameLoadRequest.h"
 #include "GraphicsContext.h"
 #include "HTMLFormElement.h"
 #include "HTMLFrameElement.h"
@@ -1115,13 +1116,12 @@ void Frame::changeLocation(const DeprecatedString& URL, const String& referrer,
     }
 
     ResourceRequest request(completeURL(URL));
-    request.setLockHistory(lockHistory);
     if (!referrer.isEmpty())
         request.setReferrer(referrer);
 
     request.reload = (d->m_cachePolicy == CachePolicyReload) || (d->m_cachePolicy == CachePolicyRefresh);
     
-    urlSelected(request, "_self");
+    urlSelected(request, "_self", lockHistory);
 }
 
 void Frame::redirectionTimerFired(Timer<Frame>*)
@@ -1426,7 +1426,7 @@ void Frame::urlSelected(const DeprecatedString& url, const String& target)
     urlSelected(ResourceRequest(completeURL(url)), target);
 }
 
-void Frame::urlSelected(const ResourceRequest& request, const String& _target)
+void Frame::urlSelected(const ResourceRequest& request, const String& _target, bool lockHistory)
 {
   String target = _target;
   if (target.isEmpty() && d->m_doc)
@@ -1443,16 +1443,17 @@ void Frame::urlSelected(const ResourceRequest& request, const String& _target)
     // ### ERROR HANDLING
     return;
 
-  ResourceRequest requestCopy = request;
-  requestCopy.frameName = target;
+  FrameLoadRequest frameRequest;
+  frameRequest.m_request = request;
+  frameRequest.m_frameName = target;
 
   if (d->m_bHTTPRefresh)
     d->m_bHTTPRefresh = false;
 
   if (!d->m_referrer.isEmpty())
-    requestCopy.setReferrer(d->m_referrer);
+    frameRequest.m_request.setReferrer(d->m_referrer);
 
-  urlSelected(requestCopy);
+  urlSelected(frameRequest);
 }
 
 bool Frame::requestFrame(Element* ownerElement, const String& urlParam, const AtomicString& frameName)
@@ -1472,7 +1473,9 @@ bool Frame::requestFrame(Element* ownerElement, const String& urlParam, const At
         ResourceRequest request(url);
         request.setReferrer(d->m_referrer);
         request.reload = (d->m_cachePolicy == CachePolicyReload) || (d->m_cachePolicy == CachePolicyRefresh);
-        frame->openURLRequest(request);
+        FrameLoadRequest frameRequest;
+        frameRequest.m_request = request;
+        frame->openURLRequest(frameRequest);
     } else
         frame = loadSubframe(ownerElement, url, frameName, d->m_referrer);
     
@@ -1618,12 +1621,12 @@ void Frame::submitForm(const char *action, const String& url, const FormData& fo
     return;
   }
 
-  ResourceRequest request;
+  FrameLoadRequest frameRequest;
 
   if (!d->m_referrer.isEmpty())
-     request.setReferrer(d->m_referrer);
+      frameRequest.m_request.setReferrer(d->m_referrer);
 
-  request.frameName = _target.isEmpty() ? d->m_doc->baseTarget() : _target ;
+  frameRequest.m_frameName = _target.isEmpty() ? d->m_doc->baseTarget() : _target ;
 
   // Handle mailto: forms
   if (u.protocol() == "mailto") {
@@ -1653,16 +1656,16 @@ void Frame::submitForm(const char *action, const String& url, const FormData& fo
   if (strcmp(action, "get") == 0) {
     if (u.protocol() != "mailto")
        u.setQuery(formData.flattenToString().deprecatedString());
-    request.setDoPost(false);
+    frameRequest.m_request.setDoPost(false);
   } else {
-    request.postData = formData;
-    request.setDoPost(true);
+    frameRequest.m_request.postData = formData;
+    frameRequest.m_request.setDoPost(true);
 
     // construct some user headers if necessary
     if (contentType.isNull() || contentType == "application/x-www-form-urlencoded")
-      request.setContentType("Content-Type: application/x-www-form-urlencoded");
+      frameRequest.m_request.setContentType("Content-Type: application/x-www-form-urlencoded");
     else // contentType must be "multipart/form-data"
-      request.setContentType("Content-Type: " + contentType + "; boundary=" + boundary);
+      frameRequest.m_request.setContentType("Content-Type: " + contentType + "; boundary=" + boundary);
   }
 
   if (d->m_runningScripts > 0) {
@@ -1676,8 +1679,8 @@ void Frame::submitForm(const char *action, const String& url, const FormData& fo
     d->m_submitForm->submitContentType = contentType;
     d->m_submitForm->submitBoundary = boundary;
   } else {
-      request.setURL(u);
-      submitForm(request);
+      frameRequest.m_request.setURL(u);
+      submitForm(frameRequest);
   }
 }
 
index 415ebe5d224d56e5d131fb0533859acad9463c20..4fe29a0f0432409bc01151cb049b608dfb366d65 100644 (file)
@@ -62,6 +62,7 @@ class DrawContentsEvent;
 class DOMWindow;
 class EditCommand;
 class FramePrivate;
+class FrameLoadRequest;
 class FrameTree;
 class KJSProxy;
 class Page;
@@ -529,7 +530,7 @@ public:
   void selectClosestWordFromMouseEvent(const PlatformMouseEvent&, Node* innerNode);
 
   virtual void urlSelected(const DeprecatedString& url, const String& target);
-  virtual void urlSelected(const ResourceRequest&, const String& target);
+  virtual void urlSelected(const ResourceRequest&, const String& target, bool lockHistory = false);
 
   // Methods with platform-specific overrides (and no base class implementation).
   virtual void setTitle(const String&) = 0;
@@ -577,9 +578,9 @@ public:
   virtual void saveDocumentState() = 0;
   virtual void restoreDocumentState() = 0;
   virtual bool canGoBackOrForward(int distance) const = 0;
-  virtual void openURLRequest(const ResourceRequest&) = 0;
-  virtual void submitForm(const ResourceRequest&) = 0;
-  virtual void urlSelected(const ResourceRequest&) = 0;
+  virtual void openURLRequest(const FrameLoadRequest&) = 0;
+  virtual void submitForm(const FrameLoadRequest&) = 0;
+  virtual void urlSelected(const FrameLoadRequest&) = 0;
   virtual bool lastEventIsMouseUp() const = 0;
   virtual String overrideMediaType() const = 0;
   virtual void redirectDataToPlugin(Widget* pluginWidget) { }
diff --git a/WebCore/page/FrameLoadRequest.h b/WebCore/page/FrameLoadRequest.h
new file mode 100644 (file)
index 0000000..d4fe762
--- /dev/null
@@ -0,0 +1,50 @@
+// -*- 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 FrameLoadRequest_H_
+#define FrameLoadRequest_H_
+
+#include "ResourceRequest.h"
+
+
+namespace WebCore {
+
+    struct FrameLoadRequest {
+    public:
+        FrameLoadRequest() : m_lockHistory(false) { }
+        ResourceRequest m_request;
+        String m_frameName;
+        bool lockHistory() const { return m_lockHistory; }
+        void setLockHistory(bool lock) { m_lockHistory = lock; }
+
+    private:
+        bool m_lockHistory;
+    };
+
+}
+
+#endif // FrameLoadRequest_H_
+
index b29a501454bcd863bde5b53f4a6de4a64e8b14f4..4898bb0459adcc83ab9350f04c41fe9fbbeac53b 100644 (file)
@@ -35,8 +35,8 @@ namespace WebCore {
 
     struct ResourceRequest {
 
-        ResourceRequest() : m_lockHistory(false), reload(false), m_doPost(false) { }
-        explicit ResourceRequest(const KURL& url) : m_lockHistory(false), reload(false), m_url(url), m_doPost(false) { }
+        ResourceRequest() : reload(false), m_doPost(false) { }
+        explicit ResourceRequest(const KURL& url) : reload(false), m_url(url), m_doPost(false) { }
 
         const KURL& url() const { return m_url; }
         void setURL(const KURL& url) { m_url = url; }
@@ -47,18 +47,9 @@ namespace WebCore {
         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; }
-        
         const String& referrer() const { return m_referrer; }
         void setReferrer(const String& referrer) { m_referrer = referrer; }
 
-        // FIXME: these two parameters are specific to frame opening,
-        // should move to FrameRequest once we have that
-        String frameName;
-    private:
-        bool m_lockHistory;
-
     public:
         FormData postData;
         bool reload;