ResourceHandleClient.h [plain text]
#ifndef ResourceHandleClient_h
#define ResourceHandleClient_h
#include <wtf/CurrentTime.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
#if USE(CFNETWORK)
#include <CFNetwork/CFURLCachePriv.h>
#include <CFNetwork/CFURLResponsePriv.h>
#endif
#if PLATFORM(WIN) && USE(CFNETWORK)
#include <ConditionalMacros.h>
#endif
#if PLATFORM(MAC)
#ifdef __OBJC__
@class NSCachedURLResponse;
#else
class NSCachedURLResponse;
#endif
#endif
namespace WebCore {
class AsyncFileStream;
class AuthenticationChallenge;
class Credential;
class FileStreamClient;
class KURL;
class ProtectionSpace;
class ResourceHandle;
class ResourceError;
class ResourceRequest;
class ResourceResponse;
enum CacheStoragePolicy {
StorageAllowed,
StorageAllowedInMemoryOnly,
StorageNotAllowed
};
class ResourceHandleClient {
public:
virtual ~ResourceHandleClient() { }
virtual void willSendRequest(ResourceHandle*, ResourceRequest&, const ResourceResponse& ) { }
virtual void didSendData(ResourceHandle*, unsigned long long , unsigned long long ) { }
virtual void didReceiveResponse(ResourceHandle*, const ResourceResponse&) { }
virtual void didReceiveData(ResourceHandle*, const char*, int, int ) { }
virtual void didReceiveCachedMetadata(ResourceHandle*, const char*, int) { }
virtual void didFinishLoading(ResourceHandle*, double ) { }
virtual void didFail(ResourceHandle*, const ResourceError&) { }
virtual void wasBlocked(ResourceHandle*) { }
virtual void cannotShowURL(ResourceHandle*) { }
#if HAVE(CFNETWORK_DATA_ARRAY_CALLBACK)
virtual bool supportsDataArray() { return false; }
virtual void didReceiveDataArray(ResourceHandle*, CFArrayRef) { }
#endif
virtual void willCacheResponse(ResourceHandle*, CacheStoragePolicy&) { }
virtual bool shouldUseCredentialStorage(ResourceHandle*) { return false; }
virtual void didReceiveAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge&) { }
virtual void didCancelAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge&) { }
#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
virtual bool canAuthenticateAgainstProtectionSpace(ResourceHandle*, const ProtectionSpace&) { return false; }
#endif
virtual void receivedCancellation(ResourceHandle*, const AuthenticationChallenge&) { }
virtual CFDictionaryRef connectionProperties(ResourceHandle*) { return 0; }
#if PLATFORM(MAC)
#if USE(CFNETWORK)
virtual CFCachedURLResponseRef willCacheResponse(ResourceHandle*, CFCachedURLResponseRef response) { return response; }
#else
virtual NSCachedURLResponse* willCacheResponse(ResourceHandle*, NSCachedURLResponse* response) { return response; }
#endif
virtual void willStopBufferingData(ResourceHandle*, const char*, int) { }
#endif // PLATFORM(MAC)
#if PLATFORM(WIN) && USE(CFNETWORK)
virtual bool shouldCacheResponse(ResourceHandle*, CFCachedURLResponseRef) { return true; }
#endif
#if ENABLE(BLOB)
virtual AsyncFileStream* createAsyncFileStream(FileStreamClient*) { return 0; }
#endif
};
}
#endif