Index: webkit/plugins/ppapi/ppb_websocket_impl.h |
diff --git a/webkit/plugins/ppapi/ppb_websocket_impl.h b/webkit/plugins/ppapi/ppb_websocket_impl.h |
index a96617171eec1a43cc3b12e572c4caf874cf1f79..1128e6c68276671f6d9b9913b54f2b3b8d150eb3 100644 |
--- a/webkit/plugins/ppapi/ppb_websocket_impl.h |
+++ b/webkit/plugins/ppapi/ppb_websocket_impl.h |
@@ -5,8 +5,18 @@ |
#ifndef WEBKIT_PLUGINS_PPAPI_PPB_WEBSOCKET_IMPL_H_ |
#define WEBKIT_PLUGINS_PPAPI_PPB_WEBSOCKET_IMPL_H_ |
+#include <queue> |
+ |
+#include "base/memory/scoped_ptr.h" |
#include "ppapi/shared_impl/resource.h" |
#include "ppapi/thunk/ppb_websocket_api.h" |
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebSocketClient.h" |
+ |
+struct PPB_Var; |
+ |
+namespace WebKit { |
+class WebSocket; |
+} |
namespace webkit { |
namespace ppapi { |
@@ -14,7 +24,8 @@ namespace ppapi { |
// All implementation is in this class for now. We should move some common |
// implementation to shared_impl when we implement proxy interfaces. |
class PPB_WebSocket_Impl : public ::ppapi::Resource, |
- public ::ppapi::thunk::PPB_WebSocket_API { |
+ public ::ppapi::thunk::PPB_WebSocket_API, |
+ public ::WebKit::WebSocketClient { |
public: |
explicit PPB_WebSocket_Impl(PP_Instance instance); |
virtual ~PPB_WebSocket_Impl(); |
@@ -44,6 +55,43 @@ class PPB_WebSocket_Impl : public ::ppapi::Resource, |
virtual PP_WebSocketReadyState_Dev GetReadyState() OVERRIDE; |
virtual PP_Var GetURL() OVERRIDE; |
+ // WebSocketClient |
dmichael (off chromium)
2011/11/23 17:41:24
nit: "WebSocketClient implementation." ?
Takashi Toyoshima
2011/11/24 03:55:49
Done.
|
+ // TODO(toyoshim): Check if OVERRIDE is needed for following methods. |
Takashi Toyoshima
2011/11/24 03:55:49
Oh, I forget to remove this TODO.
I think followin
dmichael (off chromium)
2011/11/24 04:32:36
Since they're overriding WebKit functions it's opt
|
+ virtual void didConnect(); |
+ virtual void didReceiveMessage(const WebKit::WebString& message); |
+ virtual void didReceiveBinaryData(const WebKit::WebData& binaryData); |
+ virtual void didReceiveMessageError(); |
+ virtual void didStartClosingHandshake(); |
+ virtual void didClose(unsigned long bufferedAmount, |
+ ClosingHandshakeCompletionStatus status, |
+ unsigned short code, |
+ const WebKit::WebString& reason); |
+ private: |
+ int32_t DoReceive(); |
+ PP_Var ReturnVarString(PP_Var var); |
+ |
+ scoped_ptr<WebKit::WebSocket> websocket_; |
+ PP_WebSocketReadyState_Dev state_; |
+ |
+ PP_CompletionCallback connect_callback_; |
+ |
+ PP_CompletionCallback receive_callback_; |
+ PP_Var* receive_callback_var_; |
+ bool wait_for_receive_; |
+ std::queue<PP_Var> received_messages_; |
+ |
+ PP_CompletionCallback close_callback_; |
+ uint16_t close_code_; |
+ PP_Var close_reason_; |
+ PP_Bool close_was_clean_; |
+ |
+ PP_Var extensions_; |
+ PP_Var protocol_; |
+ |
+ const PPB_Var* var_interface_; |
+ PP_Var empty_var_; |
+ PP_Var url_; |
+ |
DISALLOW_COPY_AND_ASSIGN(PPB_WebSocket_Impl); |
}; |