03f2f0eed3013a0d4c11dab3315077378eabc527
[WebKit-https.git] / Source / WebKit2 / UIProcess / qt / QtWebPageLoadClient.h
1 /*
2  * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public License
15  * along with this program; see the file COPYING.LIB.  If not, write to
16  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  *
19  */
20
21 #ifndef QtWebPageLoadClient_h
22 #define QtWebPageLoadClient_h
23
24 #include "QtWebError.h"
25 #include <QtCore/QString>
26 #include <QtCore/QUrl>
27 #include <WKPage.h>
28
29 class QQuickWebView;
30
31 class QtWebPageLoadClient {
32 public:
33     QtWebPageLoadClient(WKPageRef, QQuickWebView*);
34
35     int loadProgress() const { return m_loadProgress; }
36
37 private:
38     void didStartProvisionalLoadForFrame();
39     void didCommitLoadForFrame(const QUrl&);
40     void didSameDocumentNavigationForFrame(const QUrl&);
41     void didReceiveTitleForFrame(const QString&);
42     void didFirstVisuallyNonEmptyLayoutForFrame();
43
44     void dispatchLoadSucceeded();
45     void dispatchLoadFailed(WKErrorRef);
46     void setLoadProgress(int);
47
48     // WKPageLoadClient callbacks.
49     static void didStartProvisionalLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef userData, const void* clientInfo);
50     static void didFailProvisionalLoadWithErrorForFrame(WKPageRef, WKFrameRef, WKErrorRef, WKTypeRef userData, const void* clientInfo);
51     static void didCommitLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef userData, const void* clientInfo);
52     static void didFinishLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef userData, const void* clientInfo);
53     static void didFailLoadWithErrorForFrame(WKPageRef, WKFrameRef, WKErrorRef, WKTypeRef userData, const void* clientInfo);
54     static void didSameDocumentNavigationForFrame(WKPageRef, WKFrameRef, WKSameDocumentNavigationType, WKTypeRef userData, const void* clientInfo);
55     static void didReceiveTitleForFrame(WKPageRef, WKStringRef, WKFrameRef, WKTypeRef userData, const void* clientInfo);
56     static void didStartProgress(WKPageRef, const void* clientInfo);
57     static void didChangeProgress(WKPageRef, const void* clientInfo);
58     static void didFinishProgress(WKPageRef, const void* clientInfo);
59     static void didFirstVisuallyNonEmptyLayoutForFrame(WKPageRef, WKFrameRef, WKTypeRef userData, const void* clientInfo);
60
61     QQuickWebView* m_webView;
62     int m_loadProgress;
63 };
64
65 #endif // QtWebPageLoadClient_h