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 "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/ppb_audio_config_shared.h" | 8 #include "ppapi/shared_impl/ppb_audio_config_shared.h" |
9 #include "ppapi/shared_impl/private/ppb_font_shared.h" | 9 #include "ppapi/shared_impl/private/ppb_font_shared.h" |
10 #include "ppapi/shared_impl/ppb_input_event_shared.h" | 10 #include "ppapi/shared_impl/ppb_input_event_shared.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 PPB_Audio_Callback audio_callback, | 63 PPB_Audio_Callback audio_callback, |
64 void* user_data) { | 64 void* user_data) { |
65 return PPB_Audio_Impl::Create(instance, config_id, audio_callback, | 65 return PPB_Audio_Impl::Create(instance, config_id, audio_callback, |
66 user_data); | 66 user_data); |
67 } | 67 } |
68 | 68 |
69 PP_Resource ResourceCreationImpl::CreateAudioConfig( | 69 PP_Resource ResourceCreationImpl::CreateAudioConfig( |
70 PP_Instance instance, | 70 PP_Instance instance, |
71 PP_AudioSampleRate sample_rate, | 71 PP_AudioSampleRate sample_rate, |
72 uint32_t sample_frame_count) { | 72 uint32_t sample_frame_count) { |
73 return ::ppapi::PPB_AudioConfig_Shared::CreateAsImpl(instance, sample_rate, | 73 return ::ppapi::PPB_AudioConfig_Shared::Create( |
74 sample_frame_count); | 74 ::ppapi::OBJECT_IS_IMPL, instance, sample_rate, sample_frame_count); |
75 } | 75 } |
76 | 76 |
77 PP_Resource ResourceCreationImpl::CreateAudioTrusted( | 77 PP_Resource ResourceCreationImpl::CreateAudioTrusted( |
78 PP_Instance instance) { | 78 PP_Instance instance) { |
79 return (new PPB_Audio_Impl(instance))->GetReference(); | 79 return (new PPB_Audio_Impl(instance))->GetReference(); |
80 } | 80 } |
81 | 81 |
82 PP_Resource ResourceCreationImpl::CreateAudioInput( | 82 PP_Resource ResourceCreationImpl::CreateAudioInput( |
83 PP_Instance instance, | 83 PP_Instance instance, |
84 PP_Resource config_id, | 84 PP_Resource config_id, |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 return (new PPB_Flash_NetConnector_Impl(instance))->GetReference(); | 145 return (new PPB_Flash_NetConnector_Impl(instance))->GetReference(); |
146 } | 146 } |
147 | 147 |
148 PP_Resource ResourceCreationImpl::CreateFontObject( | 148 PP_Resource ResourceCreationImpl::CreateFontObject( |
149 PP_Instance instance, | 149 PP_Instance instance, |
150 const PP_FontDescription_Dev* description) { | 150 const PP_FontDescription_Dev* description) { |
151 PluginInstance* plugin_instance = | 151 PluginInstance* plugin_instance = |
152 ResourceHelper::PPInstanceToPluginInstance(instance); | 152 ResourceHelper::PPInstanceToPluginInstance(instance); |
153 if (!plugin_instance) | 153 if (!plugin_instance) |
154 return 0; | 154 return 0; |
155 return ::ppapi::PPB_Font_Shared::CreateAsImpl( | 155 return ::ppapi::PPB_Font_Shared::Create( |
156 instance, *description, plugin_instance->delegate()->GetPreferences()); | 156 ::ppapi::OBJECT_IS_IMPL, instance, *description, |
| 157 plugin_instance->delegate()->GetPreferences()); |
157 } | 158 } |
158 | 159 |
159 PP_Resource ResourceCreationImpl::CreateGraphics2D( | 160 PP_Resource ResourceCreationImpl::CreateGraphics2D( |
160 PP_Instance instance, | 161 PP_Instance instance, |
161 const PP_Size& size, | 162 const PP_Size& size, |
162 PP_Bool is_always_opaque) { | 163 PP_Bool is_always_opaque) { |
163 return PPB_Graphics2D_Impl::Create(instance, size, is_always_opaque); | 164 return PPB_Graphics2D_Impl::Create(instance, size, is_always_opaque); |
164 } | 165 } |
165 | 166 |
166 PP_Resource ResourceCreationImpl::CreateGraphics3D( | 167 PP_Resource ResourceCreationImpl::CreateGraphics3D( |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 data.event_time_stamp = time_stamp; | 203 data.event_time_stamp = time_stamp; |
203 data.event_modifiers = modifiers; | 204 data.event_modifiers = modifiers; |
204 data.key_code = key_code; | 205 data.key_code = key_code; |
205 if (character_text.type == PP_VARTYPE_STRING) { | 206 if (character_text.type == PP_VARTYPE_STRING) { |
206 StringVar* string_var = StringVar::FromPPVar(character_text); | 207 StringVar* string_var = StringVar::FromPPVar(character_text); |
207 if (!string_var) | 208 if (!string_var) |
208 return 0; | 209 return 0; |
209 data.character_text = string_var->value(); | 210 data.character_text = string_var->value(); |
210 } | 211 } |
211 | 212 |
212 return (new PPB_InputEvent_Shared(PPB_InputEvent_Shared::InitAsImpl(), | 213 return (new PPB_InputEvent_Shared(::ppapi::OBJECT_IS_IMPL, |
213 instance, data))->GetReference(); | 214 instance, data))->GetReference(); |
214 } | 215 } |
215 | 216 |
216 PP_Resource ResourceCreationImpl::CreateMouseInputEvent( | 217 PP_Resource ResourceCreationImpl::CreateMouseInputEvent( |
217 PP_Instance instance, | 218 PP_Instance instance, |
218 PP_InputEvent_Type type, | 219 PP_InputEvent_Type type, |
219 PP_TimeTicks time_stamp, | 220 PP_TimeTicks time_stamp, |
220 uint32_t modifiers, | 221 uint32_t modifiers, |
221 PP_InputEvent_MouseButton mouse_button, | 222 PP_InputEvent_MouseButton mouse_button, |
222 const PP_Point* mouse_position, | 223 const PP_Point* mouse_position, |
223 int32_t click_count, | 224 int32_t click_count, |
224 const PP_Point* mouse_movement) { | 225 const PP_Point* mouse_movement) { |
225 if (type != PP_INPUTEVENT_TYPE_MOUSEDOWN && | 226 if (type != PP_INPUTEVENT_TYPE_MOUSEDOWN && |
226 type != PP_INPUTEVENT_TYPE_MOUSEUP && | 227 type != PP_INPUTEVENT_TYPE_MOUSEUP && |
227 type != PP_INPUTEVENT_TYPE_MOUSEMOVE && | 228 type != PP_INPUTEVENT_TYPE_MOUSEMOVE && |
228 type != PP_INPUTEVENT_TYPE_MOUSEENTER && | 229 type != PP_INPUTEVENT_TYPE_MOUSEENTER && |
229 type != PP_INPUTEVENT_TYPE_MOUSELEAVE) | 230 type != PP_INPUTEVENT_TYPE_MOUSELEAVE) |
230 return 0; | 231 return 0; |
231 | 232 |
232 InputEventData data; | 233 InputEventData data; |
233 data.event_type = type; | 234 data.event_type = type; |
234 data.event_time_stamp = time_stamp; | 235 data.event_time_stamp = time_stamp; |
235 data.event_modifiers = modifiers; | 236 data.event_modifiers = modifiers; |
236 data.mouse_button = mouse_button; | 237 data.mouse_button = mouse_button; |
237 data.mouse_position = *mouse_position; | 238 data.mouse_position = *mouse_position; |
238 data.mouse_click_count = click_count; | 239 data.mouse_click_count = click_count; |
239 data.mouse_movement = *mouse_movement; | 240 data.mouse_movement = *mouse_movement; |
240 | 241 |
241 return (new PPB_InputEvent_Shared(PPB_InputEvent_Shared::InitAsImpl(), | 242 return (new PPB_InputEvent_Shared(::ppapi::OBJECT_IS_IMPL, |
242 instance, data))->GetReference(); | 243 instance, data))->GetReference(); |
243 } | 244 } |
244 | 245 |
245 PP_Resource ResourceCreationImpl::CreateScrollbar(PP_Instance instance, | 246 PP_Resource ResourceCreationImpl::CreateScrollbar(PP_Instance instance, |
246 PP_Bool vertical) { | 247 PP_Bool vertical) { |
247 return PPB_Scrollbar_Impl::Create(instance, PP_ToBool(vertical)); | 248 return PPB_Scrollbar_Impl::Create(instance, PP_ToBool(vertical)); |
248 } | 249 } |
249 | 250 |
250 PP_Resource ResourceCreationImpl::CreateResourceArray( | 251 PP_Resource ResourceCreationImpl::CreateResourceArray( |
251 PP_Instance instance, | 252 PP_Instance instance, |
252 const PP_Resource elements[], | 253 const PP_Resource elements[], |
253 uint32_t size) { | 254 uint32_t size) { |
254 PPB_ResourceArray_Shared* object = new PPB_ResourceArray_Shared( | 255 PPB_ResourceArray_Shared* object = new PPB_ResourceArray_Shared( |
255 PPB_ResourceArray_Shared::InitAsImpl(), instance, elements, size); | 256 ::ppapi::OBJECT_IS_IMPL, instance, elements, size); |
256 return object->GetReference(); | 257 return object->GetReference(); |
257 } | 258 } |
258 | 259 |
259 PP_Resource ResourceCreationImpl::CreateTCPSocketPrivate(PP_Instance instance) { | 260 PP_Resource ResourceCreationImpl::CreateTCPSocketPrivate(PP_Instance instance) { |
260 return PPB_TCPSocket_Private_Impl::CreateResource(instance); | 261 return PPB_TCPSocket_Private_Impl::CreateResource(instance); |
261 } | 262 } |
262 | 263 |
263 PP_Resource ResourceCreationImpl::CreateTransport(PP_Instance instance, | 264 PP_Resource ResourceCreationImpl::CreateTransport(PP_Instance instance, |
264 const char* name, | 265 const char* name, |
265 PP_TransportType type) { | 266 PP_TransportType type) { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 const PP_FloatPoint* wheel_ticks, | 317 const PP_FloatPoint* wheel_ticks, |
317 PP_Bool scroll_by_page) { | 318 PP_Bool scroll_by_page) { |
318 InputEventData data; | 319 InputEventData data; |
319 data.event_type = PP_INPUTEVENT_TYPE_WHEEL; | 320 data.event_type = PP_INPUTEVENT_TYPE_WHEEL; |
320 data.event_time_stamp = time_stamp; | 321 data.event_time_stamp = time_stamp; |
321 data.event_modifiers = modifiers; | 322 data.event_modifiers = modifiers; |
322 data.wheel_delta = *wheel_delta; | 323 data.wheel_delta = *wheel_delta; |
323 data.wheel_ticks = *wheel_ticks; | 324 data.wheel_ticks = *wheel_ticks; |
324 data.wheel_scroll_by_page = PP_ToBool(scroll_by_page); | 325 data.wheel_scroll_by_page = PP_ToBool(scroll_by_page); |
325 | 326 |
326 return (new PPB_InputEvent_Shared(PPB_InputEvent_Shared::InitAsImpl(), | 327 return (new PPB_InputEvent_Shared(::ppapi::OBJECT_IS_IMPL, |
327 instance, data))->GetReference(); | 328 instance, data))->GetReference(); |
328 } | 329 } |
329 | 330 |
330 } // namespace ppapi | 331 } // namespace ppapi |
331 } // namespace webkit | 332 } // namespace webkit |
OLD | NEW |