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 "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 11 matching lines...) Expand all Loading... |
22 #include "ppapi/proxy/ppb_font_proxy.h" | 22 #include "ppapi/proxy/ppb_font_proxy.h" |
23 #include "ppapi/proxy/ppb_graphics_2d_proxy.h" | 23 #include "ppapi/proxy/ppb_graphics_2d_proxy.h" |
24 #include "ppapi/proxy/ppb_graphics_3d_proxy.h" | 24 #include "ppapi/proxy/ppb_graphics_3d_proxy.h" |
25 #include "ppapi/proxy/ppb_image_data_proxy.h" | 25 #include "ppapi/proxy/ppb_image_data_proxy.h" |
26 #include "ppapi/proxy/ppb_tcp_socket_private_proxy.h" | 26 #include "ppapi/proxy/ppb_tcp_socket_private_proxy.h" |
27 #include "ppapi/proxy/ppb_udp_socket_private_proxy.h" | 27 #include "ppapi/proxy/ppb_udp_socket_private_proxy.h" |
28 #include "ppapi/proxy/ppb_url_loader_proxy.h" | 28 #include "ppapi/proxy/ppb_url_loader_proxy.h" |
29 #include "ppapi/proxy/ppb_video_capture_proxy.h" | 29 #include "ppapi/proxy/ppb_video_capture_proxy.h" |
30 #include "ppapi/proxy/ppb_video_decoder_proxy.h" | 30 #include "ppapi/proxy/ppb_video_decoder_proxy.h" |
31 #include "ppapi/shared_impl/api_id.h" | 31 #include "ppapi/shared_impl/api_id.h" |
| 32 #include "ppapi/shared_impl/audio_config_impl.h" |
| 33 #include "ppapi/shared_impl/font_impl.h" |
32 #include "ppapi/shared_impl/function_group_base.h" | 34 #include "ppapi/shared_impl/function_group_base.h" |
33 #include "ppapi/shared_impl/host_resource.h" | 35 #include "ppapi/shared_impl/host_resource.h" |
34 #include "ppapi/shared_impl/ppb_audio_config_shared.h" | 36 #include "ppapi/shared_impl/input_event_impl.h" |
35 #include "ppapi/shared_impl/ppb_font_shared.h" | 37 #include "ppapi/shared_impl/url_request_info_impl.h" |
36 #include "ppapi/shared_impl/ppb_input_event_shared.h" | |
37 #include "ppapi/shared_impl/ppb_url_request_info_shared.h" | |
38 #include "ppapi/shared_impl/var.h" | 38 #include "ppapi/shared_impl/var.h" |
39 #include "ppapi/thunk/enter.h" | 39 #include "ppapi/thunk/enter.h" |
40 #include "ppapi/thunk/ppb_image_data_api.h" | 40 #include "ppapi/thunk/ppb_image_data_api.h" |
41 | 41 |
42 using ppapi::thunk::ResourceCreationAPI; | 42 using ppapi::thunk::ResourceCreationAPI; |
43 | 43 |
44 namespace ppapi { | 44 namespace ppapi { |
45 namespace proxy { | 45 namespace proxy { |
46 | 46 |
47 ResourceCreationProxy::ResourceCreationProxy(Dispatcher* dispatcher) | 47 ResourceCreationProxy::ResourceCreationProxy(Dispatcher* dispatcher) |
(...skipping 18 matching lines...) Expand all Loading... |
66 PPB_Audio_Callback audio_callback, | 66 PPB_Audio_Callback audio_callback, |
67 void* user_data) { | 67 void* user_data) { |
68 return PPB_Audio_Proxy::CreateProxyResource(instance, config_id, | 68 return PPB_Audio_Proxy::CreateProxyResource(instance, config_id, |
69 audio_callback, user_data); | 69 audio_callback, user_data); |
70 } | 70 } |
71 | 71 |
72 PP_Resource ResourceCreationProxy::CreateAudioConfig( | 72 PP_Resource ResourceCreationProxy::CreateAudioConfig( |
73 PP_Instance instance, | 73 PP_Instance instance, |
74 PP_AudioSampleRate sample_rate, | 74 PP_AudioSampleRate sample_rate, |
75 uint32_t sample_frame_count) { | 75 uint32_t sample_frame_count) { |
76 return PPB_AudioConfig_Shared::CreateAsProxy( | 76 return AudioConfigImpl::CreateAsProxy( |
77 instance, sample_rate, sample_frame_count); | 77 instance, sample_rate, sample_frame_count); |
78 } | 78 } |
79 | 79 |
80 PP_Resource ResourceCreationProxy::CreateAudioTrusted(PP_Instance instance) { | 80 PP_Resource ResourceCreationProxy::CreateAudioTrusted(PP_Instance instance) { |
81 // Proxied plugins can't created trusted audio devices. | 81 // Proxied plugins can't created trusted audio devices. |
82 return 0; | 82 return 0; |
83 } | 83 } |
84 | 84 |
85 PP_Resource ResourceCreationProxy::CreateAudioInput( | 85 PP_Resource ResourceCreationProxy::CreateAudioInput( |
86 PP_Instance instance, | 86 PP_Instance instance, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 } | 144 } |
145 | 145 |
146 PP_Resource ResourceCreationProxy::CreateFlashNetConnector( | 146 PP_Resource ResourceCreationProxy::CreateFlashNetConnector( |
147 PP_Instance instance) { | 147 PP_Instance instance) { |
148 return PPB_Flash_NetConnector_Proxy::CreateProxyResource(instance); | 148 return PPB_Flash_NetConnector_Proxy::CreateProxyResource(instance); |
149 } | 149 } |
150 | 150 |
151 PP_Resource ResourceCreationProxy::CreateFontObject( | 151 PP_Resource ResourceCreationProxy::CreateFontObject( |
152 PP_Instance instance, | 152 PP_Instance instance, |
153 const PP_FontDescription_Dev* description) { | 153 const PP_FontDescription_Dev* description) { |
154 if (!PPB_Font_Shared::IsPPFontDescriptionValid(*description)) | 154 if (!ppapi::FontImpl::IsPPFontDescriptionValid(*description)) |
155 return 0; | 155 return 0; |
156 return (new Font(HostResource::MakeInstanceOnly(instance), *description))-> | 156 return (new Font(HostResource::MakeInstanceOnly(instance), *description))-> |
157 GetReference(); | 157 GetReference(); |
158 } | 158 } |
159 | 159 |
160 PP_Resource ResourceCreationProxy::CreateGraphics2D(PP_Instance instance, | 160 PP_Resource ResourceCreationProxy::CreateGraphics2D(PP_Instance instance, |
161 const PP_Size& size, | 161 const PP_Size& size, |
162 PP_Bool is_always_opaque) { | 162 PP_Bool is_always_opaque) { |
163 return PPB_Graphics2D_Proxy::CreateProxyResource(instance, size, | 163 return PPB_Graphics2D_Proxy::CreateProxyResource(instance, size, |
164 is_always_opaque); | 164 is_always_opaque); |
(...skipping 12 matching lines...) Expand all Loading... |
177 PP_InputEvent_Type type, | 177 PP_InputEvent_Type type, |
178 PP_TimeTicks time_stamp, | 178 PP_TimeTicks time_stamp, |
179 uint32_t modifiers, | 179 uint32_t modifiers, |
180 uint32_t key_code, | 180 uint32_t key_code, |
181 struct PP_Var character_text) { | 181 struct PP_Var character_text) { |
182 if (type != PP_INPUTEVENT_TYPE_RAWKEYDOWN && | 182 if (type != PP_INPUTEVENT_TYPE_RAWKEYDOWN && |
183 type != PP_INPUTEVENT_TYPE_KEYDOWN && | 183 type != PP_INPUTEVENT_TYPE_KEYDOWN && |
184 type != PP_INPUTEVENT_TYPE_KEYUP && | 184 type != PP_INPUTEVENT_TYPE_KEYUP && |
185 type != PP_INPUTEVENT_TYPE_CHAR) | 185 type != PP_INPUTEVENT_TYPE_CHAR) |
186 return 0; | 186 return 0; |
187 InputEventData data; | 187 ppapi::InputEventData data; |
188 data.event_type = type; | 188 data.event_type = type; |
189 data.event_time_stamp = time_stamp; | 189 data.event_time_stamp = time_stamp; |
190 data.event_modifiers = modifiers; | 190 data.event_modifiers = modifiers; |
191 data.key_code = key_code; | 191 data.key_code = key_code; |
192 if (character_text.type == PP_VARTYPE_STRING) { | 192 if (character_text.type == PP_VARTYPE_STRING) { |
193 StringVar* text_str = StringVar::FromPPVar(character_text); | 193 StringVar* text_str = StringVar::FromPPVar(character_text); |
194 if (!text_str) | 194 if (!text_str) |
195 return 0; | 195 return 0; |
196 data.character_text = text_str->value(); | 196 data.character_text = text_str->value(); |
197 } | 197 } |
198 | 198 |
199 return (new PPB_InputEvent_Shared(PPB_InputEvent_Shared::InitAsProxy(), | 199 return (new InputEventImpl(InputEventImpl::InitAsProxy(), |
200 instance, data))->GetReference(); | 200 instance, data))->GetReference(); |
201 } | 201 } |
202 | 202 |
203 PP_Resource ResourceCreationProxy::CreateMouseInputEvent( | 203 PP_Resource ResourceCreationProxy::CreateMouseInputEvent( |
204 PP_Instance instance, | 204 PP_Instance instance, |
205 PP_InputEvent_Type type, | 205 PP_InputEvent_Type type, |
206 PP_TimeTicks time_stamp, | 206 PP_TimeTicks time_stamp, |
207 uint32_t modifiers, | 207 uint32_t modifiers, |
208 PP_InputEvent_MouseButton mouse_button, | 208 PP_InputEvent_MouseButton mouse_button, |
209 const PP_Point* mouse_position, | 209 const PP_Point* mouse_position, |
210 int32_t click_count, | 210 int32_t click_count, |
211 const PP_Point* mouse_movement) { | 211 const PP_Point* mouse_movement) { |
212 if (type != PP_INPUTEVENT_TYPE_MOUSEDOWN && | 212 if (type != PP_INPUTEVENT_TYPE_MOUSEDOWN && |
213 type != PP_INPUTEVENT_TYPE_MOUSEUP && | 213 type != PP_INPUTEVENT_TYPE_MOUSEUP && |
214 type != PP_INPUTEVENT_TYPE_MOUSEMOVE && | 214 type != PP_INPUTEVENT_TYPE_MOUSEMOVE && |
215 type != PP_INPUTEVENT_TYPE_MOUSEENTER && | 215 type != PP_INPUTEVENT_TYPE_MOUSEENTER && |
216 type != PP_INPUTEVENT_TYPE_MOUSELEAVE) | 216 type != PP_INPUTEVENT_TYPE_MOUSELEAVE) |
217 return 0; | 217 return 0; |
218 | 218 |
219 InputEventData data; | 219 ppapi::InputEventData data; |
220 data.event_type = type; | 220 data.event_type = type; |
221 data.event_time_stamp = time_stamp; | 221 data.event_time_stamp = time_stamp; |
222 data.event_modifiers = modifiers; | 222 data.event_modifiers = modifiers; |
223 data.mouse_button = mouse_button; | 223 data.mouse_button = mouse_button; |
224 data.mouse_position = *mouse_position; | 224 data.mouse_position = *mouse_position; |
225 data.mouse_click_count = click_count; | 225 data.mouse_click_count = click_count; |
226 data.mouse_movement = *mouse_movement; | 226 data.mouse_movement = *mouse_movement; |
227 | 227 |
228 return (new PPB_InputEvent_Shared(PPB_InputEvent_Shared::InitAsProxy(), | 228 return (new InputEventImpl(InputEventImpl::InitAsProxy(), |
229 instance, data))->GetReference(); | 229 instance, data))->GetReference(); |
230 } | 230 } |
231 | 231 |
232 PP_Resource ResourceCreationProxy::CreateGraphics3D( | 232 PP_Resource ResourceCreationProxy::CreateGraphics3D( |
233 PP_Instance instance, | 233 PP_Instance instance, |
234 PP_Resource share_context, | 234 PP_Resource share_context, |
235 const int32_t* attrib_list) { | 235 const int32_t* attrib_list) { |
236 return PPB_Graphics3D_Proxy::CreateProxyResource( | 236 return PPB_Graphics3D_Proxy::CreateProxyResource( |
237 instance, share_context, attrib_list); | 237 instance, share_context, attrib_list); |
238 } | 238 } |
239 | 239 |
(...skipping 29 matching lines...) Expand all Loading... |
269 return PPB_UDPSocket_Private_Proxy::CreateProxyResource(instance); | 269 return PPB_UDPSocket_Private_Proxy::CreateProxyResource(instance); |
270 } | 270 } |
271 | 271 |
272 PP_Resource ResourceCreationProxy::CreateURLLoader(PP_Instance instance) { | 272 PP_Resource ResourceCreationProxy::CreateURLLoader(PP_Instance instance) { |
273 return PPB_URLLoader_Proxy::CreateProxyResource(instance); | 273 return PPB_URLLoader_Proxy::CreateProxyResource(instance); |
274 } | 274 } |
275 | 275 |
276 PP_Resource ResourceCreationProxy::CreateURLRequestInfo( | 276 PP_Resource ResourceCreationProxy::CreateURLRequestInfo( |
277 PP_Instance instance, | 277 PP_Instance instance, |
278 const PPB_URLRequestInfo_Data& data) { | 278 const PPB_URLRequestInfo_Data& data) { |
279 return (new PPB_URLRequestInfo_Shared( | 279 return (new URLRequestInfoImpl( |
280 HostResource::MakeInstanceOnly(instance), data))->GetReference(); | 280 HostResource::MakeInstanceOnly(instance), data))->GetReference(); |
281 } | 281 } |
282 | 282 |
283 PP_Resource ResourceCreationProxy::CreateVideoCapture(PP_Instance instance) { | 283 PP_Resource ResourceCreationProxy::CreateVideoCapture(PP_Instance instance) { |
284 return PPB_VideoCapture_Proxy::CreateProxyResource(instance); | 284 return PPB_VideoCapture_Proxy::CreateProxyResource(instance); |
285 } | 285 } |
286 | 286 |
287 PP_Resource ResourceCreationProxy::CreateVideoDecoder( | 287 PP_Resource ResourceCreationProxy::CreateVideoDecoder( |
288 PP_Instance instance, | 288 PP_Instance instance, |
289 PP_Resource context3d_id, | 289 PP_Resource context3d_id, |
(...skipping 14 matching lines...) Expand all Loading... |
304 return 0; | 304 return 0; |
305 } | 305 } |
306 | 306 |
307 PP_Resource ResourceCreationProxy::CreateWheelInputEvent( | 307 PP_Resource ResourceCreationProxy::CreateWheelInputEvent( |
308 PP_Instance instance, | 308 PP_Instance instance, |
309 PP_TimeTicks time_stamp, | 309 PP_TimeTicks time_stamp, |
310 uint32_t modifiers, | 310 uint32_t modifiers, |
311 const PP_FloatPoint* wheel_delta, | 311 const PP_FloatPoint* wheel_delta, |
312 const PP_FloatPoint* wheel_ticks, | 312 const PP_FloatPoint* wheel_ticks, |
313 PP_Bool scroll_by_page) { | 313 PP_Bool scroll_by_page) { |
314 InputEventData data; | 314 ppapi::InputEventData data; |
315 data.event_type = PP_INPUTEVENT_TYPE_WHEEL; | 315 data.event_type = PP_INPUTEVENT_TYPE_WHEEL; |
316 data.event_time_stamp = time_stamp; | 316 data.event_time_stamp = time_stamp; |
317 data.event_modifiers = modifiers; | 317 data.event_modifiers = modifiers; |
318 data.wheel_delta = *wheel_delta; | 318 data.wheel_delta = *wheel_delta; |
319 data.wheel_ticks = *wheel_ticks; | 319 data.wheel_ticks = *wheel_ticks; |
320 data.wheel_scroll_by_page = PP_ToBool(scroll_by_page); | 320 data.wheel_scroll_by_page = PP_ToBool(scroll_by_page); |
321 | 321 |
322 return (new PPB_InputEvent_Shared(PPB_InputEvent_Shared::InitAsProxy(), | 322 return (new InputEventImpl(InputEventImpl::InitAsProxy(), |
323 instance, data))->GetReference(); | 323 instance, data))->GetReference(); |
324 } | 324 } |
325 | 325 |
326 bool ResourceCreationProxy::Send(IPC::Message* msg) { | 326 bool ResourceCreationProxy::Send(IPC::Message* msg) { |
327 return dispatcher()->Send(msg); | 327 return dispatcher()->Send(msg); |
328 } | 328 } |
329 | 329 |
330 bool ResourceCreationProxy::OnMessageReceived(const IPC::Message& msg) { | 330 bool ResourceCreationProxy::OnMessageReceived(const IPC::Message& msg) { |
331 return false; | 331 return false; |
332 } | 332 } |
333 | 333 |
334 } // namespace proxy | 334 } // namespace proxy |
335 } // namespace ppapi | 335 } // namespace ppapi |
OLD | NEW |