OLD | NEW |
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 PPB_Audio_Callback audio_callback, | 69 PPB_Audio_Callback audio_callback, |
70 void* user_data) { | 70 void* user_data) { |
71 return PPB_Audio_Proxy::CreateProxyResource(instance, config_id, | 71 return PPB_Audio_Proxy::CreateProxyResource(instance, config_id, |
72 audio_callback, user_data); | 72 audio_callback, user_data); |
73 } | 73 } |
74 | 74 |
75 PP_Resource ResourceCreationProxy::CreateAudioConfig( | 75 PP_Resource ResourceCreationProxy::CreateAudioConfig( |
76 PP_Instance instance, | 76 PP_Instance instance, |
77 PP_AudioSampleRate sample_rate, | 77 PP_AudioSampleRate sample_rate, |
78 uint32_t sample_frame_count) { | 78 uint32_t sample_frame_count) { |
79 return PPB_AudioConfig_Shared::CreateAsProxy( | 79 return PPB_AudioConfig_Shared::Create( |
80 instance, sample_rate, sample_frame_count); | 80 OBJECT_IS_PROXY, instance, sample_rate, sample_frame_count); |
81 } | 81 } |
82 | 82 |
83 PP_Resource ResourceCreationProxy::CreateAudioTrusted(PP_Instance instance) { | 83 PP_Resource ResourceCreationProxy::CreateAudioTrusted(PP_Instance instance) { |
84 // Proxied plugins can't created trusted audio devices. | 84 // Proxied plugins can't created trusted audio devices. |
85 return 0; | 85 return 0; |
86 } | 86 } |
87 | 87 |
88 PP_Resource ResourceCreationProxy::CreateAudioInput( | 88 PP_Resource ResourceCreationProxy::CreateAudioInput( |
89 PP_Instance instance, | 89 PP_Instance instance, |
90 PP_Resource config_id, | 90 PP_Resource config_id, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 return PPB_Flash_NetConnector_Proxy::CreateProxyResource(instance); | 155 return PPB_Flash_NetConnector_Proxy::CreateProxyResource(instance); |
156 } | 156 } |
157 | 157 |
158 PP_Resource ResourceCreationProxy::CreateFontObject( | 158 PP_Resource ResourceCreationProxy::CreateFontObject( |
159 PP_Instance instance, | 159 PP_Instance instance, |
160 const PP_FontDescription_Dev* description) { | 160 const PP_FontDescription_Dev* description) { |
161 PluginDispatcher* dispatcher = | 161 PluginDispatcher* dispatcher = |
162 PluginDispatcher::GetForInstance(instance); | 162 PluginDispatcher::GetForInstance(instance); |
163 if (!dispatcher) | 163 if (!dispatcher) |
164 return 0; | 164 return 0; |
165 return PPB_Font_Shared::CreateAsProxy(instance, *description, | 165 return PPB_Font_Shared::Create(OBJECT_IS_PROXY, instance, *description, |
166 dispatcher->preferences()); | 166 dispatcher->preferences()); |
167 } | 167 } |
168 | 168 |
169 PP_Resource ResourceCreationProxy::CreateGraphics2D(PP_Instance instance, | 169 PP_Resource ResourceCreationProxy::CreateGraphics2D(PP_Instance instance, |
170 const PP_Size& size, | 170 const PP_Size& size, |
171 PP_Bool is_always_opaque) { | 171 PP_Bool is_always_opaque) { |
172 return PPB_Graphics2D_Proxy::CreateProxyResource(instance, size, | 172 return PPB_Graphics2D_Proxy::CreateProxyResource(instance, size, |
173 is_always_opaque); | 173 is_always_opaque); |
174 } | 174 } |
175 | 175 |
176 PP_Resource ResourceCreationProxy::CreateImageData(PP_Instance instance, | 176 PP_Resource ResourceCreationProxy::CreateImageData(PP_Instance instance, |
(...skipping 21 matching lines...) Expand all Loading... |
198 data.event_time_stamp = time_stamp; | 198 data.event_time_stamp = time_stamp; |
199 data.event_modifiers = modifiers; | 199 data.event_modifiers = modifiers; |
200 data.key_code = key_code; | 200 data.key_code = key_code; |
201 if (character_text.type == PP_VARTYPE_STRING) { | 201 if (character_text.type == PP_VARTYPE_STRING) { |
202 StringVar* text_str = StringVar::FromPPVar(character_text); | 202 StringVar* text_str = StringVar::FromPPVar(character_text); |
203 if (!text_str) | 203 if (!text_str) |
204 return 0; | 204 return 0; |
205 data.character_text = text_str->value(); | 205 data.character_text = text_str->value(); |
206 } | 206 } |
207 | 207 |
208 return (new PPB_InputEvent_Shared(PPB_InputEvent_Shared::InitAsProxy(), | 208 return (new PPB_InputEvent_Shared(OBJECT_IS_PROXY, |
209 instance, data))->GetReference(); | 209 instance, data))->GetReference(); |
210 } | 210 } |
211 | 211 |
212 PP_Resource ResourceCreationProxy::CreateMouseInputEvent( | 212 PP_Resource ResourceCreationProxy::CreateMouseInputEvent( |
213 PP_Instance instance, | 213 PP_Instance instance, |
214 PP_InputEvent_Type type, | 214 PP_InputEvent_Type type, |
215 PP_TimeTicks time_stamp, | 215 PP_TimeTicks time_stamp, |
216 uint32_t modifiers, | 216 uint32_t modifiers, |
217 PP_InputEvent_MouseButton mouse_button, | 217 PP_InputEvent_MouseButton mouse_button, |
218 const PP_Point* mouse_position, | 218 const PP_Point* mouse_position, |
219 int32_t click_count, | 219 int32_t click_count, |
220 const PP_Point* mouse_movement) { | 220 const PP_Point* mouse_movement) { |
221 if (type != PP_INPUTEVENT_TYPE_MOUSEDOWN && | 221 if (type != PP_INPUTEVENT_TYPE_MOUSEDOWN && |
222 type != PP_INPUTEVENT_TYPE_MOUSEUP && | 222 type != PP_INPUTEVENT_TYPE_MOUSEUP && |
223 type != PP_INPUTEVENT_TYPE_MOUSEMOVE && | 223 type != PP_INPUTEVENT_TYPE_MOUSEMOVE && |
224 type != PP_INPUTEVENT_TYPE_MOUSEENTER && | 224 type != PP_INPUTEVENT_TYPE_MOUSEENTER && |
225 type != PP_INPUTEVENT_TYPE_MOUSELEAVE) | 225 type != PP_INPUTEVENT_TYPE_MOUSELEAVE) |
226 return 0; | 226 return 0; |
227 | 227 |
228 InputEventData data; | 228 InputEventData data; |
229 data.event_type = type; | 229 data.event_type = type; |
230 data.event_time_stamp = time_stamp; | 230 data.event_time_stamp = time_stamp; |
231 data.event_modifiers = modifiers; | 231 data.event_modifiers = modifiers; |
232 data.mouse_button = mouse_button; | 232 data.mouse_button = mouse_button; |
233 data.mouse_position = *mouse_position; | 233 data.mouse_position = *mouse_position; |
234 data.mouse_click_count = click_count; | 234 data.mouse_click_count = click_count; |
235 data.mouse_movement = *mouse_movement; | 235 data.mouse_movement = *mouse_movement; |
236 | 236 |
237 return (new PPB_InputEvent_Shared(PPB_InputEvent_Shared::InitAsProxy(), | 237 return (new PPB_InputEvent_Shared(OBJECT_IS_PROXY, |
238 instance, data))->GetReference(); | 238 instance, data))->GetReference(); |
239 } | 239 } |
240 | 240 |
241 PP_Resource ResourceCreationProxy::CreateGraphics3D( | 241 PP_Resource ResourceCreationProxy::CreateGraphics3D( |
242 PP_Instance instance, | 242 PP_Instance instance, |
243 PP_Resource share_context, | 243 PP_Resource share_context, |
244 const int32_t* attrib_list) { | 244 const int32_t* attrib_list) { |
245 return PPB_Graphics3D_Proxy::CreateProxyResource( | 245 return PPB_Graphics3D_Proxy::CreateProxyResource( |
246 instance, share_context, attrib_list); | 246 instance, share_context, attrib_list); |
247 } | 247 } |
248 | 248 |
249 PP_Resource ResourceCreationProxy::CreateGraphics3DRaw( | 249 PP_Resource ResourceCreationProxy::CreateGraphics3DRaw( |
250 PP_Instance instance, | 250 PP_Instance instance, |
251 PP_Resource share_context, | 251 PP_Resource share_context, |
252 const int32_t* attrib_list) { | 252 const int32_t* attrib_list) { |
253 // Not proxied. The raw creation function is used only in the implementation | 253 // Not proxied. The raw creation function is used only in the implementation |
254 // of the proxy on the host side. | 254 // of the proxy on the host side. |
255 return 0; | 255 return 0; |
256 } | 256 } |
257 | 257 |
258 PP_Resource ResourceCreationProxy::CreateResourceArray( | 258 PP_Resource ResourceCreationProxy::CreateResourceArray( |
259 PP_Instance instance, | 259 PP_Instance instance, |
260 const PP_Resource elements[], | 260 const PP_Resource elements[], |
261 uint32_t size) { | 261 uint32_t size) { |
262 PPB_ResourceArray_Shared* object = new PPB_ResourceArray_Shared( | 262 PPB_ResourceArray_Shared* object = new PPB_ResourceArray_Shared( |
263 PPB_ResourceArray_Shared::InitAsProxy(), instance, elements, size); | 263 OBJECT_IS_PROXY, instance, elements, size); |
264 return object->GetReference(); | 264 return object->GetReference(); |
265 } | 265 } |
266 | 266 |
267 PP_Resource ResourceCreationProxy::CreateScrollbar(PP_Instance instance, | 267 PP_Resource ResourceCreationProxy::CreateScrollbar(PP_Instance instance, |
268 PP_Bool vertical) { | 268 PP_Bool vertical) { |
269 NOTIMPLEMENTED(); // Not proxied yet. | 269 NOTIMPLEMENTED(); // Not proxied yet. |
270 return 0; | 270 return 0; |
271 } | 271 } |
272 | 272 |
273 PP_Resource ResourceCreationProxy::CreateTCPSocketPrivate( | 273 PP_Resource ResourceCreationProxy::CreateTCPSocketPrivate( |
(...skipping 13 matching lines...) Expand all Loading... |
287 return PPB_UDPSocket_Private_Proxy::CreateProxyResource(instance); | 287 return PPB_UDPSocket_Private_Proxy::CreateProxyResource(instance); |
288 } | 288 } |
289 | 289 |
290 PP_Resource ResourceCreationProxy::CreateURLLoader(PP_Instance instance) { | 290 PP_Resource ResourceCreationProxy::CreateURLLoader(PP_Instance instance) { |
291 return PPB_URLLoader_Proxy::CreateProxyResource(instance); | 291 return PPB_URLLoader_Proxy::CreateProxyResource(instance); |
292 } | 292 } |
293 | 293 |
294 PP_Resource ResourceCreationProxy::CreateURLRequestInfo( | 294 PP_Resource ResourceCreationProxy::CreateURLRequestInfo( |
295 PP_Instance instance, | 295 PP_Instance instance, |
296 const PPB_URLRequestInfo_Data& data) { | 296 const PPB_URLRequestInfo_Data& data) { |
297 return (new PPB_URLRequestInfo_Shared( | 297 return (new PPB_URLRequestInfo_Shared(OBJECT_IS_PROXY, |
298 HostResource::MakeInstanceOnly(instance), data))->GetReference(); | 298 instance, data))->GetReference(); |
299 } | 299 } |
300 | 300 |
301 PP_Resource ResourceCreationProxy::CreateVideoCapture(PP_Instance instance) { | 301 PP_Resource ResourceCreationProxy::CreateVideoCapture(PP_Instance instance) { |
302 return PPB_VideoCapture_Proxy::CreateProxyResource(instance); | 302 return PPB_VideoCapture_Proxy::CreateProxyResource(instance); |
303 } | 303 } |
304 | 304 |
305 PP_Resource ResourceCreationProxy::CreateVideoDecoder( | 305 PP_Resource ResourceCreationProxy::CreateVideoDecoder( |
306 PP_Instance instance, | 306 PP_Instance instance, |
307 PP_Resource context3d_id, | 307 PP_Resource context3d_id, |
308 PP_VideoDecoder_Profile profile) { | 308 PP_VideoDecoder_Profile profile) { |
(...skipping 21 matching lines...) Expand all Loading... |
330 const PP_FloatPoint* wheel_ticks, | 330 const PP_FloatPoint* wheel_ticks, |
331 PP_Bool scroll_by_page) { | 331 PP_Bool scroll_by_page) { |
332 InputEventData data; | 332 InputEventData data; |
333 data.event_type = PP_INPUTEVENT_TYPE_WHEEL; | 333 data.event_type = PP_INPUTEVENT_TYPE_WHEEL; |
334 data.event_time_stamp = time_stamp; | 334 data.event_time_stamp = time_stamp; |
335 data.event_modifiers = modifiers; | 335 data.event_modifiers = modifiers; |
336 data.wheel_delta = *wheel_delta; | 336 data.wheel_delta = *wheel_delta; |
337 data.wheel_ticks = *wheel_ticks; | 337 data.wheel_ticks = *wheel_ticks; |
338 data.wheel_scroll_by_page = PP_ToBool(scroll_by_page); | 338 data.wheel_scroll_by_page = PP_ToBool(scroll_by_page); |
339 | 339 |
340 return (new PPB_InputEvent_Shared(PPB_InputEvent_Shared::InitAsProxy(), | 340 return (new PPB_InputEvent_Shared(OBJECT_IS_PROXY, |
341 instance, data))->GetReference(); | 341 instance, data))->GetReference(); |
342 } | 342 } |
343 | 343 |
344 bool ResourceCreationProxy::Send(IPC::Message* msg) { | 344 bool ResourceCreationProxy::Send(IPC::Message* msg) { |
345 return dispatcher()->Send(msg); | 345 return dispatcher()->Send(msg); |
346 } | 346 } |
347 | 347 |
348 bool ResourceCreationProxy::OnMessageReceived(const IPC::Message& msg) { | 348 bool ResourceCreationProxy::OnMessageReceived(const IPC::Message& msg) { |
349 return false; | 349 return false; |
350 } | 350 } |
351 | 351 |
352 } // namespace proxy | 352 } // namespace proxy |
353 } // namespace ppapi | 353 } // namespace ppapi |
OLD | NEW |