Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_CHILD_WEBSOCKET_BRIDGE_H_ | |
| 6 #define CONTENT_CHILD_WEBSOCKET_BRIDGE_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "third_party/WebKit/public/platform/WebSocketHandle.h" | |
| 10 #include "third_party/WebKit/public/platform/WebString.h" | |
| 11 #include "third_party/WebKit/public/platform/WebURL.h" | |
| 12 #include "third_party/WebKit/public/platform/WebVector.h" | |
| 13 | |
| 14 namespace content { | |
| 15 | |
| 16 class WebSocketBridge : public WebKit::WebSocketHandle { | |
| 17 public: | |
| 18 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.
| |
| 19 | |
| 20 // Methods called by WebSocketDispatcher. | |
| 21 void DidConnect(bool fail, | |
| 22 const WebKit::WebString& selected_protocol, | |
| 23 const WebKit::WebString& extensions); | |
| 24 void DidReceiveData(bool fin, | |
| 25 WebSocketHandle::MessageType type, | |
| 26 const char* data, | |
| 27 size_t size); | |
| 28 void DidReceiveFlowControl(int64_t quota); | |
| 29 void DidClose(unsigned short code, const WebKit::WebString& reason); | |
| 30 | |
| 31 // WebSocketHandle functions. | |
| 32 virtual void connect(const WebKit::WebURL& url, | |
| 33 const WebKit::WebVector<WebKit::WebString>& protocols, | |
| 34 const WebKit::WebString& origin, | |
| 35 WebKit::WebSocketHandleClient* client) OVERRIDE; | |
| 36 virtual void send(bool fin, | |
| 37 WebSocketHandle::MessageType type, | |
| 38 const char* data, | |
| 39 size_t size) OVERRIDE; | |
| 40 virtual void flowControl(int64_t quota) OVERRIDE; | |
| 41 virtual void close(unsigned short code, | |
| 42 const WebKit::WebString& reason) OVERRIDE; | |
| 43 | |
| 44 virtual void Disconnect(); | |
| 45 | |
| 46 private: | |
| 47 virtual ~WebSocketBridge(); | |
| 48 int channel_id_; | |
| 49 WebKit::WebSocketHandleClient* client_; | |
| 50 | |
| 51 static const int kInvalidChannelId = -1; | |
| 52 }; | |
| 53 | |
| 54 } // namespace content | |
| 55 | |
| 56 #endif // CONTENT_CHILD_WEBSOCKET_BRIDGE_H_ | |
| OLD | NEW |