| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_WEBSOCKET_IMPL_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_WEBSOCKET_IMPL_H_ |
| 6 #define WEBKIT_PLUGINS_PPAPI_PPB_WEBSOCKET_IMPL_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_PPB_WEBSOCKET_IMPL_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 PP_CompletionCallback callbac) OVERRIDE; | 48 PP_CompletionCallback callbac) OVERRIDE; |
| 49 virtual int32_t SendMessage(PP_Var message) OVERRIDE; | 49 virtual int32_t SendMessage(PP_Var message) OVERRIDE; |
| 50 virtual uint64_t GetBufferedAmount() OVERRIDE; | 50 virtual uint64_t GetBufferedAmount() OVERRIDE; |
| 51 virtual uint16_t GetCloseCode() OVERRIDE; | 51 virtual uint16_t GetCloseCode() OVERRIDE; |
| 52 virtual PP_Var GetCloseReason() OVERRIDE; | 52 virtual PP_Var GetCloseReason() OVERRIDE; |
| 53 virtual PP_Bool GetCloseWasClean() OVERRIDE; | 53 virtual PP_Bool GetCloseWasClean() OVERRIDE; |
| 54 virtual PP_Var GetExtensions() OVERRIDE; | 54 virtual PP_Var GetExtensions() OVERRIDE; |
| 55 virtual PP_Var GetProtocol() OVERRIDE; | 55 virtual PP_Var GetProtocol() OVERRIDE; |
| 56 virtual PP_WebSocketReadyState_Dev GetReadyState() OVERRIDE; | 56 virtual PP_WebSocketReadyState_Dev GetReadyState() OVERRIDE; |
| 57 virtual PP_Var GetURL() OVERRIDE; | 57 virtual PP_Var GetURL() OVERRIDE; |
| 58 virtual PP_Bool SetBinaryType( | |
| 59 PP_WebSocketBinaryType_Dev binary_type) OVERRIDE; | |
| 60 virtual PP_WebSocketBinaryType_Dev GetBinaryType() OVERRIDE; | |
| 61 | 58 |
| 62 // WebSocketClient implementation. | 59 // WebSocketClient implementation. |
| 63 virtual void didConnect(); | 60 virtual void didConnect(); |
| 64 virtual void didReceiveMessage(const WebKit::WebString& message); | 61 virtual void didReceiveMessage(const WebKit::WebString& message); |
| 65 virtual void didReceiveArrayBuffer(const WebKit::WebArrayBuffer& binaryData); | 62 virtual void didReceiveArrayBuffer(const WebKit::WebArrayBuffer& binaryData); |
| 66 virtual void didReceiveMessageError(); | 63 virtual void didReceiveMessageError(); |
| 67 virtual void didUpdateBufferedAmount(unsigned long buffered_amount); | 64 virtual void didUpdateBufferedAmount(unsigned long buffered_amount); |
| 68 virtual void didStartClosingHandshake(); | 65 virtual void didStartClosingHandshake(); |
| 69 virtual void didClose(unsigned long unhandled_buffered_amount, | 66 virtual void didClose(unsigned long unhandled_buffered_amount, |
| 70 ClosingHandshakeCompletionStatus status, | 67 ClosingHandshakeCompletionStatus status, |
| 71 unsigned short code, | 68 unsigned short code, |
| 72 const WebKit::WebString& reason); | 69 const WebKit::WebString& reason); |
| 73 private: | 70 private: |
| 74 int32_t DoReceive(); | 71 int32_t DoReceive(); |
| 75 | 72 |
| 76 scoped_ptr<WebKit::WebSocket> websocket_; | 73 scoped_ptr<WebKit::WebSocket> websocket_; |
| 77 PP_WebSocketReadyState_Dev state_; | 74 PP_WebSocketReadyState_Dev state_; |
| 78 WebKit::WebSocket::BinaryType binary_type_; | |
| 79 bool error_was_received_; | 75 bool error_was_received_; |
| 80 | 76 |
| 81 scoped_refptr< ::ppapi::TrackedCallback> connect_callback_; | 77 scoped_refptr< ::ppapi::TrackedCallback> connect_callback_; |
| 82 | 78 |
| 83 scoped_refptr< ::ppapi::TrackedCallback> receive_callback_; | 79 scoped_refptr< ::ppapi::TrackedCallback> receive_callback_; |
| 84 PP_Var* receive_callback_var_; | 80 PP_Var* receive_callback_var_; |
| 85 bool wait_for_receive_; | 81 bool wait_for_receive_; |
| 86 std::queue< scoped_refptr< ::ppapi::Var> > received_messages_; | 82 std::queue< scoped_refptr< ::ppapi::Var> > received_messages_; |
| 87 | 83 |
| 88 scoped_refptr< ::ppapi::TrackedCallback> close_callback_; | 84 scoped_refptr< ::ppapi::TrackedCallback> close_callback_; |
| 89 uint16_t close_code_; | 85 uint16_t close_code_; |
| 90 scoped_refptr< ::ppapi::StringVar> close_reason_; | 86 scoped_refptr< ::ppapi::StringVar> close_reason_; |
| 91 PP_Bool close_was_clean_; | 87 PP_Bool close_was_clean_; |
| 92 | 88 |
| 93 scoped_refptr< ::ppapi::StringVar> empty_string_; | 89 scoped_refptr< ::ppapi::StringVar> empty_string_; |
| 94 scoped_refptr< ::ppapi::StringVar> extensions_; | 90 scoped_refptr< ::ppapi::StringVar> extensions_; |
| 95 scoped_refptr< ::ppapi::StringVar> url_; | 91 scoped_refptr< ::ppapi::StringVar> url_; |
| 96 | 92 |
| 97 uint64_t buffered_amount_; | 93 uint64_t buffered_amount_; |
| 98 uint64_t buffered_amount_after_close_; | 94 uint64_t buffered_amount_after_close_; |
| 99 | 95 |
| 100 DISALLOW_COPY_AND_ASSIGN(PPB_WebSocket_Impl); | 96 DISALLOW_COPY_AND_ASSIGN(PPB_WebSocket_Impl); |
| 101 }; | 97 }; |
| 102 | 98 |
| 103 } // namespace ppapi | 99 } // namespace ppapi |
| 104 } // namespace webkit | 100 } // namespace webkit |
| 105 | 101 |
| 106 #endif // WEBKIT_PLUGINS_PPAPI_PPB_WEBSOCKET_IMPL_H_ | 102 #endif // WEBKIT_PLUGINS_PPAPI_PPB_WEBSOCKET_IMPL_H_ |
| OLD | NEW |