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

Side by Side Diff: ppapi/proxy/resource_creation_proxy.cc

Issue 10116003: Add #ifdefs to separate NaCl and non-NaCl PPAPI Proxy code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 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
« no previous file with comments | « ppapi/proxy/resource_creation_proxy.h ('k') | ppapi/shared_impl/ppb_instance_shared.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/proxy/resource_creation_proxy.h" 5 #include "ppapi/proxy/resource_creation_proxy.h"
6 6
7 #include "ppapi/c/pp_errors.h" 7 #include "ppapi/c/pp_errors.h"
8 #include "ppapi/c/pp_size.h" 8 #include "ppapi/c/pp_size.h"
9 #include "ppapi/c/trusted/ppb_image_data_trusted.h" 9 #include "ppapi/c/trusted/ppb_image_data_trusted.h"
10 #include "ppapi/proxy/plugin_dispatcher.h" 10 #include "ppapi/proxy/plugin_dispatcher.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 // static 60 // static
61 InterfaceProxy* ResourceCreationProxy::Create(Dispatcher* dispatcher) { 61 InterfaceProxy* ResourceCreationProxy::Create(Dispatcher* dispatcher) {
62 return new ResourceCreationProxy(dispatcher); 62 return new ResourceCreationProxy(dispatcher);
63 } 63 }
64 64
65 ResourceCreationAPI* ResourceCreationProxy::AsResourceCreationAPI() { 65 ResourceCreationAPI* ResourceCreationProxy::AsResourceCreationAPI() {
66 return this; 66 return this;
67 } 67 }
68 68
69 PP_Resource ResourceCreationProxy::CreateFileIO(PP_Instance instance) {
70 return PPB_FileIO_Proxy::CreateProxyResource(instance);
71 }
72
73 PP_Resource ResourceCreationProxy::CreateFileRef(PP_Resource file_system,
74 const char* path) {
75 return PPB_FileRef_Proxy::CreateProxyResource(file_system, path);
76 }
77
78 PP_Resource ResourceCreationProxy::CreateFileSystem(
79 PP_Instance instance,
80 PP_FileSystemType type) {
81 return PPB_FileSystem_Proxy::CreateProxyResource(instance, type);
82 }
83
84 PP_Resource ResourceCreationProxy::CreateKeyboardInputEvent(
85 PP_Instance instance,
86 PP_InputEvent_Type type,
87 PP_TimeTicks time_stamp,
88 uint32_t modifiers,
89 uint32_t key_code,
90 struct PP_Var character_text) {
91 if (type != PP_INPUTEVENT_TYPE_RAWKEYDOWN &&
92 type != PP_INPUTEVENT_TYPE_KEYDOWN &&
93 type != PP_INPUTEVENT_TYPE_KEYUP &&
94 type != PP_INPUTEVENT_TYPE_CHAR)
95 return 0;
96 InputEventData data;
97 data.event_type = type;
98 data.event_time_stamp = time_stamp;
99 data.event_modifiers = modifiers;
100 data.key_code = key_code;
101 if (character_text.type == PP_VARTYPE_STRING) {
102 StringVar* text_str = StringVar::FromPPVar(character_text);
103 if (!text_str)
104 return 0;
105 data.character_text = text_str->value();
106 }
107
108 return (new PPB_InputEvent_Shared(OBJECT_IS_PROXY,
109 instance, data))->GetReference();
110 }
111
112 PP_Resource ResourceCreationProxy::CreateMouseInputEvent(
113 PP_Instance instance,
114 PP_InputEvent_Type type,
115 PP_TimeTicks time_stamp,
116 uint32_t modifiers,
117 PP_InputEvent_MouseButton mouse_button,
118 const PP_Point* mouse_position,
119 int32_t click_count,
120 const PP_Point* mouse_movement) {
121 if (type != PP_INPUTEVENT_TYPE_MOUSEDOWN &&
122 type != PP_INPUTEVENT_TYPE_MOUSEUP &&
123 type != PP_INPUTEVENT_TYPE_MOUSEMOVE &&
124 type != PP_INPUTEVENT_TYPE_MOUSEENTER &&
125 type != PP_INPUTEVENT_TYPE_MOUSELEAVE)
126 return 0;
127
128 InputEventData data;
129 data.event_type = type;
130 data.event_time_stamp = time_stamp;
131 data.event_modifiers = modifiers;
132 data.mouse_button = mouse_button;
133 data.mouse_position = *mouse_position;
134 data.mouse_click_count = click_count;
135 data.mouse_movement = *mouse_movement;
136
137 return (new PPB_InputEvent_Shared(OBJECT_IS_PROXY,
138 instance, data))->GetReference();
139 }
140
141 PP_Resource ResourceCreationProxy::CreateResourceArray(
142 PP_Instance instance,
143 const PP_Resource elements[],
144 uint32_t size) {
145 PPB_ResourceArray_Shared* object = new PPB_ResourceArray_Shared(
146 OBJECT_IS_PROXY, instance, elements, size);
147 return object->GetReference();
148 }
149
150 PP_Resource ResourceCreationProxy::CreateURLLoader(PP_Instance instance) {
151 return PPB_URLLoader_Proxy::CreateProxyResource(instance);
152 }
153
154 PP_Resource ResourceCreationProxy::CreateURLRequestInfo(
155 PP_Instance instance,
156 const PPB_URLRequestInfo_Data& data) {
157 return (new PPB_URLRequestInfo_Shared(OBJECT_IS_PROXY,
158 instance, data))->GetReference();
159 }
160
161 PP_Resource ResourceCreationProxy::CreateWheelInputEvent(
162 PP_Instance instance,
163 PP_TimeTicks time_stamp,
164 uint32_t modifiers,
165 const PP_FloatPoint* wheel_delta,
166 const PP_FloatPoint* wheel_ticks,
167 PP_Bool scroll_by_page) {
168 InputEventData data;
169 data.event_type = PP_INPUTEVENT_TYPE_WHEEL;
170 data.event_time_stamp = time_stamp;
171 data.event_modifiers = modifiers;
172 data.wheel_delta = *wheel_delta;
173 data.wheel_ticks = *wheel_ticks;
174 data.wheel_scroll_by_page = PP_ToBool(scroll_by_page);
175
176 return (new PPB_InputEvent_Shared(OBJECT_IS_PROXY,
177 instance, data))->GetReference();
178 }
179
180 #if !defined(OS_NACL)
69 PP_Resource ResourceCreationProxy::CreateAudio( 181 PP_Resource ResourceCreationProxy::CreateAudio(
70 PP_Instance instance, 182 PP_Instance instance,
71 PP_Resource config_id, 183 PP_Resource config_id,
72 PPB_Audio_Callback audio_callback, 184 PPB_Audio_Callback audio_callback,
73 void* user_data) { 185 void* user_data) {
74 return PPB_Audio_Proxy::CreateProxyResource(instance, config_id, 186 return PPB_Audio_Proxy::CreateProxyResource(instance, config_id,
75 audio_callback, user_data); 187 audio_callback, user_data);
76 } 188 }
77 189
78 PP_Resource ResourceCreationProxy::CreateAudioConfig( 190 PP_Resource ResourceCreationProxy::CreateAudioConfig(
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 } 241 }
130 242
131 PP_Resource ResourceCreationProxy::CreateFileChooser( 243 PP_Resource ResourceCreationProxy::CreateFileChooser(
132 PP_Instance instance, 244 PP_Instance instance,
133 PP_FileChooserMode_Dev mode, 245 PP_FileChooserMode_Dev mode,
134 const char* accept_mime_types) { 246 const char* accept_mime_types) {
135 return PPB_FileChooser_Proxy::CreateProxyResource(instance, mode, 247 return PPB_FileChooser_Proxy::CreateProxyResource(instance, mode,
136 accept_mime_types); 248 accept_mime_types);
137 } 249 }
138 250
139 PP_Resource ResourceCreationProxy::CreateFileIO(PP_Instance instance) {
140 return PPB_FileIO_Proxy::CreateProxyResource(instance);
141 }
142
143 PP_Resource ResourceCreationProxy::CreateFileRef(PP_Resource file_system,
144 const char* path) {
145 return PPB_FileRef_Proxy::CreateProxyResource(file_system, path);
146 }
147
148 PP_Resource ResourceCreationProxy::CreateFileSystem(
149 PP_Instance instance,
150 PP_FileSystemType type) {
151 return PPB_FileSystem_Proxy::CreateProxyResource(instance, type);
152 }
153
154 #if !defined(OS_NACL)
155 PP_Resource ResourceCreationProxy::CreateFlashMenu( 251 PP_Resource ResourceCreationProxy::CreateFlashMenu(
156 PP_Instance instance, 252 PP_Instance instance,
157 const PP_Flash_Menu* menu_data) { 253 const PP_Flash_Menu* menu_data) {
158 return PPB_Flash_Menu_Proxy::CreateProxyResource(instance, menu_data); 254 return PPB_Flash_Menu_Proxy::CreateProxyResource(instance, menu_data);
159 } 255 }
160 256
161 PP_Resource ResourceCreationProxy::CreateFlashMessageLoop( 257 PP_Resource ResourceCreationProxy::CreateFlashMessageLoop(
162 PP_Instance instance) { 258 PP_Instance instance) {
163 return PPB_Flash_MessageLoop_Proxy::CreateProxyResource(instance); 259 return PPB_Flash_MessageLoop_Proxy::CreateProxyResource(instance);
164 } 260 }
165 #endif // !defined(OS_NACL)
166 261
167 PP_Resource ResourceCreationProxy::CreateGraphics2D(PP_Instance instance, 262 PP_Resource ResourceCreationProxy::CreateGraphics2D(PP_Instance instance,
168 const PP_Size& size, 263 const PP_Size& size,
169 PP_Bool is_always_opaque) { 264 PP_Bool is_always_opaque) {
170 return PPB_Graphics2D_Proxy::CreateProxyResource(instance, size, 265 return PPB_Graphics2D_Proxy::CreateProxyResource(instance, size,
171 is_always_opaque); 266 is_always_opaque);
172 } 267 }
173 268
174 PP_Resource ResourceCreationProxy::CreateHostResolverPrivate( 269 PP_Resource ResourceCreationProxy::CreateHostResolverPrivate(
175 PP_Instance instance) { 270 PP_Instance instance) {
176 return PPB_HostResolver_Private_Proxy::CreateProxyResource(instance); 271 return PPB_HostResolver_Private_Proxy::CreateProxyResource(instance);
177 } 272 }
178 273
179 PP_Resource ResourceCreationProxy::CreateImageData(PP_Instance instance, 274 PP_Resource ResourceCreationProxy::CreateImageData(PP_Instance instance,
180 PP_ImageDataFormat format, 275 PP_ImageDataFormat format,
181 const PP_Size& size, 276 const PP_Size& size,
182 PP_Bool init_to_zero) { 277 PP_Bool init_to_zero) {
183 return PPB_ImageData_Proxy::CreateProxyResource(instance, format, size, 278 return PPB_ImageData_Proxy::CreateProxyResource(instance, format, size,
184 init_to_zero); 279 init_to_zero);
185 } 280 }
186 281
187 PP_Resource ResourceCreationProxy::CreateKeyboardInputEvent(
188 PP_Instance instance,
189 PP_InputEvent_Type type,
190 PP_TimeTicks time_stamp,
191 uint32_t modifiers,
192 uint32_t key_code,
193 struct PP_Var character_text) {
194 if (type != PP_INPUTEVENT_TYPE_RAWKEYDOWN &&
195 type != PP_INPUTEVENT_TYPE_KEYDOWN &&
196 type != PP_INPUTEVENT_TYPE_KEYUP &&
197 type != PP_INPUTEVENT_TYPE_CHAR)
198 return 0;
199 InputEventData data;
200 data.event_type = type;
201 data.event_time_stamp = time_stamp;
202 data.event_modifiers = modifiers;
203 data.key_code = key_code;
204 if (character_text.type == PP_VARTYPE_STRING) {
205 StringVar* text_str = StringVar::FromPPVar(character_text);
206 if (!text_str)
207 return 0;
208 data.character_text = text_str->value();
209 }
210
211 return (new PPB_InputEvent_Shared(OBJECT_IS_PROXY,
212 instance, data))->GetReference();
213 }
214
215 PP_Resource ResourceCreationProxy::CreateMouseInputEvent(
216 PP_Instance instance,
217 PP_InputEvent_Type type,
218 PP_TimeTicks time_stamp,
219 uint32_t modifiers,
220 PP_InputEvent_MouseButton mouse_button,
221 const PP_Point* mouse_position,
222 int32_t click_count,
223 const PP_Point* mouse_movement) {
224 if (type != PP_INPUTEVENT_TYPE_MOUSEDOWN &&
225 type != PP_INPUTEVENT_TYPE_MOUSEUP &&
226 type != PP_INPUTEVENT_TYPE_MOUSEMOVE &&
227 type != PP_INPUTEVENT_TYPE_MOUSEENTER &&
228 type != PP_INPUTEVENT_TYPE_MOUSELEAVE)
229 return 0;
230
231 InputEventData data;
232 data.event_type = type;
233 data.event_time_stamp = time_stamp;
234 data.event_modifiers = modifiers;
235 data.mouse_button = mouse_button;
236 data.mouse_position = *mouse_position;
237 data.mouse_click_count = click_count;
238 data.mouse_movement = *mouse_movement;
239
240 return (new PPB_InputEvent_Shared(OBJECT_IS_PROXY,
241 instance, data))->GetReference();
242 }
243
244 PP_Resource ResourceCreationProxy::CreateNetworkMonitor( 282 PP_Resource ResourceCreationProxy::CreateNetworkMonitor(
245 PP_Instance instance, 283 PP_Instance instance,
246 PPB_NetworkMonitor_Callback callback, 284 PPB_NetworkMonitor_Callback callback,
247 void* user_data) { 285 void* user_data) {
248 return PPB_NetworkMonitor_Private_Proxy::CreateProxyResource( 286 return PPB_NetworkMonitor_Private_Proxy::CreateProxyResource(
249 instance, callback, user_data); 287 instance, callback, user_data);
250 } 288 }
251 289
252 PP_Resource ResourceCreationProxy::CreateGraphics3D( 290 PP_Resource ResourceCreationProxy::CreateGraphics3D(
253 PP_Instance instance, 291 PP_Instance instance,
254 PP_Resource share_context, 292 PP_Resource share_context,
255 const int32_t* attrib_list) { 293 const int32_t* attrib_list) {
256 return PPB_Graphics3D_Proxy::CreateProxyResource( 294 return PPB_Graphics3D_Proxy::CreateProxyResource(
257 instance, share_context, attrib_list); 295 instance, share_context, attrib_list);
258 } 296 }
259 297
260 PP_Resource ResourceCreationProxy::CreateGraphics3DRaw( 298 PP_Resource ResourceCreationProxy::CreateGraphics3DRaw(
261 PP_Instance instance, 299 PP_Instance instance,
262 PP_Resource share_context, 300 PP_Resource share_context,
263 const int32_t* attrib_list) { 301 const int32_t* attrib_list) {
264 // Not proxied. The raw creation function is used only in the implementation 302 // Not proxied. The raw creation function is used only in the implementation
265 // of the proxy on the host side. 303 // of the proxy on the host side.
266 return 0; 304 return 0;
267 } 305 }
268 306
269 PP_Resource ResourceCreationProxy::CreateResourceArray(
270 PP_Instance instance,
271 const PP_Resource elements[],
272 uint32_t size) {
273 PPB_ResourceArray_Shared* object = new PPB_ResourceArray_Shared(
274 OBJECT_IS_PROXY, instance, elements, size);
275 return object->GetReference();
276 }
277
278 PP_Resource ResourceCreationProxy::CreateScrollbar(PP_Instance instance, 307 PP_Resource ResourceCreationProxy::CreateScrollbar(PP_Instance instance,
279 PP_Bool vertical) { 308 PP_Bool vertical) {
280 NOTIMPLEMENTED(); // Not proxied yet. 309 NOTIMPLEMENTED(); // Not proxied yet.
281 return 0; 310 return 0;
282 } 311 }
283 312
284 PP_Resource ResourceCreationProxy::CreateTalk(PP_Instance instance) { 313 PP_Resource ResourceCreationProxy::CreateTalk(PP_Instance instance) {
285 return PPB_Talk_Private_Proxy::CreateProxyResource(instance); 314 return PPB_Talk_Private_Proxy::CreateProxyResource(instance);
286 } 315 }
287 316
288 #if !defined(OS_NACL)
289 PP_Resource ResourceCreationProxy::CreateTCPServerSocketPrivate( 317 PP_Resource ResourceCreationProxy::CreateTCPServerSocketPrivate(
290 PP_Instance instance) { 318 PP_Instance instance) {
291 return PPB_TCPServerSocket_Private_Proxy::CreateProxyResource(instance); 319 return PPB_TCPServerSocket_Private_Proxy::CreateProxyResource(instance);
292 } 320 }
293 321
294 PP_Resource ResourceCreationProxy::CreateTCPSocketPrivate( 322 PP_Resource ResourceCreationProxy::CreateTCPSocketPrivate(
295 PP_Instance instance) { 323 PP_Instance instance) {
296 return PPB_TCPSocket_Private_Proxy::CreateProxyResource(instance); 324 return PPB_TCPSocket_Private_Proxy::CreateProxyResource(instance);
297 } 325 }
298 #endif // !defined(OS_NACL)
299 326
300 PP_Resource ResourceCreationProxy::CreateTransport(PP_Instance instance, 327 PP_Resource ResourceCreationProxy::CreateTransport(PP_Instance instance,
301 const char* name, 328 const char* name,
302 PP_TransportType type) { 329 PP_TransportType type) {
303 NOTIMPLEMENTED(); // Not proxied yet. 330 NOTIMPLEMENTED(); // Not proxied yet.
304 return 0; 331 return 0;
305 } 332 }
306 333
307 #if !defined(OS_NACL)
308 PP_Resource ResourceCreationProxy::CreateUDPSocketPrivate( 334 PP_Resource ResourceCreationProxy::CreateUDPSocketPrivate(
309 PP_Instance instance) { 335 PP_Instance instance) {
310 return PPB_UDPSocket_Private_Proxy::CreateProxyResource(instance); 336 return PPB_UDPSocket_Private_Proxy::CreateProxyResource(instance);
311 } 337 }
312 #endif // !defined(OS_NACL)
313
314 PP_Resource ResourceCreationProxy::CreateURLLoader(PP_Instance instance) {
315 return PPB_URLLoader_Proxy::CreateProxyResource(instance);
316 }
317
318 PP_Resource ResourceCreationProxy::CreateURLRequestInfo(
319 PP_Instance instance,
320 const PPB_URLRequestInfo_Data& data) {
321 return (new PPB_URLRequestInfo_Shared(OBJECT_IS_PROXY,
322 instance, data))->GetReference();
323 }
324 338
325 PP_Resource ResourceCreationProxy::CreateVideoCapture(PP_Instance instance) { 339 PP_Resource ResourceCreationProxy::CreateVideoCapture(PP_Instance instance) {
326 return PPB_VideoCapture_Proxy::CreateProxyResource(instance); 340 return PPB_VideoCapture_Proxy::CreateProxyResource(instance);
327 } 341 }
328 342
329 PP_Resource ResourceCreationProxy::CreateVideoDecoder( 343 PP_Resource ResourceCreationProxy::CreateVideoDecoder(
330 PP_Instance instance, 344 PP_Instance instance,
331 PP_Resource context3d_id, 345 PP_Resource context3d_id,
332 PP_VideoDecoder_Profile profile) { 346 PP_VideoDecoder_Profile profile) {
333 return PPB_VideoDecoder_Proxy::CreateProxyResource( 347 return PPB_VideoDecoder_Proxy::CreateProxyResource(
334 instance, context3d_id, profile); 348 instance, context3d_id, profile);
335 } 349 }
336 350
337 PP_Resource ResourceCreationProxy::CreateVideoLayer( 351 PP_Resource ResourceCreationProxy::CreateVideoLayer(
338 PP_Instance instance, 352 PP_Instance instance,
339 PP_VideoLayerMode_Dev mode) { 353 PP_VideoLayerMode_Dev mode) {
340 NOTIMPLEMENTED(); 354 NOTIMPLEMENTED();
341 return 0; 355 return 0;
342 } 356 }
343 357
344 PP_Resource ResourceCreationProxy::CreateWebSocket(PP_Instance instance) { 358 PP_Resource ResourceCreationProxy::CreateWebSocket(PP_Instance instance) {
345 NOTIMPLEMENTED(); 359 NOTIMPLEMENTED();
346 return 0; 360 return 0;
347 } 361 }
348 362
349 PP_Resource ResourceCreationProxy::CreateWheelInputEvent(
350 PP_Instance instance,
351 PP_TimeTicks time_stamp,
352 uint32_t modifiers,
353 const PP_FloatPoint* wheel_delta,
354 const PP_FloatPoint* wheel_ticks,
355 PP_Bool scroll_by_page) {
356 InputEventData data;
357 data.event_type = PP_INPUTEVENT_TYPE_WHEEL;
358 data.event_time_stamp = time_stamp;
359 data.event_modifiers = modifiers;
360 data.wheel_delta = *wheel_delta;
361 data.wheel_ticks = *wheel_ticks;
362 data.wheel_scroll_by_page = PP_ToBool(scroll_by_page);
363
364 return (new PPB_InputEvent_Shared(OBJECT_IS_PROXY,
365 instance, data))->GetReference();
366 }
367
368 #if !defined(OS_NACL)
369 PP_Resource ResourceCreationProxy::CreateX509CertificatePrivate( 363 PP_Resource ResourceCreationProxy::CreateX509CertificatePrivate(
370 PP_Instance instance) { 364 PP_Instance instance) {
371 return PPB_X509Certificate_Private_Proxy::CreateProxyResource(instance); 365 return PPB_X509Certificate_Private_Proxy::CreateProxyResource(instance);
372 } 366 }
373 #endif 367 #endif // !defined(OS_NACL)
374 368
375 369
376 bool ResourceCreationProxy::Send(IPC::Message* msg) { 370 bool ResourceCreationProxy::Send(IPC::Message* msg) {
377 return dispatcher()->Send(msg); 371 return dispatcher()->Send(msg);
378 } 372 }
379 373
380 bool ResourceCreationProxy::OnMessageReceived(const IPC::Message& msg) { 374 bool ResourceCreationProxy::OnMessageReceived(const IPC::Message& msg) {
381 return false; 375 return false;
382 } 376 }
383 377
384 } // namespace proxy 378 } // namespace proxy
385 } // namespace ppapi 379 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/resource_creation_proxy.h ('k') | ppapi/shared_impl/ppb_instance_shared.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698