#ifndef FetchContext_h
#define FetchContext_h
#include "core/fetch/CachePolicy.h"
#include "core/fetch/FetchInitiatorInfo.h"
#include "core/fetch/Resource.h"
#include "platform/network/ResourceLoadPriority.h"
#include "wtf/Noncopyable.h"
namespace WebCore {
class Document;
class DocumentLoader;
class LocalFrame;
class KURL;
class Page;
class ResourceError;
class ResourceLoader;
class ResourceResponse;
class ResourceRequest;
enum FetchResourceType {
FetchMainResource,
FetchSubresource
};
class FetchContext {
WTF_MAKE_NONCOPYABLE(FetchContext);
public:
static FetchContext& nullInstance();
FetchContext() { }
virtual ~FetchContext() { }
virtual void reportLocalLoadFailed(const KURL&);
virtual void addAdditionalRequestHeaders(Document*, ResourceRequest&, FetchResourceType);
virtual CachePolicy cachePolicy(Document*) const;
virtual void dispatchDidChangeResourcePriority(unsigned long identifier, ResourceLoadPriority, int intraPriorityValue);
virtual void dispatchWillSendRequest(DocumentLoader*, unsigned long identifier, ResourceRequest&, const ResourceResponse& redirectResponse, const FetchInitiatorInfo& = FetchInitiatorInfo());
virtual void dispatchDidLoadResourceFromMemoryCache(const ResourceRequest&, const ResourceResponse&);
virtual void dispatchDidReceiveResponse(DocumentLoader*, unsigned long identifier, const ResourceResponse&, ResourceLoader* = 0);
virtual void dispatchDidReceiveData(DocumentLoader*, unsigned long identifier, const char* data, int dataLength, int encodedDataLength);
virtual void dispatchDidDownloadData(DocumentLoader*, unsigned long identifier, int dataLength, int encodedDataLength);
virtual void dispatchDidFinishLoading(DocumentLoader*, unsigned long identifier, double finishTime, int64_t encodedDataLength);
virtual void dispatchDidFail(DocumentLoader*, unsigned long identifier, const ResourceError&);
virtual void sendRemainingDelegateMessages(DocumentLoader*, unsigned long identifier, const ResourceResponse&, int dataLength);
};
}
#endif