Changeset 65337 in webkit


Ignore:
Timestamp:
Aug 13, 2010 1:11:17 PM (14 years ago)
Author:
weinig@apple.com
Message:

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.
Location:
trunk/WebKit2
Files:
6 added
18 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/WebKit2/ChangeLog

    r65305 r65337  
     12010-08-13  Sam Weinig  <sam@webkit.org>
     2
     3        Reviewed by Jon Honeycutt.
     4
     5        Add form submission listener to WebKit2
     6        Part of <rdar://problem/8255932>
     7        https://bugs.webkit.org/show_bug.cgi?id=43947
     8
     9        * Shared/APIObject.h:
     10        Add TypeFormSubmissionListener APIType.
     11       
     12        * Shared/CoreIPCSupport/WebPageProxyMessageKinds.h:
     13        Add WillSubmitForm message kind.
     14
     15        * UIProcess/API/C/WKAPICast.h:
     16        Add new mappings for WKFormSubmissionListenerRef -> WebFormSubmissionListener
     17
     18        * UIProcess/API/C/WKBase.h:
     19        Add OpaqueWKFormSubmissionListener and rename the other opaque types to match.
     20
     21        * UIProcess/API/C/WKFormSubmissionListener.cpp: Added.
     22        (WKFormSubmissionListenerGetTypeID):
     23        (WKFormSubmissionListenerContinue):
     24        (WKFormSubmissionListenerRetain):
     25        (WKFormSubmissionListenerRelease):
     26        * UIProcess/API/C/WKFormSubmissionListener.h: Added.
     27        Add C wrapper for WebFormSubmissionListener.
     28
     29        * UIProcess/API/C/WKPage.cpp:
     30        (WKPageSetPageFormClient):
     31        * UIProcess/API/C/WKPage.h:
     32        Add WKPageFormClient with willSubmitForm callback. Additional callbacks will be added as
     33        needed.
     34
     35        * UIProcess/API/C/WebKit2.h:
     36        Add include for WKFormSubmissionListener.h
     37
     38        * UIProcess/WebFormClient.cpp: Added.
     39        (WebKit::WebFormClient::WebFormClient):
     40        (WebKit::WebFormClient::initialize):
     41        (WebKit::WebFormClient::willSubmitForm):
     42        * UIProcess/WebFormClient.h: Added.
     43        Add client for form related delagations.
     44
     45        * UIProcess/WebFormSubmissionListenerProxy.cpp: Added.
     46        (WebKit::WebFormSubmissionListenerProxy::WebFormSubmissionListenerProxy):
     47        (WebKit::WebFormSubmissionListenerProxy::continueSubmission):
     48        * UIProcess/WebFormSubmissionListenerProxy.h: Added.
     49        (WebKit::WebFormSubmissionListenerProxy::create):
     50        (WebKit::WebFormSubmissionListenerProxy::type):
     51        * UIProcess/WebFrameListenerProxy.cpp: Copied from UIProcess/WebFramePolicyListenerProxy.cpp.
     52        Add new type of listener for form submissions. It inherits from the new base class
     53        for listeners, WebFrameListenerProxy.
     54
     55        (WebKit::WebFrameListenerProxy::WebFrameListenerProxy):
     56        (WebKit::WebFrameListenerProxy::~WebFrameListenerProxy):
     57        (WebKit::WebFrameListenerProxy::invalidate):
     58        (WebKit::WebFrameListenerProxy::receivedPolicyDecision):
     59        * UIProcess/WebFrameListenerProxy.h: Copied from UIProcess/WebFramePolicyListenerProxy.h.
     60        Move logic that would have to be shared between WebFramePolicyListenerProxy and
     61        WebFormSubmissionListenerProxy into shared base class.
     62
     63        * UIProcess/WebFramePolicyListenerProxy.cpp:
     64        (WebKit::WebFramePolicyListenerProxy::WebFramePolicyListenerProxy):
     65        * UIProcess/WebFramePolicyListenerProxy.h:
     66        (WebKit::WebFramePolicyListenerProxy::create):
     67        (WebKit::WebFramePolicyListenerProxy::type):
     68        Move to inheriting from WebFrameListenerProxy.
     69
     70        * UIProcess/WebFrameProxy.cpp:
     71        (WebKit::WebFrameProxy::disconnect):
     72        (WebKit::WebFrameProxy::receivedPolicyDecision):
     73        (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
     74        (WebKit::WebFrameProxy::setUpFormSubmissionListenerProxy):
     75        * UIProcess/WebFrameProxy.h:
     76        Change listener functions to act on WebFrameListenerProxys and add setUpFormSubmissionListenerProxy.
     77
     78        * UIProcess/WebPageProxy.cpp:
     79        (WebKit::WebPageProxy::initializeFormClient):
     80        (WebKit::WebPageProxy::didReceiveMessage):
     81        (WebKit::WebPageProxy::willSubmitForm):
     82        * UIProcess/WebPageProxy.h:
     83        Plumb through willSubmitForm call as we do with the other listeners.
     84
     85        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
     86        (WebKit::WebFrameLoaderClient::dispatchWillSubmitForm):
     87        Ditto.
     88
     89        * WebKit2.xcodeproj/project.pbxproj: Add new files.
     90        * win/WebKit2.vcproj: Add new files.
     91        * win/WebKit2Generated.make: Ditto.
     92
    1932010-08-13  Gavin Barraclough  <barraclough@apple.com>
    294
  • trunk/WebKit2/Shared/APIObject.h

    r64788 r65337  
    4545        TypeBackForwardListItem,
    4646        TypeContext,
     47        TypeFormSubmissionListener,
    4748        TypeFrame,
    4849        TypeFramePolicyListener,
  • trunk/WebKit2/Shared/CoreIPCSupport/WebPageProxyMessageKinds.h

    r64918 r65337  
    6565    SetToolTip,
    6666    TakeFocus,
     67    WillSubmitForm,
    6768   
    6869    BackForwardAddItem,
  • trunk/WebKit2/UIProcess/API/C/WKAPICast.h

    r65021 r65337  
    4545class WebData;
    4646class WebError;
     47class WebFormSubmissionListenerProxy;
    4748class WebFramePolicyListenerProxy;
    4849class WebFrameProxy;
     
    6061template<> struct APITypeInfo<WKContextRef>                     { typedef WebContext* ImplType; };
    6162template<> struct APITypeInfo<WKDataRef>                        { typedef WebData* ImplType; };
     63template<> struct APITypeInfo<WKFormSubmissionListenerRef>      { typedef WebFormSubmissionListenerProxy* ImplType; };
    6264template<> struct APITypeInfo<WKFramePolicyListenerRef>         { typedef WebFramePolicyListenerProxy* ImplType; };
    6365template<> struct APITypeInfo<WKFrameRef>                       { typedef WebFrameProxy* ImplType; };
     
    7880template<> struct ImplTypeInfo<WebData*>                        { typedef WKDataRef APIType; };
    7981template<> struct ImplTypeInfo<WebError*>                       { typedef WKErrorRef APIType; };
     82template<> struct ImplTypeInfo<WebFormSubmissionListenerProxy*> { typedef WKFormSubmissionListenerRef APIType; };
    8083template<> struct ImplTypeInfo<WebFramePolicyListenerProxy*>    { typedef WKFramePolicyListenerRef APIType; };
    8184template<> struct ImplTypeInfo<WebFrameProxy*>                  { typedef WKFrameRef APIType; };
  • trunk/WebKit2/UIProcess/API/C/WKBase.h

    r64688 r65337  
    3636typedef void* WKTypeRef;
    3737
    38 typedef struct OpaqueWKArrayRef* WKArrayRef;
    39 typedef struct OpaqueWKBackForwardListItemRef* WKBackForwardListItemRef;
    40 typedef struct OpaqueWKBackForwardListRef* WKBackForwardListRef;
     38typedef struct OpaqueWKArray* WKArrayRef;
     39typedef struct OpaqueWKBackForwardList* WKBackForwardListRef;
     40typedef struct OpaqueWKBackForwardListItem* WKBackForwardListItemRef;
    4141typedef struct OpaqueWKContext* WKContextRef;
    4242typedef struct OpaqueWKData* WKDataRef;
    4343typedef struct OpaqueWKError* WKErrorRef;
     44typedef struct OpaqueWKFormSubmissionListener* WKFormSubmissionListenerRef;
    4445typedef struct OpaqueWKFrame* WKFrameRef;
    4546typedef struct OpaqueWKFramePolicyListener* WKFramePolicyListenerRef;
    46 typedef struct OpaqueWKNavigationDataRef* WKNavigationDataRef;
     47typedef struct OpaqueWKNavigationData* WKNavigationDataRef;
    4748typedef struct OpaqueWKPage* WKPageRef;
    4849typedef struct OpaqueWKPageNamespace* WKPageNamespaceRef;
    49 typedef struct OpaqueWKPreferencesRef* WKPreferencesRef;
    50 typedef struct OpaqueWKStringRef* WKStringRef;
    51 typedef struct OpaqueWKURLRef* WKURLRef;
     50typedef struct OpaqueWKPreferences* WKPreferencesRef;
     51typedef struct OpaqueWKString* WKStringRef;
     52typedef struct OpaqueWKURL* WKURLRef;
    5253
    5354#undef WK_EXPORT
  • trunk/WebKit2/UIProcess/API/C/WKPage.cpp

    r64688 r65337  
    156156}
    157157
     158void WKPageSetPageFormClient(WKPageRef pageRef, const WKPageFormClient* wkClient)
     159{
     160    if (wkClient && !wkClient->version)
     161        toWK(pageRef)->initializeFormClient(wkClient);
     162}
     163
    158164void WKPageSetPageUIClient(WKPageRef pageRef, const WKPageUIClient * wkClient)
    159165{
  • trunk/WebKit2/UIProcess/API/C/WKPage.h

    r64688 r65337  
    114114typedef struct WKPagePolicyClient WKPagePolicyClient;
    115115
     116// Form Client.
     117typedef void (*WKPageWillSubmitFormCallback)(WKPageRef page, WKFrameRef frame, WKFrameRef sourceFrame, WKFormSubmissionListenerRef listener, const void* clientInfo);
     118
     119struct WKPageFormClient {
     120    int                                                                 version;
     121    const void *                                                        clientInfo;
     122    WKPageWillSubmitFormCallback                                        willSubmitForm;
     123};
     124typedef struct WKPageFormClient WKPageFormClient;
     125
    116126// UI Client
    117127typedef WKPageRef (*WKPageCreateNewPageCallback)(WKPageRef page, const void *clientInfo);
     
    166176WK_EXPORT void WKPageSetPageLoaderClient(WKPageRef page, const WKPageLoaderClient* client);
    167177WK_EXPORT void WKPageSetPagePolicyClient(WKPageRef page, const WKPagePolicyClient* client);
     178WK_EXPORT void WKPageSetPageFormClient(WKPageRef page, const WKPageFormClient* client);
    168179WK_EXPORT void WKPageSetPageUIClient(WKPageRef page, const WKPageUIClient* client);
    169180
  • trunk/WebKit2/UIProcess/API/C/WebKit2.h

    r64380 r65337  
    2929#include <WebKit2/WKBase.h>
    3030#include <WebKit2/WKType.h>
     31
    3132#include <WebKit2/WKBackForwardList.h>
    3233#include <WebKit2/WKBackForwardListItem.h>
    3334#include <WebKit2/WKContext.h>
     35#include <WebKit2/WKFormSubmissionListener.h>
    3436#include <WebKit2/WKFrame.h>
    3537#include <WebKit2/WKFramePolicyListener.h>
  • trunk/WebKit2/UIProcess/WebFrameListenerProxy.cpp

    r65287 r65337  
    2424 */
    2525
    26 #include "WebFramePolicyListenerProxy.h"
     26#include "WebFrameListenerProxy.h"
    2727
    2828#include "WebFrameProxy.h"
     
    3030namespace WebKit {
    3131
    32 WebFramePolicyListenerProxy::WebFramePolicyListenerProxy(WebFrameProxy* frame, uint64_t listenerID)
     32WebFrameListenerProxy::WebFrameListenerProxy(WebFrameProxy* frame, uint64_t listenerID)
    3333    : m_frame(frame)
    3434    , m_listenerID(listenerID)
     
    3636}
    3737
    38 WebFramePolicyListenerProxy::~WebFramePolicyListenerProxy()
     38WebFrameListenerProxy::~WebFrameListenerProxy()
    3939{
    4040}
    4141
    42 void WebFramePolicyListenerProxy::invalidate()
     42void WebFrameListenerProxy::invalidate()
    4343{
    4444    m_frame = 0;
    4545}
    4646
    47 void WebFramePolicyListenerProxy::receivedPolicyDecision(WebCore::PolicyAction action)
     47void WebFrameListenerProxy::receivedPolicyDecision(WebCore::PolicyAction action)
    4848{
    4949    if (!m_frame)
     
    5454}
    5555
    56 void WebFramePolicyListenerProxy::use()
    57 {
    58     receivedPolicyDecision(WebCore::PolicyUse);
    59 }
    60 
    61 void WebFramePolicyListenerProxy::download()
    62 {
    63     receivedPolicyDecision(WebCore::PolicyDownload);
    64 }
    65 
    66 void WebFramePolicyListenerProxy::ignore()
    67 {
    68     receivedPolicyDecision(WebCore::PolicyIgnore);
    69 }
    70 
    7156} // namespace WebKit
  • trunk/WebKit2/UIProcess/WebFrameListenerProxy.h

    r65287 r65337  
    2424 */
    2525
    26 #ifndef WebFramePolicyListenerProxy_h
    27 #define WebFramePolicyListenerProxy_h
     26#ifndef WebFrameListenerProxy_h
     27#define WebFrameListenerProxy_h
    2828
    2929#include "APIObject.h"
     
    3636class WebFrameProxy;
    3737
    38 class WebFramePolicyListenerProxy : public APIObject {
     38class WebFrameListenerProxy : public APIObject {
    3939public:
    40     static const Type APIType = TypeFramePolicyListener;
    41 
    42     static PassRefPtr<WebFramePolicyListenerProxy> create(WebFrameProxy* frame, uint64_t listenerID)
    43     {
    44         return adoptRef(new WebFramePolicyListenerProxy(frame, listenerID));
    45     }
    46     ~WebFramePolicyListenerProxy();
    47 
    48     void use();
    49     void download();
    50     void ignore();
     40    virtual ~WebFrameListenerProxy();
    5141
    5242    void invalidate();
    53 
    5443    uint64_t listenerID() const { return m_listenerID; }
    5544
    56 private:
    57     WebFramePolicyListenerProxy(WebFrameProxy*, uint64_t listenerID);
    58 
    59     virtual Type type() const { return APIType; }
     45protected:
     46    WebFrameListenerProxy(WebFrameProxy*, uint64_t listenerID);
    6047
    6148    void receivedPolicyDecision(WebCore::PolicyAction);
    6249
     50private:
    6351    RefPtr<WebFrameProxy> m_frame;
    6452    uint64_t m_listenerID;
     
    6755} // namespace WebKit
    6856
    69 #endif // WebFramePolicyListenerProxy_h
     57#endif // WebFrameListenerProxy_h
  • trunk/WebKit2/UIProcess/WebFramePolicyListenerProxy.cpp

    r57310 r65337  
    3131
    3232WebFramePolicyListenerProxy::WebFramePolicyListenerProxy(WebFrameProxy* frame, uint64_t listenerID)
    33     : m_frame(frame)
    34     , m_listenerID(listenerID)
     33    : WebFrameListenerProxy(frame, listenerID)
    3534{
    36 }
    37 
    38 WebFramePolicyListenerProxy::~WebFramePolicyListenerProxy()
    39 {
    40 }
    41 
    42 void WebFramePolicyListenerProxy::invalidate()
    43 {
    44     m_frame = 0;
    45 }
    46 
    47 void WebFramePolicyListenerProxy::receivedPolicyDecision(WebCore::PolicyAction action)
    48 {
    49     if (!m_frame)
    50         return;
    51 
    52     m_frame->receivedPolicyDecision(action, m_listenerID);
    53     m_frame = 0;
    5435}
    5536
  • trunk/WebKit2/UIProcess/WebFramePolicyListenerProxy.h

    r64386 r65337  
    2727#define WebFramePolicyListenerProxy_h
    2828
    29 #include "APIObject.h"
    30 #include <WebCore/FrameLoaderTypes.h>
    31 #include <wtf/PassRefPtr.h>
    32 #include <wtf/RefPtr.h>
     29#include "WebFrameListenerProxy.h"
    3330
    3431namespace WebKit {
    3532
    36 class WebFrameProxy;
    37 
    38 class WebFramePolicyListenerProxy : public APIObject {
     33class WebFramePolicyListenerProxy : public WebFrameListenerProxy {
    3934public:
    4035    static const Type APIType = TypeFramePolicyListener;
     
    4439        return adoptRef(new WebFramePolicyListenerProxy(frame, listenerID));
    4540    }
    46     ~WebFramePolicyListenerProxy();
    4741
    4842    void use();
     
    5044    void ignore();
    5145
    52     void invalidate();
    53 
    54     uint64_t listenerID() const { return m_listenerID; }
    55 
    5646private:
    5747    WebFramePolicyListenerProxy(WebFrameProxy*, uint64_t listenerID);
    5848
    5949    virtual Type type() const { return APIType; }
    60 
    61     void receivedPolicyDecision(WebCore::PolicyAction);
    62 
    63     RefPtr<WebFrameProxy> m_frame;
    64     uint64_t m_listenerID;
    6550};
    6651
  • trunk/WebKit2/UIProcess/WebFrameProxy.cpp

    r65021 r65337  
    2727
    2828#include "WebPageProxy.h"
     29#include "WebFormSubmissionListenerProxy.h"
     30#include "WebFramePolicyListenerProxy.h"
    2931#include <WebCore/PlatformString.h>
    3032
     
    4749{
    4850    m_page = 0;
    49     if (m_policyListener) {
    50         m_policyListener->invalidate();
    51         m_policyListener = 0;
     51    if (m_activeListener) {
     52        m_activeListener->invalidate();
     53        m_activeListener = 0;
    5254    }
    5355}
     
    9193        return;
    9294
    93     ASSERT(m_policyListener);
    94     ASSERT(m_policyListener->listenerID() == listenerID);
     95    ASSERT(m_activeListener);
     96    ASSERT(m_activeListener->listenerID() == listenerID);
    9597    m_page->receivedPolicyDecision(action, this, listenerID);
    9698}
     
    98100WebFramePolicyListenerProxy* WebFrameProxy::setUpPolicyListenerProxy(uint64_t listenerID)
    99101{
    100     if (m_policyListener)
    101         m_policyListener->invalidate();
    102     m_policyListener = WebFramePolicyListenerProxy::create(this, listenerID);
    103     return m_policyListener.get();
     102    if (m_activeListener)
     103        m_activeListener->invalidate();
     104    m_activeListener = WebFramePolicyListenerProxy::create(this, listenerID);
     105    return static_cast<WebFramePolicyListenerProxy*>(m_activeListener.get());
     106}
     107
     108WebFormSubmissionListenerProxy* WebFrameProxy::setUpFormSubmissionListenerProxy(uint64_t listenerID)
     109{
     110    if (m_activeListener)
     111        m_activeListener->invalidate();
     112    m_activeListener = WebFormSubmissionListenerProxy::create(this, listenerID);
     113    return static_cast<WebFormSubmissionListenerProxy*>(m_activeListener.get());
    104114}
    105115
  • trunk/WebKit2/UIProcess/WebFrameProxy.h

    r65021 r65337  
    2828
    2929#include "APIObject.h"
    30 #include "WebFramePolicyListenerProxy.h"
     30#include "WebFrameListenerProxy.h"
    3131#include <WebCore/FrameLoaderTypes.h>
    3232#include <WebCore/PlatformString.h>
     
    4343
    4444class WebPageProxy;
     45class WebFramePolicyListenerProxy;
     46class WebFormSubmissionListenerProxy;
    4547
    4648class WebFrameProxy : public APIObject {
     
    7880    void receivedPolicyDecision(WebCore::PolicyAction, uint64_t listenerID);
    7981    WebFramePolicyListenerProxy* setUpPolicyListenerProxy(uint64_t listenerID);
     82    WebFormSubmissionListenerProxy* setUpFormSubmissionListenerProxy(uint64_t listenerID);
    8083
    8184private:
     
    8891    WTF::String m_url;
    8992    WTF::String m_provisionalURL;
    90     RefPtr<WebFramePolicyListenerProxy> m_policyListener;
     93    RefPtr<WebFrameListenerProxy> m_activeListener;
    9194    uint64_t m_frameID;
    9295};
  • trunk/WebKit2/UIProcess/WebPageProxy.cpp

    r64918 r65337  
    3535#include "WebData.h"
    3636#include "WebEvent.h"
     37#include "WebFormSubmissionListenerProxy.h"
     38#include "WebFramePolicyListenerProxy.h"
    3739#include "WebPageMessageKinds.h"
    3840#include "WebPageNamespace.h"
     
    119121}
    120122
     123void WebPageProxy::initializeFormClient(const WKPageFormClient* formClient)
     124{
     125    m_formClient.initialize(formClient);
     126}
     127
    121128void WebPageProxy::initializeUIClient(const WKPageUIClient* client)
    122129{
     
    534541            break;
    535542        }
     543        case WebPageProxyMessage::WillSubmitForm: {
     544            uint64_t frameID;
     545            uint64_t sourceFrameID;
     546            uint64_t listenerID;
     547            if (!arguments->decode(CoreIPC::Out(frameID, sourceFrameID, listenerID)))
     548                return;
     549            willSubmitForm(webFrame(frameID), webFrame(sourceFrameID), listenerID);
     550            break;
     551        }
     552       
    536553        case WebPageProxyMessage::DidRunJavaScriptInMainFrame: {
    537554            String resultString;
     
    818835}
    819836
     837// FormClient
     838
     839void WebPageProxy::willSubmitForm(WebFrameProxy* frame, WebFrameProxy* sourceFrame, uint64_t listenerID)
     840{
     841    RefPtr<WebFormSubmissionListenerProxy> listener = frame->setUpFormSubmissionListenerProxy(listenerID);
     842    if (!m_formClient.willSubmitForm(this, frame, sourceFrame, listener.get()))
     843        listener->continueSubmission();
     844}
     845
    820846// UIClient
     847
    821848PassRefPtr<WebPageProxy> WebPageProxy::createNewPage()
    822849{
  • trunk/WebKit2/UIProcess/WebPageProxy.h

    r65021 r65337  
    3232#include "WKBase.h"
    3333#include "WebEvent.h"
     34#include "WebFormClient.h"
    3435#include "WebFrameProxy.h"
    3536#include "WebHistoryClient.h"
     
    9596    void initializeLoaderClient(const WKPageLoaderClient*);
    9697    void initializePolicyClient(const WKPagePolicyClient*);
     98    void initializeFormClient(const WKPageFormClient*);
    9799    void initializeUIClient(const WKPageUIClient*);
    98100
     
    191193    void decidePolicyForMIMEType(WebFrameProxy*, const WTF::String& MIMEType, const WTF::String& url, uint64_t listenerID);
    192194
     195    void willSubmitForm(WebFrameProxy* frame, WebFrameProxy* frameSource, uint64_t listenerID);
     196
    193197    PassRefPtr<WebPageProxy> createNewPage();
    194198    void showPage();
     
    216220    WebLoaderClient m_loaderClient;
    217221    WebPolicyClient m_policyClient;
     222    WebFormClient m_formClient;
    218223    WebUIClient m_uiClient;
    219224
  • trunk/WebKit2/WebKit2.xcodeproj/project.pbxproj

    r64888 r65337  
    277277                BCDE059B11CDA8AE00E41AF1 /* WebContextInjectedBundleClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BCDE059911CDA8AE00E41AF1 /* WebContextInjectedBundleClient.h */; };
    278278                BCDE059C11CDA8AE00E41AF1 /* WebContextInjectedBundleClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCDE059A11CDA8AE00E41AF1 /* WebContextInjectedBundleClient.cpp */; };
     279                BCE469531214E6CB000B98EB /* WebFormClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE4694F1214E6CB000B98EB /* WebFormClient.cpp */; };
     280                BCE469541214E6CB000B98EB /* WebFormClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE469501214E6CB000B98EB /* WebFormClient.h */; };
     281                BCE469551214E6CB000B98EB /* WebFormSubmissionListenerProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE469511214E6CB000B98EB /* WebFormSubmissionListenerProxy.cpp */; };
     282                BCE469561214E6CB000B98EB /* WebFormSubmissionListenerProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE469521214E6CB000B98EB /* WebFormSubmissionListenerProxy.h */; };
     283                BCE469591214EDF4000B98EB /* WKFormSubmissionListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE469571214EDF4000B98EB /* WKFormSubmissionListener.cpp */; };
     284                BCE4695A1214EDF4000B98EB /* WKFormSubmissionListener.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE469581214EDF4000B98EB /* WKFormSubmissionListener.h */; settings = {ATTRIBUTES = (Public, ); }; };
     285                BCE469771214F27B000B98EB /* WebFrameListenerProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE469761214F27B000B98EB /* WebFrameListenerProxy.h */; };
     286                BCE469791214F2B4000B98EB /* WebFrameListenerProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE469781214F2B4000B98EB /* WebFrameListenerProxy.cpp */; };
    279287                BCEE966C112FAF57006BCC24 /* Attachment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEE966A112FAF57006BCC24 /* Attachment.cpp */; };
    280288                BCEE966D112FAF57006BCC24 /* Attachment.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEE966B112FAF57006BCC24 /* Attachment.h */; };
     
    608616                BCDE059911CDA8AE00E41AF1 /* WebContextInjectedBundleClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContextInjectedBundleClient.h; sourceTree = "<group>"; };
    609617                BCDE059A11CDA8AE00E41AF1 /* WebContextInjectedBundleClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebContextInjectedBundleClient.cpp; sourceTree = "<group>"; };
     618                BCE4694F1214E6CB000B98EB /* WebFormClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebFormClient.cpp; sourceTree = "<group>"; };
     619                BCE469501214E6CB000B98EB /* WebFormClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebFormClient.h; sourceTree = "<group>"; };
     620                BCE469511214E6CB000B98EB /* WebFormSubmissionListenerProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebFormSubmissionListenerProxy.cpp; sourceTree = "<group>"; };
     621                BCE469521214E6CB000B98EB /* WebFormSubmissionListenerProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebFormSubmissionListenerProxy.h; sourceTree = "<group>"; };
     622                BCE469571214EDF4000B98EB /* WKFormSubmissionListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKFormSubmissionListener.cpp; sourceTree = "<group>"; };
     623                BCE469581214EDF4000B98EB /* WKFormSubmissionListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKFormSubmissionListener.h; sourceTree = "<group>"; };
     624                BCE469761214F27B000B98EB /* WebFrameListenerProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebFrameListenerProxy.h; sourceTree = "<group>"; };
     625                BCE469781214F2B4000B98EB /* WebFrameListenerProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebFrameListenerProxy.cpp; sourceTree = "<group>"; };
    610626                BCEE966A112FAF57006BCC24 /* Attachment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Attachment.cpp; sourceTree = "<group>"; };
    611627                BCEE966B112FAF57006BCC24 /* Attachment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Attachment.h; sourceTree = "<group>"; };
     
    9901006                                BCDE059A11CDA8AE00E41AF1 /* WebContextInjectedBundleClient.cpp */,
    9911007                                BCDE059911CDA8AE00E41AF1 /* WebContextInjectedBundleClient.h */,
     1008                                BCE4694F1214E6CB000B98EB /* WebFormClient.cpp */,
     1009                                BCE469501214E6CB000B98EB /* WebFormClient.h */,
     1010                                BCE469511214E6CB000B98EB /* WebFormSubmissionListenerProxy.cpp */,
     1011                                BCE469521214E6CB000B98EB /* WebFormSubmissionListenerProxy.h */,
    9921012                                BCB9F69F1123A84B00A137E0 /* WebFramePolicyListenerProxy.cpp */,
    9931013                                BCB9F69E1123A84B00A137E0 /* WebFramePolicyListenerProxy.h */,
     1014                                BCE469781214F2B4000B98EB /* WebFrameListenerProxy.cpp */,
     1015                                BCE469761214F27B000B98EB /* WebFrameListenerProxy.h */,
    9941016                                BC111B0A112F5E4F00337BAB /* WebFrameProxy.cpp */,
    9951017                                BC9B389F10F538BE00443A15 /* WebFrameProxy.h */,
     
    10481070                                516A4A58120A1AB500C05B7F /* WKError.cpp */,
    10491071                                516A4A57120A1AB500C05B7F /* WKError.h */,
     1072                                BCE469571214EDF4000B98EB /* WKFormSubmissionListener.cpp */,
     1073                                BCE469581214EDF4000B98EB /* WKFormSubmissionListener.h */,
    10501074                                BCD01398110FA420003B8A67 /* WKFrame.cpp */,
    10511075                                BCD01397110FA420003B8A67 /* WKFrame.h */,
     
    14491473                                BC14DF9F120B635F00826C0C /* WKBundleScriptWorld.h in Headers */,
    14501474                                BC14E10A120B905E00826C0C /* InjectedBundlePageFormClient.h in Headers */,
     1475                                BCE469541214E6CB000B98EB /* WebFormClient.h in Headers */,
     1476                                BCE469561214E6CB000B98EB /* WebFormSubmissionListenerProxy.h in Headers */,
     1477                                BCE4695A1214EDF4000B98EB /* WKFormSubmissionListener.h in Headers */,
     1478                                BCE469771214F27B000B98EB /* WebFrameListenerProxy.h in Headers */,
    14511479                        );
    14521480                        runOnlyForDeploymentPostprocessing = 0;
     
    16651693                                BC14DF9E120B635F00826C0C /* WKBundleScriptWorld.cpp in Sources */,
    16661694                                BC14E109120B905E00826C0C /* InjectedBundlePageFormClient.cpp in Sources */,
     1695                                BCE469531214E6CB000B98EB /* WebFormClient.cpp in Sources */,
     1696                                BCE469551214E6CB000B98EB /* WebFormSubmissionListenerProxy.cpp in Sources */,
     1697                                BCE469591214EDF4000B98EB /* WKFormSubmissionListener.cpp in Sources */,
     1698                                BCE469791214F2B4000B98EB /* WebFrameListenerProxy.cpp in Sources */,
    16671699                        );
    16681700                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp

    r64927 r65337  
    466466}
    467467
    468 void WebFrameLoaderClient::dispatchWillSubmitForm(FramePolicyFunction function, PassRefPtr<FormState>)
    469 {
    470     notImplemented();
    471 
    472     Frame* coreFrame = m_frame->coreFrame();
    473     (coreFrame->loader()->policyChecker()->*function)(PolicyUse);
     468void WebFrameLoaderClient::dispatchWillSubmitForm(FramePolicyFunction function, PassRefPtr<FormState> formState)
     469{
     470    WebPage* webPage = m_frame->page();
     471    if (!webPage)
     472        return;
     473
     474    // FIXME: Pass more of the form state.
     475
     476    uint64_t listenerID = m_frame->setUpPolicyListener(function);
     477
     478    WebFrame* sourceFrame = static_cast<WebFrameLoaderClient*>(formState->sourceFrame()->loader()->client())->webFrame();   
     479
     480    WebProcess::shared().connection()->send(WebPageProxyMessage::WillSubmitForm, webPage->pageID(),
     481                                            CoreIPC::In(m_frame->frameID(), sourceFrame->frameID(), listenerID));
    474482}
    475483
  • trunk/WebKit2/win/WebKit2.vcproj

    r65270 r65337  
    10501050                        </File>
    10511051                        <File
     1052                                RelativePath="..\UIProcess\WebFormClient.cpp"
     1053                                >
     1054                        </File>
     1055                        <File
     1056                                RelativePath="..\UIProcess\WebFormClient.h"
     1057                                >
     1058                        </File>
     1059                        <File
     1060                                RelativePath="..\UIProcess\WebFormSubmissionListenerProxy.cpp"
     1061                                >
     1062                        </File>
     1063                        <File
     1064                                RelativePath="..\UIProcess\WebFormSubmissionListenerProxy.h"
     1065                                >
     1066                        </File>
     1067                        <File
    10521068                                RelativePath="..\UIProcess\WebFramePolicyListenerProxy.cpp"
    10531069                                >
     
    10551071                        <File
    10561072                                RelativePath="..\UIProcess\WebFramePolicyListenerProxy.h"
     1073                                >
     1074                        </File>
     1075                        <File
     1076                                RelativePath="..\UIProcess\WebFrameListenerProxy.cpp"
     1077                                >
     1078                        </File>
     1079                        <File
     1080                                RelativePath="..\UIProcess\WebFrameListenerProxy.h"
    10571081                                >
    10581082                        </File>
     
    12211245                                        <File
    12221246                                                RelativePath="..\UIProcess\API\C\WKError.h"
     1247                                                >
     1248                                        </File>
     1249                                        <File
     1250                                                RelativePath="..\UIProcess\API\C\WKFormSubmissionListener.cpp"
     1251                                                >
     1252                                        </File>
     1253                                        <File
     1254                                                RelativePath="..\UIProcess\API\C\WKFormSubmissionListener.h"
    12231255                                                >
    12241256                                        </File>
  • trunk/WebKit2/win/WebKit2Generated.make

    r65270 r65337  
    1111    xcopy /y /d "..\UIProcess\API\C\WKData.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
    1212    xcopy /y /d "..\UIProcess\API\C\WKError.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
     13    xcopy /y /d "..\UIProcess\API\C\WKFormSubmissionListener.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
    1314    xcopy /y /d "..\UIProcess\API\C\WKFrame.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
    1415    xcopy /y /d "..\UIProcess\API\C\WKFramePolicyListener.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
Note: See TracChangeset for help on using the changeset viewer.