Changeset 167330 in webkit


Ignore:
Timestamp:
Apr 15, 2014 4:05:28 PM (10 years ago)
Author:
mitz@apple.com
Message:

Introduce API::FormClient
https://bugs.webkit.org/show_bug.cgi?id=131714

Reviewed by Tim Horton.

  • UIProcess/API/APIFormClient.h: Added.

(API::FormClient::~FormClient):
(API::FormClient::willSubmitForm):

  • UIProcess/API/C/WKPage.cpp:

(WKPageSetPageFormClient): Changed to create a WebFormClient and call
WebPageProxy::setFormClient.

  • UIProcess/WebFormClient.cpp:

(WebKit::WebFormClient::WebFormClient): Added a constructor from WKPageFormClientBase.

  • UIProcess/WebFormClient.h: Added inheritance from API::FormClient, marked overrides as

such.

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::WebPageProxy): Initialize m_formClient member.
(WebKit::WebPageProxy::setFormClient): Added. Updates m_formClient.
(WebKit::WebPageProxy::close): Updated code to clear m_formClient.
(WebKit::WebPageProxy::willSubmitForm): Updated for type change.
(WebKit::WebPageProxy::initializeFormClient): Deleted.

  • UIProcess/WebPageProxy.h:
  • WebKit2.xcodeproj/project.pbxproj: Added reference to new file.
Location:
trunk/Source/WebKit2
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r167316 r167330  
     12014-04-15  Dan Bernstein  <mitz@apple.com>
     2
     3        Introduce API::FormClient
     4        https://bugs.webkit.org/show_bug.cgi?id=131714
     5
     6        Reviewed by Tim Horton.
     7
     8        * UIProcess/API/APIFormClient.h: Added.
     9        (API::FormClient::~FormClient):
     10        (API::FormClient::willSubmitForm):
     11
     12        * UIProcess/API/C/WKPage.cpp:
     13        (WKPageSetPageFormClient): Changed to create a WebFormClient and call
     14        WebPageProxy::setFormClient.
     15
     16        * UIProcess/WebFormClient.cpp:
     17        (WebKit::WebFormClient::WebFormClient): Added a constructor from WKPageFormClientBase.
     18        * UIProcess/WebFormClient.h: Added inheritance from API::FormClient, marked overrides as
     19        such.
     20
     21        * UIProcess/WebPageProxy.cpp:
     22        (WebKit::WebPageProxy::WebPageProxy): Initialize m_formClient member.
     23        (WebKit::WebPageProxy::setFormClient): Added. Updates m_formClient.
     24        (WebKit::WebPageProxy::close): Updated code to clear m_formClient.
     25        (WebKit::WebPageProxy::willSubmitForm): Updated for type change.
     26        (WebKit::WebPageProxy::initializeFormClient): Deleted.
     27        * UIProcess/WebPageProxy.h:
     28
     29        * WebKit2.xcodeproj/project.pbxproj: Added reference to new file.
     30
    1312014-04-15  Simon Fraser  <simon.fraser@apple.com>
    232
  • trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp

    r167172 r167330  
    4444#include "WKPluginInformation.h"
    4545#include "WebBackForwardList.h"
     46#include "WebFormClient.h"
    4647#include "WebPageMessages.h"
    4748#include "WebPageProxy.h"
     
    741742void WKPageSetPageFormClient(WKPageRef pageRef, const WKPageFormClientBase* wkClient)
    742743{
    743     toImpl(pageRef)->initializeFormClient(wkClient);
     744    toImpl(pageRef)->setFormClient(std::make_unique<WebFormClient>(wkClient));
    744745}
    745746
  • trunk/Source/WebKit2/UIProcess/WebFormClient.cpp

    r160608 r167330  
    3333namespace WebKit {
    3434
     35WebFormClient::WebFormClient(const WKPageFormClientBase* wkClient)
     36{
     37    initialize(wkClient);
     38}
     39
    3540bool WebFormClient::willSubmitForm(WebPageProxy* page, WebFrameProxy* frame, WebFrameProxy* sourceFrame, const Vector<std::pair<String, String>>& textFieldValues, API::Object* userData, WebFormSubmissionListenerProxy* listener)
    3641{
  • trunk/Source/WebKit2/UIProcess/WebFormClient.h

    r159994 r167330  
    2828
    2929#include "APIClient.h"
    30 #include "WKPage.h"
    31 #include <utility>
    32 #include <wtf/Forward.h>
    33 #include <wtf/Vector.h>
     30#include "APIFormClient.h"
     31#include "WKPageFormClient.h"
    3432
    3533namespace API {
    36 class Object;
    37 
    3834template<> struct ClientTraits<WKPageFormClientBase> {
    3935    typedef std::tuple<WKPageFormClientV0> Versions;
     
    4339namespace WebKit {
    4440
    45 class WebPageProxy;
    46 class WebFrameProxy;
    47 class WebFormSubmissionListenerProxy;
     41class WebFormClient : public API::FormClient, API::Client<WKPageFormClientBase> {
     42public:
     43    explicit WebFormClient(const WKPageFormClientBase*);
    4844
    49 class WebFormClient : public API::Client<WKPageFormClientBase> {
    50 public:
    51     bool willSubmitForm(WebPageProxy*, WebFrameProxy*, WebFrameProxy*, const Vector<std::pair<String, String>>& textFieldValues, API::Object* userData, WebFormSubmissionListenerProxy*);
     45    virtual bool willSubmitForm(WebPageProxy*, WebFrameProxy*, WebFrameProxy*, const Vector<std::pair<String, String>>& textFieldValues, API::Object* userData, WebFormSubmissionListenerProxy*) override;
    5246};
    5347
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r167262 r167330  
    3030#include "APIArray.h"
    3131#include "APIFindClient.h"
     32#include "APIFormClient.h"
    3233#include "APILoaderClient.h"
    3334#include "APIPolicyClient.h"
     
    257258    , m_loaderClient(std::make_unique<API::LoaderClient>())
    258259    , m_policyClient(std::make_unique<API::PolicyClient>())
     260    , m_formClient(std::make_unique<API::FormClient>())
    259261    , m_uiClient(std::make_unique<API::UIClient>())
    260262    , m_findClient(std::make_unique<API::FindClient>())
     
    461463}
    462464
    463 void WebPageProxy::initializeFormClient(const WKPageFormClientBase* formClient)
    464 {
    465     m_formClient.initialize(formClient);
     465void WebPageProxy::setFormClient(std::unique_ptr<API::FormClient> formClient)
     466{
     467    if (!formClient) {
     468        m_formClient = std::make_unique<API::FormClient>();
     469        return;
     470    }
     471
     472    m_formClient = std::move(formClient);
    466473}
    467474
     
    615622    m_loaderClient = std::make_unique<API::LoaderClient>();
    616623    m_policyClient = std::make_unique<API::PolicyClient>();
    617     m_formClient.initialize(0);
     624    m_formClient = std::make_unique<API::FormClient>();
    618625    m_uiClient = std::make_unique<API::UIClient>();
    619626#if PLATFORM(EFL)
     
    27352742
    27362743    RefPtr<WebFormSubmissionListenerProxy> listener = frame->setUpFormSubmissionListenerProxy(listenerID);
    2737     if (!m_formClient.willSubmitForm(this, frame, sourceFrame, textFieldValues, userData.get(), listener.get()))
     2744    if (!m_formClient->willSubmitForm(this, frame, sourceFrame, textFieldValues, userData.get(), listener.get()))
    27382745        listener->continueSubmission();
    27392746}
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.h

    r167262 r167330  
    5353#include "WebCoreArgumentCoders.h"
    5454#include "WebFindClient.h"
    55 #include "WebFormClient.h"
    5655#include "WebFrameProxy.h"
    5756#include "WebPageContextMenuClient.h"
     
    104103namespace API {
    105104class FindClient;
     105class FormClient;
    106106class LoaderClient;
    107107class PolicyClient;
     
    479479    void setFindClient(std::unique_ptr<API::FindClient>);
    480480    void initializeFindMatchesClient(const WKPageFindMatchesClientBase*);
    481     void initializeFormClient(const WKPageFormClientBase*);
     481    void setFormClient(std::unique_ptr<API::FormClient>);
    482482    void setLoaderClient(std::unique_ptr<API::LoaderClient>);
    483483    void setPolicyClient(std::unique_ptr<API::PolicyClient>);
     
    13961396    std::unique_ptr<API::LoaderClient> m_loaderClient;
    13971397    std::unique_ptr<API::PolicyClient> m_policyClient;
    1398     WebFormClient m_formClient;
     1398    std::unique_ptr<API::FormClient> m_formClient;
    13991399    std::unique_ptr<API::UIClient> m_uiClient;
    14001400#if PLATFORM(EFL)
  • trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj

    r167169 r167330  
    706706                37D0B5C81845232700F6CE7D /* WKErrorRecoveryAttempting.m in Sources */ = {isa = PBXBuildFile; fileRef = 37D0B5C71845232700F6CE7D /* WKErrorRecoveryAttempting.m */; };
    707707                37DFA7001810BB92001F4A9F /* WKFoundation.h in Headers */ = {isa = PBXBuildFile; fileRef = 37DFA6FF1810BB92001F4A9F /* WKFoundation.h */; settings = {ATTRIBUTES = (Public, ); }; };
     708                37E25D6E18FDE5D6005D3A00 /* APIFormClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 37E25D6D18FDE5D6005D3A00 /* APIFormClient.h */; };
    708709                37F623B812A57B6200E3FDF6 /* WKFindOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 37F623B712A57B6200E3FDF6 /* WKFindOptions.h */; settings = {ATTRIBUTES = (Private, ); }; };
    709710                37F90DE31376560E0051CF68 /* HTTPCookieAcceptPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = F638954F133BEF38008941D5 /* HTTPCookieAcceptPolicy.h */; };
     
    25302531                37D0B5C71845232700F6CE7D /* WKErrorRecoveryAttempting.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WKErrorRecoveryAttempting.m; sourceTree = "<group>"; };
    25312532                37DFA6FF1810BB92001F4A9F /* WKFoundation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKFoundation.h; sourceTree = "<group>"; };
     2533                37E25D6D18FDE5D6005D3A00 /* APIFormClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIFormClient.h; sourceTree = "<group>"; };
    25322534                37F623B712A57B6200E3FDF6 /* WKFindOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKFindOptions.h; sourceTree = "<group>"; };
    25332535                37FC19461850FBF2008CFA47 /* WKBrowsingContextLoadDelegatePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBrowsingContextLoadDelegatePrivate.h; sourceTree = "<group>"; };
     
    55455547                                1F7D36C018DA513F00D9D659 /* APIDownloadClient.h */,
    55465548                                00B9661518E24CBA00CE1F88 /* APIFindClient.h */,
     5549                                37E25D6D18FDE5D6005D3A00 /* APIFormClient.h */,
    55475550                                1A6637D618B2831F00C0BCF3 /* APIHistoryClient.h */,
    55485551                                1A2464F21891E45100234C5B /* APILoaderClient.h */,
     
    69016904                                1A2BB6D114117B4D000F35D4 /* PluginProcessConnectionMessages.h in Headers */,
    69026905                                1A2D90D21281C966001EB962 /* PluginProcessCreationParameters.h in Headers */,
     6906                                37E25D6E18FDE5D6005D3A00 /* APIFormClient.h in Headers */,
    69036907                                3743925818BC4C60001C8675 /* WKUIDelegatePrivate.h in Headers */,
    69046908                                1A0EC603124A9F2C007EF4A5 /* PluginProcessManager.h in Headers */,
Note: See TracChangeset for help on using the changeset viewer.