1
0
Fork 0
mirror of https://github.com/thoughtbot/capybara-webkit synced 2023-03-27 23:22:28 -04:00
capybara-webkit/src/WebPageManager.h

80 lines
2.1 KiB
C
Raw Normal View History

#ifndef _WEBPAGEMANAGER_H
#define _WEBPAGEMANAGER_H
2012-03-26 18:41:33 -04:00
#include <QList>
2012-06-29 10:41:08 -04:00
#include <QSet>
#include <QObject>
2012-06-29 10:41:08 -04:00
#include <QNetworkReply>
#include <QDebug>
#include <QFile>
#include "UnknownUrlHandler.h"
class WebPage;
2012-06-21 23:34:51 -04:00
class NetworkCookieJar;
class NetworkAccessManager;
class BlacklistedRequestHandler;
class CustomHeadersRequestHandler;
2012-03-26 18:41:33 -04:00
class WebPageManager : public QObject {
Q_OBJECT
2012-03-26 18:41:33 -04:00
public:
WebPageManager(QObject *parent = 0);
2012-03-26 18:41:33 -04:00
void append(WebPage *value);
2012-06-29 10:41:08 -04:00
QList<WebPage *> pages() const;
void setCurrentPage(WebPage *);
WebPage *currentPage() const;
WebPage *createPage();
void removePage(WebPage *);
void setIgnoreSslErrors(bool);
bool ignoreSslErrors();
void setTimeout(int);
int getTimeout();
2012-05-14 21:59:28 -04:00
void reset();
2012-06-21 23:34:51 -04:00
NetworkCookieJar *cookieJar();
2012-06-29 10:41:08 -04:00
bool isLoading() const;
QDebug logger() const;
void enableLogging();
void replyFinished(QNetworkReply *reply);
NetworkAccessManager *networkAccessManager();
void setUrlBlacklist(const QStringList &);
void addHeader(QString, QString);
void setUnknownUrlMode(UnknownUrlHandler::Mode);
void allowUrl(const QString &);
void blockUrl(const QString &);
2012-03-26 18:41:33 -04:00
public slots:
2012-05-14 21:59:28 -04:00
void emitLoadStarted();
void setPageStatus(bool);
2012-07-11 23:36:22 -04:00
void requestCreated(QByteArray &url, QNetworkReply *reply);
void handleReplyFinished();
void replyDestroyed(QObject *);
signals:
void pageFinished(bool);
2012-05-14 21:59:28 -04:00
void loadStarted();
2012-03-26 18:41:33 -04:00
private:
void emitPageFinished();
static void handleDebugMessage(QtMsgType type, const char *message);
void initOfflineWebApplicationCache();
QList<WebPage *> m_pages;
QList<QNetworkReply *> m_pendingReplies;
WebPage *m_currentPage;
bool m_ignoreSslErrors;
2012-06-21 23:34:51 -04:00
NetworkCookieJar *m_cookieJar;
QSet<WebPage *> m_started;
2012-06-29 10:41:08 -04:00
bool m_success;
bool m_loggingEnabled;
bool m_isCacheInitialized;
QFile *m_ignoredOutput;
int m_timeout;
NetworkAccessManager *m_networkAccessManager;
BlacklistedRequestHandler *m_blacklistedRequestHandler;
CustomHeadersRequestHandler *m_customHeadersRequestHandler;
UnknownUrlHandler *m_unknownUrlHandler;
2012-03-26 18:41:33 -04:00
};
#endif // _WEBPAGEMANAGER_H