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 #include "ppapi/c/pp_errors.h" | 5 #include "ppapi/c/pp_errors.h" |
6 #include "ppapi/c/pp_var.h" | 6 #include "ppapi/c/pp_var.h" |
7 #include "ppapi/thunk/common.h" | 7 #include "ppapi/thunk/common.h" |
8 #include "ppapi/thunk/thunk.h" | 8 #include "ppapi/thunk/thunk.h" |
9 #include "ppapi/thunk/enter.h" | 9 #include "ppapi/thunk/enter.h" |
10 #include "ppapi/thunk/ppb_websocket_api.h" | 10 #include "ppapi/thunk/ppb_websocket_api.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 return enter.object()->GetReadyState(); | 117 return enter.object()->GetReadyState(); |
118 } | 118 } |
119 | 119 |
120 PP_Var GetURL(PP_Resource resource) { | 120 PP_Var GetURL(PP_Resource resource) { |
121 EnterResource<PPB_WebSocket_API> enter(resource, false); | 121 EnterResource<PPB_WebSocket_API> enter(resource, false); |
122 if (enter.failed()) | 122 if (enter.failed()) |
123 return PP_MakeUndefined(); | 123 return PP_MakeUndefined(); |
124 return enter.object()->GetURL(); | 124 return enter.object()->GetURL(); |
125 } | 125 } |
126 | 126 |
| 127 PP_Bool SetBinaryType(PP_Resource resource, |
| 128 PP_WebSocketBinaryType_Dev binary_type) { |
| 129 EnterResource<PPB_WebSocket_API> enter(resource, false); |
| 130 if (enter.failed()) |
| 131 return PP_FALSE; |
| 132 return enter.object()->SetBinaryType(binary_type); |
| 133 } |
127 | 134 |
128 const PPB_WebSocket_Dev g_ppb_websocket_thunk = { | 135 PP_WebSocketBinaryType_Dev GetBinaryType(PP_Resource resource) { |
| 136 EnterResource<PPB_WebSocket_API> enter(resource, false); |
| 137 if (enter.failed()) |
| 138 return PP_WEBSOCKETBINARYTYPE_INVALID; |
| 139 return enter.object()->GetBinaryType(); |
| 140 } |
| 141 |
| 142 const PPB_WebSocket_Dev_0_1 g_ppb_websocket_0_1_thunk = { |
129 &Create, | 143 &Create, |
130 &IsWebSocket, | 144 &IsWebSocket, |
131 &Connect, | 145 &Connect, |
132 &Close, | 146 &Close, |
133 &ReceiveMessage, | 147 &ReceiveMessage, |
134 &SendMessage, | 148 &SendMessage, |
135 &GetBufferedAmount, | 149 &GetBufferedAmount, |
136 &GetCloseCode, | 150 &GetCloseCode, |
137 &GetCloseReason, | 151 &GetCloseReason, |
138 &GetCloseWasClean, | 152 &GetCloseWasClean, |
139 &GetExtensions, | 153 &GetExtensions, |
140 &GetProtocol, | 154 &GetProtocol, |
141 &GetReadyState, | 155 &GetReadyState, |
142 &GetURL | 156 &GetURL |
143 }; | 157 }; |
144 | 158 |
| 159 const PPB_WebSocket_Dev_0_9 g_ppb_websocket_0_9_thunk = { |
| 160 &Create, |
| 161 &IsWebSocket, |
| 162 &Connect, |
| 163 &Close, |
| 164 &ReceiveMessage, |
| 165 &SendMessage, |
| 166 &GetBufferedAmount, |
| 167 &GetCloseCode, |
| 168 &GetCloseReason, |
| 169 &GetCloseWasClean, |
| 170 &GetExtensions, |
| 171 &GetProtocol, |
| 172 &GetReadyState, |
| 173 &GetURL, |
| 174 &SetBinaryType, |
| 175 &GetBinaryType |
| 176 }; |
| 177 |
145 } // namespace | 178 } // namespace |
146 | 179 |
147 const PPB_WebSocket_Dev_0_1* GetPPB_WebSocket_Dev_0_1_Thunk() { | 180 const PPB_WebSocket_Dev_0_1* GetPPB_WebSocket_Dev_0_1_Thunk() { |
148 return &g_ppb_websocket_thunk; | 181 return &g_ppb_websocket_0_1_thunk; |
| 182 } |
| 183 |
| 184 const PPB_WebSocket_Dev_0_9* GetPPB_WebSocket_Dev_0_9_Thunk() { |
| 185 return &g_ppb_websocket_0_9_thunk; |
149 } | 186 } |
150 | 187 |
151 } // namespace thunk | 188 } // namespace thunk |
152 } // namespace ppapi | 189 } // namespace ppapi |
OLD | NEW |