Chromium Code Reviews| Index: content/child/websocket_bridge.h |
| diff --git a/content/child/websocket_bridge.h b/content/child/websocket_bridge.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d8fc1dd4dc0f711223339150efab8c69d4b7107b |
| --- /dev/null |
| +++ b/content/child/websocket_bridge.h |
| @@ -0,0 +1,56 @@ |
| +// Copyright (c) 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 "base/basictypes.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: |
| + explicit WebSocketBridge(); |
|
Adam Rice
2013/09/17 14:49:43
Does this "explicit" keyword do anything here?
yhirano
2013/09/18 00:49:30
Thanks, done.
|
| + |
| + // Methods called by WebSocketDispatcher. |
| + void DidConnect(bool fail, |
| + const WebKit::WebString& selected_protocol, |
| + const WebKit::WebString& extensions); |
| + void DidReceiveData(bool fin, |
| + WebSocketHandle::MessageType type, |
| + const char* data, |
| + size_t size); |
| + void DidReceiveFlowControl(int64_t quota); |
| + void DidClose(unsigned short code, const WebKit::WebString& reason); |
| + |
| + // 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(); |
| + int channel_id_; |
| + WebKit::WebSocketHandleClient* client_; |
| + |
| + static const int kInvalidChannelId = -1; |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_CHILD_WEBSOCKET_BRIDGE_H_ |