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 PPAPI_PROXY_WEBSOCKET_RESOURCE_H_ | 5 #ifndef PPAPI_PROXY_WEBSOCKET_RESOURCE_H_ |
6 #define PPAPI_PROXY_WEBSOCKET_RESOURCE_H_ | 6 #define PPAPI_PROXY_WEBSOCKET_RESOURCE_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 | 9 |
10 #include "ppapi/c/ppb_websocket.h" | 10 #include "ppapi/c/ppb_websocket.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 // This class contains protocol checks which doesn't affect security when it | 22 // This class contains protocol checks which doesn't affect security when it |
23 // run with untrusted code. | 23 // run with untrusted code. |
24 class PPAPI_PROXY_EXPORT WebSocketResource | 24 class PPAPI_PROXY_EXPORT WebSocketResource |
25 : public PluginResource, | 25 : public PluginResource, |
26 public NON_EXPORTED_BASE(thunk::PPB_WebSocket_API) { | 26 public NON_EXPORTED_BASE(thunk::PPB_WebSocket_API) { |
27 public: | 27 public: |
28 WebSocketResource(Connection connection, PP_Instance instance); | 28 WebSocketResource(Connection connection, PP_Instance instance); |
29 virtual ~WebSocketResource(); | 29 virtual ~WebSocketResource(); |
30 | 30 |
31 // PluginResource implementation. | 31 // PluginResource implementation. |
32 virtual thunk::PPB_WebSocket_API* AsPPB_WebSocket_API() OVERRIDE; | 32 virtual thunk::PPB_WebSocket_API* AsPPB_WebSocket_API() override; |
33 | 33 |
34 // PPB_WebSocket_API implementation. | 34 // PPB_WebSocket_API implementation. |
35 virtual int32_t Connect(const PP_Var& url, | 35 virtual int32_t Connect(const PP_Var& url, |
36 const PP_Var protocols[], | 36 const PP_Var protocols[], |
37 uint32_t protocol_count, | 37 uint32_t protocol_count, |
38 scoped_refptr<TrackedCallback> callback) OVERRIDE; | 38 scoped_refptr<TrackedCallback> callback) override; |
39 virtual int32_t Close(uint16_t code, | 39 virtual int32_t Close(uint16_t code, |
40 const PP_Var& reason, | 40 const PP_Var& reason, |
41 scoped_refptr<TrackedCallback> callback) OVERRIDE; | 41 scoped_refptr<TrackedCallback> callback) override; |
42 virtual int32_t ReceiveMessage( | 42 virtual int32_t ReceiveMessage( |
43 PP_Var* message, | 43 PP_Var* message, |
44 scoped_refptr<TrackedCallback> callback) OVERRIDE; | 44 scoped_refptr<TrackedCallback> callback) override; |
45 virtual int32_t SendMessage(const PP_Var& message) OVERRIDE; | 45 virtual int32_t SendMessage(const PP_Var& message) override; |
46 virtual uint64_t GetBufferedAmount() OVERRIDE; | 46 virtual uint64_t GetBufferedAmount() override; |
47 virtual uint16_t GetCloseCode() OVERRIDE; | 47 virtual uint16_t GetCloseCode() override; |
48 virtual PP_Var GetCloseReason() OVERRIDE; | 48 virtual PP_Var GetCloseReason() override; |
49 virtual PP_Bool GetCloseWasClean() OVERRIDE; | 49 virtual PP_Bool GetCloseWasClean() override; |
50 virtual PP_Var GetExtensions() OVERRIDE; | 50 virtual PP_Var GetExtensions() override; |
51 virtual PP_Var GetProtocol() OVERRIDE; | 51 virtual PP_Var GetProtocol() override; |
52 virtual PP_WebSocketReadyState GetReadyState() OVERRIDE; | 52 virtual PP_WebSocketReadyState GetReadyState() override; |
53 virtual PP_Var GetURL() OVERRIDE; | 53 virtual PP_Var GetURL() override; |
54 | 54 |
55 private: | 55 private: |
56 // PluginResource override. | 56 // PluginResource override. |
57 virtual void OnReplyReceived(const ResourceMessageReplyParams& params, | 57 virtual void OnReplyReceived(const ResourceMessageReplyParams& params, |
58 const IPC::Message& msg) OVERRIDE; | 58 const IPC::Message& msg) override; |
59 | 59 |
60 // IPC message handlers. | 60 // IPC message handlers. |
61 void OnPluginMsgConnectReply(const ResourceMessageReplyParams& params, | 61 void OnPluginMsgConnectReply(const ResourceMessageReplyParams& params, |
62 const std::string& url, | 62 const std::string& url, |
63 const std::string& protocol); | 63 const std::string& protocol); |
64 void OnPluginMsgCloseReply(const ResourceMessageReplyParams& params, | 64 void OnPluginMsgCloseReply(const ResourceMessageReplyParams& params, |
65 unsigned long buffered_amount, | 65 unsigned long buffered_amount, |
66 bool was_clean, | 66 bool was_clean, |
67 unsigned short code, | 67 unsigned short code, |
68 const std::string& reason); | 68 const std::string& reason); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 // specification. The calculated value can be read via GetBufferedAmount(). | 148 // specification. The calculated value can be read via GetBufferedAmount(). |
149 uint64_t buffered_amount_after_close_; | 149 uint64_t buffered_amount_after_close_; |
150 | 150 |
151 DISALLOW_COPY_AND_ASSIGN(WebSocketResource); | 151 DISALLOW_COPY_AND_ASSIGN(WebSocketResource); |
152 }; | 152 }; |
153 | 153 |
154 } // namespace proxy | 154 } // namespace proxy |
155 } // namespace ppapi | 155 } // namespace ppapi |
156 | 156 |
157 #endif // PPAPI_PROXY_WEBSOCKET_RESOURCE_H_ | 157 #endif // PPAPI_PROXY_WEBSOCKET_RESOURCE_H_ |
OLD | NEW |