Diff
Modified: trunk/Source/WebCore/ChangeLog (100848 => 100849)
--- trunk/Source/WebCore/ChangeLog 2011-11-19 07:11:05 UTC (rev 100848)
+++ trunk/Source/WebCore/ChangeLog 2011-11-19 07:19:57 UTC (rev 100849)
@@ -1,3 +1,20 @@
+2011-11-18 Takashi Toyoshima <[email protected]>
+
+ [Chromium] [WebSocket] export WebSocketChannel interface for plugins
+ https://bugs.webkit.org/show_bug.cgi?id=72016
+
+ Reviewed by Darin Fisher.
+
+ Add a interface to send raw binary data.
+ This interface is used by WebWebSocketChannel implementation
+ in WebKit API.
+
+ No new tests because just export a interface.
+
+ * websockets/WebSocketChannel.cpp:
+ (WebCore::WebSocketChannel::send):
+ * websockets/WebSocketChannel.h:
+
2011-11-18 Vineet Chaudhary <[email protected]>
https://bugs.webkit.org/show_bug.cgi?id=72591
Modified: trunk/Source/WebCore/websockets/WebSocketChannel.cpp (100848 => 100849)
--- trunk/Source/WebCore/websockets/WebSocketChannel.cpp 2011-11-19 07:11:05 UTC (rev 100848)
+++ trunk/Source/WebCore/websockets/WebSocketChannel.cpp 2011-11-19 07:19:57 UTC (rev 100849)
@@ -186,6 +186,14 @@
return true;
}
+bool WebSocketChannel::send(const char* data, int length)
+{
+ LOG(Network, "WebSocketChannel %p send binary %p (%dB)", this, data, length);
+ ASSERT(!m_useHixie76Protocol);
+ enqueueRawFrame(OpCodeBinary, data, length);
+ return true;
+}
+
unsigned long WebSocketChannel::bufferedAmount() const
{
LOG(Network, "WebSocketChannel %p bufferedAmount", this);
Modified: trunk/Source/WebCore/websockets/WebSocketChannel.h (100848 => 100849)
--- trunk/Source/WebCore/websockets/WebSocketChannel.h 2011-11-19 07:11:05 UTC (rev 100848)
+++ trunk/Source/WebCore/websockets/WebSocketChannel.h 2011-11-19 07:19:57 UTC (rev 100849)
@@ -68,6 +68,7 @@
virtual bool send(const String& message);
virtual bool send(const ArrayBuffer&);
virtual bool send(const Blob&);
+ virtual bool send(const char* data, int length);
virtual unsigned long bufferedAmount() const;
virtual void close(int code, const String& reason); // Start closing handshake.
virtual void fail(const String& reason);
Modified: trunk/Source/WebKit/chromium/ChangeLog (100848 => 100849)
--- trunk/Source/WebKit/chromium/ChangeLog 2011-11-19 07:11:05 UTC (rev 100848)
+++ trunk/Source/WebKit/chromium/ChangeLog 2011-11-19 07:19:57 UTC (rev 100849)
@@ -1,3 +1,52 @@
+2011-11-18 Takashi Toyoshima <[email protected]>
+
+ [Chromium] [WebSocket] export WebSocketChannel interface for plugins
+ https://bugs.webkit.org/show_bug.cgi?id=72016
+
+ Add WebSocket and WebSocketClient to WebKit API.
+
+ Currently, only WebSocketStreamHandle class is exported to WebKit API.
+ WebSocketStreamHandle implements bi-directional communication ports.
+ If plugins handles the WebSocket protocol, WebSocketChannel and
+ WebSocketChannelClient must be exported as WebSocket because they are
+ the classes which implement the WebSocket protocol stack.
+
+ Normally, we use WebWebSocketChannel and WebWebSocketChannelClient as
+ their class names. But here we use just WebSocket and WebSocketClient
+ because of avoiding WebWeb prefix and class name confliction on
+ header include.
+
+ Reviewed by Darin Fisher.
+
+ * WebKit.gyp:
+ * public/WebSocket.h: Added.
+ (WebKit::WebSocket::~WebSocket):
+ * public/WebSocketClient.h: Added.
+ (WebKit::WebSocketClient::~WebSocketClient):
+ * src/WebRuntimeFeatures.cpp: Insert websockets directory to include path in order to avoid filename confliction.
+ (WebKit::WebRuntimeFeatures::enableSockets): Use WebCore namespace explicitly.
+ * src/WebSocket.cpp: Added.
+ (WebKit::WebSocket::create):
+ * src/WebSocketImpl.cpp: Added.
+ (WebKit::WebSocketImpl::WebSocketImpl):
+ (WebKit::WebSocketImpl::~WebSocketImpl):
+ (WebKit::WebSocketImpl::connect):
+ (WebKit::WebSocketImpl::subprotocol):
+ (WebKit::WebSocketImpl::sendText):
+ (WebKit::WebSocketImpl::sendBinary):
+ (WebKit::WebSocketImpl::bufferedAmount):
+ (WebKit::WebSocketImpl::close):
+ (WebKit::WebSocketImpl::fail):
+ (WebKit::WebSocketImpl::disconnect):
+ (WebKit::WebSocketImpl::didConnect):
+ (WebKit::WebSocketImpl::didReceiveMessage):
+ (WebKit::WebSocketImpl::didReceiveBinaryData):
+ (WebKit::WebSocketImpl::didReceiveMessageError):
+ (WebKit::WebSocketImpl::didStartClosingHandshake):
+ (WebKit::WebSocketImpl::didClose):
+ * src/WebSocketImpl.h: Added.
+ (WebKit::WebSocketImpl::isNull):
+
2011-11-18 Alpha Lam <[email protected]>
[chromium] composited layers are blurry with a zoom-in page scale factor
Modified: trunk/Source/WebKit/chromium/WebKit.gyp (100848 => 100849)
--- trunk/Source/WebKit/chromium/WebKit.gyp 2011-11-19 07:11:05 UTC (rev 100848)
+++ trunk/Source/WebKit/chromium/WebKit.gyp 2011-11-19 07:19:57 UTC (rev 100849)
@@ -291,6 +291,8 @@
'public/WebSharedWorker.h',
'public/WebSharedWorkerRepository.h',
'public/WebSize.h',
+ 'public/WebSocket.h',
+ 'public/WebSocketClient.h',
'public/WebSocketStreamError.h',
'public/WebSocketStreamHandle.h',
'public/WebSocketStreamHandleClient.h',
@@ -606,6 +608,9 @@
'src/WebSettingsImpl.h',
'src/WebSharedWorkerImpl.cpp',
'src/WebSharedWorkerImpl.h',
+ 'src/WebSocket.cpp',
+ 'src/WebSocketImpl.cpp',
+ 'src/WebSocketImpl.h',
'src/WebSpeechInputControllerMockImpl.cpp',
'src/WebSpeechInputControllerMockImpl.h',
'src/WebSpeechInputResult.cpp',
Added: trunk/Source/WebKit/chromium/public/WebSocket.h (0 => 100849)
--- trunk/Source/WebKit/chromium/public/WebSocket.h (rev 0)
+++ trunk/Source/WebKit/chromium/public/WebSocket.h 2011-11-19 07:19:57 UTC (rev 100849)
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebSocket_h
+#define WebSocket_h
+
+#include "WebCommon.h"
+#include "WebPrivatePtr.h"
+
+namespace WebCore { class WebSocketChannel; }
+
+namespace WebKit {
+
+class WebData;
+class WebDocument;
+class WebString;
+class WebURL;
+class WebSocketClient;
+
+class WebSocket {
+public:
+ enum CloseEventCode {
+ CloseEventCodeNotSpecified = -1,
+ CloseEventCodeNormalClosure = 1000,
+ CloseEventCodeGoingAway = 1001,
+ CloseEventCodeProtocolError = 1002,
+ CloseEventCodeUnsupportedData = 1003,
+ CloseEventCodeFrameTooLarge = 1004,
+ CloseEventCodeNoStatusRcvd = 1005,
+ CloseEventCodeAbnormalClosure = 1006,
+ CloseEventCodeInvalidUTF8 = 1007,
+ CloseEventCodeMinimumUserDefined = 3000,
+ CloseEventCodeMaximumUserDefined = 4999
+ };
+
+ WEBKIT_EXPORT static WebSocket* create(const WebDocument&, WebSocketClient*);
+ virtual ~WebSocket() { }
+
+ virtual void connect(const WebURL&, const WebString& protocol) = 0;
+ virtual WebString subprotocol() = 0;
+ virtual bool sendText(const WebString& message) = 0;
+ virtual bool sendBinary(const WebData& binaryData) = 0;
+ virtual unsigned long bufferedAmount() const = 0;
+ virtual void close(int code, const WebString& reason) = 0;
+ virtual void fail(const WebString& reason) = 0;
+ virtual void disconnect() = 0;
+};
+
+} // namespace WebKit
+
+#endif // WebSocket_h
Added: trunk/Source/WebKit/chromium/public/WebSocketClient.h (0 => 100849)
--- trunk/Source/WebKit/chromium/public/WebSocketClient.h (rev 0)
+++ trunk/Source/WebKit/chromium/public/WebSocketClient.h 2011-11-19 07:19:57 UTC (rev 100849)
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebSocketClient_h
+#define WebSocketClient_h
+
+#include "WebCommon.h"
+#include "WebData.h"
+
+namespace WebKit {
+
+class WebString;
+
+class WebSocketClient {
+public:
+ enum ClosingHandshakeCompletionStatus {
+ ClosingHandshakeIncomplete,
+ ClosingHandshakeComplete
+ };
+
+ virtual ~WebSocketClient() { }
+ virtual void didConnect() = 0;
+ virtual void didReceiveMessage(const WebString& message) = 0;
+ virtual void didReceiveBinaryData(const WebData& binaryData) = 0;
+ virtual void didReceiveMessageError() = 0;
+ virtual void didStartClosingHandshake() = 0;
+ virtual void didClose(unsigned long bufferedAmount, ClosingHandshakeCompletionStatus, unsigned short code, const WebString& reason) = 0;
+};
+
+} // namespace WebKit
+
+#endif // WebSocketClient_h
Modified: trunk/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp (100848 => 100849)
--- trunk/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp 2011-11-19 07:11:05 UTC (rev 100848)
+++ trunk/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp 2011-11-19 07:19:57 UTC (rev 100849)
@@ -34,7 +34,7 @@
#include "AbstractDatabase.h"
#include "RuntimeEnabledFeatures.h"
#include "WebMediaPlayerClientImpl.h"
-#include "WebSocket.h"
+#include "websockets/WebSocket.h"
#include <wtf/UnusedParam.h>
@@ -101,7 +101,7 @@
void WebRuntimeFeatures::enableSockets(bool enable)
{
#if ENABLE(WEB_SOCKETS)
- WebSocket::setIsAvailable(enable);
+ WebCore::WebSocket::setIsAvailable(enable);
#endif
}
Added: trunk/Source/WebKit/chromium/src/WebSocket.cpp (0 => 100849)
--- trunk/Source/WebKit/chromium/src/WebSocket.cpp (rev 0)
+++ trunk/Source/WebKit/chromium/src/WebSocket.cpp 2011-11-19 07:19:57 UTC (rev 100849)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebSocket.h"
+
+#include "WebSocketImpl.h"
+
+namespace WebKit {
+
+WebSocket* WebSocket::create(const WebDocument& document, WebSocketClient* client)
+{
+ if (!client)
+ return 0;
+
+ OwnPtr<WebSocketImpl> websocket = adoptPtr(new WebSocketImpl(document, client));
+ if (websocket && websocket->isNull())
+ return 0;
+ return websocket.leakPtr();
+}
+
+} // namespace WebKit
Added: trunk/Source/WebKit/chromium/src/WebSocketImpl.cpp (0 => 100849)
--- trunk/Source/WebKit/chromium/src/WebSocketImpl.cpp (rev 0)
+++ trunk/Source/WebKit/chromium/src/WebSocketImpl.cpp 2011-11-19 07:19:57 UTC (rev 100849)
@@ -0,0 +1,202 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebSocketImpl.h"
+
+#include "Document.h"
+#include "KURL.h"
+#if ENABLE(WEB_SOCKETS)
+#include "WebSocketChannel.h"
+#include "WebSocketChannelClient.h"
+#else
+namespace WebCore {
+class WebSocketChannel {
+};
+} // namespace WebCore
+#endif
+
+#include "WebData.h"
+#include "WebDocument.h"
+#include "WebSocketClient.h"
+#include "WebString.h"
+#include "WebURL.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+WebSocketImpl::WebSocketImpl(const WebDocument& document, WebSocketClient* client)
+ : m_client(client)
+{
+#if ENABLE(WEB_SOCKETS)
+ m_private = WebSocketChannel::create(PassRefPtr<Document>(document).get(), this);
+#else
+ ASSERT_NOT_REACHED();
+#endif
+}
+
+WebSocketImpl::~WebSocketImpl()
+{
+#if ENABLE(WEB_SOCKETS)
+ m_private->disconnect();
+#else
+ ASSERT_NOT_REACHED();
+#endif
+}
+
+void WebSocketImpl::connect(const WebURL& url, const WebString& protocol)
+{
+#if ENABLE(WEB_SOCKETS)
+ m_private->connect(url, protocol);
+#else
+ ASSERT_NOT_REACHED();
+#endif
+}
+
+WebString WebSocketImpl::subprotocol()
+{
+#if ENABLE(WEB_SOCKETS)
+ return m_private->subprotocol();
+#else
+ ASSERT_NOT_REACHED();
+#endif
+}
+
+bool WebSocketImpl::sendText(const WebString& message)
+{
+#if ENABLE(WEB_SOCKETS)
+ return m_private->send(message);
+#else
+ ASSERT_NOT_REACHED();
+#endif
+}
+
+bool WebSocketImpl::sendBinary(const WebData& binaryData)
+{
+#if ENABLE(WEB_SOCKETS)
+ return m_private->send(binaryData.data(), binaryData.size());
+#else
+ ASSERT_NOT_REACHED();
+#endif
+}
+
+unsigned long WebSocketImpl::bufferedAmount() const
+{
+#if ENABLE(WEB_SOCKETS)
+ return m_private->bufferedAmount();
+#else
+ ASSERT_NOT_REACHED();
+#endif
+}
+
+void WebSocketImpl::close(int code, const WebString& reason)
+{
+#if ENABLE(WEB_SOCKETS)
+ m_private->close(code, reason);
+#else
+ ASSERT_NOT_REACHED();
+#endif
+}
+
+void WebSocketImpl::fail(const WebString& reason)
+{
+#if ENABLE(WEB_SOCKETS)
+ m_private->fail(reason);
+#else
+ ASSERT_NOT_REACHED();
+#endif
+}
+
+void WebSocketImpl::disconnect()
+{
+#if ENABLE(WEB_SOCKETS)
+ m_private->disconnect();
+ m_client = 0;
+#else
+ ASSERT_NOT_REACHED();
+#endif
+}
+
+void WebSocketImpl::didConnect()
+{
+#if ENABLE(WEB_SOCKETS)
+ m_client->didConnect();
+#else
+ ASSERT_NOT_REACHED();
+#endif
+}
+
+void WebSocketImpl::didReceiveMessage(const String& message)
+{
+#if ENABLE(WEB_SOCKETS)
+ m_client->didReceiveMessage(WebString(message));
+#else
+ ASSERT_NOT_REACHED();
+#endif
+}
+
+void WebSocketImpl::didReceiveBinaryData(PassOwnPtr<Vector<char> > binaryData)
+{
+#if ENABLE(WEB_SOCKETS)
+ m_client->didReceiveBinaryData(WebData(binaryData->data(), binaryData->size()));
+#else
+ ASSERT_NOT_REACHED();
+#endif
+}
+
+void WebSocketImpl::didReceiveMessageError()
+{
+#if ENABLE(WEB_SOCKETS)
+ m_client->didReceiveMessageError();
+#else
+ ASSERT_NOT_REACHED();
+#endif
+}
+
+void WebSocketImpl::didStartClosingHandshake()
+{
+#if ENABLE(WEB_SOCKETS)
+ m_client->didStartClosingHandshake();
+#else
+ ASSERT_NOT_REACHED();
+#endif
+}
+
+void WebSocketImpl::didClose(unsigned long bufferedAmount, ClosingHandshakeCompletionStatus status, unsigned short code, const String& reason)
+{
+#if ENABLE(WEB_SOCKETS)
+ m_client->didClose(bufferedAmount, static_cast<WebSocketClient::ClosingHandshakeCompletionStatus>(status), code, WebString(reason));
+#else
+ ASSERT_NOT_REACHED();
+#endif
+}
+
+} // namespace WebKit
Added: trunk/Source/WebKit/chromium/src/WebSocketImpl.h (0 => 100849)
--- trunk/Source/WebKit/chromium/src/WebSocketImpl.h (rev 0)
+++ trunk/Source/WebKit/chromium/src/WebSocketImpl.h 2011-11-19 07:19:57 UTC (rev 100849)
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebSocketImpl_h
+#define WebSocketImpl_h
+
+#include "WebCommon.h"
+#include "WebSocket.h"
+#include "WebSocketChannelClient.h"
+#include "WebSocketClient.h"
+#include <wtf/OwnPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore { class WebSocketChannel; }
+
+namespace WebKit {
+
+class WebData;
+class WebDocument;
+class WebString;
+class WebURL;
+
+class WebSocketImpl : public WebSocket, public WebCore::WebSocketChannelClient {
+public:
+ WebSocketImpl(const WebDocument&, WebSocketClient*);
+ virtual ~WebSocketImpl();
+
+ bool isNull() const { return !m_private; }
+
+ virtual void connect(const WebURL&, const WebString& protocol);
+ virtual WebString subprotocol();
+ virtual bool sendText(const WebString& message);
+ virtual bool sendBinary(const WebData& binaryData);
+ virtual unsigned long bufferedAmount() const;
+ virtual void close(int code, const WebString& reason);
+ virtual void fail(const WebString& reason);
+ virtual void disconnect();
+
+ // WebSocketChannelClient
+ virtual void didConnect();
+ virtual void didReceiveMessage(const String& message);
+ virtual void didReceiveBinaryData(PassOwnPtr<Vector<char> > binaryData);
+ virtual void didReceiveMessageError();
+ virtual void didStartClosingHandshake();
+ virtual void didClose(unsigned long bufferedAmount, ClosingHandshakeCompletionStatus, unsigned short code, const String& reason);
+
+private:
+ RefPtr<WebCore::WebSocketChannel> m_private;
+ WebSocketClient* m_client;
+};
+
+} // namespace WebKit
+
+#endif // WebWebSocketChannelImpl_h