Commit 7b17ad9c authored by weinig@apple.com's avatar weinig@apple.com

Add form submission listener to WebKit2

Part of <rdar://problem/8255932>
https://bugs.webkit.org/show_bug.cgi?id=43947

Reviewed by Jon Honeycutt.

* Shared/APIObject.h:
Add TypeFormSubmissionListener APIType.
        
* Shared/CoreIPCSupport/WebPageProxyMessageKinds.h:
Add WillSubmitForm message kind.

* UIProcess/API/C/WKAPICast.h:
Add new mappings for WKFormSubmissionListenerRef -> WebFormSubmissionListener

* UIProcess/API/C/WKBase.h:
Add OpaqueWKFormSubmissionListener and rename the other opaque types to match.

* UIProcess/API/C/WKFormSubmissionListener.cpp: Added.
(WKFormSubmissionListenerGetTypeID):
(WKFormSubmissionListenerContinue):
(WKFormSubmissionListenerRetain):
(WKFormSubmissionListenerRelease):
* UIProcess/API/C/WKFormSubmissionListener.h: Added.
Add C wrapper for WebFormSubmissionListener.

* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageFormClient):
* UIProcess/API/C/WKPage.h:
Add WKPageFormClient with willSubmitForm callback. Additional callbacks will be added as
needed.

* UIProcess/API/C/WebKit2.h:
Add include for WKFormSubmissionListener.h

* UIProcess/WebFormClient.cpp: Added.
(WebKit::WebFormClient::WebFormClient):
(WebKit::WebFormClient::initialize):
(WebKit::WebFormClient::willSubmitForm):
* UIProcess/WebFormClient.h: Added.
Add client for form related delagations.

* UIProcess/WebFormSubmissionListenerProxy.cpp: Added.
(WebKit::WebFormSubmissionListenerProxy::WebFormSubmissionListenerProxy):
(WebKit::WebFormSubmissionListenerProxy::continueSubmission):
* UIProcess/WebFormSubmissionListenerProxy.h: Added.
(WebKit::WebFormSubmissionListenerProxy::create):
(WebKit::WebFormSubmissionListenerProxy::type):
* UIProcess/WebFrameListenerProxy.cpp: Copied from UIProcess/WebFramePolicyListenerProxy.cpp.
Add new type of listener for form submissions. It inherits from the new base class
for listeners, WebFrameListenerProxy.

(WebKit::WebFrameListenerProxy::WebFrameListenerProxy):
(WebKit::WebFrameListenerProxy::~WebFrameListenerProxy):
(WebKit::WebFrameListenerProxy::invalidate):
(WebKit::WebFrameListenerProxy::receivedPolicyDecision):
* UIProcess/WebFrameListenerProxy.h: Copied from UIProcess/WebFramePolicyListenerProxy.h.
Move logic that would have to be shared between WebFramePolicyListenerProxy and
WebFormSubmissionListenerProxy into shared base class.

* UIProcess/WebFramePolicyListenerProxy.cpp:
(WebKit::WebFramePolicyListenerProxy::WebFramePolicyListenerProxy):
* UIProcess/WebFramePolicyListenerProxy.h:
(WebKit::WebFramePolicyListenerProxy::create):
(WebKit::WebFramePolicyListenerProxy::type):
Move to inheriting from WebFrameListenerProxy.

* UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::disconnect):
(WebKit::WebFrameProxy::receivedPolicyDecision):
(WebKit::WebFrameProxy::setUpPolicyListenerProxy):
(WebKit::WebFrameProxy::setUpFormSubmissionListenerProxy):
* UIProcess/WebFrameProxy.h:
Change listener functions to act on WebFrameListenerProxys and add setUpFormSubmissionListenerProxy.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::initializeFormClient):
(WebKit::WebPageProxy::didReceiveMessage):
(WebKit::WebPageProxy::willSubmitForm):
* UIProcess/WebPageProxy.h:
Plumb through willSubmitForm call as we do with the other listeners.

* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchWillSubmitForm):
Ditto.

* WebKit2.xcodeproj/project.pbxproj: Add new files.
* win/WebKit2.vcproj: Add new files.
* win/WebKit2Generated.make: Ditto.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b989e0a8
2010-08-13 Sam Weinig <sam@webkit.org>
Reviewed by Jon Honeycutt.
Add form submission listener to WebKit2
Part of <rdar://problem/8255932>
https://bugs.webkit.org/show_bug.cgi?id=43947
* Shared/APIObject.h:
Add TypeFormSubmissionListener APIType.
* Shared/CoreIPCSupport/WebPageProxyMessageKinds.h:
Add WillSubmitForm message kind.
* UIProcess/API/C/WKAPICast.h:
Add new mappings for WKFormSubmissionListenerRef -> WebFormSubmissionListener
* UIProcess/API/C/WKBase.h:
Add OpaqueWKFormSubmissionListener and rename the other opaque types to match.
* UIProcess/API/C/WKFormSubmissionListener.cpp: Added.
(WKFormSubmissionListenerGetTypeID):
(WKFormSubmissionListenerContinue):
(WKFormSubmissionListenerRetain):
(WKFormSubmissionListenerRelease):
* UIProcess/API/C/WKFormSubmissionListener.h: Added.
Add C wrapper for WebFormSubmissionListener.
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageFormClient):
* UIProcess/API/C/WKPage.h:
Add WKPageFormClient with willSubmitForm callback. Additional callbacks will be added as
needed.
* UIProcess/API/C/WebKit2.h:
Add include for WKFormSubmissionListener.h
* UIProcess/WebFormClient.cpp: Added.
(WebKit::WebFormClient::WebFormClient):
(WebKit::WebFormClient::initialize):
(WebKit::WebFormClient::willSubmitForm):
* UIProcess/WebFormClient.h: Added.
Add client for form related delagations.
* UIProcess/WebFormSubmissionListenerProxy.cpp: Added.
(WebKit::WebFormSubmissionListenerProxy::WebFormSubmissionListenerProxy):
(WebKit::WebFormSubmissionListenerProxy::continueSubmission):
* UIProcess/WebFormSubmissionListenerProxy.h: Added.
(WebKit::WebFormSubmissionListenerProxy::create):
(WebKit::WebFormSubmissionListenerProxy::type):
* UIProcess/WebFrameListenerProxy.cpp: Copied from UIProcess/WebFramePolicyListenerProxy.cpp.
Add new type of listener for form submissions. It inherits from the new base class
for listeners, WebFrameListenerProxy.
(WebKit::WebFrameListenerProxy::WebFrameListenerProxy):
(WebKit::WebFrameListenerProxy::~WebFrameListenerProxy):
(WebKit::WebFrameListenerProxy::invalidate):
(WebKit::WebFrameListenerProxy::receivedPolicyDecision):
* UIProcess/WebFrameListenerProxy.h: Copied from UIProcess/WebFramePolicyListenerProxy.h.
Move logic that would have to be shared between WebFramePolicyListenerProxy and
WebFormSubmissionListenerProxy into shared base class.
* UIProcess/WebFramePolicyListenerProxy.cpp:
(WebKit::WebFramePolicyListenerProxy::WebFramePolicyListenerProxy):
* UIProcess/WebFramePolicyListenerProxy.h:
(WebKit::WebFramePolicyListenerProxy::create):
(WebKit::WebFramePolicyListenerProxy::type):
Move to inheriting from WebFrameListenerProxy.
* UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::disconnect):
(WebKit::WebFrameProxy::receivedPolicyDecision):
(WebKit::WebFrameProxy::setUpPolicyListenerProxy):
(WebKit::WebFrameProxy::setUpFormSubmissionListenerProxy):
* UIProcess/WebFrameProxy.h:
Change listener functions to act on WebFrameListenerProxys and add setUpFormSubmissionListenerProxy.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::initializeFormClient):
(WebKit::WebPageProxy::didReceiveMessage):
(WebKit::WebPageProxy::willSubmitForm):
* UIProcess/WebPageProxy.h:
Plumb through willSubmitForm call as we do with the other listeners.
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchWillSubmitForm):
Ditto.
* WebKit2.xcodeproj/project.pbxproj: Add new files.
* win/WebKit2.vcproj: Add new files.
* win/WebKit2Generated.make: Ditto.
2010-08-13 Gavin Barraclough <barraclough@apple.com>
Reviewed by Sam Weinig
......
......@@ -44,6 +44,7 @@ public:
TypeBackForwardList,
TypeBackForwardListItem,
TypeContext,
TypeFormSubmissionListener,
TypeFrame,
TypeFramePolicyListener,
TypeNavigationData,
......
......@@ -64,6 +64,7 @@ enum Kind {
SetCursor,
SetToolTip,
TakeFocus,
WillSubmitForm,
BackForwardAddItem,
BackForwardGoToItem,
......
......@@ -44,6 +44,7 @@ class WebBackForwardListItem;
class WebContext;
class WebData;
class WebError;
class WebFormSubmissionListenerProxy;
class WebFramePolicyListenerProxy;
class WebFrameProxy;
class WebNavigationData;
......@@ -59,6 +60,7 @@ template<> struct APITypeInfo<WKBackForwardListItemRef> { typedef WebBac
template<> struct APITypeInfo<WKBackForwardListRef> { typedef WebBackForwardList* ImplType; };
template<> struct APITypeInfo<WKContextRef> { typedef WebContext* ImplType; };
template<> struct APITypeInfo<WKDataRef> { typedef WebData* ImplType; };
template<> struct APITypeInfo<WKFormSubmissionListenerRef> { typedef WebFormSubmissionListenerProxy* ImplType; };
template<> struct APITypeInfo<WKFramePolicyListenerRef> { typedef WebFramePolicyListenerProxy* ImplType; };
template<> struct APITypeInfo<WKFrameRef> { typedef WebFrameProxy* ImplType; };
template<> struct APITypeInfo<WKNavigationDataRef> { typedef WebNavigationData* ImplType; };
......@@ -77,6 +79,7 @@ template<> struct ImplTypeInfo<WebBackForwardListItem*> { typedef WKBack
template<> struct ImplTypeInfo<WebContext*> { typedef WKContextRef APIType; };
template<> struct ImplTypeInfo<WebData*> { typedef WKDataRef APIType; };
template<> struct ImplTypeInfo<WebError*> { typedef WKErrorRef APIType; };
template<> struct ImplTypeInfo<WebFormSubmissionListenerProxy*> { typedef WKFormSubmissionListenerRef APIType; };
template<> struct ImplTypeInfo<WebFramePolicyListenerProxy*> { typedef WKFramePolicyListenerRef APIType; };
template<> struct ImplTypeInfo<WebFrameProxy*> { typedef WKFrameRef APIType; };
template<> struct ImplTypeInfo<WebNavigationData*> { typedef WKNavigationDataRef APIType; };
......
......@@ -35,20 +35,21 @@
typedef uint32_t WKTypeID;
typedef void* WKTypeRef;
typedef struct OpaqueWKArrayRef* WKArrayRef;
typedef struct OpaqueWKBackForwardListItemRef* WKBackForwardListItemRef;
typedef struct OpaqueWKBackForwardListRef* WKBackForwardListRef;
typedef struct OpaqueWKArray* WKArrayRef;
typedef struct OpaqueWKBackForwardList* WKBackForwardListRef;
typedef struct OpaqueWKBackForwardListItem* WKBackForwardListItemRef;
typedef struct OpaqueWKContext* WKContextRef;
typedef struct OpaqueWKData* WKDataRef;
typedef struct OpaqueWKError* WKErrorRef;
typedef struct OpaqueWKFormSubmissionListener* WKFormSubmissionListenerRef;
typedef struct OpaqueWKFrame* WKFrameRef;
typedef struct OpaqueWKFramePolicyListener* WKFramePolicyListenerRef;
typedef struct OpaqueWKNavigationDataRef* WKNavigationDataRef;
typedef struct OpaqueWKNavigationData* WKNavigationDataRef;
typedef struct OpaqueWKPage* WKPageRef;
typedef struct OpaqueWKPageNamespace* WKPageNamespaceRef;
typedef struct OpaqueWKPreferencesRef* WKPreferencesRef;
typedef struct OpaqueWKStringRef* WKStringRef;
typedef struct OpaqueWKURLRef* WKURLRef;
typedef struct OpaqueWKPreferences* WKPreferencesRef;
typedef struct OpaqueWKString* WKStringRef;
typedef struct OpaqueWKURL* WKURLRef;
#undef WK_EXPORT
#if defined(WK_NO_EXPORT)
......
/*
* Copyright (C) 2010 Apple 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 INC. 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 INC. 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 "WKFormSubmissionListener.h"
#include "WKAPICast.h"
#include "WebFormSubmissionListenerProxy.h"
using namespace WebKit;
WKTypeID WKFormSubmissionListenerGetTypeID()
{
return toRef(WebFormSubmissionListenerProxy::APIType);
}
void WKFormSubmissionListenerContinue(WKFormSubmissionListenerRef submissionListener)
{
toWK(submissionListener)->continueSubmission();
}
WKFormSubmissionListenerRef WKFormSubmissionListenerRetain(WKFormSubmissionListenerRef submissionListenerRef)
{
toWK(submissionListenerRef)->ref();
return submissionListenerRef;
}
void WKFormSubmissionListenerRelease(WKFormSubmissionListenerRef submissionListenerRef)
{
toWK(submissionListenerRef)->deref();
}
/*
* Copyright (C) 2010 Apple 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 INC. 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 INC. 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 WKFormSubmissionListener_h
#define WKFormSubmissionListener_h
#include <WebKit2/WKBase.h>
#ifdef __cplusplus
extern "C" {
#endif
WK_EXPORT WKTypeID WKFormSubmissionListenerGetTypeID();
WK_EXPORT void WKFormSubmissionListenerContinue(WKFormSubmissionListenerRef submissionListener);
WK_EXPORT WKFormSubmissionListenerRef WKFormSubmissionListenerRetain(WKFormSubmissionListenerRef submissionListener);
WK_EXPORT void WKFormSubmissionListenerRelease(WKFormSubmissionListenerRef submissionListener);
#ifdef __cplusplus
}
#endif
WK_DECLARE_RETAIN_RELEASE_OVERLOADS(WKFormSubmissionListener)
#endif /* WKFormSubmissionListener_h */
......@@ -155,6 +155,12 @@ void WKPageSetPagePolicyClient(WKPageRef pageRef, const WKPagePolicyClient* wkCl
toWK(pageRef)->initializePolicyClient(wkClient);
}
void WKPageSetPageFormClient(WKPageRef pageRef, const WKPageFormClient* wkClient)
{
if (wkClient && !wkClient->version)
toWK(pageRef)->initializeFormClient(wkClient);
}
void WKPageSetPageUIClient(WKPageRef pageRef, const WKPageUIClient * wkClient)
{
if (wkClient && !wkClient->version)
......
......@@ -113,6 +113,16 @@ struct WKPagePolicyClient {
};
typedef struct WKPagePolicyClient WKPagePolicyClient;
// Form Client.
typedef void (*WKPageWillSubmitFormCallback)(WKPageRef page, WKFrameRef frame, WKFrameRef sourceFrame, WKFormSubmissionListenerRef listener, const void* clientInfo);
struct WKPageFormClient {
int version;
const void * clientInfo;
WKPageWillSubmitFormCallback willSubmitForm;
};
typedef struct WKPageFormClient WKPageFormClient;
// UI Client
typedef WKPageRef (*WKPageCreateNewPageCallback)(WKPageRef page, const void *clientInfo);
typedef void (*WKPageShowPageCallback)(WKPageRef page, const void *clientInfo);
......@@ -165,6 +175,7 @@ WK_EXPORT void WKPageRestoreFromSessionState(WKPageRef page, WKDataRef sessionSt
WK_EXPORT void WKPageSetPageLoaderClient(WKPageRef page, const WKPageLoaderClient* client);
WK_EXPORT void WKPageSetPagePolicyClient(WKPageRef page, const WKPagePolicyClient* client);
WK_EXPORT void WKPageSetPageFormClient(WKPageRef page, const WKPageFormClient* client);
WK_EXPORT void WKPageSetPageUIClient(WKPageRef page, const WKPageUIClient* client);
typedef void (*WKPageRunJavaScriptFunction)(WKStringRef, WKErrorRef, void*);
......
......@@ -28,9 +28,11 @@
#include <WebKit2/WKBase.h>
#include <WebKit2/WKType.h>
#include <WebKit2/WKBackForwardList.h>
#include <WebKit2/WKBackForwardListItem.h>
#include <WebKit2/WKContext.h>
#include <WebKit2/WKFormSubmissionListener.h>
#include <WebKit2/WKFrame.h>
#include <WebKit2/WKFramePolicyListener.h>
#include <WebKit2/WKNavigationData.h>
......
/*
* Copyright (C) 2010 Apple 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 INC. 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 INC. 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 "WebFormClient.h"
#include "WKAPICast.h"
using namespace WebCore;
namespace WebKit {
WebFormClient::WebFormClient()
{
initialize(0);
}
void WebFormClient::initialize(const WKPageFormClient* client)
{
if (client && !client->version)
m_pageFormClient = *client;
else
memset(&m_pageFormClient, 0, sizeof(m_pageFormClient));
}
bool WebFormClient::willSubmitForm(WebPageProxy* page, WebFrameProxy* frame, WebFrameProxy* sourceFrame, WebFormSubmissionListenerProxy* listener)
{
if (!m_pageFormClient.willSubmitForm)
return false;
m_pageFormClient.willSubmitForm(toRef(page), toRef(frame), toRef(sourceFrame), toRef(listener), m_pageFormClient.clientInfo);
return true;
}
} // namespace WebKit
/*
* Copyright (C) 2010 Apple 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 INC. 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 INC. 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 WebFormClient_h
#define WebFormClient_h
#include "WKPage.h"
#include <wtf/Forward.h>
namespace WebKit {
class WebPageProxy;
class WebFrameProxy;
class WebFormSubmissionListenerProxy;
class WebFormClient {
public:
WebFormClient();
void initialize(const WKPageFormClient*);
// FIXME: Add value dictionary and form element reference.
bool willSubmitForm(WebPageProxy*, WebFrameProxy*, WebFrameProxy*, WebFormSubmissionListenerProxy*);
private:
WKPageFormClient m_pageFormClient;
};
} // namespace WebKit
#endif // WebFormClient_h
/*
* Copyright (C) 2010 Apple 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 INC. 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 INC. 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 "WebFormSubmissionListenerProxy.h"
namespace WebKit {
WebFormSubmissionListenerProxy::WebFormSubmissionListenerProxy(WebFrameProxy* frame, uint64_t listenerID)
: WebFrameListenerProxy(frame, listenerID)
{
}
void WebFormSubmissionListenerProxy::continueSubmission()
{
receivedPolicyDecision(WebCore::PolicyUse);
}
} // namespace WebKit
/*
* Copyright (C) 2010 Apple 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 INC. 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 INC. 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 WebFormSubmissionListenerProxy_h
#define WebFormSubmissionListenerProxy_h
#include "WebFrameListenerProxy.h"
namespace WebKit {
class WebFrameProxy;
class WebFormSubmissionListenerProxy : public WebFrameListenerProxy {
public:
static const Type APIType = TypeFormSubmissionListener;
static PassRefPtr<WebFormSubmissionListenerProxy> create(WebFrameProxy* frame, uint64_t listenerID)
{
return adoptRef(new WebFormSubmissionListenerProxy(frame, listenerID));
}
void continueSubmission();
private:
WebFormSubmissionListenerProxy(WebFrameProxy*, uint64_t listenerID);
virtual Type type() const { return APIType; }
};
} // namespace WebKit
#endif // WebFramePolicyListenerProxy_h
/*
* Copyright (C) 2010 Apple 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 INC. 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 INC. 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 "WebFrameListenerProxy.h"
#include "WebFrameProxy.h"
namespace WebKit {
WebFrameListenerProxy::WebFrameListenerProxy(WebFrameProxy* frame, uint64_t listenerID)
: m_frame(frame)
, m_listenerID(listenerID)
{
}
WebFrameListenerProxy::~WebFrameListenerProxy()
{
}
void WebFrameListenerProxy::invalidate()
{
m_frame = 0;
}
void WebFrameListenerProxy::receivedPolicyDecision(WebCore::PolicyAction action)
{
if (!m_frame)
return;
m_frame->receivedPolicyDecision(action, m_listenerID);
m_frame = 0;
}
} // namespace WebKit
/*
* Copyright (C) 2010 Apple 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 INC. 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 INC. 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 WebFrameListenerProxy_h
#define WebFrameListenerProxy_h
#include "APIObject.h"
#include <WebCore/FrameLoaderTypes.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
namespace WebKit {
class WebFrameProxy;
class WebFrameListenerProxy : public APIObject {
public:
virtual ~WebFrameListenerProxy();
void invalidate();
uint64_t listenerID() const { return m_listenerID; }
protected:
WebFrameListenerProxy(WebFrameProxy*, uint64_t listenerID);
void receivedPolicyDecision(WebCore::PolicyAction);