Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(459)

Side by Side Diff: ppapi/thunk/ppb_websocket_thunk.cc

Issue 9192009: WebSocket Pepper API: make the API out of dev (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove binary type handling interfaces Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 return enter.object()->GetExtensions(); 103 return enter.object()->GetExtensions();
104 } 104 }
105 105
106 PP_Var GetProtocol(PP_Resource resource) { 106 PP_Var GetProtocol(PP_Resource resource) {
107 EnterResource<PPB_WebSocket_API> enter(resource, false); 107 EnterResource<PPB_WebSocket_API> enter(resource, false);
108 if (enter.failed()) 108 if (enter.failed())
109 return PP_MakeUndefined(); 109 return PP_MakeUndefined();
110 return enter.object()->GetProtocol(); 110 return enter.object()->GetProtocol();
111 } 111 }
112 112
113 PP_WebSocketReadyState_Dev GetReadyState(PP_Resource resource) { 113 PP_WebSocketReadyState GetReadyState(PP_Resource resource) {
114 EnterResource<PPB_WebSocket_API> enter(resource, false); 114 EnterResource<PPB_WebSocket_API> enter(resource, false);
115 if (enter.failed()) 115 if (enter.failed())
116 return PP_WEBSOCKETREADYSTATE_INVALID_DEV; 116 return PP_WEBSOCKETREADYSTATE_INVALID;
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, 127 const PPB_WebSocket_1_0 g_ppb_websocket_1_0_thunk = {
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 = {
143 &Create, 128 &Create,
144 &IsWebSocket, 129 &IsWebSocket,
145 &Connect, 130 &Connect,
146 &Close,
147 &ReceiveMessage,
148 &SendMessage,
149 &GetBufferedAmount,
150 &GetCloseCode,
151 &GetCloseReason,
152 &GetCloseWasClean,
153 &GetExtensions,
154 &GetProtocol,
155 &GetReadyState,
156 &GetURL
157 };
158
159 const PPB_WebSocket_Dev_0_9 g_ppb_websocket_0_9_thunk = {
160 &Create,
161 &IsWebSocket,
162 &Connect,
163 &Close, 131 &Close,
164 &ReceiveMessage, 132 &ReceiveMessage,
165 &SendMessage, 133 &SendMessage,
166 &GetBufferedAmount, 134 &GetBufferedAmount,
167 &GetCloseCode, 135 &GetCloseCode,
168 &GetCloseReason, 136 &GetCloseReason,
169 &GetCloseWasClean, 137 &GetCloseWasClean,
170 &GetExtensions, 138 &GetExtensions,
171 &GetProtocol, 139 &GetProtocol,
172 &GetReadyState, 140 &GetReadyState,
173 &GetURL, 141 &GetURL,
174 &SetBinaryType,
175 &GetBinaryType
176 }; 142 };
177 143
178 } // namespace 144 } // namespace
179 145
180 const PPB_WebSocket_Dev_0_1* GetPPB_WebSocket_Dev_0_1_Thunk() { 146 const PPB_WebSocket_1_0* GetPPB_WebSocket_1_0_Thunk() {
181 return &g_ppb_websocket_0_1_thunk; 147 return &g_ppb_websocket_1_0_thunk;
182 }
183
184 const PPB_WebSocket_Dev_0_9* GetPPB_WebSocket_Dev_0_9_Thunk() {
185 return &g_ppb_websocket_0_9_thunk;
186 } 148 }
187 149
188 } // namespace thunk 150 } // namespace thunk
189 } // namespace ppapi 151 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698