| 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 } | |
| 134 | |
| 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 = { | 127 const PPB_WebSocket_Dev_0_1 g_ppb_websocket_0_1_thunk = { |
| 143 &Create, | 128 &Create, |
| 144 &IsWebSocket, | 129 &IsWebSocket, |
| 145 &Connect, | 130 &Connect, |
| 146 &Close, | 131 &Close, |
| 147 &ReceiveMessage, | 132 &ReceiveMessage, |
| 148 &SendMessage, | 133 &SendMessage, |
| 149 &GetBufferedAmount, | 134 &GetBufferedAmount, |
| 150 &GetCloseCode, | 135 &GetCloseCode, |
| 151 &GetCloseReason, | 136 &GetCloseReason, |
| 152 &GetCloseWasClean, | 137 &GetCloseWasClean, |
| 153 &GetExtensions, | 138 &GetExtensions, |
| 154 &GetProtocol, | 139 &GetProtocol, |
| 155 &GetReadyState, | 140 &GetReadyState, |
| 156 &GetURL | 141 &GetURL |
| 157 }; | 142 }; |
| 158 | 143 |
| 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 | |
| 178 } // namespace | 144 } // namespace |
| 179 | 145 |
| 180 const PPB_WebSocket_Dev_0_1* GetPPB_WebSocket_Dev_0_1_Thunk() { | 146 const PPB_WebSocket_Dev_0_1* GetPPB_WebSocket_Dev_0_1_Thunk() { |
| 181 return &g_ppb_websocket_0_1_thunk; | 147 return &g_ppb_websocket_0_1_thunk; |
| 182 } | 148 } |
| 183 | 149 |
| 184 const PPB_WebSocket_Dev_0_9* GetPPB_WebSocket_Dev_0_9_Thunk() { | |
| 185 return &g_ppb_websocket_0_9_thunk; | |
| 186 } | |
| 187 | |
| 188 } // namespace thunk | 150 } // namespace thunk |
| 189 } // namespace ppapi | 151 } // namespace ppapi |
| OLD | NEW |