2009-09-11 Fumitoshi Ukai <ukai@chromium.org>
authorukai@chromium.org <ukai@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Sep 2009 05:42:58 +0000 (05:42 +0000)
committerukai@chromium.org <ukai@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Sep 2009 05:42:58 +0000 (05:42 +0000)
        Reviewed by Adam Barth.

        Add platform code to support WebSocket for chromium.
        https://bugs.webkit.org/show_bug.cgi?id=29171

        To build within chromium tree, it requires a patch in bug 29174.
        Real implementation will be landed in chromium tree.

        * WebCore.gypi:
        * platform/network/chromium/SocketStreamError.h: Added.
        (WebCore::SocketStreamError::SocketStreamError):
        * platform/network/chromium/SocketStreamHandle.h: Added.
        (WebCore::SocketStreamHandle::create):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@48859 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/WebCore.gypi
WebCore/platform/network/chromium/SocketStreamError.h [new file with mode: 0644]
WebCore/platform/network/chromium/SocketStreamHandle.h [new file with mode: 0644]

index 790df0b..5a7e8f9 100644 (file)
@@ -1,3 +1,19 @@
+2009-09-11  Fumitoshi Ukai  <ukai@chromium.org>
+
+        Reviewed by Adam Barth.
+
+        Add platform code to support WebSocket for chromium.
+        https://bugs.webkit.org/show_bug.cgi?id=29171
+
+        To build within chromium tree, it requires a patch in bug 29174.
+        Real implementation will be landed in chromium tree.
+
+        * WebCore.gypi:
+        * platform/network/chromium/SocketStreamError.h: Added.
+        (WebCore::SocketStreamError::SocketStreamError):
+        * platform/network/chromium/SocketStreamHandle.h: Added.
+        (WebCore::SocketStreamHandle::create):
+
 2009-09-28  Dan Bernstein  <mitz@apple.com>
 
         Reviewed by Sam Weinig.
index 6d03260..a4e8666 100644 (file)
             'svg/SVGViewSpec.idl',
             'svg/SVGZoomAndPan.idl',
             'svg/SVGZoomEvent.idl',
+            'websockets/WebSocket.idl',
             'workers/AbstractWorker.idl',
             'workers/DedicatedWorkerContext.idl',
             'workers/SharedWorker.idl',
             'bindings/js/JSWebKitCSSMatrixConstructor.h',
             'bindings/js/JSWebKitPointConstructor.cpp',
             'bindings/js/JSWebKitPointConstructor.h',
+            'bindings/js/JSWebSocketConstructor.cpp',
+            'bindings/js/JSWebSocketConsuructor.h',
+            'bindings/js/JSWebSocketCustom.cpp',
             'bindings/js/JSWorkerConstructor.cpp',
             'bindings/js/JSWorkerConstructor.h',
             'bindings/js/JSWorkerContextBase.cpp',
             'bindings/v8/custom/V8TreeWalkerCustom.cpp',
             'bindings/v8/custom/V8WebKitCSSMatrixConstructor.cpp',
             'bindings/v8/custom/V8WebKitPointConstructor.cpp',
+            'bindings/v8/custom/V8WebSocketCustom.cpp',
             'bindings/v8/custom/V8WorkerContextCustom.cpp',
             'bindings/v8/custom/V8WorkerCustom.cpp',
             'bindings/v8/custom/V8XMLHttpRequestConstructor.cpp',
             'platform/network/cf/ResourceResponse.h',
             'platform/network/cf/ResourceResponseCFNet.cpp',
             'platform/network/cf/ResourceResponseCFNet.h',
+            'platform/network/cf/SocketStreamError.h',
+            'platform/network/cf/SocketStreamHandle.h',
+            'platform/network/cf/SocketStreamHandleCFNet.cpp',
             'platform/network/chromium/AuthenticationChallenge.h',
             'platform/network/chromium/AuthenticationChallengeChromium.cpp',
             'platform/network/chromium/CookieJarChromium.cpp',
             'platform/network/chromium/ResourceError.h',
             'platform/network/chromium/ResourceRequest.h',
             'platform/network/chromium/ResourceResponse.h',
+            'platform/network/chromium/SocketStreamError.h',
+            'platform/network/chromium/SocketStreamHandle.h',
             'platform/network/curl/AuthenticationChallenge.h',
             'platform/network/curl/CookieJarCurl.cpp',
             'platform/network/curl/DNSCurl.cpp',
             'platform/network/soup/ResourceHandleSoup.cpp',
             'platform/network/soup/ResourceRequest.h',
             'platform/network/soup/ResourceResponse.h',
+            'platform/network/soup/SocketStreamError.h',
+            'platform/network/soup/SocketStreamHandle.h',
+            'platform/network/soup/SocketStreamHandleSoup.cpp',
             'platform/network/soup/webkit-soup-auth-dialog.c',
             'platform/network/soup/webkit-soup-auth-dialog.h',
             'platform/network/win/CookieJarCFNetWin.cpp',
             'platform/network/ResourceRequestBase.h',
             'platform/network/ResourceResponseBase.cpp',
             'platform/network/ResourceResponseBase.h',
+            'platform/network/SocketStreamErrorBase.cpp',
+            'platform/network/SocketStreamErrorBase.h',
+            'platform/network/SocketStreamHandleBase.cpp',
+            'platform/network/SocketStreamHandleBase.h',
+            'platform/network/SocketStreamHandleClient.h',
             'platform/posix/FileSystemPOSIX.cpp',
             'platform/qt/ClipboardQt.cpp',
             'platform/qt/ClipboardQt.h',
             'svg/SVGZoomEvent.cpp',
             'svg/SVGZoomEvent.h',
             'svg/SynchronizableTypeWrapper.h',
+            'websockets/WebSocket.cpp',
+            'websockets/WebSocket.h',
+            'websockets/WebSocketChannel.cpp',
+            'websockets/WebSocketChannel.h',
+            'websockets/WebSocketChannelClient.h',
+            'websockets/WebSocketHandshake.cpp',
+            'websockets/WebSocketHandshake.h',
             'workers/AbstractWorker.cpp',
             'workers/AbstractWorker.h',
             'workers/DedicatedWorkerContext.cpp',
diff --git a/WebCore/platform/network/chromium/SocketStreamError.h b/WebCore/platform/network/chromium/SocketStreamError.h
new file mode 100644 (file)
index 0000000..540496b
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2009 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 SocketStreamError_h
+#define SocketStreamError_h
+
+#include "SocketStreamErrorBase.h"
+
+namespace WebCore {
+
+class SocketStreamError : public SocketStreamErrorBase {
+public:
+    SocketStreamError() { }
+    explicit SocketStreamError(int errorCode)
+            : SocketStreamErrorBase(errorCode) { }
+};
+
+}  // namespace WebCore
+
+#endif  // SocketStreamError_h
diff --git a/WebCore/platform/network/chromium/SocketStreamHandle.h b/WebCore/platform/network/chromium/SocketStreamHandle.h
new file mode 100644 (file)
index 0000000..5a905cb
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 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 SocketStreamHandle_h
+#define SocketStreamHandle_h
+
+#include "SocketStreamHandleBase.h"
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+    class AuthenticationChallenge;
+    class Credential;
+    class SocketStreamHandleClient;
+    class SocketStreamHandleInternal;
+
+    class SocketStreamHandle : public RefCounted<SocketStreamHandle>, public SocketStreamHandleBase {
+    public:
+        static PassRefPtr<SocketStreamHandle> create(const KURL& url, SocketStreamHandleClient* client) { return adoptRef(new SocketStreamHandle(url, client)); }
+
+        virtual ~SocketStreamHandle();
+
+    protected:
+        virtual int platformSend(const char* data, int length);
+        virtual void platformClose();
+
+    private:
+        SocketStreamHandle(const KURL&, SocketStreamHandleClient*);
+
+        // No authentication for streams per se, but proxy may ask for credentials.
+        void didReceiveAuthenticationChallenge(const AuthenticationChallenge&);
+        void receivedCredential(const AuthenticationChallenge&, const Credential&);
+        void receivedRequestToContinueWithoutCredential(const AuthenticationChallenge&);
+        void receivedCancellation(const AuthenticationChallenge&);
+
+        friend class SocketStreamHandleInternal;
+        OwnPtr<SocketStreamHandleInternal> m_internal;
+    };
+
+}  // namespace WebCore
+
+#endif  // SocketStreamHandle_h