OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "webkit/plugins/ppapi/resource_creation_impl.h" | 5 #include "webkit/plugins/ppapi/resource_creation_impl.h" |
6 | 6 |
7 #include "ppapi/c/pp_size.h" | 7 #include "ppapi/c/pp_size.h" |
8 #include "ppapi/shared_impl/audio_config_impl.h" | 8 #include "ppapi/shared_impl/audio_config_impl.h" |
9 #include "ppapi/shared_impl/input_event_impl.h" | 9 #include "ppapi/shared_impl/input_event_impl.h" |
10 #include "ppapi/shared_impl/var.h" | 10 #include "ppapi/shared_impl/var.h" |
11 #include "webkit/plugins/ppapi/common.h" | 11 #include "webkit/plugins/ppapi/common.h" |
12 #include "webkit/plugins/ppapi/ppb_audio_impl.h" | 12 #include "webkit/plugins/ppapi/ppb_audio_impl.h" |
13 #include "webkit/plugins/ppapi/ppb_audio_input_impl.h" | 13 #include "webkit/plugins/ppapi/ppb_audio_input_impl.h" |
14 #include "webkit/plugins/ppapi/ppb_broker_impl.h" | 14 #include "webkit/plugins/ppapi/ppb_broker_impl.h" |
15 #include "webkit/plugins/ppapi/ppb_buffer_impl.h" | 15 #include "webkit/plugins/ppapi/ppb_buffer_impl.h" |
16 #include "webkit/plugins/ppapi/ppb_context_3d_impl.h" | |
17 #include "webkit/plugins/ppapi/ppb_directory_reader_impl.h" | 16 #include "webkit/plugins/ppapi/ppb_directory_reader_impl.h" |
18 #include "webkit/plugins/ppapi/ppb_file_chooser_impl.h" | 17 #include "webkit/plugins/ppapi/ppb_file_chooser_impl.h" |
19 #include "webkit/plugins/ppapi/ppb_file_io_impl.h" | 18 #include "webkit/plugins/ppapi/ppb_file_io_impl.h" |
20 #include "webkit/plugins/ppapi/ppb_file_ref_impl.h" | 19 #include "webkit/plugins/ppapi/ppb_file_ref_impl.h" |
21 #include "webkit/plugins/ppapi/ppb_file_system_impl.h" | 20 #include "webkit/plugins/ppapi/ppb_file_system_impl.h" |
22 #include "webkit/plugins/ppapi/ppb_flash_menu_impl.h" | 21 #include "webkit/plugins/ppapi/ppb_flash_menu_impl.h" |
23 #include "webkit/plugins/ppapi/ppb_flash_net_connector_impl.h" | 22 #include "webkit/plugins/ppapi/ppb_flash_net_connector_impl.h" |
24 #include "webkit/plugins/ppapi/ppb_font_impl.h" | 23 #include "webkit/plugins/ppapi/ppb_font_impl.h" |
25 #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h" | 24 #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h" |
26 #include "webkit/plugins/ppapi/ppb_graphics_3d_impl.h" | 25 #include "webkit/plugins/ppapi/ppb_graphics_3d_impl.h" |
27 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" | 26 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" |
28 #include "webkit/plugins/ppapi/ppb_scrollbar_impl.h" | 27 #include "webkit/plugins/ppapi/ppb_scrollbar_impl.h" |
29 #include "webkit/plugins/ppapi/ppb_surface_3d_impl.h" | |
30 #include "webkit/plugins/ppapi/ppb_transport_impl.h" | 28 #include "webkit/plugins/ppapi/ppb_transport_impl.h" |
31 #include "webkit/plugins/ppapi/ppb_url_loader_impl.h" | 29 #include "webkit/plugins/ppapi/ppb_url_loader_impl.h" |
32 #include "webkit/plugins/ppapi/ppb_url_request_info_impl.h" | 30 #include "webkit/plugins/ppapi/ppb_url_request_info_impl.h" |
33 #include "webkit/plugins/ppapi/ppb_video_capture_impl.h" | 31 #include "webkit/plugins/ppapi/ppb_video_capture_impl.h" |
34 #include "webkit/plugins/ppapi/ppb_video_decoder_impl.h" | 32 #include "webkit/plugins/ppapi/ppb_video_decoder_impl.h" |
35 #include "webkit/plugins/ppapi/ppb_video_layer_impl.h" | 33 #include "webkit/plugins/ppapi/ppb_video_layer_impl.h" |
36 #include "webkit/plugins/ppapi/ppb_websocket_impl.h" | 34 #include "webkit/plugins/ppapi/ppb_websocket_impl.h" |
37 | 35 |
38 using ppapi::InputEventData; | 36 using ppapi::InputEventData; |
39 using ppapi::InputEventImpl; | 37 using ppapi::InputEventImpl; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 89 |
92 PP_Resource ResourceCreationImpl::CreateBroker(PP_Instance instance) { | 90 PP_Resource ResourceCreationImpl::CreateBroker(PP_Instance instance) { |
93 return (new PPB_Broker_Impl(instance))->GetReference(); | 91 return (new PPB_Broker_Impl(instance))->GetReference(); |
94 } | 92 } |
95 | 93 |
96 PP_Resource ResourceCreationImpl::CreateBuffer(PP_Instance instance, | 94 PP_Resource ResourceCreationImpl::CreateBuffer(PP_Instance instance, |
97 uint32_t size) { | 95 uint32_t size) { |
98 return PPB_Buffer_Impl::Create(instance, size); | 96 return PPB_Buffer_Impl::Create(instance, size); |
99 } | 97 } |
100 | 98 |
101 PP_Resource ResourceCreationImpl::CreateContext3D( | |
102 PP_Instance instance, | |
103 PP_Config3D_Dev config, | |
104 PP_Resource share_context, | |
105 const int32_t* attrib_list) { | |
106 return PPB_Context3D_Impl::Create(instance, config, share_context, | |
107 attrib_list); | |
108 } | |
109 | |
110 PP_Resource ResourceCreationImpl::CreateContext3DRaw( | |
111 PP_Instance instance, | |
112 PP_Config3D_Dev config, | |
113 PP_Resource share_context, | |
114 const int32_t* attrib_list) { | |
115 return PPB_Context3D_Impl::CreateRaw(instance, config, share_context, | |
116 attrib_list); | |
117 } | |
118 | |
119 PP_Resource ResourceCreationImpl::CreateDirectoryReader( | 99 PP_Resource ResourceCreationImpl::CreateDirectoryReader( |
120 PP_Resource directory_ref) { | 100 PP_Resource directory_ref) { |
121 return PPB_DirectoryReader_Impl::Create(directory_ref); | 101 return PPB_DirectoryReader_Impl::Create(directory_ref); |
122 } | 102 } |
123 | 103 |
124 PP_Resource ResourceCreationImpl::CreateFileChooser( | 104 PP_Resource ResourceCreationImpl::CreateFileChooser( |
125 PP_Instance instance, | 105 PP_Instance instance, |
126 PP_FileChooserMode_Dev mode, | 106 PP_FileChooserMode_Dev mode, |
127 const char* accept_mime_types) { | 107 const char* accept_mime_types) { |
128 return PPB_FileChooser_Impl::Create(instance, mode, accept_mime_types); | 108 return PPB_FileChooser_Impl::Create(instance, mode, accept_mime_types); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 | 225 |
246 return (new InputEventImpl(InputEventImpl::InitAsImpl(), | 226 return (new InputEventImpl(InputEventImpl::InitAsImpl(), |
247 instance, data))->GetReference(); | 227 instance, data))->GetReference(); |
248 } | 228 } |
249 | 229 |
250 PP_Resource ResourceCreationImpl::CreateScrollbar(PP_Instance instance, | 230 PP_Resource ResourceCreationImpl::CreateScrollbar(PP_Instance instance, |
251 PP_Bool vertical) { | 231 PP_Bool vertical) { |
252 return PPB_Scrollbar_Impl::Create(instance, PP_ToBool(vertical)); | 232 return PPB_Scrollbar_Impl::Create(instance, PP_ToBool(vertical)); |
253 } | 233 } |
254 | 234 |
255 PP_Resource ResourceCreationImpl::CreateSurface3D( | |
256 PP_Instance instance, | |
257 PP_Config3D_Dev config, | |
258 const int32_t* attrib_list) { | |
259 return PPB_Surface3D_Impl::Create(instance, config, attrib_list); | |
260 } | |
261 | |
262 | |
263 PP_Resource ResourceCreationImpl::CreateTCPSocketPrivate(PP_Instance instance) { | 235 PP_Resource ResourceCreationImpl::CreateTCPSocketPrivate(PP_Instance instance) { |
264 // Creating TCP socket resource at the renderer side is not supported. | 236 // Creating TCP socket resource at the renderer side is not supported. |
265 return 0; | 237 return 0; |
266 } | 238 } |
267 | 239 |
268 PP_Resource ResourceCreationImpl::CreateTransport(PP_Instance instance, | 240 PP_Resource ResourceCreationImpl::CreateTransport(PP_Instance instance, |
269 const char* name, | 241 const char* name, |
270 PP_TransportType type) { | 242 PP_TransportType type) { |
271 #if defined(ENABLE_P2P_APIS) | 243 #if defined(ENABLE_P2P_APIS) |
272 return PPB_Transport_Impl::Create(instance, name, type); | 244 return PPB_Transport_Impl::Create(instance, name, type); |
(...skipping 18 matching lines...) Expand all Loading... |
291 PP_Resource ResourceCreationImpl::CreateVideoCapture(PP_Instance instance) { | 263 PP_Resource ResourceCreationImpl::CreateVideoCapture(PP_Instance instance) { |
292 scoped_refptr<PPB_VideoCapture_Impl> video_capture = | 264 scoped_refptr<PPB_VideoCapture_Impl> video_capture = |
293 new PPB_VideoCapture_Impl(instance); | 265 new PPB_VideoCapture_Impl(instance); |
294 if (!video_capture->Init()) | 266 if (!video_capture->Init()) |
295 return 0; | 267 return 0; |
296 return video_capture->GetReference(); | 268 return video_capture->GetReference(); |
297 } | 269 } |
298 | 270 |
299 PP_Resource ResourceCreationImpl::CreateVideoDecoder( | 271 PP_Resource ResourceCreationImpl::CreateVideoDecoder( |
300 PP_Instance instance, | 272 PP_Instance instance, |
301 PP_Resource context3d_id, | 273 PP_Resource graphics3d_id, |
302 PP_VideoDecoder_Profile profile) { | 274 PP_VideoDecoder_Profile profile) { |
303 return PPB_VideoDecoder_Impl::Create(instance, context3d_id, profile); | 275 return PPB_VideoDecoder_Impl::Create(instance, graphics3d_id, profile); |
304 } | 276 } |
305 | 277 |
306 PP_Resource ResourceCreationImpl::CreateVideoLayer(PP_Instance instance, | 278 PP_Resource ResourceCreationImpl::CreateVideoLayer(PP_Instance instance, |
307 PP_VideoLayerMode_Dev mode) { | 279 PP_VideoLayerMode_Dev mode) { |
308 return PPB_VideoLayer_Impl::Create(instance, mode); | 280 return PPB_VideoLayer_Impl::Create(instance, mode); |
309 } | 281 } |
310 | 282 |
311 PP_Resource ResourceCreationImpl::CreateWebSocket(PP_Instance instance) { | 283 PP_Resource ResourceCreationImpl::CreateWebSocket(PP_Instance instance) { |
312 return PPB_WebSocket_Impl::Create(instance); | 284 return PPB_WebSocket_Impl::Create(instance); |
313 } | 285 } |
(...skipping 12 matching lines...) Expand all Loading... |
326 data.wheel_delta = *wheel_delta; | 298 data.wheel_delta = *wheel_delta; |
327 data.wheel_ticks = *wheel_ticks; | 299 data.wheel_ticks = *wheel_ticks; |
328 data.wheel_scroll_by_page = PP_ToBool(scroll_by_page); | 300 data.wheel_scroll_by_page = PP_ToBool(scroll_by_page); |
329 | 301 |
330 return (new InputEventImpl(InputEventImpl::InitAsImpl(), | 302 return (new InputEventImpl(InputEventImpl::InitAsImpl(), |
331 instance, data))->GetReference(); | 303 instance, data))->GetReference(); |
332 } | 304 } |
333 | 305 |
334 } // namespace ppapi | 306 } // namespace ppapi |
335 } // namespace webkit | 307 } // namespace webkit |
OLD | NEW |