summaryrefslogtreecommitdiffstats
path: root/content/child/websocket_bridge.h
diff options
context:
space:
mode:
authoryhirano@chromium.org <yhirano@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-24 09:37:31 +0000
committeryhirano@chromium.org <yhirano@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-24 09:37:31 +0000
commitd7d8229037bb3a02e4d2162afccd3821fde23327 (patch)
treef105795bec4780bde8780a43154de19191db020c /content/child/websocket_bridge.h
parentb76ee6f64a25f1a20994fac0e653ac42f8e42ac0 (diff)
downloadchromium_src-d7d8229037bb3a02e4d2162afccd3821fde23327.zip
chromium_src-d7d8229037bb3a02e4d2162afccd3821fde23327.tar.gz
chromium_src-d7d8229037bb3a02e4d2162afccd3821fde23327.tar.bz2
Introduce webkit_glue bridges for the new WebSocket Implementation.
We are implementing the new WebSocket implementation. This CL introduces WebSocketDispatcher, an IPC message dispatcher. WebSocketBridge and other bridge classes are also introduces. Currently this CL doesn't change any behavior because nobody uses the classes yet. BUG=275459 Review URL: https://chromiumcodereview.appspot.com/22815034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@224955 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/child/websocket_bridge.h')
-rw-r--r--content/child/websocket_bridge.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/content/child/websocket_bridge.h b/content/child/websocket_bridge.h
new file mode 100644
index 0000000..4834c40
--- /dev/null
+++ b/content/child/websocket_bridge.h
@@ -0,0 +1,64 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_CHILD_WEBSOCKET_BRIDGE_H_
+#define CONTENT_CHILD_WEBSOCKET_BRIDGE_H_
+
+#include <stdint.h>
+#include <string>
+#include <vector>
+
+#include "base/basictypes.h"
+#include "content/common/websocket.h"
+#include "ipc/ipc_message.h"
+#include "third_party/WebKit/public/platform/WebSocketHandle.h"
+#include "third_party/WebKit/public/platform/WebString.h"
+#include "third_party/WebKit/public/platform/WebURL.h"
+#include "third_party/WebKit/public/platform/WebVector.h"
+
+namespace content {
+
+class WebSocketBridge : public WebKit::WebSocketHandle {
+ public:
+ WebSocketBridge();
+
+ // Handles an IPC message from the browser process.
+ bool OnMessageReceived(const IPC::Message& message);
+
+ // WebSocketHandle functions.
+ virtual void connect(const WebKit::WebURL& url,
+ const WebKit::WebVector<WebKit::WebString>& protocols,
+ const WebKit::WebString& origin,
+ WebKit::WebSocketHandleClient* client) OVERRIDE;
+ virtual void send(bool fin,
+ WebSocketHandle::MessageType type,
+ const char* data,
+ size_t size) OVERRIDE;
+ virtual void flowControl(int64_t quota) OVERRIDE;
+ virtual void close(unsigned short code,
+ const WebKit::WebString& reason) OVERRIDE;
+
+ virtual void Disconnect();
+
+ private:
+ virtual ~WebSocketBridge();
+
+ void DidConnect(bool fail,
+ const std::string& selected_protocol,
+ const std::string& extensions);
+ void DidReceiveData(bool fin,
+ WebSocketMessageType type,
+ const std::vector<char>& data);
+ void DidReceiveFlowControl(int64_t quota);
+ void DidClose(unsigned short code, const std::string& reason);
+
+ int channel_id_;
+ WebKit::WebSocketHandleClient* client_;
+
+ static const int kInvalidChannelId = -1;
+};
+
+} // namespace content
+
+#endif // CONTENT_CHILD_WEBSOCKET_BRIDGE_H_