• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
5 #include "ppapi/proxy/resource_creation_proxy.h"
6 
7 #include "ppapi/c/pp_errors.h"
8 #include "ppapi/c/pp_size.h"
9 #include "ppapi/proxy/audio_input_resource.h"
10 #include "ppapi/proxy/compositor_resource.h"
11 #include "ppapi/proxy/connection.h"
12 #include "ppapi/proxy/file_chooser_resource.h"
13 #include "ppapi/proxy/file_io_resource.h"
14 #include "ppapi/proxy/file_ref_resource.h"
15 #include "ppapi/proxy/file_system_resource.h"
16 #include "ppapi/proxy/flash_drm_resource.h"
17 #include "ppapi/proxy/flash_font_file_resource.h"
18 #include "ppapi/proxy/flash_menu_resource.h"
19 #include "ppapi/proxy/graphics_2d_resource.h"
20 #include "ppapi/proxy/host_resolver_private_resource.h"
21 #include "ppapi/proxy/host_resolver_resource.h"
22 #include "ppapi/proxy/media_stream_video_track_resource.h"
23 #include "ppapi/proxy/net_address_resource.h"
24 #include "ppapi/proxy/network_monitor_resource.h"
25 #include "ppapi/proxy/output_protection_resource.h"
26 #include "ppapi/proxy/platform_verification_private_resource.h"
27 #include "ppapi/proxy/plugin_dispatcher.h"
28 #include "ppapi/proxy/plugin_globals.h"
29 #include "ppapi/proxy/plugin_resource_tracker.h"
30 #include "ppapi/proxy/ppapi_messages.h"
31 #include "ppapi/proxy/ppb_audio_proxy.h"
32 #include "ppapi/proxy/ppb_broker_proxy.h"
33 #include "ppapi/proxy/ppb_buffer_proxy.h"
34 #include "ppapi/proxy/ppb_flash_message_loop_proxy.h"
35 #include "ppapi/proxy/ppb_graphics_3d_proxy.h"
36 #include "ppapi/proxy/ppb_image_data_proxy.h"
37 #include "ppapi/proxy/ppb_video_decoder_proxy.h"
38 #include "ppapi/proxy/ppb_x509_certificate_private_proxy.h"
39 #include "ppapi/proxy/printing_resource.h"
40 #include "ppapi/proxy/talk_resource.h"
41 #include "ppapi/proxy/tcp_server_socket_private_resource.h"
42 #include "ppapi/proxy/tcp_socket_private_resource.h"
43 #include "ppapi/proxy/tcp_socket_resource.h"
44 #include "ppapi/proxy/truetype_font_resource.h"
45 #include "ppapi/proxy/udp_socket_private_resource.h"
46 #include "ppapi/proxy/udp_socket_resource.h"
47 #include "ppapi/proxy/url_loader_resource.h"
48 #include "ppapi/proxy/url_request_info_resource.h"
49 #include "ppapi/proxy/url_response_info_resource.h"
50 #include "ppapi/proxy/video_capture_resource.h"
51 #include "ppapi/proxy/video_decoder_resource.h"
52 #include "ppapi/proxy/video_destination_resource.h"
53 #include "ppapi/proxy/video_source_resource.h"
54 #include "ppapi/proxy/websocket_resource.h"
55 #include "ppapi/shared_impl/api_id.h"
56 #include "ppapi/shared_impl/host_resource.h"
57 #include "ppapi/shared_impl/ppb_audio_config_shared.h"
58 #include "ppapi/shared_impl/ppb_audio_shared.h"
59 #include "ppapi/shared_impl/ppb_input_event_shared.h"
60 #include "ppapi/shared_impl/var.h"
61 #include "ppapi/thunk/enter.h"
62 #include "ppapi/thunk/ppb_image_data_api.h"
63 
64 using ppapi::thunk::ResourceCreationAPI;
65 
66 namespace ppapi {
67 namespace proxy {
68 
ResourceCreationProxy(Dispatcher * dispatcher)69 ResourceCreationProxy::ResourceCreationProxy(Dispatcher* dispatcher)
70     : InterfaceProxy(dispatcher) {
71 }
72 
~ResourceCreationProxy()73 ResourceCreationProxy::~ResourceCreationProxy() {
74 }
75 
76 // static
Create(Dispatcher * dispatcher)77 InterfaceProxy* ResourceCreationProxy::Create(Dispatcher* dispatcher) {
78   return new ResourceCreationProxy(dispatcher);
79 }
80 
CreateFileIO(PP_Instance instance)81 PP_Resource ResourceCreationProxy::CreateFileIO(PP_Instance instance) {
82   return (new FileIOResource(GetConnection(), instance))->GetReference();
83 }
84 
CreateFileRef(PP_Instance instance,const FileRefCreateInfo & create_info)85 PP_Resource ResourceCreationProxy::CreateFileRef(
86     PP_Instance instance,
87     const FileRefCreateInfo& create_info) {
88   return FileRefResource::CreateFileRef(GetConnection(), instance, create_info);
89 }
90 
CreateFileSystem(PP_Instance instance,PP_FileSystemType type)91 PP_Resource ResourceCreationProxy::CreateFileSystem(
92     PP_Instance instance,
93     PP_FileSystemType type) {
94   return (new FileSystemResource(GetConnection(), instance,
95                                  type))->GetReference();
96 }
97 
CreateIMEInputEvent(PP_Instance instance,PP_InputEvent_Type type,PP_TimeTicks time_stamp,struct PP_Var text,uint32_t segment_number,const uint32_t * segment_offsets,int32_t target_segment,uint32_t selection_start,uint32_t selection_end)98 PP_Resource ResourceCreationProxy::CreateIMEInputEvent(
99     PP_Instance instance,
100     PP_InputEvent_Type type,
101     PP_TimeTicks time_stamp,
102     struct PP_Var text,
103     uint32_t segment_number,
104     const uint32_t* segment_offsets,
105     int32_t target_segment,
106     uint32_t selection_start,
107     uint32_t selection_end) {
108   return PPB_InputEvent_Shared::CreateIMEInputEvent(
109       OBJECT_IS_PROXY, instance, type, time_stamp, text, segment_number,
110       segment_offsets, target_segment, selection_start, selection_end);
111 }
112 
CreateKeyboardInputEvent_1_0(PP_Instance instance,PP_InputEvent_Type type,PP_TimeTicks time_stamp,uint32_t modifiers,uint32_t key_code,struct PP_Var character_text)113 PP_Resource ResourceCreationProxy::CreateKeyboardInputEvent_1_0(
114     PP_Instance instance,
115     PP_InputEvent_Type type,
116     PP_TimeTicks time_stamp,
117     uint32_t modifiers,
118     uint32_t key_code,
119     struct PP_Var character_text) {
120   PP_Var code = StringVar::StringToPPVar("");
121   return PPB_InputEvent_Shared::CreateKeyboardInputEvent(
122       OBJECT_IS_PROXY, instance, type, time_stamp, modifiers, key_code,
123       character_text, code);
124 }
125 
CreateKeyboardInputEvent_1_2(PP_Instance instance,PP_InputEvent_Type type,PP_TimeTicks time_stamp,uint32_t modifiers,uint32_t key_code,struct PP_Var character_text,struct PP_Var code)126 PP_Resource ResourceCreationProxy::CreateKeyboardInputEvent_1_2(
127     PP_Instance instance,
128     PP_InputEvent_Type type,
129     PP_TimeTicks time_stamp,
130     uint32_t modifiers,
131     uint32_t key_code,
132     struct PP_Var character_text,
133     struct PP_Var code) {
134   return PPB_InputEvent_Shared::CreateKeyboardInputEvent(
135       OBJECT_IS_PROXY, instance, type, time_stamp, modifiers, key_code,
136       character_text, code);
137 }
138 
CreateMouseInputEvent(PP_Instance instance,PP_InputEvent_Type type,PP_TimeTicks time_stamp,uint32_t modifiers,PP_InputEvent_MouseButton mouse_button,const PP_Point * mouse_position,int32_t click_count,const PP_Point * mouse_movement)139 PP_Resource ResourceCreationProxy::CreateMouseInputEvent(
140     PP_Instance instance,
141     PP_InputEvent_Type type,
142     PP_TimeTicks time_stamp,
143     uint32_t modifiers,
144     PP_InputEvent_MouseButton mouse_button,
145     const PP_Point* mouse_position,
146     int32_t click_count,
147     const PP_Point* mouse_movement) {
148   return PPB_InputEvent_Shared::CreateMouseInputEvent(
149       OBJECT_IS_PROXY, instance, type, time_stamp, modifiers,
150       mouse_button, mouse_position, click_count, mouse_movement);
151 }
152 
CreateTouchInputEvent(PP_Instance instance,PP_InputEvent_Type type,PP_TimeTicks time_stamp,uint32_t modifiers)153 PP_Resource ResourceCreationProxy::CreateTouchInputEvent(
154     PP_Instance instance,
155     PP_InputEvent_Type type,
156     PP_TimeTicks time_stamp,
157     uint32_t modifiers) {
158   return PPB_InputEvent_Shared::CreateTouchInputEvent(
159       OBJECT_IS_PROXY, instance, type, time_stamp, modifiers);
160 }
161 
CreateTrueTypeFont(PP_Instance instance,const PP_TrueTypeFontDesc_Dev * desc)162 PP_Resource ResourceCreationProxy::CreateTrueTypeFont(
163     PP_Instance instance,
164     const PP_TrueTypeFontDesc_Dev* desc) {
165   return (new TrueTypeFontResource(GetConnection(),
166                                    instance, *desc))->GetReference();
167 
168 }
169 
CreateURLLoader(PP_Instance instance)170 PP_Resource ResourceCreationProxy::CreateURLLoader(PP_Instance instance) {
171     return (new URLLoaderResource(GetConnection(), instance))->GetReference();
172 }
173 
CreateURLRequestInfo(PP_Instance instance)174 PP_Resource ResourceCreationProxy::CreateURLRequestInfo(
175     PP_Instance instance) {
176   return (new URLRequestInfoResource(
177       GetConnection(), instance, URLRequestInfoData()))->GetReference();
178 }
179 
CreateWheelInputEvent(PP_Instance instance,PP_TimeTicks time_stamp,uint32_t modifiers,const PP_FloatPoint * wheel_delta,const PP_FloatPoint * wheel_ticks,PP_Bool scroll_by_page)180 PP_Resource ResourceCreationProxy::CreateWheelInputEvent(
181     PP_Instance instance,
182     PP_TimeTicks time_stamp,
183     uint32_t modifiers,
184     const PP_FloatPoint* wheel_delta,
185     const PP_FloatPoint* wheel_ticks,
186     PP_Bool scroll_by_page) {
187   return PPB_InputEvent_Shared::CreateWheelInputEvent(
188       OBJECT_IS_PROXY, instance, time_stamp, modifiers,
189       wheel_delta, wheel_ticks, scroll_by_page);
190 }
191 
CreateAudio1_0(PP_Instance instance,PP_Resource config_id,PPB_Audio_Callback_1_0 audio_callback,void * user_data)192 PP_Resource ResourceCreationProxy::CreateAudio1_0(
193     PP_Instance instance,
194     PP_Resource config_id,
195     PPB_Audio_Callback_1_0 audio_callback,
196     void* user_data) {
197   return PPB_Audio_Proxy::CreateProxyResource(
198       instance, config_id, AudioCallbackCombined(audio_callback), user_data);
199 }
200 
CreateAudio(PP_Instance instance,PP_Resource config_id,PPB_Audio_Callback audio_callback,void * user_data)201 PP_Resource ResourceCreationProxy::CreateAudio(
202     PP_Instance instance,
203     PP_Resource config_id,
204     PPB_Audio_Callback audio_callback,
205     void* user_data) {
206   return PPB_Audio_Proxy::CreateProxyResource(
207       instance, config_id, AudioCallbackCombined(audio_callback), user_data);
208 }
209 
CreateAudioTrusted(PP_Instance instance)210 PP_Resource ResourceCreationProxy::CreateAudioTrusted(PP_Instance instance) {
211   // Proxied plugins can't create trusted audio devices.
212   return 0;
213 }
214 
CreateAudioConfig(PP_Instance instance,PP_AudioSampleRate sample_rate,uint32_t sample_frame_count)215 PP_Resource ResourceCreationProxy::CreateAudioConfig(
216     PP_Instance instance,
217     PP_AudioSampleRate sample_rate,
218     uint32_t sample_frame_count) {
219   return PPB_AudioConfig_Shared::Create(
220       OBJECT_IS_PROXY, instance, sample_rate, sample_frame_count);
221 }
222 
CreateCompositor(PP_Instance instance)223 PP_Resource ResourceCreationProxy::CreateCompositor(PP_Instance instance) {
224   return (new CompositorResource(GetConnection(), instance))->GetReference();
225 }
226 
CreateFileChooser(PP_Instance instance,PP_FileChooserMode_Dev mode,const PP_Var & accept_types)227 PP_Resource ResourceCreationProxy::CreateFileChooser(
228     PP_Instance instance,
229     PP_FileChooserMode_Dev mode,
230     const PP_Var& accept_types) {
231   scoped_refptr<StringVar> string_var = StringVar::FromPPVar(accept_types);
232   std::string str = string_var.get() ? string_var->value() : std::string();
233   return (new FileChooserResource(GetConnection(), instance, mode, str.c_str()))
234       ->GetReference();
235 }
236 
CreateGraphics2D(PP_Instance instance,const PP_Size * size,PP_Bool is_always_opaque)237 PP_Resource ResourceCreationProxy::CreateGraphics2D(PP_Instance instance,
238                                                     const PP_Size* size,
239                                                     PP_Bool is_always_opaque) {
240   return (new Graphics2DResource(GetConnection(), instance, *size,
241                                  is_always_opaque))->GetReference();
242 }
243 
CreateGraphics3D(PP_Instance instance,PP_Resource share_context,const int32_t * attrib_list)244 PP_Resource ResourceCreationProxy::CreateGraphics3D(
245     PP_Instance instance,
246     PP_Resource share_context,
247     const int32_t* attrib_list) {
248   return PPB_Graphics3D_Proxy::CreateProxyResource(
249       instance, share_context, attrib_list);
250 }
251 
CreateGraphics3DRaw(PP_Instance instance,PP_Resource share_context,const int32_t * attrib_list)252 PP_Resource ResourceCreationProxy::CreateGraphics3DRaw(
253     PP_Instance instance,
254     PP_Resource share_context,
255     const int32_t* attrib_list) {
256   // Not proxied. The raw creation function is used only in the implementation
257   // of the proxy on the host side.
258   return 0;
259 }
260 
CreateHostResolver(PP_Instance instance)261 PP_Resource ResourceCreationProxy::CreateHostResolver(PP_Instance instance) {
262   return (new HostResolverResource(GetConnection(), instance))->GetReference();
263 }
264 
CreateHostResolverPrivate(PP_Instance instance)265 PP_Resource ResourceCreationProxy::CreateHostResolverPrivate(
266     PP_Instance instance) {
267   return (new HostResolverPrivateResource(
268       GetConnection(), instance))->GetReference();
269 }
270 
CreateImageData(PP_Instance instance,PP_ImageDataFormat format,const PP_Size * size,PP_Bool init_to_zero)271 PP_Resource ResourceCreationProxy::CreateImageData(
272     PP_Instance instance,
273     PP_ImageDataFormat format,
274     const PP_Size* size,
275     PP_Bool init_to_zero) {
276   // On the plugin side, we create PlatformImageData resources for trusted
277   // plugins and SimpleImageData resources for untrusted ones.
278   PPB_ImageData_Shared::ImageDataType type =
279 #if !defined(OS_NACL)
280       PPB_ImageData_Shared::PLATFORM;
281 #else
282       PPB_ImageData_Shared::SIMPLE;
283 #endif
284   return PPB_ImageData_Proxy::CreateProxyResource(
285       instance, type,
286       format, *size, init_to_zero);
287 }
288 
CreateImageDataSimple(PP_Instance instance,PP_ImageDataFormat format,const PP_Size * size,PP_Bool init_to_zero)289 PP_Resource ResourceCreationProxy::CreateImageDataSimple(
290     PP_Instance instance,
291     PP_ImageDataFormat format,
292     const PP_Size* size,
293     PP_Bool init_to_zero) {
294   return PPB_ImageData_Proxy::CreateProxyResource(
295       instance,
296       PPB_ImageData_Shared::SIMPLE,
297       format, *size, init_to_zero);
298 }
299 
CreateMediaStreamVideoTrack(PP_Instance instance)300 PP_Resource ResourceCreationProxy::CreateMediaStreamVideoTrack(
301     PP_Instance instance) {
302   return (new MediaStreamVideoTrackResource(GetConnection(),
303                                             instance))->GetReference();
304 }
305 
CreateNetAddressFromIPv4Address(PP_Instance instance,const PP_NetAddress_IPv4 * ipv4_addr)306 PP_Resource ResourceCreationProxy::CreateNetAddressFromIPv4Address(
307     PP_Instance instance,
308     const PP_NetAddress_IPv4* ipv4_addr) {
309   return (new NetAddressResource(GetConnection(), instance,
310                                  *ipv4_addr))->GetReference();
311 }
312 
CreateNetAddressFromIPv6Address(PP_Instance instance,const PP_NetAddress_IPv6 * ipv6_addr)313 PP_Resource ResourceCreationProxy::CreateNetAddressFromIPv6Address(
314     PP_Instance instance,
315     const PP_NetAddress_IPv6* ipv6_addr) {
316   return (new NetAddressResource(GetConnection(), instance,
317                                  *ipv6_addr))->GetReference();
318 }
319 
CreateNetAddressFromNetAddressPrivate(PP_Instance instance,const PP_NetAddress_Private & private_addr)320 PP_Resource ResourceCreationProxy::CreateNetAddressFromNetAddressPrivate(
321     PP_Instance instance,
322     const PP_NetAddress_Private& private_addr) {
323   return (new NetAddressResource(GetConnection(), instance,
324                                  private_addr))->GetReference();
325 }
326 
CreateNetworkMonitor(PP_Instance instance)327 PP_Resource ResourceCreationProxy::CreateNetworkMonitor(
328     PP_Instance instance) {
329   return (new NetworkMonitorResource(GetConnection(), instance))->
330       GetReference();
331 }
332 
CreateOutputProtectionPrivate(PP_Instance instance)333 PP_Resource ResourceCreationProxy::CreateOutputProtectionPrivate(
334     PP_Instance instance) {
335   return (new OutputProtectionResource(GetConnection(), instance))->
336       GetReference();
337 }
338 
CreatePrinting(PP_Instance instance)339 PP_Resource ResourceCreationProxy::CreatePrinting(PP_Instance instance) {
340   return (new PrintingResource(GetConnection(), instance))->GetReference();
341 }
342 
CreateTCPServerSocketPrivate(PP_Instance instance)343 PP_Resource ResourceCreationProxy::CreateTCPServerSocketPrivate(
344     PP_Instance instance) {
345   return (new TCPServerSocketPrivateResource(GetConnection(), instance))->
346       GetReference();
347 }
348 
CreateTCPSocket1_0(PP_Instance instance)349 PP_Resource ResourceCreationProxy::CreateTCPSocket1_0(
350     PP_Instance instance) {
351   return (new TCPSocketResource(GetConnection(), instance,
352                                 TCP_SOCKET_VERSION_1_0))->GetReference();
353 }
354 
CreateTCPSocket(PP_Instance instance)355 PP_Resource ResourceCreationProxy::CreateTCPSocket(
356     PP_Instance instance) {
357   return (new TCPSocketResource(
358       GetConnection(), instance, TCP_SOCKET_VERSION_1_1_OR_ABOVE))->
359           GetReference();
360 }
361 
CreateTCPSocketPrivate(PP_Instance instance)362 PP_Resource ResourceCreationProxy::CreateTCPSocketPrivate(
363     PP_Instance instance) {
364   return (new TCPSocketPrivateResource(GetConnection(), instance))->
365       GetReference();
366 }
367 
CreateUDPSocket(PP_Instance instance)368 PP_Resource ResourceCreationProxy::CreateUDPSocket(PP_Instance instance) {
369   return (new UDPSocketResource(GetConnection(), instance))->GetReference();
370 }
371 
CreateUDPSocketPrivate(PP_Instance instance)372 PP_Resource ResourceCreationProxy::CreateUDPSocketPrivate(
373     PP_Instance instance) {
374   return (new UDPSocketPrivateResource(
375       GetConnection(), instance))->GetReference();
376 }
377 
CreateVideoDecoder(PP_Instance instance)378 PP_Resource ResourceCreationProxy::CreateVideoDecoder(PP_Instance instance) {
379   return (new VideoDecoderResource(GetConnection(), instance))->GetReference();
380 }
381 
CreateVideoDestination(PP_Instance instance)382 PP_Resource ResourceCreationProxy::CreateVideoDestination(
383     PP_Instance instance) {
384   return (new VideoDestinationResource(GetConnection(),
385                                        instance))->GetReference();
386 }
387 
CreateVideoSource(PP_Instance instance)388 PP_Resource ResourceCreationProxy::CreateVideoSource(
389     PP_Instance instance) {
390   return (new VideoSourceResource(GetConnection(), instance))->GetReference();
391 }
392 
CreateWebSocket(PP_Instance instance)393 PP_Resource ResourceCreationProxy::CreateWebSocket(PP_Instance instance) {
394   return (new WebSocketResource(GetConnection(), instance))->GetReference();
395 }
396 
CreateX509CertificatePrivate(PP_Instance instance)397 PP_Resource ResourceCreationProxy::CreateX509CertificatePrivate(
398     PP_Instance instance) {
399   return PPB_X509Certificate_Private_Proxy::CreateProxyResource(instance);
400 }
401 
402 #if !defined(OS_NACL)
CreateAudioInput(PP_Instance instance)403 PP_Resource ResourceCreationProxy::CreateAudioInput(
404     PP_Instance instance) {
405   return (new AudioInputResource(GetConnection(), instance))->GetReference();
406 }
407 
CreateBroker(PP_Instance instance)408 PP_Resource ResourceCreationProxy::CreateBroker(PP_Instance instance) {
409   return PPB_Broker_Proxy::CreateProxyResource(instance);
410 }
411 
CreateBrowserFont(PP_Instance instance,const PP_BrowserFont_Trusted_Description * description)412 PP_Resource ResourceCreationProxy::CreateBrowserFont(
413     PP_Instance instance,
414     const PP_BrowserFont_Trusted_Description* description) {
415   PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
416   if (!dispatcher)
417     return 0;
418   return PluginGlobals::Get()->CreateBrowserFont(
419       GetConnection(), instance, *description, dispatcher->preferences());
420 }
421 
CreateBuffer(PP_Instance instance,uint32_t size)422 PP_Resource ResourceCreationProxy::CreateBuffer(PP_Instance instance,
423                                                 uint32_t size) {
424   return PPB_Buffer_Proxy::CreateProxyResource(instance, size);
425 }
426 
CreateFlashDRM(PP_Instance instance)427 PP_Resource ResourceCreationProxy::CreateFlashDRM(PP_Instance instance) {
428   return (new FlashDRMResource(GetConnection(), instance))->GetReference();
429 }
430 
CreateFlashFontFile(PP_Instance instance,const PP_BrowserFont_Trusted_Description * description,PP_PrivateFontCharset charset)431 PP_Resource ResourceCreationProxy::CreateFlashFontFile(
432     PP_Instance instance,
433     const PP_BrowserFont_Trusted_Description* description,
434     PP_PrivateFontCharset charset) {
435   return (new FlashFontFileResource(
436       GetConnection(), instance, description, charset))->GetReference();
437 }
438 
CreateFlashMenu(PP_Instance instance,const PP_Flash_Menu * menu_data)439 PP_Resource ResourceCreationProxy::CreateFlashMenu(
440     PP_Instance instance,
441     const PP_Flash_Menu* menu_data) {
442   scoped_refptr<FlashMenuResource> flash_menu(
443       new FlashMenuResource(GetConnection(), instance));
444   if (!flash_menu->Initialize(menu_data))
445     return 0;
446   return flash_menu->GetReference();
447 }
448 
CreateFlashMessageLoop(PP_Instance instance)449 PP_Resource ResourceCreationProxy::CreateFlashMessageLoop(
450     PP_Instance instance) {
451   return PPB_Flash_MessageLoop_Proxy::CreateProxyResource(instance);
452 }
453 
CreatePlatformVerificationPrivate(PP_Instance instance)454 PP_Resource ResourceCreationProxy::CreatePlatformVerificationPrivate(
455     PP_Instance instance) {
456   return (new PlatformVerificationPrivateResource(GetConnection(), instance))->
457       GetReference();
458 }
459 
CreateScrollbar(PP_Instance instance,PP_Bool vertical)460 PP_Resource ResourceCreationProxy::CreateScrollbar(PP_Instance instance,
461                                                    PP_Bool vertical) {
462   NOTIMPLEMENTED();  // Not proxied yet.
463   return 0;
464 }
465 
CreateTalk(PP_Instance instance)466 PP_Resource ResourceCreationProxy::CreateTalk(PP_Instance instance) {
467   return (new TalkResource(GetConnection(), instance))->GetReference();
468 }
469 
CreateVideoCapture(PP_Instance instance)470 PP_Resource ResourceCreationProxy::CreateVideoCapture(PP_Instance instance) {
471   PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
472   if (!dispatcher)
473     return 0;
474   return (new VideoCaptureResource(GetConnection(), instance, dispatcher))
475       ->GetReference();
476 }
477 
CreateVideoDecoderDev(PP_Instance instance,PP_Resource context3d_id,PP_VideoDecoder_Profile profile)478 PP_Resource ResourceCreationProxy::CreateVideoDecoderDev(
479     PP_Instance instance,
480     PP_Resource context3d_id,
481     PP_VideoDecoder_Profile profile) {
482   return PPB_VideoDecoder_Proxy::CreateProxyResource(
483       instance, context3d_id, profile);
484 }
485 
486 #endif  // !defined(OS_NACL)
487 
Send(IPC::Message * msg)488 bool ResourceCreationProxy::Send(IPC::Message* msg) {
489   return dispatcher()->Send(msg);
490 }
491 
OnMessageReceived(const IPC::Message & msg)492 bool ResourceCreationProxy::OnMessageReceived(const IPC::Message& msg) {
493   return false;
494 }
495 
GetConnection()496 Connection ResourceCreationProxy::GetConnection() {
497   return Connection(PluginGlobals::Get()->GetBrowserSender(), dispatcher());
498 }
499 
500 }  // namespace proxy
501 }  // namespace ppapi
502