[Qt][WK2] Fold QtWebPageLoadClient into QQuickWebViewPrivate and move to C API.
authormichael.bruning@digia.com <michael.bruning@digia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Feb 2013 12:34:08 +0000 (12:34 +0000)
committermichael.bruning@digia.com <michael.bruning@digia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Feb 2013 12:34:08 +0000 (12:34 +0000)
https://bugs.webkit.org/show_bug.cgi?id=108473

Reviewed by Simon Hausmann.
Signed off for WebKit2 by Benjamin Poulain.

This patch removes the QtWebPageLoadClient and moves the functionality into the
QQuickWebViewPrivate as most callback methods are calling the private webview
indirectly anyway.

The patch also moves as much of the functionality to the C API as is possible with
the current C API.

* Target.pri:
* UIProcess/API/qt/qquickwebview.cpp:
(QQuickWebViewPrivate::initialize):
(QQuickWebViewPrivate::didStartProvisionalLoadForFrame):
(QQuickWebViewPrivate::didReceiveServerRedirectForProvisionalLoadForFrame):
(QQuickWebViewPrivate::didFailLoad):
(QQuickWebViewPrivate::didCommitLoadForFrame):
(QQuickWebViewPrivate::didFinishLoadForFrame):
(QQuickWebViewPrivate::didSameDocumentNavigationForFrame):
(QQuickWebViewPrivate::didReceiveTitleForFrame):
(QQuickWebViewPrivate::didStartProgress):
(QQuickWebViewPrivate::didChangeProgress):
(QQuickWebViewPrivate::didFinishProgress):
(QQuickWebViewPrivate::didChangeBackForwardList):
(QQuickWebViewPrivate::setTransparentBackground):
(QQuickWebViewPrivate::transparentBackground):
(QQuickWebViewPrivate::loadProgressDidChange):
* UIProcess/API/qt/qquickwebview_p.h:
(WebKit):
* UIProcess/API/qt/qquickwebview_p_p.h:
(WebKit):
(QQuickWebViewPrivate):
* UIProcess/qt/QtWebError.cpp:
(WebKit::QtWebError::url):
* UIProcess/qt/QtWebPageLoadClient.cpp: Removed.
* UIProcess/qt/QtWebPageLoadClient.h: Removed.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@142095 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/Target.pri
Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h
Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h
Source/WebKit2/UIProcess/qt/QtWebError.cpp
Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp [deleted file]
Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.h [deleted file]

index 6f63b2a..a73e644 100644 (file)
@@ -1,3 +1,45 @@
+2013-02-07  Michael BrĂ¼ning  <michael.bruning@digia.com>
+
+        [Qt][WK2] Fold QtWebPageLoadClient into QQuickWebViewPrivate and move to C API.
+        https://bugs.webkit.org/show_bug.cgi?id=108473
+
+        Reviewed by Simon Hausmann.
+        Signed off for WebKit2 by Benjamin Poulain.
+
+        This patch removes the QtWebPageLoadClient and moves the functionality into the
+        QQuickWebViewPrivate as most callback methods are calling the private webview
+        indirectly anyway.
+
+        The patch also moves as much of the functionality to the C API as is possible with
+        the current C API.
+
+        * Target.pri:
+        * UIProcess/API/qt/qquickwebview.cpp:
+        (QQuickWebViewPrivate::initialize):
+        (QQuickWebViewPrivate::didStartProvisionalLoadForFrame):
+        (QQuickWebViewPrivate::didReceiveServerRedirectForProvisionalLoadForFrame):
+        (QQuickWebViewPrivate::didFailLoad):
+        (QQuickWebViewPrivate::didCommitLoadForFrame):
+        (QQuickWebViewPrivate::didFinishLoadForFrame):
+        (QQuickWebViewPrivate::didSameDocumentNavigationForFrame):
+        (QQuickWebViewPrivate::didReceiveTitleForFrame):
+        (QQuickWebViewPrivate::didStartProgress):
+        (QQuickWebViewPrivate::didChangeProgress):
+        (QQuickWebViewPrivate::didFinishProgress):
+        (QQuickWebViewPrivate::didChangeBackForwardList):
+        (QQuickWebViewPrivate::setTransparentBackground):
+        (QQuickWebViewPrivate::transparentBackground):
+        (QQuickWebViewPrivate::loadProgressDidChange):
+        * UIProcess/API/qt/qquickwebview_p.h:
+        (WebKit):
+        * UIProcess/API/qt/qquickwebview_p_p.h:
+        (WebKit):
+        (QQuickWebViewPrivate):
+        * UIProcess/qt/QtWebError.cpp:
+        (WebKit::QtWebError::url):
+        * UIProcess/qt/QtWebPageLoadClient.cpp: Removed.
+        * UIProcess/qt/QtWebPageLoadClient.h: Removed.
+
 2013-02-05  Eunmi Lee  <eunmi15.lee@samsung.com> and Raphael Kubo da Costa  <raphael.kubo.da.costa@intel.com>
 
         [EFL][WK2] Refactoring initialization and shutdown codes of EFL libraries.
index 6a55f4f..a21c673 100644 (file)
@@ -785,7 +785,6 @@ have?(QTQUICK) {
         UIProcess/qt/QtDialogRunner.h \
         UIProcess/qt/QtDownloadManager.h \
         UIProcess/qt/QtPageClient.h \
-        UIProcess/qt/QtWebPageLoadClient.h \
         UIProcess/qt/QtWebPagePolicyClient.h \
         UIProcess/qt/QtWebPageSGNode.h \
         UIProcess/qt/QtWebPageUIClient.h \
@@ -812,7 +811,6 @@ have?(QTQUICK) {
         UIProcess/qt/QtDialogRunner.cpp \
         UIProcess/qt/QtDownloadManager.cpp \
         UIProcess/qt/QtPageClient.cpp \
-        UIProcess/qt/QtWebPageLoadClient.cpp \
         UIProcess/qt/QtWebPagePolicyClient.cpp \
         UIProcess/qt/QtWebPageSGNode.cpp \
         UIProcess/qt/QtWebPageEventHandler.cpp \
index 77e5e23..3a8010a 100644 (file)
@@ -32,7 +32,6 @@
 #include "QtWebError.h"
 #include "QtWebIconDatabaseClient.h"
 #include "QtWebPageEventHandler.h"
-#include "QtWebPageLoadClient.h"
 #include "QtWebPagePolicyClient.h"
 #include "WebBackForwardList.h"
 #include "WebFindOptions.h"
@@ -330,7 +329,26 @@ void QQuickWebViewPrivate::initialize(WKContextRef contextRef, WKPageGroupRef pa
         WKPageSetPageFindClient(webPage.get(), &findClient);
     }
 
-    pageLoadClient.reset(new QtWebPageLoadClient(webPage.get(), q_ptr));
+    {
+        WKPageLoaderClient loadClient;
+        memset(&loadClient, 0, sizeof(WKPageLoaderClient));
+        loadClient.version = kWKPageLoaderClientCurrentVersion;
+        loadClient.clientInfo = this;
+        loadClient.didStartProvisionalLoadForFrame = didStartProvisionalLoadForFrame;
+        loadClient.didReceiveServerRedirectForProvisionalLoadForFrame = didReceiveServerRedirectForProvisionalLoadForFrame;
+        loadClient.didFailProvisionalLoadWithErrorForFrame = didFailLoad;
+        loadClient.didCommitLoadForFrame = didCommitLoadForFrame;
+        loadClient.didFinishLoadForFrame = didFinishLoadForFrame;
+        loadClient.didFailLoadWithErrorForFrame = didFailLoad;
+        loadClient.didSameDocumentNavigationForFrame = didSameDocumentNavigationForFrame;
+        loadClient.didReceiveTitleForFrame = didReceiveTitleForFrame;
+        loadClient.didStartProgress = didStartProgress;
+        loadClient.didChangeProgress = didChangeProgress;
+        loadClient.didFinishProgress = didFinishProgress;
+        loadClient.didChangeBackForwardList = didChangeBackForwardList;
+        WKPageSetPageLoaderClient(webPage.get(), &loadClient);
+    }
+
     pagePolicyClient.reset(new QtWebPagePolicyClient(webPage.get(), q_ptr));
     pageUIClient.reset(new QtWebPageUIClient(webPage.get(), q_ptr));
     navigationHistory = adoptPtr(QWebNavigationHistoryPrivate::createHistory(webPage.get()));
@@ -356,96 +374,147 @@ void QQuickWebViewPrivate::initialize(WKContextRef contextRef, WKPageGroupRef pa
     q_ptr->setFlag(QQuickItem::ItemAcceptsDrops, true);
 }
 
-void QQuickWebViewPrivate::loadDidStop()
+void QQuickWebViewPrivate::didStartProvisionalLoadForFrame(WKPageRef, WKFrameRef frame, WKTypeRef, const void* clientInfo)
 {
-    Q_Q(QQuickWebView);
-    ASSERT(!q->loading());
-    QWebLoadRequest loadRequest(q->url(), QQuickWebView::LoadStoppedStatus);
+    if (!WKFrameIsMainFrame(frame))
+        return;
+
+    WKRetainPtr<WKURLRef> url  = adoptWK(WKFrameCopyProvisionalURL(frame));
+
+    QQuickWebView* const q = toQQuickWebViewPrivate(clientInfo)->q_func();
+
+    q->emitUrlChangeIfNeeded();
+    QWebLoadRequest loadRequest(WKURLCopyQUrl(url.get()), QQuickWebView::LoadStartedStatus);
     emit q->loadingChanged(&loadRequest);
 }
 
-void QQuickWebViewPrivate::setTransparentBackground(bool enable)
+void QQuickWebViewPrivate::didReceiveServerRedirectForProvisionalLoadForFrame(WKPageRef, WKFrameRef frame, WKTypeRef, const void* clientInfo)
 {
-    webPageProxy->setDrawsTransparentBackground(enable);
-}
+    if (!WKFrameIsMainFrame(frame))
+        return;
 
-bool QQuickWebViewPrivate::transparentBackground() const
-{
-    return webPageProxy->drawsTransparentBackground();
+    toQQuickWebViewPrivate(clientInfo)->q_func()->emitUrlChangeIfNeeded();
 }
 
-void QQuickWebViewPrivate::provisionalLoadDidStart(const WTF::String& url)
+void QQuickWebViewPrivate::didFailLoad(WKPageRef, WKFrameRef frame, WKErrorRef errorRef, WKTypeRef, const void* clientInfo)
 {
-    Q_Q(QQuickWebView);
+    if (!WKFrameIsMainFrame(frame))
+        return;
 
-    q->emitUrlChangeIfNeeded();
+    QQuickWebView* const q = toQQuickWebViewPrivate(clientInfo)->q_func();
+    ASSERT(!q->loading());
 
-    QWebLoadRequest loadRequest(QString(url), QQuickWebView::LoadStartedStatus);
-    emit q->loadingChanged(&loadRequest);
-}
+    QtWebError error(errorRef);
+    if (error.isCancellation()) {
+        QWebLoadRequest loadRequest(q->url(), QQuickWebView::LoadStoppedStatus);
+        emit q->loadingChanged(&loadRequest);
+        return;
+    }
 
-void QQuickWebViewPrivate::didReceiveServerRedirectForProvisionalLoad(const WTF::String&)
-{
-    Q_Q(QQuickWebView);
+    int errorCode = error.errorCode();
+    if (errorCode == kWKErrorCodeFrameLoadInterruptedByPolicyChange && errorCode == kWKErrorCodePlugInWillHandleLoad) {
+        QWebLoadRequest loadRequest(q->url(), QQuickWebView::LoadSucceededStatus);
+        q->emitUrlChangeIfNeeded();
+        emit q->loadingChanged(&loadRequest);
+        return;
+    }
 
+    // We set the unreachable url unconditionally so that the current
+    // active url of the webview when the loadingChanged signal is
+    // emitted reflects the failed url, not the previously committed
+    // url. This also ensures that if the user does not do a loadHtml
+    // with an error page and and unreachable url as a reponse to the
+    // failed load, we can still detect the failed url for reloads.
+    // We need to find a way to do this via the C API or find another
+    // way to do this.
+    toImpl(frame)->setUnreachableURL(error.url());
     q->emitUrlChangeIfNeeded();
+    QWebLoadRequest loadRequest(error.url(), QQuickWebView::LoadFailedStatus, error.description(), static_cast<QQuickWebView::ErrorDomain>(error.type()), errorCode);
+    emit q->loadingChanged(&loadRequest);
 }
 
-void QQuickWebViewPrivate::loadDidCommit()
+void QQuickWebViewPrivate::didCommitLoadForFrame(WKPageRef, WKFrameRef frame, WKTypeRef, const void* clientInfo)
 {
-    Q_Q(QQuickWebView);
-    ASSERT(q->loading());
+    if (!WKFrameIsMainFrame(frame))
+        return;
+    QQuickWebViewPrivate* d = toQQuickWebViewPrivate(clientInfo);
+
+    PageViewportController* pageViewportController = d->viewportController();
+    if (pageViewportController)
+        pageViewportController->didCommitLoad();
 
-    m_betweenLoadCommitAndFirstFrame = true;
+    QQuickWebView* const q = d->q_func();
+    ASSERT(q->loading());
+    d->m_betweenLoadCommitAndFirstFrame = true;
     emit q->navigationHistoryChanged();
     emit q->titleChanged();
 }
 
-void QQuickWebViewPrivate::didSameDocumentNavigation()
+void QQuickWebViewPrivate::didFinishLoadForFrame(WKPageRef, WKFrameRef frame, WKTypeRef, const void* clientInfo)
 {
-    Q_Q(QQuickWebView);
+    if (!WKFrameIsMainFrame(frame))
+        return;
+
+    QQuickWebView* const q = toQQuickWebViewPrivate(clientInfo)->q_func();
+    ASSERT(!q->loading());
+
+    QWebLoadRequest loadRequest(q->url(), QQuickWebView::LoadSucceededStatus);
+    emit q->loadingChanged(&loadRequest);
+}
 
+void QQuickWebViewPrivate::didSameDocumentNavigationForFrame(WKPageRef, WKFrameRef frame, WKSameDocumentNavigationType type, WKTypeRef userData, const void* clientInfo)
+{
+    if (!WKFrameIsMainFrame(frame))
+        return;
+    QQuickWebView* const q = toQQuickWebViewPrivate(clientInfo)->q_func();
     q->emitUrlChangeIfNeeded();
     emit q->navigationHistoryChanged();
 }
 
-void QQuickWebViewPrivate::titleDidChange()
+void QQuickWebViewPrivate::didReceiveTitleForFrame(WKPageRef, WKStringRef title, WKFrameRef frame, WKTypeRef, const void* clientInfo)
 {
-    Q_Q(QQuickWebView);
-
-    emit q->titleChanged();
+    if (!WKFrameIsMainFrame(frame))
+        return;
+    emit toQQuickWebViewPrivate(clientInfo)->q_func()->titleChanged();
 }
 
-void QQuickWebViewPrivate::loadProgressDidChange(int loadProgress)
+void QQuickWebViewPrivate::didStartProgress(WKPageRef, const void* clientInfo)
 {
-    Q_Q(QQuickWebView);
+    toQQuickWebViewPrivate(clientInfo)->loadProgressDidChange(0);
+}
 
-    m_loadProgress = loadProgress;
+void QQuickWebViewPrivate::didChangeProgress(WKPageRef page, const void* clientInfo)
+{
+    toQQuickWebViewPrivate(clientInfo)->loadProgressDidChange(WKPageGetEstimatedProgress(page) * 100);
+}
 
-    emit q->loadProgressChanged();
+void QQuickWebViewPrivate::didFinishProgress(WKPageRef, const void* clientInfo)
+{
+    toQQuickWebViewPrivate(clientInfo)->loadProgressDidChange(100);
 }
 
-void QQuickWebViewPrivate::backForwardListDidChange()
+void QQuickWebViewPrivate::didChangeBackForwardList(WKPageRef, WKBackForwardListItemRef, WKArrayRef, const void *clientInfo)
 {
-    navigationHistory->d->reset();
+    toQQuickWebViewPrivate(clientInfo)->navigationHistory->d->reset();
 }
 
-void QQuickWebViewPrivate::loadDidSucceed()
+void QQuickWebViewPrivate::setTransparentBackground(bool enable)
 {
-    Q_Q(QQuickWebView);
-    ASSERT(!q->loading());
+    webPageProxy->setDrawsTransparentBackground(enable);
+}
 
-    QWebLoadRequest loadRequest(q->url(), QQuickWebView::LoadSucceededStatus);
-    emit q->loadingChanged(&loadRequest);
+bool QQuickWebViewPrivate::transparentBackground() const
+{
+    return webPageProxy->drawsTransparentBackground();
 }
 
-void QQuickWebViewPrivate::loadDidFail(const QtWebError& error)
+void QQuickWebViewPrivate::loadProgressDidChange(int loadProgress)
 {
     Q_Q(QQuickWebView);
-    ASSERT(!q->loading());
 
-    QWebLoadRequest loadRequest(error.url(), QQuickWebView::LoadFailedStatus, error.description(), static_cast<QQuickWebView::ErrorDomain>(error.type()), error.errorCode());
-    emit q->loadingChanged(&loadRequest);
+    m_loadProgress = loadProgress;
+
+    emit q->loadProgressChanged();
 }
 
 void QQuickWebViewPrivate::handleMouseEvent(QMouseEvent* event)
index 338a112..457de65 100644 (file)
@@ -51,7 +51,6 @@ class PlatformWebView;
 namespace WebKit {
 struct QtRefCountedNetworkRequestData;
 class PageViewportControllerClientQt;
-class QtWebPageLoadClient;
 class QtWebPageFindClient;
 class QtWebPagePolicyClient;
 class QtWebPageUIClient;
@@ -221,7 +220,6 @@ private:
 
     friend class QWebKitTest;
     friend class WebKit::PageViewportControllerClientQt;
-    friend class WebKit::QtWebPageLoadClient;
     friend class WebKit::QtWebPageFindClient;
     friend class WebKit::QtWebPagePolicyClient;
     friend class WebKit::QtWebPageUIClient;
index a3c94fa..b916614 100644 (file)
@@ -44,7 +44,6 @@ class QtDialogRunner;
 class PageViewportControllerClientQt;
 class QtWebContext;
 class QtWebError;
-class QtWebPageLoadClient;
 class QtWebPagePolicyClient;
 class WebPageProxy;
 }
@@ -73,16 +72,7 @@ public:
 
     virtual void onComponentComplete() { }
 
-    virtual void provisionalLoadDidStart(const WTF::String& url);
-    virtual void didReceiveServerRedirectForProvisionalLoad(const WTF::String& url);
-    virtual void loadDidCommit();
-    virtual void didSameDocumentNavigation();
-    virtual void titleDidChange();
     virtual void loadProgressDidChange(int loadProgress);
-    virtual void backForwardListDidChange();
-    virtual void loadDidSucceed();
-    virtual void loadDidStop();
-    virtual void loadDidFail(const WebKit::QtWebError& error);
     virtual void handleMouseEvent(QMouseEvent*);
 
     static void didFindString(WKPageRef page, WKStringRef string, unsigned matchCount, const void* clientInfo);
@@ -160,6 +150,19 @@ protected:
         QPointF adjust(const QPointF&);
     };
 
+    // WKPageLoadClient callbacks.
+    static void didStartProvisionalLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef userData, const void* clientInfo);
+    static void didReceiveServerRedirectForProvisionalLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef userData, const void* clientInfo);
+    static void didFailLoad(WKPageRef, WKFrameRef, WKErrorRef, WKTypeRef userData, const void* clientInfo);
+    static void didCommitLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef userData, const void* clientInfo);
+    static void didFinishLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef userData, const void* clientInfo);
+    static void didSameDocumentNavigationForFrame(WKPageRef, WKFrameRef, WKSameDocumentNavigationType, WKTypeRef userData, const void* clientInfo);
+    static void didReceiveTitleForFrame(WKPageRef, WKStringRef, WKFrameRef, WKTypeRef userData, const void* clientInfo);
+    static void didStartProgress(WKPageRef, const void* clientInfo);
+    static void didChangeProgress(WKPageRef, const void* clientInfo);
+    static void didFinishProgress(WKPageRef, const void* clientInfo);
+    static void didChangeBackForwardList(WKPageRef, WKBackForwardListItemRef, WKArrayRef, const void *clientInfo);
+
     QQuickWebViewPrivate(QQuickWebView* viewport);
     RefPtr<WebKit::QtWebContext> context;
     RefPtr<WebKit::WebPageProxy> webPageProxy;
@@ -171,7 +174,6 @@ protected:
     OwnPtr<QWebNavigationHistory> navigationHistory;
     OwnPtr<QWebPreferences> preferences;
 
-    QScopedPointer<WebKit::QtWebPageLoadClient> pageLoadClient;
     QScopedPointer<WebKit::QtWebPagePolicyClient> pagePolicyClient;
     QScopedPointer<WebKit::QtWebPageUIClient> pageUIClient;
 
index 75884f4..b589159 100644 (file)
@@ -57,7 +57,7 @@ int QtWebError::errorCode() const
 
 QString QtWebError::url() const
 {
-    return toImpl(error.get())->failingURL();
+    return WKStringCopyQString(WKURLCopyString(WKErrorCopyFailingURL(error.get())));
 }
 
 QString QtWebError::description() const
diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp b/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp
deleted file mode 100644 (file)
index b877ca8..0000000
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this program; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#include "config.h"
-#include "QtWebPageLoadClient.h"
-
-#include "QtWebError.h"
-#include "qquickwebview_p_p.h"
-
-using namespace WebCore;
-
-namespace WebKit {
-
-QtWebPageLoadClient::QtWebPageLoadClient(WKPageRef pageRef, QQuickWebView* webView)
-    : m_webView(webView)
-{
-    WKPageLoaderClient loadClient;
-    memset(&loadClient, 0, sizeof(WKPageLoaderClient));
-    loadClient.version = kWKPageLoaderClientCurrentVersion;
-    loadClient.clientInfo = this;
-    loadClient.didStartProvisionalLoadForFrame = didStartProvisionalLoadForFrame;
-    loadClient.didReceiveServerRedirectForProvisionalLoadForFrame = didReceiveServerRedirectForProvisionalLoadForFrame;
-    loadClient.didFailProvisionalLoadWithErrorForFrame = didFailProvisionalLoadWithErrorForFrame;
-    loadClient.didCommitLoadForFrame = didCommitLoadForFrame;
-    loadClient.didFinishLoadForFrame = didFinishLoadForFrame;
-    loadClient.didFailLoadWithErrorForFrame = didFailLoadWithErrorForFrame;
-    loadClient.didSameDocumentNavigationForFrame = didSameDocumentNavigationForFrame;
-    loadClient.didReceiveTitleForFrame = didReceiveTitleForFrame;
-    loadClient.didStartProgress = didStartProgress;
-    loadClient.didChangeProgress = didChangeProgress;
-    loadClient.didFinishProgress = didFinishProgress;
-    loadClient.didChangeBackForwardList = didChangeBackForwardList;
-    WKPageSetPageLoaderClient(pageRef, &loadClient);
-}
-
-void QtWebPageLoadClient::didStartProvisionalLoad(const WTF::String& url)
-{
-    m_webView->d_func()->provisionalLoadDidStart(url);
-}
-
-void QtWebPageLoadClient::didReceiveServerRedirectForProvisionalLoad(const WTF::String& url)
-{
-    m_webView->d_func()->didReceiveServerRedirectForProvisionalLoad(url);
-}
-
-void QtWebPageLoadClient::didCommitLoad()
-{
-    PageViewportController* pvc = m_webView->d_func()->viewportController();
-    if (pvc)
-        pvc->didCommitLoad();
-    m_webView->d_func()->loadDidCommit();
-}
-
-void QtWebPageLoadClient::didSameDocumentNavigation()
-{
-    m_webView->d_func()->didSameDocumentNavigation();
-}
-
-void QtWebPageLoadClient::didReceiveTitle()
-{
-    m_webView->d_func()->titleDidChange();
-}
-
-void QtWebPageLoadClient::didChangeProgress(int loadProgress)
-{
-    m_webView->d_func()->loadProgressDidChange(loadProgress);
-}
-
-void QtWebPageLoadClient::didChangeBackForwardList()
-{
-    m_webView->d_func()->backForwardListDidChange();
-}
-
-void QtWebPageLoadClient::dispatchLoadSucceeded()
-{
-    m_webView->d_func()->loadDidSucceed();
-}
-
-void QtWebPageLoadClient::dispatchLoadStopped()
-{
-    m_webView->d_func()->loadDidStop();
-}
-
-void QtWebPageLoadClient::dispatchLoadFailed(WebFrameProxy* frame, const QtWebError& error)
-{
-    if (error.isCancellation()) {
-        dispatchLoadStopped();
-        return;
-    }
-
-    int errorCode = error.errorCode();
-
-    if (errorCode == kWKErrorCodeFrameLoadInterruptedByPolicyChange || errorCode == kWKErrorCodePlugInWillHandleLoad) {
-        // The active url might have changed
-        m_webView->emitUrlChangeIfNeeded();
-
-        // Make sure that LoadStartedStatus has a counterpart when e.g. requesting a download.
-        dispatchLoadSucceeded();
-
-        return;
-    }
-
-    // We set the unreachable url unconditionally so that the current
-    // active url of the webview when the loadingChanged signal is
-    // emitted reflects the failed url, not the previously committed
-    // url. This also ensures that if the user does not do a loadHtml
-    // with an error page and and unreachable url as a reponse to the
-    // failed load, we can still detect the failed url for reloads.
-    frame->setUnreachableURL(error.url());
-    m_webView->emitUrlChangeIfNeeded();
-
-    m_webView->d_func()->loadDidFail(error);
-}
-
-static QtWebPageLoadClient* toQtWebPageLoadClient(const void* clientInfo)
-{
-    ASSERT(clientInfo);
-    return reinterpret_cast<QtWebPageLoadClient*>(const_cast<void*>(clientInfo));
-}
-
-void QtWebPageLoadClient::didStartProvisionalLoadForFrame(WKPageRef, WKFrameRef frame, WKTypeRef, const void* clientInfo)
-{
-    if (!WKFrameIsMainFrame(frame))
-        return;
-    toQtWebPageLoadClient(clientInfo)->didStartProvisionalLoad(toImpl(frame)->provisionalURL());
-}
-
-void QtWebPageLoadClient::didReceiveServerRedirectForProvisionalLoadForFrame(WKPageRef, WKFrameRef frame, WKTypeRef, const void* clientInfo)
-{
-    if (!WKFrameIsMainFrame(frame))
-        return;
-
-    WebFrameProxy* wkframe = toImpl(frame);
-    toQtWebPageLoadClient(clientInfo)->didReceiveServerRedirectForProvisionalLoad(wkframe->provisionalURL());
-}
-
-void QtWebPageLoadClient::didFailProvisionalLoadWithErrorForFrame(WKPageRef, WKFrameRef frame, WKErrorRef error, WKTypeRef, const void* clientInfo)
-{
-    if (!WKFrameIsMainFrame(frame))
-        return;
-    toQtWebPageLoadClient(clientInfo)->dispatchLoadFailed(toImpl(frame), error);
-}
-
-void QtWebPageLoadClient::didCommitLoadForFrame(WKPageRef, WKFrameRef frame, WKTypeRef, const void* clientInfo)
-{
-    if (!WKFrameIsMainFrame(frame))
-        return;
-    toQtWebPageLoadClient(clientInfo)->didCommitLoad();
-}
-
-void QtWebPageLoadClient::didFinishLoadForFrame(WKPageRef, WKFrameRef frame, WKTypeRef, const void* clientInfo)
-{
-    if (!WKFrameIsMainFrame(frame))
-        return;
-    toQtWebPageLoadClient(clientInfo)->dispatchLoadSucceeded();
-}
-
-void QtWebPageLoadClient::didFailLoadWithErrorForFrame(WKPageRef, WKFrameRef frame, WKErrorRef error, WKTypeRef, const void* clientInfo)
-{
-    if (!WKFrameIsMainFrame(frame))
-        return;
-    toQtWebPageLoadClient(clientInfo)->dispatchLoadFailed(toImpl(frame), error);
-}
-
-void QtWebPageLoadClient::didSameDocumentNavigationForFrame(WKPageRef, WKFrameRef frame, WKSameDocumentNavigationType type, WKTypeRef userData, const void* clientInfo)
-{
-    if (!WKFrameIsMainFrame(frame))
-        return;
-    toQtWebPageLoadClient(clientInfo)->didSameDocumentNavigation();
-}
-
-void QtWebPageLoadClient::didReceiveTitleForFrame(WKPageRef, WKStringRef title, WKFrameRef frame, WKTypeRef, const void* clientInfo)
-{
-    if (!WKFrameIsMainFrame(frame))
-        return;
-    toQtWebPageLoadClient(clientInfo)->didReceiveTitle();
-}
-
-void QtWebPageLoadClient::didStartProgress(WKPageRef, const void* clientInfo)
-{
-    toQtWebPageLoadClient(clientInfo)->didChangeProgress(0);
-}
-
-void QtWebPageLoadClient::didChangeProgress(WKPageRef page, const void* clientInfo)
-{
-    toQtWebPageLoadClient(clientInfo)->didChangeProgress(WKPageGetEstimatedProgress(page) * 100);
-}
-
-void QtWebPageLoadClient::didFinishProgress(WKPageRef, const void* clientInfo)
-{
-    toQtWebPageLoadClient(clientInfo)->didChangeProgress(100);
-}
-
-void QtWebPageLoadClient::didChangeBackForwardList(WKPageRef, WKBackForwardListItemRef, WKArrayRef, const void *clientInfo)
-{
-    toQtWebPageLoadClient(clientInfo)->didChangeBackForwardList();
-}
-
-} // namespace Webkit
diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.h b/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.h
deleted file mode 100644 (file)
index 668bac1..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this program; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef QtWebPageLoadClient_h
-#define QtWebPageLoadClient_h
-
-#include <QtGlobal>
-#include <WebFrameProxy.h>
-#include <WKPage.h>
-#include <wtf/text/WTFString.h>
-
-QT_BEGIN_NAMESPACE
-class QUrl;
-QT_END_NAMESPACE
-
-class QQuickWebView;
-
-namespace WebKit {
-
-class QtWebError;
-
-class QtWebPageLoadClient {
-public:
-    QtWebPageLoadClient(WKPageRef, QQuickWebView*);
-
-private:
-    void didStartProvisionalLoad(const WTF::String&);
-    void didReceiveServerRedirectForProvisionalLoad(const WTF::String&);
-    void didCommitLoad();
-    void didSameDocumentNavigation();
-    void didReceiveTitle();
-    void didChangeProgress(int);
-    void didChangeBackForwardList();
-
-    void dispatchLoadSucceeded();
-    void dispatchLoadStopped();
-    void dispatchLoadFailed(WebFrameProxy*, const QtWebError&);
-
-
-    // WKPageLoadClient callbacks.
-    static void didStartProvisionalLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef userData, const void* clientInfo);
-    static void didReceiveServerRedirectForProvisionalLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef userData, const void* clientInfo);
-    static void didFailProvisionalLoadWithErrorForFrame(WKPageRef, WKFrameRef, WKErrorRef, WKTypeRef userData, const void* clientInfo);
-    static void didCommitLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef userData, const void* clientInfo);
-    static void didFinishLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef userData, const void* clientInfo);
-    static void didFailLoadWithErrorForFrame(WKPageRef, WKFrameRef, WKErrorRef, WKTypeRef userData, const void* clientInfo);
-    static void didSameDocumentNavigationForFrame(WKPageRef, WKFrameRef, WKSameDocumentNavigationType, WKTypeRef userData, const void* clientInfo);
-    static void didReceiveTitleForFrame(WKPageRef, WKStringRef, WKFrameRef, WKTypeRef userData, const void* clientInfo);
-    static void didStartProgress(WKPageRef, const void* clientInfo);
-    static void didChangeProgress(WKPageRef, const void* clientInfo);
-    static void didFinishProgress(WKPageRef, const void* clientInfo);
-    static void didChangeBackForwardList(WKPageRef, WKBackForwardListItemRef, WKArrayRef, const void *clientInfo);
-
-    QQuickWebView* m_webView;
-};
-
-} // namespace Webkit
-
-#endif // QtWebPageLoadClient_h