Title: [142095] trunk/Source/WebKit2
Revision
142095
Author
[email protected]
Date
2013-02-07 04:34:08 -0800 (Thu, 07 Feb 2013)

Log Message

[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.

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (142094 => 142095)


--- trunk/Source/WebKit2/ChangeLog	2013-02-07 12:21:43 UTC (rev 142094)
+++ trunk/Source/WebKit2/ChangeLog	2013-02-07 12:34:08 UTC (rev 142095)
@@ -1,3 +1,45 @@
+2013-02-07  Michael BrĂ¼ning  <[email protected]>
+
+        [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  <[email protected]> and Raphael Kubo da Costa  <[email protected]>
 
         [EFL][WK2] Refactoring initialization and shutdown codes of EFL libraries.

Modified: trunk/Source/WebKit2/Target.pri (142094 => 142095)


--- trunk/Source/WebKit2/Target.pri	2013-02-07 12:21:43 UTC (rev 142094)
+++ trunk/Source/WebKit2/Target.pri	2013-02-07 12:34:08 UTC (rev 142095)
@@ -785,7 +785,6 @@
         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 @@
         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 \

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp (142094 => 142095)


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp	2013-02-07 12:21:43 UTC (rev 142094)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp	2013-02-07 12:34:08 UTC (rev 142095)
@@ -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 @@
         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 @@
     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  = ""
+
+    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;
 
+    QQuickWebView* const q = toQQuickWebViewPrivate(clientInfo)->q_func();
+    ASSERT(!q->loading());
+
+    QtWebError error(errorRef);
+    if (error.isCancellation()) {
+        QWebLoadRequest loadRequest(q->url(), QQuickWebView::LoadStoppedStatus);
+        emit q->loadingChanged(&loadRequest);
+        return;
+    }
+
+    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(QString(url), QQuickWebView::LoadStartedStatus);
+    QWebLoadRequest loadRequest(error.url(), QQuickWebView::LoadFailedStatus, error.description(), static_cast<QQuickWebView::ErrorDomain>(error.type()), errorCode);
     emit q->loadingChanged(&loadRequest);
 }
 
-void QQuickWebViewPrivate::didReceiveServerRedirectForProvisionalLoad(const WTF::String&)
+void QQuickWebViewPrivate::didCommitLoadForFrame(WKPageRef, WKFrameRef frame, WKTypeRef, const void* clientInfo)
 {
-    Q_Q(QQuickWebView);
+    if (!WKFrameIsMainFrame(frame))
+        return;
+    QQuickWebViewPrivate* d = toQQuickWebViewPrivate(clientInfo);
 
-    q->emitUrlChangeIfNeeded();
-}
+    PageViewportController* pageViewportController = d->viewportController();
+    if (pageViewportController)
+        pageViewportController->didCommitLoad();
 
-void QQuickWebViewPrivate::loadDidCommit()
-{
-    Q_Q(QQuickWebView);
+    QQuickWebView* const q = d->q_func();
     ASSERT(q->loading());
-
-    m_betweenLoadCommitAndFirstFrame = true;
+    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);
+    if (!WKFrameIsMainFrame(frame))
+        return;
+    emit toQQuickWebViewPrivate(clientInfo)->q_func()->titleChanged();
+}
 
-    emit q->titleChanged();
+void QQuickWebViewPrivate::didStartProgress(WKPageRef, const void* clientInfo)
+{
+    toQQuickWebViewPrivate(clientInfo)->loadProgressDidChange(0);
 }
 
-void QQuickWebViewPrivate::loadProgressDidChange(int loadProgress)
+void QQuickWebViewPrivate::didChangeProgress(WKPageRef page, const void* clientInfo)
 {
-    Q_Q(QQuickWebView);
+    toQQuickWebViewPrivate(clientInfo)->loadProgressDidChange(WKPageGetEstimatedProgress(page) * 100);
+}
 
-    m_loadProgress = loadProgress;
+void QQuickWebViewPrivate::didFinishProgress(WKPageRef, const void* clientInfo)
+{
+    toQQuickWebViewPrivate(clientInfo)->loadProgressDidChange(100);
+}
 
-    emit q->loadProgressChanged();
+void QQuickWebViewPrivate::didChangeBackForwardList(WKPageRef, WKBackForwardListItemRef, WKArrayRef, const void *clientInfo)
+{
+    toQQuickWebViewPrivate(clientInfo)->navigationHistory->d->reset();
 }
 
-void QQuickWebViewPrivate::backForwardListDidChange()
+void QQuickWebViewPrivate::setTransparentBackground(bool enable)
 {
-    navigationHistory->d->reset();
+    webPageProxy->setDrawsTransparentBackground(enable);
 }
 
-void QQuickWebViewPrivate::loadDidSucceed()
+bool QQuickWebViewPrivate::transparentBackground() const
 {
-    Q_Q(QQuickWebView);
-    ASSERT(!q->loading());
-
-    QWebLoadRequest loadRequest(q->url(), QQuickWebView::LoadSucceededStatus);
-    emit q->loadingChanged(&loadRequest);
+    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)

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h (142094 => 142095)


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h	2013-02-07 12:21:43 UTC (rev 142094)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h	2013-02-07 12:34:08 UTC (rev 142095)
@@ -51,7 +51,6 @@
 namespace WebKit {
 struct QtRefCountedNetworkRequestData;
 class PageViewportControllerClientQt;
-class QtWebPageLoadClient;
 class QtWebPageFindClient;
 class QtWebPagePolicyClient;
 class QtWebPageUIClient;
@@ -221,7 +220,6 @@
 
     friend class QWebKitTest;
     friend class WebKit::PageViewportControllerClientQt;
-    friend class WebKit::QtWebPageLoadClient;
     friend class WebKit::QtWebPageFindClient;
     friend class WebKit::QtWebPagePolicyClient;
     friend class WebKit::QtWebPageUIClient;

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h (142094 => 142095)


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h	2013-02-07 12:21:43 UTC (rev 142094)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h	2013-02-07 12:34:08 UTC (rev 142095)
@@ -44,7 +44,6 @@
 class PageViewportControllerClientQt;
 class QtWebContext;
 class QtWebError;
-class QtWebPageLoadClient;
 class QtWebPagePolicyClient;
 class WebPageProxy;
 }
@@ -73,16 +72,7 @@
 
     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 @@
         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 @@
     OwnPtr<QWebNavigationHistory> navigationHistory;
     OwnPtr<QWebPreferences> preferences;
 
-    QScopedPointer<WebKit::QtWebPageLoadClient> pageLoadClient;
     QScopedPointer<WebKit::QtWebPagePolicyClient> pagePolicyClient;
     QScopedPointer<WebKit::QtWebPageUIClient> pageUIClient;
 

Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebError.cpp (142094 => 142095)


--- trunk/Source/WebKit2/UIProcess/qt/QtWebError.cpp	2013-02-07 12:21:43 UTC (rev 142094)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebError.cpp	2013-02-07 12:34:08 UTC (rev 142095)
@@ -57,7 +57,7 @@
 
 QString QtWebError::url() const
 {
-    return toImpl(error.get())->failingURL();
+    return WKStringCopyQString(WKURLCopyString(WKErrorCopyFailingURL(error.get())));
 }
 
 QString QtWebError::description() const

Deleted: trunk/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp (142094 => 142095)


--- trunk/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp	2013-02-07 12:21:43 UTC (rev 142094)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp	2013-02-07 12:34:08 UTC (rev 142095)
@@ -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

Deleted: trunk/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.h (142094 => 142095)


--- trunk/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.h	2013-02-07 12:21:43 UTC (rev 142094)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.h	2013-02-07 12:34:08 UTC (rev 142095)
@@ -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
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to