SocketStreamHandle.h [plain text]
#ifndef SocketStreamHandle_h
#define SocketStreamHandle_h
#include "SocketStreamHandleBase.h"
#if USE(SOUP)
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/gobject/GRefPtr.h>
namespace WebCore {
class AuthenticationChallenge;
class Credential;
class SocketStreamHandleClient;
class SocketStreamHandle : public RefCounted<SocketStreamHandle>, public SocketStreamHandleBase {
public:
static PassRefPtr<SocketStreamHandle> create(const URL& url, SocketStreamHandleClient* client) { return adoptRef(new SocketStreamHandle(url, client)); }
static PassRefPtr<SocketStreamHandle> create(GSocketConnection* socketConnection, SocketStreamHandleClient* client) { return adoptRef(new SocketStreamHandle(socketConnection, client)); }
virtual ~SocketStreamHandle();
void connected(GSocketConnection*, GError*);
void readBytes(signed long, GError*);
void writeReady();
void* id() { return m_id; }
protected:
virtual int platformSend(const char* data, int length);
virtual void platformClose();
private:
GRefPtr<GSocketConnection> m_socketConnection;
GRefPtr<GInputStream> m_inputStream;
GRefPtr<GPollableOutputStream> m_outputStream;
GRefPtr<GSource> m_writeReadySource;
std::unique_ptr<char[]> m_readBuffer;
void* m_id;
SocketStreamHandle(const URL&, SocketStreamHandleClient*);
SocketStreamHandle(GSocketConnection*, SocketStreamHandleClient*);
void didReceiveAuthenticationChallenge(const AuthenticationChallenge&);
void receivedCredential(const AuthenticationChallenge&, const Credential&);
void receivedRequestToContinueWithoutCredential(const AuthenticationChallenge&);
void receivedCancellation(const AuthenticationChallenge&);
void receivedRequestToPerformDefaultHandling(const AuthenticationChallenge&);
void receivedChallengeRejection(const AuthenticationChallenge&);
void beginWaitingForSocketWritability();
void stopWaitingForSocketWritability();
};
}
#endif
#endif // SocketStreamHandle_h