[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

weinig at apple.com weinig at apple.com
Wed Dec 22 15:41:59 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit e4372bd8a1a5016205f8ee59b01b47277e1d5f78
Author: weinig at apple.com <weinig at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Nov 10 17:14:38 2010 +0000

    Convert client classes to use APIClient base class.
    https://bugs.webkit.org/show_bug.cgi?id=49322
    
    Reviewed by Adam Roben.
    
    * UIProcess/WebFormClient.cpp:
    (WebKit::WebFormClient::willSubmitForm):
    * UIProcess/WebFormClient.h:
    * UIProcess/WebLoaderClient.cpp:
    * UIProcess/WebLoaderClient.h:
    * UIProcess/WebPolicyClient.cpp:
    * UIProcess/WebPolicyClient.h:
    * UIProcess/WebUIClient.cpp:
    * UIProcess/WebUIClient.h:
    * WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp:
    * WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.h:
    * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp:
    * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h:
    * WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp:
    * WebProcess/InjectedBundle/InjectedBundlePageFormClient.h:
    * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
    * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
    * WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp:
    * WebProcess/InjectedBundle/InjectedBundlePageUIClient.h:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71746 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 41588cb..194ecff 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,30 @@
+2010-11-09  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Adam Roben.
+
+        Convert client classes to use APIClient base class.
+        https://bugs.webkit.org/show_bug.cgi?id=49322
+
+        * UIProcess/WebFormClient.cpp:
+        (WebKit::WebFormClient::willSubmitForm):
+        * UIProcess/WebFormClient.h:
+        * UIProcess/WebLoaderClient.cpp:
+        * UIProcess/WebLoaderClient.h:
+        * UIProcess/WebPolicyClient.cpp:
+        * UIProcess/WebPolicyClient.h:
+        * UIProcess/WebUIClient.cpp:
+        * UIProcess/WebUIClient.h:
+        * WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp:
+        * WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.h:
+        * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp:
+        * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h:
+        * WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp:
+        * WebProcess/InjectedBundle/InjectedBundlePageFormClient.h:
+        * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
+        * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
+        * WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp:
+        * WebProcess/InjectedBundle/InjectedBundlePageUIClient.h:
+
 2010-11-10  Andreas Kling  <kling at webkit.org>
 
         Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebKit2/UIProcess/WebFormClient.cpp b/WebKit2/UIProcess/WebFormClient.cpp
index 11eaf0d..159a34c 100644
--- a/WebKit2/UIProcess/WebFormClient.cpp
+++ b/WebKit2/UIProcess/WebFormClient.cpp
@@ -32,22 +32,9 @@
 
 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, const Vector<std::pair<String, String> >& textFieldValues, APIObject* userData, WebFormSubmissionListenerProxy* listener)
 {
-    if (!m_pageFormClient.willSubmitForm)
+    if (!m_client.willSubmitForm)
         return false;
 
     ImmutableDictionary::MapType map;
@@ -55,7 +42,7 @@ bool WebFormClient::willSubmitForm(WebPageProxy* page, WebFrameProxy* frame, Web
         map.set(textFieldValues[i].first, WebString::create(textFieldValues[i].second));
     RefPtr<ImmutableDictionary> textFieldsMap = ImmutableDictionary::adopt(map);
 
-    m_pageFormClient.willSubmitForm(toAPI(page), toAPI(frame), toAPI(sourceFrame), toAPI(textFieldsMap.get()), toAPI(userData), toAPI(listener), m_pageFormClient.clientInfo);
+    m_client.willSubmitForm(toAPI(page), toAPI(frame), toAPI(sourceFrame), toAPI(textFieldsMap.get()), toAPI(userData), toAPI(listener), m_client.clientInfo);
     return true;
 }
 
diff --git a/WebKit2/UIProcess/WebFormClient.h b/WebKit2/UIProcess/WebFormClient.h
index b8314e6..40bc685 100644
--- a/WebKit2/UIProcess/WebFormClient.h
+++ b/WebKit2/UIProcess/WebFormClient.h
@@ -26,6 +26,7 @@
 #ifndef WebFormClient_h
 #define WebFormClient_h
 
+#include "APIClient.h"
 #include "WKPage.h"
 #include <utility>
 #include <wtf/Forward.h>
@@ -38,15 +39,9 @@ class WebPageProxy;
 class WebFrameProxy;
 class WebFormSubmissionListenerProxy;
 
-class WebFormClient {
+class WebFormClient : public APIClient<WKPageFormClient> {
 public:
-    WebFormClient();
-    void initialize(const WKPageFormClient*);
-
     bool willSubmitForm(WebPageProxy*, WebFrameProxy*, WebFrameProxy*, const Vector<std::pair<String, String> >& textFieldValues, APIObject* userData, WebFormSubmissionListenerProxy*); 
-
-private:
-    WKPageFormClient m_pageFormClient;
 };
 
 } // namespace WebKit
diff --git a/WebKit2/UIProcess/WebLoaderClient.cpp b/WebKit2/UIProcess/WebLoaderClient.cpp
index b547abd..9c7e6dd 100644
--- a/WebKit2/UIProcess/WebLoaderClient.cpp
+++ b/WebKit2/UIProcess/WebLoaderClient.cpp
@@ -32,177 +32,164 @@ using namespace WebCore;
 
 namespace WebKit {
 
-WebLoaderClient::WebLoaderClient()
-{
-    initialize(0);
-}
-
-void WebLoaderClient::initialize(const WKPageLoaderClient* client)
-{
-    if (client && !client->version)
-        m_pageLoaderClient = *client;
-    else 
-        memset(&m_pageLoaderClient, 0, sizeof(m_pageLoaderClient));
-}
-
 void WebLoaderClient::didStartProvisionalLoadForFrame(WebPageProxy* page, WebFrameProxy* frame, APIObject* userData)
 {
-    if (!m_pageLoaderClient.didStartProvisionalLoadForFrame)
+    if (!m_client.didStartProvisionalLoadForFrame)
         return;
 
-    m_pageLoaderClient.didStartProvisionalLoadForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_pageLoaderClient.clientInfo);
+    m_client.didStartProvisionalLoadForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo);
 }
 
 void WebLoaderClient::didReceiveServerRedirectForProvisionalLoadForFrame(WebPageProxy* page, WebFrameProxy* frame, APIObject* userData)
 {
-    if (!m_pageLoaderClient.didReceiveServerRedirectForProvisionalLoadForFrame)
+    if (!m_client.didReceiveServerRedirectForProvisionalLoadForFrame)
         return;
 
-    m_pageLoaderClient.didReceiveServerRedirectForProvisionalLoadForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_pageLoaderClient.clientInfo);
+    m_client.didReceiveServerRedirectForProvisionalLoadForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo);
 }
 
 void WebLoaderClient::didFailProvisionalLoadWithErrorForFrame(WebPageProxy* page, WebFrameProxy* frame, const ResourceError& error, APIObject* userData)
 {
-    if (!m_pageLoaderClient.didFailProvisionalLoadWithErrorForFrame)
+    if (!m_client.didFailProvisionalLoadWithErrorForFrame)
         return;
 
-    m_pageLoaderClient.didFailProvisionalLoadWithErrorForFrame(toAPI(page), toAPI(frame), toAPI(error), toAPI(userData), m_pageLoaderClient.clientInfo);
+    m_client.didFailProvisionalLoadWithErrorForFrame(toAPI(page), toAPI(frame), toAPI(error), toAPI(userData), m_client.clientInfo);
 }
 
 void WebLoaderClient::didCommitLoadForFrame(WebPageProxy* page, WebFrameProxy* frame, APIObject* userData)
 {
-    if (!m_pageLoaderClient.didCommitLoadForFrame)
+    if (!m_client.didCommitLoadForFrame)
         return;
 
-    m_pageLoaderClient.didCommitLoadForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_pageLoaderClient.clientInfo);
+    m_client.didCommitLoadForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo);
 }
 
 void WebLoaderClient::didFinishDocumentLoadForFrame(WebPageProxy* page, WebFrameProxy* frame, APIObject* userData)
 {
-    if (!m_pageLoaderClient.didFinishDocumentLoadForFrame)
+    if (!m_client.didFinishDocumentLoadForFrame)
         return;
 
-    m_pageLoaderClient.didFinishDocumentLoadForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_pageLoaderClient.clientInfo);
+    m_client.didFinishDocumentLoadForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo);
 }
 
 void WebLoaderClient::didFinishLoadForFrame(WebPageProxy* page, WebFrameProxy* frame, APIObject* userData)
 {
-    if (!m_pageLoaderClient.didFinishLoadForFrame)
+    if (!m_client.didFinishLoadForFrame)
         return;
 
-    m_pageLoaderClient.didFinishLoadForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_pageLoaderClient.clientInfo);
+    m_client.didFinishLoadForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo);
 }
 
 void WebLoaderClient::didFailLoadWithErrorForFrame(WebPageProxy* page, WebFrameProxy* frame, const ResourceError& error, APIObject* userData)
 {
-    if (!m_pageLoaderClient.didFailLoadWithErrorForFrame)
+    if (!m_client.didFailLoadWithErrorForFrame)
         return;
 
-    m_pageLoaderClient.didFailLoadWithErrorForFrame(toAPI(page), toAPI(frame), toAPI(error), toAPI(userData), m_pageLoaderClient.clientInfo);
+    m_client.didFailLoadWithErrorForFrame(toAPI(page), toAPI(frame), toAPI(error), toAPI(userData), m_client.clientInfo);
 }
 
 void WebLoaderClient::didReceiveTitleForFrame(WebPageProxy* page, const String& title, WebFrameProxy* frame, APIObject* userData)
 {
-    if (!m_pageLoaderClient.didReceiveTitleForFrame)
+    if (!m_client.didReceiveTitleForFrame)
         return;
 
-    m_pageLoaderClient.didReceiveTitleForFrame(toAPI(page), toAPI(title.impl()), toAPI(frame), toAPI(userData), m_pageLoaderClient.clientInfo);
+    m_client.didReceiveTitleForFrame(toAPI(page), toAPI(title.impl()), toAPI(frame), toAPI(userData), m_client.clientInfo);
 }
 
 void WebLoaderClient::didFirstLayoutForFrame(WebPageProxy* page, WebFrameProxy* frame, APIObject* userData)
 {
-    if (!m_pageLoaderClient.didFirstLayoutForFrame)
+    if (!m_client.didFirstLayoutForFrame)
         return;
 
-    m_pageLoaderClient.didFirstLayoutForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_pageLoaderClient.clientInfo);
+    m_client.didFirstLayoutForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo);
 }
 
 void WebLoaderClient::didFirstVisuallyNonEmptyLayoutForFrame(WebPageProxy* page, WebFrameProxy* frame, APIObject* userData)
 {
-    if (!m_pageLoaderClient.didFirstVisuallyNonEmptyLayoutForFrame)
+    if (!m_client.didFirstVisuallyNonEmptyLayoutForFrame)
         return;
 
-    m_pageLoaderClient.didFirstVisuallyNonEmptyLayoutForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_pageLoaderClient.clientInfo);
+    m_client.didFirstVisuallyNonEmptyLayoutForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo);
 }
 
 void WebLoaderClient::didRemoveFrameFromHierarchy(WebPageProxy* page, WebFrameProxy* frame, APIObject* userData)
 {
-    if (!m_pageLoaderClient.didRemoveFrameFromHierarchy)
+    if (!m_client.didRemoveFrameFromHierarchy)
         return;
 
-    m_pageLoaderClient.didRemoveFrameFromHierarchy(toAPI(page), toAPI(frame), toAPI(userData), m_pageLoaderClient.clientInfo);
+    m_client.didRemoveFrameFromHierarchy(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo);
 }
 
 void WebLoaderClient::didDisplayInsecureContentForFrame(WebPageProxy* page, WebFrameProxy* frame, APIObject* userData)
 {
-    if (!m_pageLoaderClient.didDisplayInsecureContentForFrame)
+    if (!m_client.didDisplayInsecureContentForFrame)
         return;
 
-    m_pageLoaderClient.didDisplayInsecureContentForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_pageLoaderClient.clientInfo);
+    m_client.didDisplayInsecureContentForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo);
 }
 
 void WebLoaderClient::didRunInsecureContentForFrame(WebPageProxy* page, WebFrameProxy* frame, APIObject* userData)
 {
-    if (!m_pageLoaderClient.didRunInsecureContentForFrame)
+    if (!m_client.didRunInsecureContentForFrame)
         return;
 
-    m_pageLoaderClient.didRunInsecureContentForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_pageLoaderClient.clientInfo);
+    m_client.didRunInsecureContentForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo);
 }
 
 void WebLoaderClient::didStartProgress(WebPageProxy* page)
 {
-    if (!m_pageLoaderClient.didStartProgress)
+    if (!m_client.didStartProgress)
         return;
 
-    m_pageLoaderClient.didStartProgress(toAPI(page), m_pageLoaderClient.clientInfo);
+    m_client.didStartProgress(toAPI(page), m_client.clientInfo);
 }
 
 void WebLoaderClient::didChangeProgress(WebPageProxy* page)
 {
-    if (!m_pageLoaderClient.didChangeProgress)
+    if (!m_client.didChangeProgress)
         return;
 
-    m_pageLoaderClient.didChangeProgress(toAPI(page), m_pageLoaderClient.clientInfo);
+    m_client.didChangeProgress(toAPI(page), m_client.clientInfo);
 }
 
 void WebLoaderClient::didFinishProgress(WebPageProxy* page)
 {
-    if (!m_pageLoaderClient.didFinishProgress)
+    if (!m_client.didFinishProgress)
         return;
 
-    m_pageLoaderClient.didFinishProgress(toAPI(page), m_pageLoaderClient.clientInfo);
+    m_client.didFinishProgress(toAPI(page), m_client.clientInfo);
 }
 
 void WebLoaderClient::processDidBecomeUnresponsive(WebPageProxy* page)
 {
-    if (!m_pageLoaderClient.processDidBecomeUnresponsive)
+    if (!m_client.processDidBecomeUnresponsive)
         return;
 
-    m_pageLoaderClient.processDidBecomeUnresponsive(toAPI(page), m_pageLoaderClient.clientInfo);
+    m_client.processDidBecomeUnresponsive(toAPI(page), m_client.clientInfo);
 }
 
 void WebLoaderClient::processDidBecomeResponsive(WebPageProxy* page)
 {
-    if (!m_pageLoaderClient.processDidBecomeResponsive)
+    if (!m_client.processDidBecomeResponsive)
         return;
 
-    m_pageLoaderClient.processDidBecomeResponsive(toAPI(page), m_pageLoaderClient.clientInfo);
+    m_client.processDidBecomeResponsive(toAPI(page), m_client.clientInfo);
 }
 
 void WebLoaderClient::processDidCrash(WebPageProxy* page)
 {
-    if (!m_pageLoaderClient.processDidCrash)
+    if (!m_client.processDidCrash)
         return;
 
-    m_pageLoaderClient.processDidCrash(toAPI(page), m_pageLoaderClient.clientInfo);
+    m_client.processDidCrash(toAPI(page), m_client.clientInfo);
 }
 
 void WebLoaderClient::didChangeBackForwardList(WebPageProxy* page)
 {
-    if (!m_pageLoaderClient.didChangeBackForwardList)
+    if (!m_client.didChangeBackForwardList)
         return;
 
-    m_pageLoaderClient.didChangeBackForwardList(toAPI(page), m_pageLoaderClient.clientInfo);
+    m_client.didChangeBackForwardList(toAPI(page), m_client.clientInfo);
 }
 
 } // namespace WebKit
diff --git a/WebKit2/UIProcess/WebLoaderClient.h b/WebKit2/UIProcess/WebLoaderClient.h
index 0f7df7d..99e3811 100644
--- a/WebKit2/UIProcess/WebLoaderClient.h
+++ b/WebKit2/UIProcess/WebLoaderClient.h
@@ -26,6 +26,7 @@
 #ifndef WebLoaderClient_h
 #define WebLoaderClient_h
 
+#include "APIClient.h"
 #include "WKPage.h"
 #include <wtf/Forward.h>
 
@@ -39,11 +40,8 @@ class APIObject;
 class WebPageProxy;
 class WebFrameProxy;
 
-class WebLoaderClient {
+class WebLoaderClient : public APIClient<WKPageLoaderClient> {
 public:
-    WebLoaderClient();
-    void initialize(const WKPageLoaderClient*);
-
     void didStartProvisionalLoadForFrame(WebPageProxy*, WebFrameProxy*, APIObject*);
     void didReceiveServerRedirectForProvisionalLoadForFrame(WebPageProxy*, WebFrameProxy*, APIObject*);
     void didFailProvisionalLoadWithErrorForFrame(WebPageProxy*, WebFrameProxy*, const WebCore::ResourceError&, APIObject*);
@@ -68,9 +66,6 @@ public:
     void processDidCrash(WebPageProxy*);
 
     void didChangeBackForwardList(WebPageProxy*);
-
-private:
-    WKPageLoaderClient m_pageLoaderClient;
 };
 
 } // namespace WebKit
diff --git a/WebKit2/UIProcess/WebPolicyClient.cpp b/WebKit2/UIProcess/WebPolicyClient.cpp
index 57a835f..e7a8239 100644
--- a/WebKit2/UIProcess/WebPolicyClient.cpp
+++ b/WebKit2/UIProcess/WebPolicyClient.cpp
@@ -32,43 +32,30 @@ using namespace WebCore;
 
 namespace WebKit {
 
-WebPolicyClient::WebPolicyClient()
-{
-    initialize(0);
-}
-
-void WebPolicyClient::initialize(const WKPagePolicyClient* client)
-{
-    if (client && !client->version)
-        m_pagePolicyClient = *client;
-    else 
-        memset(&m_pagePolicyClient, 0, sizeof(m_pagePolicyClient));
-}
-
 bool WebPolicyClient::decidePolicyForNavigationAction(WebPageProxy* page, NavigationType type, WebEvent::Modifiers modifiers, WebMouseEvent::Button mouseButton, const String& url, WebFrameProxy* frame, WebFramePolicyListenerProxy* listener)
 {
-    if (!m_pagePolicyClient.decidePolicyForNavigationAction)
+    if (!m_client.decidePolicyForNavigationAction)
         return false;
 
-    m_pagePolicyClient.decidePolicyForNavigationAction(toAPI(page), toAPI(type), toAPI(modifiers), toAPI(mouseButton), toURLRef(url.impl()), toAPI(frame), toAPI(listener), m_pagePolicyClient.clientInfo);
+    m_client.decidePolicyForNavigationAction(toAPI(page), toAPI(type), toAPI(modifiers), toAPI(mouseButton), toURLRef(url.impl()), toAPI(frame), toAPI(listener), m_client.clientInfo);
     return true;
 }
 
 bool WebPolicyClient::decidePolicyForNewWindowAction(WebPageProxy* page, NavigationType type, WebEvent::Modifiers modifiers, WebMouseEvent::Button mouseButton, const String& url, WebFrameProxy* frame, WebFramePolicyListenerProxy* listener)
 {
-    if (!m_pagePolicyClient.decidePolicyForNewWindowAction)
+    if (!m_client.decidePolicyForNewWindowAction)
         return false;
 
-    m_pagePolicyClient.decidePolicyForNewWindowAction(toAPI(page), toAPI(type), toAPI(modifiers), toAPI(mouseButton), toURLRef(url.impl()), toAPI(frame), toAPI(listener), m_pagePolicyClient.clientInfo);
+    m_client.decidePolicyForNewWindowAction(toAPI(page), toAPI(type), toAPI(modifiers), toAPI(mouseButton), toURLRef(url.impl()), toAPI(frame), toAPI(listener), m_client.clientInfo);
     return true;
 }
 
 bool WebPolicyClient::decidePolicyForMIMEType(WebPageProxy* page, const String& MIMEType, const String& url, WebFrameProxy* frame, WebFramePolicyListenerProxy* listener)
 {
-    if (!m_pagePolicyClient.decidePolicyForMIMEType)
+    if (!m_client.decidePolicyForMIMEType)
         return false;
 
-    m_pagePolicyClient.decidePolicyForMIMEType(toAPI(page), toAPI(MIMEType.impl()), toURLRef(url.impl()), toAPI(frame), toAPI(listener), m_pagePolicyClient.clientInfo);
+    m_client.decidePolicyForMIMEType(toAPI(page), toAPI(MIMEType.impl()), toURLRef(url.impl()), toAPI(frame), toAPI(listener), m_client.clientInfo);
     return true;
 }
 
diff --git a/WebKit2/UIProcess/WebPolicyClient.h b/WebKit2/UIProcess/WebPolicyClient.h
index 16bcd64..797bc37 100644
--- a/WebKit2/UIProcess/WebPolicyClient.h
+++ b/WebKit2/UIProcess/WebPolicyClient.h
@@ -26,6 +26,7 @@
 #ifndef WebPolicyClient_h
 #define WebPolicyClient_h
 
+#include "APIClient.h"
 #include "WKPage.h"
 #include "WebEvent.h"
 #include <WebCore/FrameLoaderTypes.h>
@@ -37,17 +38,11 @@ class WebPageProxy;
 class WebFrameProxy;
 class WebFramePolicyListenerProxy;
 
-class WebPolicyClient {
+class WebPolicyClient : public APIClient<WKPagePolicyClient> {
 public:
-    WebPolicyClient();
-    void initialize(const WKPagePolicyClient*);
-
     bool decidePolicyForNavigationAction(WebPageProxy*, WebCore::NavigationType, WebEvent::Modifiers, WebMouseEvent::Button, const String& url, WebFrameProxy*, WebFramePolicyListenerProxy*);
     bool decidePolicyForNewWindowAction(WebPageProxy*, WebCore::NavigationType, WebEvent::Modifiers, WebMouseEvent::Button, const String& url, WebFrameProxy*, WebFramePolicyListenerProxy*);
     bool decidePolicyForMIMEType(WebPageProxy*, const String&, const String& url, WebFrameProxy*, WebFramePolicyListenerProxy*);
-
-private:
-    WKPagePolicyClient m_pagePolicyClient;
 };
 
 } // namespace WebKit
diff --git a/WebKit2/UIProcess/WebUIClient.cpp b/WebKit2/UIProcess/WebUIClient.cpp
index fe1bd91..9b6e0ab 100644
--- a/WebKit2/UIProcess/WebUIClient.cpp
+++ b/WebKit2/UIProcess/WebUIClient.cpp
@@ -40,22 +40,9 @@ using namespace WebCore;
 
 namespace WebKit {
 
-WebUIClient::WebUIClient()
-{
-    initialize(0);
-}
-
-void WebUIClient::initialize(const WKPageUIClient* client)
-{
-    if (client && !client->version)
-        m_pageUIClient = *client;
-    else 
-        memset(&m_pageUIClient, 0, sizeof(m_pageUIClient));
-}
-
 PassRefPtr<WebPageProxy> WebUIClient::createNewPage(WebPageProxy* page, const WindowFeatures& windowFeatures, WebEvent::Modifiers modifiers, WebMouseEvent::Button button)
 {
-    if (!m_pageUIClient.createNewPage)
+    if (!m_client.createNewPage)
         return 0;
 
     ImmutableDictionary::MapType map;
@@ -76,47 +63,47 @@ PassRefPtr<WebPageProxy> WebUIClient::createNewPage(WebPageProxy* page, const Wi
     map.set("dialog", WebBoolean::create(windowFeatures.dialog));
     RefPtr<ImmutableDictionary> featuresMap = ImmutableDictionary::adopt(map);
 
-    return adoptRef(toImpl(m_pageUIClient.createNewPage(toAPI(page), toAPI(featuresMap.get()), toAPI(modifiers), toAPI(button), m_pageUIClient.clientInfo)));
+    return adoptRef(toImpl(m_client.createNewPage(toAPI(page), toAPI(featuresMap.get()), toAPI(modifiers), toAPI(button), m_client.clientInfo)));
 } 
 
 void WebUIClient::showPage(WebPageProxy* page)
 {
-    if (!m_pageUIClient.showPage)
+    if (!m_client.showPage)
         return;
     
-    m_pageUIClient.showPage(toAPI(page), m_pageUIClient.clientInfo);
+    m_client.showPage(toAPI(page), m_client.clientInfo);
 }
 
 void WebUIClient::close(WebPageProxy* page)
 {
-    if (!m_pageUIClient.close)
+    if (!m_client.close)
         return;
     
-    m_pageUIClient.close(toAPI(page), m_pageUIClient.clientInfo);
+    m_client.close(toAPI(page), m_client.clientInfo);
 }
 
 void WebUIClient::runJavaScriptAlert(WebPageProxy* page, const String& message, WebFrameProxy* frame)
 {
-    if (!m_pageUIClient.runJavaScriptAlert)
+    if (!m_client.runJavaScriptAlert)
         return;
     
-    m_pageUIClient.runJavaScriptAlert(toAPI(page), toAPI(message.impl()), toAPI(frame), m_pageUIClient.clientInfo);
+    m_client.runJavaScriptAlert(toAPI(page), toAPI(message.impl()), toAPI(frame), m_client.clientInfo);
 }
 
 bool WebUIClient::runJavaScriptConfirm(WebPageProxy* page, const String& message, WebFrameProxy* frame)
 {
-    if (!m_pageUIClient.runJavaScriptConfirm)
+    if (!m_client.runJavaScriptConfirm)
         return false;
 
-    return m_pageUIClient.runJavaScriptConfirm(toAPI(page), toAPI(message.impl()), toAPI(frame), m_pageUIClient.clientInfo);
+    return m_client.runJavaScriptConfirm(toAPI(page), toAPI(message.impl()), toAPI(frame), m_client.clientInfo);
 }
 
 String WebUIClient::runJavaScriptPrompt(WebPageProxy* page, const String& message, const String& defaultValue, WebFrameProxy* frame)
 {
-    if (!m_pageUIClient.runJavaScriptPrompt)
+    if (!m_client.runJavaScriptPrompt)
         return String();
 
-    WebString* string = toImpl(m_pageUIClient.runJavaScriptPrompt(toAPI(page), toAPI(message.impl()), toAPI(defaultValue.impl()), toAPI(frame), m_pageUIClient.clientInfo));
+    WebString* string = toImpl(m_client.runJavaScriptPrompt(toAPI(page), toAPI(message.impl()), toAPI(defaultValue.impl()), toAPI(frame), m_client.clientInfo));
     if (!string)
         return String();
 
@@ -128,126 +115,126 @@ String WebUIClient::runJavaScriptPrompt(WebPageProxy* page, const String& messag
 
 void WebUIClient::setStatusText(WebPageProxy* page, const String& text)
 {
-    if (!m_pageUIClient.setStatusText)
+    if (!m_client.setStatusText)
         return;
 
-    m_pageUIClient.setStatusText(toAPI(page), toAPI(text.impl()), m_pageUIClient.clientInfo);
+    m_client.setStatusText(toAPI(page), toAPI(text.impl()), m_client.clientInfo);
 }
 
 void WebUIClient::mouseDidMoveOverElement(WebPageProxy* page, WebEvent::Modifiers modifiers, APIObject* userData)
 {
-    if (!m_pageUIClient.mouseDidMoveOverElement)
+    if (!m_client.mouseDidMoveOverElement)
         return;
 
-    m_pageUIClient.mouseDidMoveOverElement(toAPI(page), toAPI(modifiers), toAPI(userData), m_pageUIClient.clientInfo);
+    m_client.mouseDidMoveOverElement(toAPI(page), toAPI(modifiers), toAPI(userData), m_client.clientInfo);
 }
 
 void WebUIClient::didNotHandleKeyEvent(WebPageProxy* page, const NativeWebKeyboardEvent& event)
 {
-    if (!m_pageUIClient.didNotHandleKeyEvent)
+    if (!m_client.didNotHandleKeyEvent)
         return;
-    m_pageUIClient.didNotHandleKeyEvent(toAPI(page), event.nativeEvent(), m_pageUIClient.clientInfo);
+    m_client.didNotHandleKeyEvent(toAPI(page), event.nativeEvent(), m_client.clientInfo);
 }
 
 bool WebUIClient::toolbarsAreVisible(WebPageProxy* page)
 {
-    if (!m_pageUIClient.toolbarsAreVisible)
+    if (!m_client.toolbarsAreVisible)
         return true;
-    return m_pageUIClient.toolbarsAreVisible(toAPI(page), m_pageUIClient.clientInfo);
+    return m_client.toolbarsAreVisible(toAPI(page), m_client.clientInfo);
 
 }
 void WebUIClient::setToolbarsAreVisible(WebPageProxy* page, bool visible)
 {
-    if (!m_pageUIClient.setToolbarsAreVisible)
+    if (!m_client.setToolbarsAreVisible)
         return;
-    m_pageUIClient.setToolbarsAreVisible(toAPI(page), visible, m_pageUIClient.clientInfo);
+    m_client.setToolbarsAreVisible(toAPI(page), visible, m_client.clientInfo);
 }
 
 bool WebUIClient::menuBarIsVisible(WebPageProxy* page)
 {
-    if (!m_pageUIClient.menuBarIsVisible)
+    if (!m_client.menuBarIsVisible)
         return true;
-    return m_pageUIClient.menuBarIsVisible(toAPI(page), m_pageUIClient.clientInfo);
+    return m_client.menuBarIsVisible(toAPI(page), m_client.clientInfo);
 }
 
 void WebUIClient::setMenuBarIsVisible(WebPageProxy* page, bool visible)
 {
-    if (!m_pageUIClient.setMenuBarIsVisible)
+    if (!m_client.setMenuBarIsVisible)
         return;
-    m_pageUIClient.setMenuBarIsVisible(toAPI(page), visible, m_pageUIClient.clientInfo);
+    m_client.setMenuBarIsVisible(toAPI(page), visible, m_client.clientInfo);
 }
 
 bool WebUIClient::statusBarIsVisible(WebPageProxy* page)
 {
-    if (!m_pageUIClient.statusBarIsVisible)
+    if (!m_client.statusBarIsVisible)
         return true;
-    return m_pageUIClient.statusBarIsVisible(toAPI(page), m_pageUIClient.clientInfo);
+    return m_client.statusBarIsVisible(toAPI(page), m_client.clientInfo);
 }
 
 void WebUIClient::setStatusBarIsVisible(WebPageProxy* page, bool visible)
 {
-    if (!m_pageUIClient.setStatusBarIsVisible)
+    if (!m_client.setStatusBarIsVisible)
         return;
-    m_pageUIClient.setStatusBarIsVisible(toAPI(page), visible, m_pageUIClient.clientInfo);
+    m_client.setStatusBarIsVisible(toAPI(page), visible, m_client.clientInfo);
 }
 
 bool WebUIClient::isResizable(WebPageProxy* page)
 {
-    if (!m_pageUIClient.isResizable)
+    if (!m_client.isResizable)
         return true;
-    return m_pageUIClient.isResizable(toAPI(page), m_pageUIClient.clientInfo);
+    return m_client.isResizable(toAPI(page), m_client.clientInfo);
 }
 
 void WebUIClient::setIsResizable(WebPageProxy* page, bool resizable)
 {
-    if (!m_pageUIClient.setIsResizable)
+    if (!m_client.setIsResizable)
         return;
-    m_pageUIClient.setIsResizable(toAPI(page), resizable, m_pageUIClient.clientInfo);
+    m_client.setIsResizable(toAPI(page), resizable, m_client.clientInfo);
 }
 
 void WebUIClient::setWindowFrame(WebPageProxy* page, const FloatRect& frame)
 {
-    if (!m_pageUIClient.setWindowFrame)
+    if (!m_client.setWindowFrame)
         return;
 
-    m_pageUIClient.setWindowFrame(toAPI(page), toAPI(frame), m_pageUIClient.clientInfo);
+    m_client.setWindowFrame(toAPI(page), toAPI(frame), m_client.clientInfo);
 }
 
 FloatRect WebUIClient::windowFrame(WebPageProxy* page)
 {
-    if (!m_pageUIClient.getWindowFrame)
+    if (!m_client.getWindowFrame)
         return FloatRect();
 
-    return toImpl(m_pageUIClient.getWindowFrame(toAPI(page), m_pageUIClient.clientInfo));
+    return toImpl(m_client.getWindowFrame(toAPI(page), m_client.clientInfo));
 }
 
 bool WebUIClient::canRunBeforeUnloadConfirmPanel()
 {
-    return m_pageUIClient.runBeforeUnloadConfirmPanel;
+    return m_client.runBeforeUnloadConfirmPanel;
 }
 
 bool WebUIClient::runBeforeUnloadConfirmPanel(WebPageProxy* page, const String& message, WebFrameProxy* frame)
 {
-    if (!m_pageUIClient.runBeforeUnloadConfirmPanel)
+    if (!m_client.runBeforeUnloadConfirmPanel)
         return true;
 
-    return m_pageUIClient.runBeforeUnloadConfirmPanel(toAPI(page), toAPI(message.impl()), toAPI(frame), m_pageUIClient.clientInfo);
+    return m_client.runBeforeUnloadConfirmPanel(toAPI(page), toAPI(message.impl()), toAPI(frame), m_client.clientInfo);
 }
 
 void WebUIClient::didDraw(WebPageProxy* page)
 {
-    if (!m_pageUIClient.didDraw)
+    if (!m_client.didDraw)
         return;
 
-    m_pageUIClient.didDraw(toAPI(page), m_pageUIClient.clientInfo);
+    m_client.didDraw(toAPI(page), m_client.clientInfo);
 }
 
 void WebUIClient::pageDidScroll(WebPageProxy* page)
 {
-    if (!m_pageUIClient.pageDidScroll)
+    if (!m_client.pageDidScroll)
         return;
 
-    m_pageUIClient.pageDidScroll(toAPI(page), m_pageUIClient.clientInfo);
+    m_client.pageDidScroll(toAPI(page), m_client.clientInfo);
 }
 
 } // namespace WebKit
diff --git a/WebKit2/UIProcess/WebUIClient.h b/WebKit2/UIProcess/WebUIClient.h
index 51c193c..1136d44 100644
--- a/WebKit2/UIProcess/WebUIClient.h
+++ b/WebKit2/UIProcess/WebUIClient.h
@@ -26,6 +26,7 @@
 #ifndef WebUIClient_h
 #define WebUIClient_h
 
+#include "APIClient.h"
 #include "WKPage.h"
 #include "WebEvent.h"
 #include <wtf/Forward.h>
@@ -44,11 +45,8 @@ class NativeWebKeyboardEvent;
 class WebFrameProxy;
 class WebPageProxy;
 
-class WebUIClient {
+class WebUIClient : public APIClient<WKPageUIClient> {
 public:
-    WebUIClient();
-    void initialize(const WKPageUIClient*);
-
     PassRefPtr<WebPageProxy> createNewPage(WebPageProxy*, const WebCore::WindowFeatures&, WebEvent::Modifiers, WebMouseEvent::Button);
     void showPage(WebPageProxy*);
     void close(WebPageProxy*);
@@ -79,9 +77,6 @@ public:
 
     void didDraw(WebPageProxy*);
     void pageDidScroll(WebPageProxy*);
-
-private:
-    WKPageUIClient m_pageUIClient;
 };
 
 } // namespace WebKit
diff --git a/WebKit2/WebKit2.xcodeproj/project.pbxproj b/WebKit2/WebKit2.xcodeproj/project.pbxproj
index 1dcee74..3fd3e7e 100644
--- a/WebKit2/WebKit2.xcodeproj/project.pbxproj
+++ b/WebKit2/WebKit2.xcodeproj/project.pbxproj
@@ -1572,8 +1572,6 @@
 		BC032D5E10F4372B0058C15A /* WebPage */ = {
 			isa = PBXGroup;
 			children = (
-				51871B59127CB89D00F76232 /* WebContextMenu.cpp */,
-				51871B5A127CB89D00F76232 /* WebContextMenu.h */,
 				BC963D6C113DD19500574BE2 /* mac */,
 				BC5F7BB21182376C0052C02C /* ChunkedUpdateDrawingArea.cpp */,
 				BC5F7BB31182376C0052C02C /* ChunkedUpdateDrawingArea.h */,
@@ -1587,6 +1585,8 @@
 				1A90C23512650717003E44D4 /* PageOverlay.h */,
 				BC72B9F811E6476B001EB4EA /* WebBackForwardListProxy.cpp */,
 				BC72B9F911E6476B001EB4EA /* WebBackForwardListProxy.h */,
+				51871B59127CB89D00F76232 /* WebContextMenu.cpp */,
+				51871B5A127CB89D00F76232 /* WebContextMenu.h */,
 				BCA0EF7E12331E78007D3CFB /* WebEditCommand.cpp */,
 				BCA0EF7D12331E78007D3CFB /* WebEditCommand.h */,
 				BC111ADC112F5B9300337BAB /* WebFrame.cpp */,
diff --git a/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp b/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp
index 498ac09..c80c0be 100644
--- a/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp
+++ b/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp
@@ -38,19 +38,6 @@ using namespace WebCore;
 
 namespace WebKit {
 
-InjectedBundlePageContextMenuClient::InjectedBundlePageContextMenuClient()
-{
-    initialize(0);
-}
-
-void InjectedBundlePageContextMenuClient::initialize(WKBundlePageContextMenuClient* client)
-{
-    if (client && !client->version)
-        m_client = *client;
-    else 
-        memset(&m_client, 0, sizeof(m_client));
-}
-
 bool InjectedBundlePageContextMenuClient::getCustomMenuFromDefaultItems(WebPage* page, WebCore::ContextMenu* defaultMenu, Vector<WebContextMenuItemData>& newMenu)
 {
     if (!m_client.getContextMenuFromDefaultMenu)
diff --git a/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.h b/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.h
index 122eb35..9a25e28 100644
--- a/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.h
+++ b/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.h
@@ -26,6 +26,7 @@
 #ifndef InjectedBundlePageContextMenuClient_h
 #define InjectedBundlePageContextMenuClient_h
 
+#include "APIClient.h"
 #include "WKBundlePage.h"
 #include <wtf/Vector.h>
 
@@ -38,15 +39,9 @@ namespace WebKit {
 class WebContextMenuItemData;
 class WebPage;
 
-class InjectedBundlePageContextMenuClient {
+class InjectedBundlePageContextMenuClient : public APIClient<WKBundlePageContextMenuClient> {
 public:
-    InjectedBundlePageContextMenuClient();
-    void initialize(WKBundlePageContextMenuClient*);
-
     bool getCustomMenuFromDefaultItems(WebPage*, WebCore::ContextMenu* defaultMenu, Vector<WebContextMenuItemData>& newMenu);
-
-private:
-    WKBundlePageContextMenuClient m_client;
 };
 
 } // namespace WebKit
diff --git a/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp b/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp
index d568fc1..40996c2 100644
--- a/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp
+++ b/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp
@@ -35,19 +35,6 @@ using namespace WebCore;
 
 namespace WebKit {
 
-InjectedBundlePageEditorClient::InjectedBundlePageEditorClient()
-{
-    initialize(0);
-}
-
-void InjectedBundlePageEditorClient::initialize(WKBundlePageEditorClient* client)
-{
-    if (client && !client->version)
-        m_client = *client;
-    else 
-        memset(&m_client, 0, sizeof(m_client));
-}
-
 bool InjectedBundlePageEditorClient::shouldBeginEditing(WebPage* page, Range* range)
 {
     if (m_client.shouldBeginEditing) {
diff --git a/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h b/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h
index 33df826..c1a5aab 100644
--- a/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h
+++ b/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h
@@ -26,6 +26,7 @@
 #ifndef InjectedBundlePageEditorClient_h
 #define InjectedBundlePageEditorClient_h
 
+#include "APIClient.h"
 #include "WKBundlePage.h"
 #include <WebCore/EditorInsertAction.h>
 #include <WebCore/TextAffinity.h>
@@ -42,11 +43,8 @@ namespace WebKit {
 class WebFrame;
 class WebPage;
 
-class InjectedBundlePageEditorClient {
+class InjectedBundlePageEditorClient : public APIClient<WKBundlePageEditorClient> {
 public:
-    InjectedBundlePageEditorClient();
-    void initialize(WKBundlePageEditorClient*);
-
     bool shouldBeginEditing(WebPage*, WebCore::Range*);
     bool shouldEndEditing(WebPage*, WebCore::Range*);
     bool shouldInsertNode(WebPage*, WebCore::Node*, WebCore::Range* rangeToReplace, WebCore::EditorInsertAction);
@@ -58,9 +56,6 @@ public:
     void didEndEditing(WebPage*, StringImpl* notificationName);
     void didChange(WebPage*, StringImpl* notificationName);
     void didChangeSelection(WebPage*, StringImpl* notificationName);
-
-private:
-    WKBundlePageEditorClient m_client;
 };
 
 } // namespace WebKit
diff --git a/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp b/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp
index cfe5f87..4d210f2 100644
--- a/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp
+++ b/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp
@@ -37,19 +37,6 @@ using namespace WebCore;
 
 namespace WebKit {
 
-InjectedBundlePageFormClient::InjectedBundlePageFormClient()
-{
-    initialize(0);
-}
-
-void InjectedBundlePageFormClient::initialize(WKBundlePageFormClient* client)
-{
-    if (client && !client->version)
-        m_client = *client;
-    else 
-        memset(&m_client, 0, sizeof(m_client));
-}
-
 void InjectedBundlePageFormClient::textFieldDidBeginEditing(WebPage* page, HTMLInputElement* inputElement, WebFrame* frame)
 {
     if (!m_client.textFieldDidBeginEditing)
diff --git a/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.h b/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.h
index cc6620c..23f4cb2 100644
--- a/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.h
+++ b/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.h
@@ -26,6 +26,7 @@
 #ifndef InjectedBundlePageFormClient_h
 #define InjectedBundlePageFormClient_h
 
+#include "APIClient.h"
 #include "WKBundlePage.h"
 #include <algorithm>
 #include <wtf/Forward.h>
@@ -44,20 +45,14 @@ class ImmutableDictionary;
 class WebFrame;
 class WebPage;
 
-class InjectedBundlePageFormClient {
+class InjectedBundlePageFormClient : public APIClient<WKBundlePageFormClient> {
 public:
-    InjectedBundlePageFormClient();
-    void initialize(WKBundlePageFormClient*);
-
     void textFieldDidBeginEditing(WebPage*, WebCore::HTMLInputElement*, WebFrame*);
     void textFieldDidEndEditing(WebPage*, WebCore::HTMLInputElement*, WebFrame*);
     void textDidChangeInTextField(WebPage*, WebCore::HTMLInputElement*, WebFrame*);
     void textDidChangeInTextArea(WebPage*, WebCore::HTMLTextAreaElement*, WebFrame*);
     bool shouldPerformActionInTextField(WebPage*, WebCore::HTMLInputElement*, WKInputFieldActionType, WebFrame*);    
     void willSubmitForm(WebPage*, WebCore::HTMLFormElement*, WebFrame*, WebFrame* sourceFrame, const Vector<std::pair<String, String> >&, RefPtr<APIObject>& userData);
-
-private:
-    WKBundlePageFormClient m_client;
 };
 
 } // namespace WebKit
diff --git a/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp b/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp
index ecdfd09..80c4e78 100644
--- a/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp
+++ b/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp
@@ -35,19 +35,6 @@ using namespace WebCore;
 
 namespace WebKit {
 
-InjectedBundlePageLoaderClient::InjectedBundlePageLoaderClient()
-{
-    initialize(0);
-}
-
-void InjectedBundlePageLoaderClient::initialize(WKBundlePageLoaderClient* client)
-{
-    if (client && !client->version)
-        m_client = *client;
-    else 
-        memset(&m_client, 0, sizeof(m_client));
-}
-
 void InjectedBundlePageLoaderClient::didStartProvisionalLoadForFrame(WebPage* page, WebFrame* frame, RefPtr<APIObject>& userData)
 {
     if (!m_client.didStartProvisionalLoadForFrame)
diff --git a/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h b/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h
index dbc6410..6e36581 100644
--- a/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h
+++ b/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h
@@ -26,6 +26,7 @@
 #ifndef InjectedBundlePageLoaderClient_h
 #define InjectedBundlePageLoaderClient_h
 
+#include "APIClient.h"
 #include "WKBundlePage.h"
 #include <JavaScriptCore/JSBase.h>
 #include <wtf/Forward.h>
@@ -41,11 +42,8 @@ class APIObject;
 class WebPage;
 class WebFrame;
 
-class InjectedBundlePageLoaderClient {
+class InjectedBundlePageLoaderClient : public APIClient<WKBundlePageLoaderClient> {
 public:
-    InjectedBundlePageLoaderClient();
-    void initialize(WKBundlePageLoaderClient*);
-
     void didStartProvisionalLoadForFrame(WebPage*, WebFrame*, RefPtr<APIObject>& userData);
     void didReceiveServerRedirectForProvisionalLoadForFrame(WebPage*, WebFrame*, RefPtr<APIObject>& userData);
     void didFailProvisionalLoadWithErrorForFrame(WebPage*, WebFrame*, const WebCore::ResourceError&, RefPtr<APIObject>& userData);
@@ -65,9 +63,6 @@ public:
     void didHandleOnloadEventsForFrame(WebPage*, WebFrame*);
     void didDisplayInsecureContentForFrame(WebPage*, WebFrame*, RefPtr<APIObject>& userData);
     void didRunInsecureContentForFrame(WebPage*, WebFrame*, RefPtr<APIObject>& userData);
-
-private:
-    WKBundlePageLoaderClient m_client;
 };
 
 } // namespace WebKit
diff --git a/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp b/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp
index 42080d7..56e4434 100644
--- a/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp
+++ b/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp
@@ -34,19 +34,6 @@ using namespace WebCore;
 
 namespace WebKit {
 
-InjectedBundlePageUIClient::InjectedBundlePageUIClient()
-{
-    initialize(0);
-}
-
-void InjectedBundlePageUIClient::initialize(WKBundlePageUIClient* client)
-{
-    if (client && !client->version)
-        m_client = *client;
-    else 
-        memset(&m_client, 0, sizeof(m_client));
-}
-
 void InjectedBundlePageUIClient::willAddMessageToConsole(WebPage* page, const String& message, int32_t lineNumber)
 {
     if (m_client.willAddMessageToConsole)
diff --git a/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h b/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h
index 9ca41da..93c19e9 100644
--- a/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h
+++ b/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h
@@ -26,6 +26,7 @@
 #ifndef InjectedBundlePageUIClient_h
 #define InjectedBundlePageUIClient_h
 
+#include "APIClient.h"
 #include "WKBundlePage.h"
 #include "WebEvent.h"
 #include <wtf/Forward.h>
@@ -40,11 +41,8 @@ class APIObject;
 class WebFrame;
 class WebPage;
 
-class InjectedBundlePageUIClient {
+class InjectedBundlePageUIClient : public APIClient<WKBundlePageUIClient> {
 public:
-    InjectedBundlePageUIClient();
-    void initialize(WKBundlePageUIClient*);
-
     void willAddMessageToConsole(WebPage*, const String& message, int32_t lineNumber);
     void willSetStatusbarText(WebPage*, const String&);
     void willRunJavaScriptAlert(WebPage*, const String&, WebFrame*);
@@ -52,9 +50,6 @@ public:
     void willRunJavaScriptPrompt(WebPage*, const String&, const String&, WebFrame*);
     void mouseDidMoveOverElement(WebPage*, const WebCore::HitTestResult&, WebEvent::Modifiers, RefPtr<APIObject>& userData);
     void pageDidScroll(WebPage*);
-
-private:
-    WKBundlePageUIClient m_client;
 };
 
 } // namespace WebKit

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list