+2006-10-31 Darin Adler <darin@apple.com>
+
+ Reviewed by Brady.
+
+ - got "action dictionary" code out of FrameLoader,
+ replacing with a class called NavigationAction
+
+ * loader/DocumentLoader.h: Changed m_triggeringAction to a NavigationAction.
+ * loader/mac/DocumentLoaderMac.mm:
+ (WebCore::DocumentLoader::triggeringAction): Ditto.
+ (WebCore::DocumentLoader::setTriggeringAction): Ditto.
+
+ * loader/FrameLoader.h: Changed action parameters to NavigationAction.
+
+ * loader/FrameLoaderClient.h: Changed action parameters to NavigationAction.
+ Removed elementForEvent.
+ * loader/mac/FrameLoaderMac.mm:
+ (WebCore::FrameLoader::load): Ditto.
+ (WebCore::FrameLoader::reload): Ditto.
+ (WebCore::FrameLoader::checkNewWindowPolicy): Ditto.
+ (WebCore::FrameLoader::checkNavigationPolicy): Ditto.
+ (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy): Ditto.
+ (WebCore::FrameLoader::post): Ditto.
+
+ * loader/NavigationAction.h: Added.
+ * loader/NavigationAction.cpp: Added.
+ * loader/mac/NavigationActionMac.mm: Added.
+
+ * loader/mac/MainResourceLoaderMac.mm: Fixed copyright.
+
+ * WebCore.xcodeproj/project.pbxproj: Updated for new files.
+ * WebCore.exp: Updated.
+
2006-10-31 Steve Falkenburg <sfalken@apple.com>
Reviewed by Adam.
__ZN7WebCore11FrameLoader12shouldReloadEP5NSURLS2_
__ZN7WebCore11FrameLoader14detachChildrenEv
__ZN7WebCore11FrameLoader16detachFromParentEv
-__ZN7WebCore11FrameLoader17actionInformationENS_13FrameLoadTypeEbP7NSEventP5NSURL
-__ZN7WebCore11FrameLoader17actionInformationENS_14NavigationTypeEP7NSEventP5NSURL
__ZN7WebCore11FrameLoader19requestFromDelegateEP12NSURLRequestRP11objc_objectRP7NSError
__ZN7WebCore11FrameLoader21addPlugInStreamLoaderEPNS_14ResourceLoaderE
__ZN7WebCore11FrameLoader21commitProvisionalLoadEP12NSDictionary
__ZN7WebCore11FrameLoader25provisionalDocumentLoaderEv
__ZN7WebCore11FrameLoader29sendRemainingDelegateMessagesEP11objc_objectP13NSURLResponsejP7NSError
__ZN7WebCore11FrameLoader4loadEP12NSURLRequest
-__ZN7WebCore11FrameLoader4loadEP12NSURLRequestP12NSDictionaryNS_13FrameLoadTypeEN3WTF10PassRefPtrINS_9FormStateEEE
+__ZN7WebCore11FrameLoader4loadEP12NSURLRequestRKNS_16NavigationActionENS_13FrameLoadTypeEN3WTF10PassRefPtrINS_9FormStateEEE
__ZN7WebCore11FrameLoader4loadEP12NSURLRequestRKNS_6StringE
__ZN7WebCore11FrameLoader4loadEP5NSURLRKNS_6StringENS_13FrameLoadTypeES5_P7NSEventPNS_7ElementERKN3WTF7HashMapIS3_S3_NSB_7StrHashIS3_EENSB_10HashTraitsIS3_EESG_EE
__ZN7WebCore11FrameLoader4loadEPNS_14DocumentLoaderE
__ZN7WebCore14RenderListItem17markerStringValueEv
__ZN7WebCore14ResourceLoader14cancelledErrorEv
__ZN7WebCore14ResourceLoader20inConnectionCallbackEv
+__ZN7WebCore16DeprecatedStringC1ERKS0_
__ZN7WebCore16DeprecatedString6appendENS_14DeprecatedCharE
__ZN7WebCore16DeprecatedString6appendERKS0_
__ZN7WebCore16DeprecatedString6appendEc
__ZN7WebCore16DeprecatedStringC1EPKc
__ZN7WebCore16DeprecatedStringC1Ev
__ZN7WebCore16DeprecatedStringD1Ev
+__ZN7WebCore16DeprecatedStringaSERKS0_
+__ZN7WebCore16NavigationActionC1ERKNS_4KURLENS_13FrameLoadTypeEb
+__ZN7WebCore16NavigationActionC1ERKNS_4KURLENS_14NavigationTypeE
+__ZN7WebCore16NavigationActionC1Ev
__ZN7WebCore17FrameLoaderClientD2Ev
__ZN7WebCore19SelectionController5clearEv
__ZN7WebCore19SelectionController9selectAllEv
93B780CA09B3B7FE00690162 /* WidgetClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 93B780C909B3B7FE00690162 /* WidgetClient.h */; };
93C841F809CE855C00DFF5E5 /* DOMImplementationFront.h in Headers */ = {isa = PBXBuildFile; fileRef = 93C841F709CE855C00DFF5E5 /* DOMImplementationFront.h */; };
93C841FF09CE858300DFF5E5 /* DOMImplementationFront.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93C841FE09CE858300DFF5E5 /* DOMImplementationFront.cpp */; };
+ 93CCF0270AF6C52900018E89 /* NavigationAction.h in Headers */ = {isa = PBXBuildFile; fileRef = 93CCF0260AF6C52900018E89 /* NavigationAction.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 93CCF0580AF6C9FE00018E89 /* NavigationActionMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93CCF0570AF6C9FE00018E89 /* NavigationActionMac.mm */; };
+ 93CCF0600AF6CA7600018E89 /* NavigationAction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93CCF05F0AF6CA7600018E89 /* NavigationAction.cpp */; };
93CD4FDE0995F9EA007ECC97 /* AtomicString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93CD4FD70995F9EA007ECC97 /* AtomicString.cpp */; };
93CD4FDF0995F9EA007ECC97 /* AtomicString.h in Headers */ = {isa = PBXBuildFile; fileRef = 93CD4FD80995F9EA007ECC97 /* AtomicString.h */; settings = {ATTRIBUTES = (Private, ); }; };
93CD4FE00995F9EA007ECC97 /* AtomicStringImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 93CD4FD90995F9EA007ECC97 /* AtomicStringImpl.h */; settings = {ATTRIBUTES = (Private, ); }; };
93CA4C9F09DF93FA00DF8677 /* quirks.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = quirks.css; sourceTree = "<group>"; };
93CA4CA209DF93FA00DF8677 /* svg.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = svg.css; sourceTree = "<group>"; };
93CA4CA309DF93FA00DF8677 /* tokenizer.flex */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tokenizer.flex; sourceTree = "<group>"; };
+ 93CCF0260AF6C52900018E89 /* NavigationAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NavigationAction.h; sourceTree = "<group>"; };
+ 93CCF0570AF6C9FE00018E89 /* NavigationActionMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NavigationActionMac.mm; sourceTree = "<group>"; };
+ 93CCF05F0AF6CA7600018E89 /* NavigationAction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NavigationAction.cpp; sourceTree = "<group>"; };
93CD4FD70995F9EA007ECC97 /* AtomicString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AtomicString.cpp; sourceTree = "<group>"; };
93CD4FD80995F9EA007ECC97 /* AtomicString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AtomicString.h; sourceTree = "<group>"; };
93CD4FD90995F9EA007ECC97 /* AtomicStringImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AtomicStringImpl.h; sourceTree = "<group>"; };
isa = PBXGroup;
children = (
654F68870AF1B7C50065BDD6 /* CachedResourceMac.mm */,
+ 656D371F0ADBA5DE00A4554D /* DocumentLoaderMac.mm */,
+ 656D37200ADBA5DE00A4554D /* FormDataStream.h */,
+ 656D37210ADBA5DE00A4554D /* FormDataStream.m */,
656D37250ADBA5DE00A4554D /* FrameLoaderMac.mm */,
51A1D2C50AB69120000D732C /* IconLoaderMac.mm */,
93A1EAA70A563508006960A0 /* ImageDocumentMac.h */,
656D371B0ADBA5DE00A4554D /* LoaderNSURLExtras.m */,
6563A9A50ADF4094000ED2CD /* LoaderNSURLRequestExtras.h */,
6563A9A60ADF4094000ED2CD /* LoaderNSURLRequestExtras.m */,
- 656D371C0ADBA5DE00A4554D /* WebDataProtocol.h */,
- 656D371D0ADBA5DE00A4554D /* WebDataProtocol.mm */,
- 656D371F0ADBA5DE00A4554D /* DocumentLoaderMac.mm */,
- 656D37200ADBA5DE00A4554D /* FormDataStream.h */,
- 656D37210ADBA5DE00A4554D /* FormDataStream.m */,
- 656D37280ADBA5DE00A4554D /* ResourceLoaderMac.mm */,
656D372A0ADBA5DE00A4554D /* MainResourceLoaderMac.mm */,
+ 93CCF0570AF6C9FE00018E89 /* NavigationActionMac.mm */,
656D372C0ADBA5DE00A4554D /* NetscapePlugInStreamLoaderMac.mm */,
- 656D372D0ADBA5DE00A4554D /* WebPlugInStreamLoaderDelegate.h */,
+ 656D37280ADBA5DE00A4554D /* ResourceLoaderMac.mm */,
656D37310ADBA5DE00A4554D /* SubresourceLoaderMac.mm */,
+ 656D371C0ADBA5DE00A4554D /* WebDataProtocol.h */,
+ 656D371D0ADBA5DE00A4554D /* WebDataProtocol.mm */,
+ 656D372D0ADBA5DE00A4554D /* WebPlugInStreamLoaderDelegate.h */,
);
path = mac;
sourceTree = "<group>";
F587851702DE375901EA4122 /* LoaderFunctions.h */,
93E227DC0AF589AD00D48324 /* MainResourceLoader.cpp */,
656D37290ADBA5DE00A4554D /* MainResourceLoader.h */,
+ 93CCF0260AF6C52900018E89 /* NavigationAction.h */,
+ 93CCF05F0AF6CA7600018E89 /* NavigationAction.cpp */,
93E227DD0AF589AD00D48324 /* NetscapePlugInStreamLoader.cpp */,
656D372B0ADBA5DE00A4554D /* NetscapePlugInStreamLoader.h */,
1AC694C50A3B1676003F5049 /* PluginDocument.cpp */,
93E22A730AF5E94C00D48324 /* PageState.h in Headers */,
658821660AF4CDF700F01D1F /* ResourceResponse.h in Headers */,
6588216B0AF4CE1200F01D1F /* ResourceResponseMac.h in Headers */,
+ 93CCF0270AF6C52900018E89 /* NavigationAction.h in Headers */,
B2A015A90AF6CD53006BCE0E /* GraphicsContext.h in Headers */,
B2A015AB0AF6CD53006BCE0E /* GraphicsTypes.h in Headers */,
B2A015B30AF6CD53006BCE0E /* SVGResource.h in Headers */,
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
+ compatibilityVersion = "Xcode 2.4";
hasScannedForEncodings = 1;
knownRegions = (
English,
93E227E30AF589AD00D48324 /* ResourceLoader.cpp in Sources */,
93E227E40AF589AD00D48324 /* SubresourceLoader.cpp in Sources */,
93E22A6F0AF5E94100D48324 /* PageState.cpp in Sources */,
+ 93CCF0580AF6C9FE00018E89 /* NavigationActionMac.mm in Sources */,
+ 93CCF0600AF6CA7600018E89 /* NavigationAction.cpp in Sources */,
B2A015A80AF6CD53006BCE0E /* GraphicsContext.cpp in Sources */,
B2A015AA0AF6CD53006BCE0E /* GraphicsTypes.cpp in Sources */,
B2A015AC0AF6CD53006BCE0E /* SVGResourceClipperCg.mm in Sources */,
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "NavigationAction.h"
#include "Shared.h"
#include "PlatformString.h"
#include <wtf/Vector.h>
String overrideEncoding() const;
void addResponse(NSURLResponse *);
const ResponseVector& responses() const;
- NSDictionary *triggeringAction() const;
- void setTriggeringAction(NSDictionary *);
+ const NavigationAction& triggeringAction() const;
+ void setTriggeringAction(const NavigationAction&);
void setOverrideEncoding(const String&);
void setLastCheckedRequest(NSURLRequest *request);
NSURLRequest *lastCheckedRequest() const;
// The action that triggered loading - we keep this around for the
// benefit of the various policy handlers.
- RetainPtr<NSDictionary> m_triggeringAction;
+ NavigationAction m_triggeringAction;
// The last request that we checked click policy for - kept around
// so we can avoid asking again needlessly.
class FrameLoaderClient;
class KURL;
class MainResourceLoader;
+ class NavigationAction;
class PageState;
class ResourceLoader;
class ResourceRequest;
NSEvent *, Element* form, const HashMap<String, String>&);
void load(NSURLRequest *);
void load(NSURLRequest *, const String& frameName);
- void load(NSURLRequest *, NSDictionary *triggeringAaction, FrameLoadType, PassRefPtr<FormState>);
+ void load(NSURLRequest *, const NavigationAction&, FrameLoadType, PassRefPtr<FormState>);
#endif
void load(DocumentLoader*);
void load(DocumentLoader*, FrameLoadType, PassRefPtr<FormState>);
#if PLATFORM(MAC)
void addExtraFieldsToRequest(NSMutableURLRequest *, bool isMainResource, bool alwaysFromRequest);
- NSDictionary *actionInformation(NavigationType, NSEvent *, NSURL *);
- NSDictionary *actionInformation(FrameLoadType loadType, bool isFormSubmission, NSEvent *, NSURL *);
#endif
void setClient(FrameLoaderClient*);
#if PLATFORM(MAC)
void checkNavigationPolicy(NSURLRequest *, DocumentLoader*, PassRefPtr<FormState>,
NavigationPolicyDecisionFunction, void* argument);
- void checkNewWindowPolicy(NSDictionary *, NSURLRequest *, PassRefPtr<FormState>, const String& frameName);
+ void checkNewWindowPolicy(const NavigationAction&,
+ NSURLRequest *, PassRefPtr<FormState>, const String& frameName);
#endif
void continueAfterNavigationPolicy(PolicyAction);
class FormState;
class Frame;
class FrameLoader;
+ class NavigationAction;
class String;
class ResourceLoader;
virtual void dispatchShow() = 0;
virtual void dispatchDecidePolicyForMIMEType(FramePolicyFunction, const String& MIMEType, NSURLRequest *) = 0;
- virtual void dispatchDecidePolicyForNewWindowAction(FramePolicyFunction, NSDictionary *action, NSURLRequest *, const String& frameName) = 0;
- virtual void dispatchDecidePolicyForNavigationAction(FramePolicyFunction, NSDictionary *action, NSURLRequest *) = 0;
+ virtual void dispatchDecidePolicyForNewWindowAction(FramePolicyFunction, const NavigationAction&, NSURLRequest *, const String& frameName) = 0;
+ virtual void dispatchDecidePolicyForNavigationAction(FramePolicyFunction, const NavigationAction&, NSURLRequest *) = 0;
virtual void cancelPolicyCheck() = 0;
virtual void dispatchUnableToImplementPolicy(NSError *) = 0;
virtual bool representationExistsForURLScheme(const String& URLScheme) const = 0;
virtual String generatedMIMETypeForURLScheme(const String& URLScheme) const = 0;
- virtual NSDictionary *elementForEvent(NSEvent *) const = 0;
-
virtual void frameLoadCompleted() = 0;
virtual void restoreScrollPositionAndViewState() = 0;
virtual void provisionalLoadStarted() = 0;
--- /dev/null
+/*
+ * Copyright (C) 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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.
+ */
+
+#include "config.h"
+#include "NavigationAction.h"
+
+namespace WebCore {
+
+}
--- /dev/null
+/*
+ * Copyright (C) 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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 NavigationAction_h
+#define NavigationAction_h
+
+#include "FrameLoaderTypes.h"
+#include "KURL.h"
+
+#if PLATFORM(MAC)
+#include "RetainPtr.h"
+#ifdef __OBJC__
+@class NSEvent;
+#else
+class NSEvent;
+#endif
+#endif
+
+namespace WebCore {
+
+ class NavigationAction {
+ public:
+ NavigationAction();
+ NavigationAction(const KURL&, NavigationType);
+ NavigationAction(const KURL&, FrameLoadType, bool isFormSubmission);
+#if PLATFORM(MAC)
+ // FIXME: Change from NSEvent to DOM event.
+ NavigationAction(const KURL&, NavigationType, NSEvent *);
+ NavigationAction(const KURL&, FrameLoadType, bool isFormSubmission, NSEvent *);
+#endif
+
+ bool isEmpty() const { return m_URL.isEmpty(); }
+
+#if PLATFORM(MAC)
+ KURL URL() const { return m_URL; }
+ NavigationType type() const { return m_type; }
+ NSEvent *event() const { return m_event.get(); }
+#endif
+
+ private:
+ KURL m_URL;
+ NavigationType m_type;
+#if PLATFORM(MAC)
+ RetainPtr<NSEvent> m_event;
+#endif
+ };
+
+}
+
+#endif
return [[m_lastCheckedRequest.get() retain] autorelease];
}
-NSDictionary *DocumentLoader::triggeringAction() const
+const NavigationAction& DocumentLoader::triggeringAction() const
{
- return [[m_triggeringAction.get() retain] autorelease];
+ return m_triggeringAction;
}
-void DocumentLoader::setTriggeringAction(NSDictionary *action)
+void DocumentLoader::setTriggeringAction(const NavigationAction& action)
{
m_triggeringAction = action;
}
#import "LoaderNSURLExtras.h"
#import "LoaderNSURLRequestExtras.h"
#import "MainResourceLoader.h"
+#import "NavigationAction.h"
#import "Page.h"
#import "Plugin.h"
#import "ResourceResponse.h"
#import <kjs/JSLock.h>
#import <wtf/Assertions.h>
-using KJS::JSLock;
-using KJS::PausedTimeouts;
-using KJS::SavedBuiltins;
-using KJS::SavedProperties;
-
namespace WebCore {
using namespace HTMLNames;
ASSERT(newLoadType != FrameLoadTypeSame);
- NSDictionary *action = actionInformation(newLoadType, isFormSubmission, event, URL);
+ NavigationAction action(URL, newLoadType, isFormSubmission, event);
+
RefPtr<FormState> formState;
if (form && !values.isEmpty())
formState = FormState::create(form, values, m_frame);
return;
}
- checkNewWindowPolicy(actionInformation(NavigationTypeOther, nil, [request URL]),
+ checkNewWindowPolicy(NavigationAction([request URL], NavigationTypeOther),
request, 0, frameName);
}
-void FrameLoader::load(NSURLRequest *request, NSDictionary *action, FrameLoadType type, PassRefPtr<FormState> formState)
+void FrameLoader::load(NSURLRequest *request, const NavigationAction& action, FrameLoadType type, PassRefPtr<FormState> formState)
{
RefPtr<DocumentLoader> loader = m_client->createDocumentLoader(request);
setPolicyDocumentLoader(loader.get());
[request setCachePolicy:NSURLRequestReloadIgnoringCacheData];
- // If we're about to rePOST, set up action so the app can warn the user
+ // If we're about to re-post, set up action so the application can warn the user.
if (isCaseInsensitiveEqual([request HTTPMethod], @"POST"))
- loader->setTriggeringAction(actionInformation(NavigationTypeFormResubmitted, nil, [request URL]));
+ loader->setTriggeringAction(NavigationAction([request URL], NavigationTypeFormResubmitted));
loader->setOverrideEncoding(m_documentLoader->overrideEncoding());
check.call();
}
-void FrameLoader::checkNewWindowPolicy(NSDictionary *action, NSURLRequest *request,
+void FrameLoader::checkNewWindowPolicy(const NavigationAction& action, NSURLRequest *request,
PassRefPtr<FormState> formState, const String& frameName)
{
m_policyCheck.set(request, formState, frameName,
void FrameLoader::checkNavigationPolicy(NSURLRequest *request, DocumentLoader* loader,
PassRefPtr<FormState> formState, NavigationPolicyDecisionFunction function, void* argument)
{
- NSDictionary *action = loader->triggeringAction();
- if (!action) {
- action = actionInformation(NavigationTypeOther, nil, [request URL]);
+ NavigationAction action = loader->triggeringAction();
+ if (action.isEmpty()) {
+ action = NavigationAction([request URL], NavigationTypeOther);
loader->setTriggeringAction(action);
}
mainFrame->tree()->setName(frameName);
mainFrame->loader()->client()->dispatchShow();
mainFrame->setOpener(frame.get());
- mainFrame->loader()->load(request, nil, FrameLoadTypeStandard, formState);
+ mainFrame->loader()->load(request, NavigationAction(), FrameLoadTypeStandard, formState);
}
void FrameLoader::sendRemainingDelegateMessages(id identifier, NSURLResponse *response, unsigned length, NSError *error)
setHTTPBody(request, formData);
[request setValue:contentType forHTTPHeaderField:@"Content-Type"];
- NSDictionary *action = actionInformation(FrameLoadTypeStandard, true, event, URL);
+ NavigationAction action(URL, FrameLoadTypeStandard, true, event);
RefPtr<FormState> formState;
if (form && !formValues.isEmpty())
formState = FormState::create(form, formValues, m_frame);
[request setValue:@"text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5" forHTTPHeaderField:@"Accept"];
}
-NSDictionary *FrameLoader::actionInformation(FrameLoadType type, bool isFormSubmission, NSEvent *event, NSURL *originalURL)
-{
- NavigationType navType;
- if (isFormSubmission)
- navType = NavigationTypeFormSubmitted;
- else if (event)
- navType = NavigationTypeLinkClicked;
- else if (type == FrameLoadTypeReload)
- navType = NavigationTypeReload;
- else if (isBackForwardLoadType(type))
- navType = NavigationTypeBackForward;
- else
- navType = NavigationTypeOther;
- return actionInformation(navType, event, originalURL);
-}
-
-NSDictionary *FrameLoader::actionInformation(NavigationType navigationType, NSEvent *event, NSURL *originalURL)
-{
- NSString *ActionNavigationTypeKey = @"WebActionNavigationTypeKey";
- NSString *ActionElementKey = @"WebActionElementKey";
- NSString *ActionButtonKey = @"WebActionButtonKey";
- NSString *ActionModifierFlagsKey = @"WebActionModifierFlagsKey";
- NSString *ActionOriginalURLKey = @"WebActionOriginalURLKey";
- NSDictionary *elementInfo = m_client->elementForEvent(event);
- if (elementInfo)
- return [NSDictionary dictionaryWithObjectsAndKeys:
- [NSNumber numberWithInt:navigationType], ActionNavigationTypeKey,
- elementInfo, ActionElementKey,
- [NSNumber numberWithInt:[event buttonNumber]], ActionButtonKey,
- [NSNumber numberWithInt:[event modifierFlags]], ActionModifierFlagsKey,
- originalURL, ActionOriginalURLKey,
- nil];
- return [NSDictionary dictionaryWithObjectsAndKeys:
- [NSNumber numberWithInt:navigationType], ActionNavigationTypeKey,
- [NSNumber numberWithInt:[event modifierFlags]], ActionModifierFlagsKey,
- originalURL, ActionOriginalURLKey,
- nil];
-}
-
// Called every time a resource is completely loaded, or an error is received.
void FrameLoader::checkLoadComplete()
{
/*
- * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2005, 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
--- /dev/null
+/*
+ * Copyright (C) 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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.
+ */
+
+#include "config.h"
+#include "NavigationAction.h"
+
+#include "FrameLoader.h"
+
+namespace WebCore {
+
+static NavigationType navigationType(FrameLoadType frameLoadType, bool isFormSubmission,
+ NSEvent *event)
+{
+ if (isFormSubmission)
+ return NavigationTypeFormSubmitted;
+ if (event)
+ return NavigationTypeLinkClicked;
+ if (frameLoadType == FrameLoadTypeReload)
+ return NavigationTypeReload;
+ if (isBackForwardLoadType(frameLoadType))
+ return NavigationTypeBackForward;
+ return NavigationTypeOther;
+}
+
+NavigationAction::NavigationAction()
+ : m_type(NavigationTypeOther)
+{
+}
+
+NavigationAction::NavigationAction(const KURL& URL, NavigationType type)
+ : m_URL(URL)
+ , m_type(type)
+{
+}
+
+NavigationAction::NavigationAction(const KURL& URL, FrameLoadType frameLoadType,
+ bool isFormSubmission)
+ : m_URL(URL)
+ , m_type(navigationType(frameLoadType, isFormSubmission, 0))
+{
+}
+
+NavigationAction::NavigationAction(const KURL& URL, NavigationType type, NSEvent *event)
+ : m_URL(URL)
+ , m_type(type)
+ , m_event(event)
+{
+}
+
+NavigationAction::NavigationAction(const KURL& URL, FrameLoadType frameLoadType,
+ bool isFormSubmission, NSEvent *event)
+ : m_URL(URL)
+ , m_type(navigationType(frameLoadType, isFormSubmission, event))
+ , m_event(event)
+{
+}
+
+}
+2006-10-31 Darin Adler <darin@apple.com>
+
+ Reviewed by Brady.
+
+ - got "action dictionary" code out of FrameLoader,
+ replacing with a class called NavigationAction
+
+ * WebCoreSupport/WebFrameLoaderClient.h: Changed parameter types to NavigationAction.
+ Made elementForEvent non-virtual. Added actionDictionary function.
+ * WebCoreSupport/WebFrameLoaderClient.mm:
+ (WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction): Changed parameter type,
+ and used actionDictionary to make the action dictionary.
+ (WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): Ditto.
+ (WebFrameLoaderClient::actionDictionary): Added. Code that was originally in WebCore
+ that creates the action dictionary (from a NavigationAction).
+
+ * WebView/WebFrame.mm: (-[WebFrame _loadItem:withLoadType:]): Use NavigationAction
+ instead of a dictionary for the action parameters.
+
2006-10-31 Marvin Decker <marv.decker@gmail.com>
Reviewed by Maciej.
virtual void dispatchDecidePolicyForMIMEType(WebCore::FramePolicyFunction,
const WebCore::String& MIMEType, NSURLRequest *);
virtual void dispatchDecidePolicyForNewWindowAction(WebCore::FramePolicyFunction,
- NSDictionary *action, NSURLRequest *, const WebCore::String& frameName);
+ const WebCore::NavigationAction&, NSURLRequest *, const WebCore::String& frameName);
virtual void dispatchDecidePolicyForNavigationAction(WebCore::FramePolicyFunction,
- NSDictionary *action, NSURLRequest *);
+ const WebCore::NavigationAction&, NSURLRequest *);
virtual void cancelPolicyCheck();
virtual void dispatchUnableToImplementPolicy(NSError *);
virtual bool representationExistsForURLScheme(const WebCore::String& URLScheme) const;
virtual WebCore::String generatedMIMETypeForURLScheme(const WebCore::String& URLScheme) const;
- virtual NSDictionary *elementForEvent(NSEvent *) const;
-
virtual void frameLoadCompleted();
virtual void restoreScrollPositionAndViewState();
virtual void provisionalLoadStarted();
WebFramePolicyListener *setUpPolicyListener(WebCore::FramePolicyFunction);
+ NSDictionary *actionDictionary(const WebCore::NavigationAction&) const;
+ NSDictionary *elementForEvent(NSEvent *) const;
+
bool createPageCache(WebHistoryItem *);
WebCore::RetainPtr<WebFrame> m_webFrame;
}
void WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function,
- NSDictionary *action, NSURLRequest *request, const String& frameName)
+ const NavigationAction& action, NSURLRequest *request, const String& frameName)
{
WebView *webView = getWebView(m_webFrame.get());
[[webView _policyDelegateForwarder] webView:webView
- decidePolicyForNewWindowAction:action
+ decidePolicyForNewWindowAction:actionDictionary(action)
request:request
newFrameName:frameName
decisionListener:setUpPolicyListener(function)];
}
void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(FramePolicyFunction function,
- NSDictionary *action, NSURLRequest *request)
+ const NavigationAction& action, NSURLRequest *request)
{
WebView *webView = getWebView(m_webFrame.get());
[[webView _policyDelegateForwarder] webView:webView
- decidePolicyForNavigationAction:action
+ decidePolicyForNavigationAction:actionDictionary(action)
request:request
frame:m_webFrame.get()
decisionListener:setUpPolicyListener(function)];
return [getWebView(m_webFrame.get()) userAgentForURL:URL];
}
+NSDictionary *WebFrameLoaderClient::actionDictionary(const NavigationAction& action) const
+{
+ if (NSDictionary *elementInfo = elementForEvent(action.event()))
+ return [NSDictionary dictionaryWithObjectsAndKeys:
+ [NSNumber numberWithInt:action.type()], WebActionNavigationTypeKey,
+ elementInfo, WebActionElementKey,
+ [NSNumber numberWithInt:[action.event() buttonNumber]], WebActionButtonKey,
+ [NSNumber numberWithInt:[action.event() modifierFlags]], WebActionModifierFlagsKey,
+ action.URL().getNSURL(), WebActionOriginalURLKey,
+ nil];
+ return [NSDictionary dictionaryWithObjectsAndKeys:
+ [NSNumber numberWithInt:action.type()], WebActionNavigationTypeKey,
+ [NSNumber numberWithInt:[action.event() modifierFlags]], WebActionModifierFlagsKey,
+ action.URL().getNSURL(), WebActionOriginalURLKey,
+ nil];
+}
+
@implementation WebFramePolicyListener
- (id)initWithWebCoreFrame:(Frame*)frame
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 149C283208902B0F008A9EFC /* Build configuration list for PBXProject "WebKit" */;
+ compatibilityVersion = "Xcode 2.4";
hasScannedForEncodings = 1;
knownRegions = (
English,
mainGroup = 0867D691FE84028FC02AAC07 /* WebKit */;
productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
projectDirPath = "";
+ projectRoot = "";
+ shouldCheckCompatibility = 1;
targets = (
9398100A0824BF01008DF038 /* WebKit */,
);
[self _frameLoader]->addExtraFieldsToRequest(request, true, (formData != nil));
// If this was a repost that failed the page cache, we might try to repost the form.
- NSDictionary *action;
+ NavigationAction action;
if (formData) {
[request setHTTPMethod:@"POST"];
[request _web_setHTTPReferrer:[item formReferrer]];
if (synchResponse == nil) {
// Not in the NSURL cache
[request setCachePolicy:NSURLRequestReloadIgnoringCacheData];
- action = [self _frameLoader]->actionInformation(NavigationTypeFormResubmitted, nil, itemURL);
+ action = NavigationAction(itemURL, NavigationTypeFormResubmitted);
} else
// We can use the cache, don't use navType=resubmit
- action = [self _frameLoader]->actionInformation(loadType, false, nil, itemURL);
+ action = NavigationAction(itemURL, loadType, false);
} else {
switch (loadType) {
case FrameLoadTypeReload:
ASSERT_NOT_REACHED();
}
- action = [self _frameLoader]->actionInformation(loadType, false, nil, itemOriginalURL);
+ action = NavigationAction(itemOriginalURL, loadType, false);
}
[self _frameLoader]->load(request, action, loadType, 0);