#ifndef WebSocketImpl_h
#define WebSocketImpl_h
#include "WebSocket.h"
#include "WebSocketClient.h"
#include "modules/websockets/WebSocketChannelClient.h"
#include "public/platform/WebCommon.h"
#include "wtf/OwnPtr.h"
#include "wtf/RefPtr.h"
namespace WebCore { class WebSocketChannel; }
namespace blink {
class WebDocument;
class WebString;
class WebURL;
class WebSocketImpl FINAL : public WebSocket, public WebCore::WebSocketChannelClient {
public:
WebSocketImpl(const WebDocument&, WebSocketClient*);
virtual ~WebSocketImpl();
bool isNull() const { return !m_private; }
virtual BinaryType binaryType() const OVERRIDE;
virtual bool setBinaryType(BinaryType) OVERRIDE;
virtual void connect(const WebURL&, const WebString& protocol) OVERRIDE;
virtual WebString subprotocol() OVERRIDE;
virtual WebString extensions() OVERRIDE;
virtual bool sendText(const WebString&) OVERRIDE;
virtual bool sendArrayBuffer(const WebArrayBuffer&) OVERRIDE;
virtual unsigned long bufferedAmount() const OVERRIDE;
virtual void close(int code, const WebString& reason) OVERRIDE;
virtual void fail(const WebString& reason) OVERRIDE;
virtual void disconnect() OVERRIDE;
virtual void didConnect() OVERRIDE;
virtual void didReceiveMessage(const String& message) OVERRIDE;
virtual void didReceiveBinaryData(PassOwnPtr<Vector<char> > binaryData) OVERRIDE;
virtual void didReceiveMessageError() OVERRIDE;
virtual void didUpdateBufferedAmount(unsigned long bufferedAmount) OVERRIDE;
virtual void didStartClosingHandshake() OVERRIDE;
virtual void didClose(unsigned long bufferedAmount, ClosingHandshakeCompletionStatus, unsigned short code, const String& reason) OVERRIDE;
private:
RefPtr<WebCore::WebSocketChannel> m_private;
WebSocketClient* m_client;
BinaryType m_binaryType;
};
}
#endif