summaryrefslogtreecommitdiff
path: root/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-03-12 14:11:15 +0100
committerSimon Hausmann <simon.hausmann@nokia.com>2012-03-12 14:11:15 +0100
commitdd91e772430dc294e3bf478c119ef8d43c0a3358 (patch)
tree6f33ce4d5872a5691e0291eb45bf6ab373a5f567 /Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp
parentad0d549d4cc13433f77c1ac8f0ab379c83d93f28 (diff)
downloadqtwebkit-dd91e772430dc294e3bf478c119ef8d43c0a3358.tar.gz
Imported WebKit commit 3db4eb1820ac8fb03065d7ea73a4d9db1e8fea1a (http://svn.webkit.org/repository/webkit/trunk@110422)
This includes build fixes for the latest qtbase/qtdeclarative as well as the final QML2 API.
Diffstat (limited to 'Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp')
-rw-r--r--Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp53
1 files changed, 26 insertions, 27 deletions
diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp b/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp
index 2601f4802..de22a9fb3 100644
--- a/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp
+++ b/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp
@@ -24,6 +24,7 @@
#include "WKStringQt.h"
#include "qquickwebview_p.h"
#include "qquickwebview_p_p.h"
+#include "qwebloadrequest_p.h"
#include <WKFrame.h>
QtWebPageLoadClient::QtWebPageLoadClient(WKPageRef pageRef, QQuickWebView* webView)
@@ -49,28 +50,28 @@ QtWebPageLoadClient::QtWebPageLoadClient(WKPageRef pageRef, QQuickWebView* webVi
WKPageSetPageLoaderClient(pageRef, &loadClient);
}
-void QtWebPageLoadClient::didStartProvisionalLoadForFrame()
+void QtWebPageLoadClient::didStartProvisionalLoadForFrame(const QUrl& url)
{
- emit m_webView->navigationStateChanged();
- emit m_webView->loadStarted();
+ QWebLoadRequest loadRequest(url, QQuickWebView::LoadStartedStatus);
+ m_webView->d_func()->didChangeLoadingState(&loadRequest);
}
-void QtWebPageLoadClient::didCommitLoadForFrame(const QUrl& url)
+void QtWebPageLoadClient::didCommitLoadForFrame()
{
- emit m_webView->navigationStateChanged();
- emit m_webView->urlChanged(url);
+ emit m_webView->navigationHistoryChanged();
+ emit m_webView->urlChanged();
m_webView->d_func()->loadDidCommit();
}
-void QtWebPageLoadClient::didSameDocumentNavigationForFrame(const QUrl& url)
+void QtWebPageLoadClient::didSameDocumentNavigationForFrame()
{
- emit m_webView->navigationStateChanged();
- emit m_webView->urlChanged(url);
+ emit m_webView->navigationHistoryChanged();
+ emit m_webView->urlChanged();
}
-void QtWebPageLoadClient::didReceiveTitleForFrame(const QString& title)
+void QtWebPageLoadClient::didReceiveTitleForFrame()
{
- emit m_webView->titleChanged(title);
+ emit m_webView->titleChanged();
}
void QtWebPageLoadClient::didFirstVisuallyNonEmptyLayoutForFrame()
@@ -90,20 +91,22 @@ void QtWebPageLoadClient::dispatchLoadSucceeded()
void QtWebPageLoadClient::dispatchLoadFailed(WKErrorRef error)
{
- emit m_webView->navigationStateChanged();
-
int errorCode = WKErrorGetErrorCode(error);
- if (toImpl(error)->platformError().isCancellation() || errorCode == kWKErrorCodeFrameLoadInterruptedByPolicyChange || errorCode == kWKErrorCodePlugInWillHandleLoad)
+ if (toImpl(error)->platformError().isCancellation() || errorCode == kWKErrorCodeFrameLoadInterruptedByPolicyChange || errorCode == kWKErrorCodePlugInWillHandleLoad) {
+ // Make sure that LoadStartedStatus has a counterpart when e.g. requesting a download.
+ dispatchLoadSucceeded();
return;
+ }
QtWebError qtError(error);
- emit m_webView->loadFailed(static_cast<QQuickWebView::ErrorDomain>(qtError.type()), qtError.errorCode(), qtError.url(), qtError.description());
+ QWebLoadRequest loadRequest(qtError.url(), QQuickWebView::LoadFailedStatus, qtError.description(), static_cast<QQuickWebView::ErrorDomain>(qtError.type()), qtError.errorCode());
+ emit m_webView->loadingChanged(&loadRequest);
}
void QtWebPageLoadClient::setLoadProgress(int loadProgress)
{
m_loadProgress = loadProgress;
- emit m_webView->loadProgressChanged(m_loadProgress);
+ emit m_webView->loadProgressChanged();
}
static QtWebPageLoadClient* toQtWebPageLoadClient(const void* clientInfo)
@@ -116,7 +119,10 @@ void QtWebPageLoadClient::didStartProvisionalLoadForFrame(WKPageRef, WKFrameRef
{
if (!WKFrameIsMainFrame(frame))
return;
- toQtWebPageLoadClient(clientInfo)->didStartProvisionalLoadForFrame();
+ WebFrameProxy* wkframe = toImpl(frame);
+ QString urlStr(wkframe->provisionalURL());
+ QUrl qUrl = urlStr;
+ toQtWebPageLoadClient(clientInfo)->didStartProvisionalLoadForFrame(qUrl);
}
void QtWebPageLoadClient::didFailProvisionalLoadWithErrorForFrame(WKPageRef, WKFrameRef frame, WKErrorRef error, WKTypeRef, const void* clientInfo)
@@ -130,10 +136,7 @@ void QtWebPageLoadClient::didCommitLoadForFrame(WKPageRef, WKFrameRef frame, WKT
{
if (!WKFrameIsMainFrame(frame))
return;
- WebFrameProxy* wkframe = toImpl(frame);
- QString urlStr(wkframe->url());
- QUrl qUrl = urlStr;
- toQtWebPageLoadClient(clientInfo)->didCommitLoadForFrame(qUrl);
+ toQtWebPageLoadClient(clientInfo)->didCommitLoadForFrame();
}
void QtWebPageLoadClient::didFinishLoadForFrame(WKPageRef, WKFrameRef frame, WKTypeRef, const void* clientInfo)
@@ -152,18 +155,14 @@ void QtWebPageLoadClient::didFailLoadWithErrorForFrame(WKPageRef, WKFrameRef fra
void QtWebPageLoadClient::didSameDocumentNavigationForFrame(WKPageRef page, WKFrameRef frame, WKSameDocumentNavigationType type, WKTypeRef userData, const void* clientInfo)
{
- WebFrameProxy* wkframe = toImpl(frame);
- QString urlStr(wkframe->url());
- QUrl qUrl = urlStr;
- toQtWebPageLoadClient(clientInfo)->didSameDocumentNavigationForFrame(qUrl);
+ toQtWebPageLoadClient(clientInfo)->didSameDocumentNavigationForFrame();
}
void QtWebPageLoadClient::didReceiveTitleForFrame(WKPageRef, WKStringRef title, WKFrameRef frame, WKTypeRef, const void* clientInfo)
{
if (!WKFrameIsMainFrame(frame))
return;
- QString qTitle = WKStringCopyQString(title);
- toQtWebPageLoadClient(clientInfo)->didReceiveTitleForFrame(qTitle);
+ toQtWebPageLoadClient(clientInfo)->didReceiveTitleForFrame();
}
void QtWebPageLoadClient::didStartProgress(WKPageRef, const void* clientInfo)