#ifndef Prerender_h
#define Prerender_h
#include "platform/PlatformExport.h"
#include "platform/weborigin/KURL.h"
#include "platform/weborigin/ReferrerPolicy.h"
#include "wtf/OwnPtr.h"
#include "wtf/PassOwnPtr.h"
#include "wtf/PassRefPtr.h"
#include "wtf/RefCounted.h"
#include "wtf/RefPtr.h"
#include "wtf/text/WTFString.h"
namespace blink {
class WebPrerender;
}
namespace WebCore {
class PrerenderClient;
enum PrerenderRelType {
PrerenderRelTypePrerender = 0x1,
PrerenderRelTypeNext = 0x2,
};
class PLATFORM_EXPORT Prerender : public RefCounted<Prerender> {
WTF_MAKE_NONCOPYABLE(Prerender);
public:
class ExtraData : public RefCounted<ExtraData> {
public:
virtual ~ExtraData() { }
};
static PassRefPtr<Prerender> create(PrerenderClient*, const KURL&, unsigned relTypes, const String& referrer, ReferrerPolicy);
~Prerender();
void removeClient();
void add();
void cancel();
void abandon();
const KURL& url() const { return m_url; }
unsigned relTypes() const { return m_relTypes; }
const String& referrer() const { return m_referrer; }
ReferrerPolicy referrerPolicy() const { return m_referrerPolicy; }
void setExtraData(PassRefPtr<ExtraData> extraData) { m_extraData = extraData; }
ExtraData* extraData() { return m_extraData.get(); }
void didStartPrerender();
void didStopPrerender();
void didSendLoadForPrerender();
void didSendDOMContentLoadedForPrerender();
private:
Prerender(PrerenderClient*, const KURL&, unsigned relTypes, const String& referrer, ReferrerPolicy);
PrerenderClient* m_client;
const KURL m_url;
const unsigned m_relTypes;
const String m_referrer;
const ReferrerPolicy m_referrerPolicy;
RefPtr<ExtraData> m_extraData;
};
}
#endif