| 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/input_event_impl.h" | 9 #include "ppapi/shared_impl/input_event_impl.h" |
| 9 #include "ppapi/shared_impl/var.h" | 10 #include "ppapi/shared_impl/var.h" |
| 10 #include "webkit/plugins/ppapi/common.h" | 11 #include "webkit/plugins/ppapi/common.h" |
| 11 #include "webkit/plugins/ppapi/ppb_audio_impl.h" | 12 #include "webkit/plugins/ppapi/ppb_audio_impl.h" |
| 12 #include "webkit/plugins/ppapi/ppb_broker_impl.h" | 13 #include "webkit/plugins/ppapi/ppb_broker_impl.h" |
| 13 #include "webkit/plugins/ppapi/ppb_buffer_impl.h" | 14 #include "webkit/plugins/ppapi/ppb_buffer_impl.h" |
| 14 #include "webkit/plugins/ppapi/ppb_context_3d_impl.h" | 15 #include "webkit/plugins/ppapi/ppb_context_3d_impl.h" |
| 15 #include "webkit/plugins/ppapi/ppb_directory_reader_impl.h" | 16 #include "webkit/plugins/ppapi/ppb_directory_reader_impl.h" |
| 16 #include "webkit/plugins/ppapi/ppb_file_chooser_impl.h" | 17 #include "webkit/plugins/ppapi/ppb_file_chooser_impl.h" |
| 17 #include "webkit/plugins/ppapi/ppb_file_io_impl.h" | 18 #include "webkit/plugins/ppapi/ppb_file_io_impl.h" |
| 18 #include "webkit/plugins/ppapi/ppb_file_ref_impl.h" | 19 #include "webkit/plugins/ppapi/ppb_file_ref_impl.h" |
| 19 #include "webkit/plugins/ppapi/ppb_file_system_impl.h" | 20 #include "webkit/plugins/ppapi/ppb_file_system_impl.h" |
| 20 #include "webkit/plugins/ppapi/ppb_flash_menu_impl.h" | 21 #include "webkit/plugins/ppapi/ppb_flash_menu_impl.h" |
| 21 #include "webkit/plugins/ppapi/ppb_flash_net_connector_impl.h" | 22 #include "webkit/plugins/ppapi/ppb_flash_net_connector_impl.h" |
| 22 #include "webkit/plugins/ppapi/ppb_font_impl.h" | 23 #include "webkit/plugins/ppapi/ppb_font_impl.h" |
| 23 #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h" | 24 #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h" |
| 24 #include "webkit/plugins/ppapi/ppb_graphics_3d_impl.h" | 25 #include "webkit/plugins/ppapi/ppb_graphics_3d_impl.h" |
| 25 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" | 26 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" |
| 26 #include "webkit/plugins/ppapi/ppb_input_event_impl.h" | |
| 27 #include "webkit/plugins/ppapi/ppb_scrollbar_impl.h" | 27 #include "webkit/plugins/ppapi/ppb_scrollbar_impl.h" |
| 28 #include "webkit/plugins/ppapi/ppb_surface_3d_impl.h" | 28 #include "webkit/plugins/ppapi/ppb_surface_3d_impl.h" |
| 29 #include "webkit/plugins/ppapi/ppb_transport_impl.h" | 29 #include "webkit/plugins/ppapi/ppb_transport_impl.h" |
| 30 #include "webkit/plugins/ppapi/ppb_url_loader_impl.h" | 30 #include "webkit/plugins/ppapi/ppb_url_loader_impl.h" |
| 31 #include "webkit/plugins/ppapi/ppb_url_request_info_impl.h" | 31 #include "webkit/plugins/ppapi/ppb_url_request_info_impl.h" |
| 32 #include "webkit/plugins/ppapi/ppb_video_capture_impl.h" | 32 #include "webkit/plugins/ppapi/ppb_video_capture_impl.h" |
| 33 #include "webkit/plugins/ppapi/ppb_video_decoder_impl.h" | 33 #include "webkit/plugins/ppapi/ppb_video_decoder_impl.h" |
| 34 #include "webkit/plugins/ppapi/ppb_video_layer_impl.h" | 34 #include "webkit/plugins/ppapi/ppb_video_layer_impl.h" |
| 35 | 35 |
| 36 using ppapi::InputEventData; | 36 using ppapi::InputEventData; |
| 37 using ppapi::InputEventImpl; |
| 37 using ppapi::StringVar; | 38 using ppapi::StringVar; |
| 38 | 39 |
| 39 namespace webkit { | 40 namespace webkit { |
| 40 namespace ppapi { | 41 namespace ppapi { |
| 41 | 42 |
| 42 ResourceCreationImpl::ResourceCreationImpl(PluginInstance* instance) { | 43 ResourceCreationImpl::ResourceCreationImpl(PluginInstance* instance) { |
| 43 } | 44 } |
| 44 | 45 |
| 45 ResourceCreationImpl::~ResourceCreationImpl() { | 46 ResourceCreationImpl::~ResourceCreationImpl() { |
| 46 } | 47 } |
| 47 | 48 |
| 48 ::ppapi::thunk::ResourceCreationAPI* | 49 ::ppapi::thunk::ResourceCreationAPI* |
| 49 ResourceCreationImpl::AsResourceCreationAPI() { | 50 ResourceCreationImpl::AsResourceCreationAPI() { |
| 50 return this; | 51 return this; |
| 51 } | 52 } |
| 52 | 53 |
| 53 PP_Resource ResourceCreationImpl::CreateAudio( | 54 PP_Resource ResourceCreationImpl::CreateAudio( |
| 54 PP_Instance instance, | 55 PP_Instance instance, |
| 55 PP_Resource config_id, | 56 PP_Resource config_id, |
| 56 PPB_Audio_Callback audio_callback, | 57 PPB_Audio_Callback audio_callback, |
| 57 void* user_data) { | 58 void* user_data) { |
| 58 return PPB_Audio_Impl::Create(instance, config_id, audio_callback, | 59 return PPB_Audio_Impl::Create(instance, config_id, audio_callback, |
| 59 user_data); | 60 user_data); |
| 60 } | 61 } |
| 61 | 62 |
| 62 PP_Resource ResourceCreationImpl::CreateAudioConfig( | 63 PP_Resource ResourceCreationImpl::CreateAudioConfig( |
| 63 PP_Instance instance, | 64 PP_Instance instance, |
| 64 PP_AudioSampleRate sample_rate, | 65 PP_AudioSampleRate sample_rate, |
| 65 uint32_t sample_frame_count) { | 66 uint32_t sample_frame_count) { |
| 66 return PPB_AudioConfig_Impl::Create(instance, sample_rate, | 67 return ::ppapi::AudioConfigImpl::CreateAsImpl(instance, sample_rate, |
| 67 sample_frame_count); | 68 sample_frame_count); |
| 68 } | 69 } |
| 69 | 70 |
| 70 PP_Resource ResourceCreationImpl::CreateAudioTrusted( | 71 PP_Resource ResourceCreationImpl::CreateAudioTrusted( |
| 71 PP_Instance instance) { | 72 PP_Instance instance) { |
| 72 return (new PPB_Audio_Impl(instance))->GetReference(); | 73 return (new PPB_Audio_Impl(instance))->GetReference(); |
| 73 } | 74 } |
| 74 | 75 |
| 75 PP_Resource ResourceCreationImpl::CreateBroker(PP_Instance instance) { | 76 PP_Resource ResourceCreationImpl::CreateBroker(PP_Instance instance) { |
| 76 return (new PPB_Broker_Impl(instance))->GetReference(); | 77 return (new PPB_Broker_Impl(instance))->GetReference(); |
| 77 } | 78 } |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 data.event_time_stamp = time_stamp; | 196 data.event_time_stamp = time_stamp; |
| 196 data.event_modifiers = modifiers; | 197 data.event_modifiers = modifiers; |
| 197 data.key_code = key_code; | 198 data.key_code = key_code; |
| 198 if (character_text.type == PP_VARTYPE_STRING) { | 199 if (character_text.type == PP_VARTYPE_STRING) { |
| 199 StringVar* string_var = StringVar::FromPPVar(character_text); | 200 StringVar* string_var = StringVar::FromPPVar(character_text); |
| 200 if (!string_var) | 201 if (!string_var) |
| 201 return 0; | 202 return 0; |
| 202 data.character_text = string_var->value(); | 203 data.character_text = string_var->value(); |
| 203 } | 204 } |
| 204 | 205 |
| 205 return (new PPB_InputEvent_Impl(instance, data))->GetReference(); | 206 return (new InputEventImpl(InputEventImpl::InitAsImpl(), |
| 207 instance, data))->GetReference(); |
| 206 } | 208 } |
| 207 | 209 |
| 208 PP_Resource ResourceCreationImpl::CreateMouseInputEvent( | 210 PP_Resource ResourceCreationImpl::CreateMouseInputEvent( |
| 209 PP_Instance instance, | 211 PP_Instance instance, |
| 210 PP_InputEvent_Type type, | 212 PP_InputEvent_Type type, |
| 211 PP_TimeTicks time_stamp, | 213 PP_TimeTicks time_stamp, |
| 212 uint32_t modifiers, | 214 uint32_t modifiers, |
| 213 PP_InputEvent_MouseButton mouse_button, | 215 PP_InputEvent_MouseButton mouse_button, |
| 214 const PP_Point* mouse_position, | 216 const PP_Point* mouse_position, |
| 215 int32_t click_count) { | 217 int32_t click_count) { |
| 216 if (type != PP_INPUTEVENT_TYPE_MOUSEDOWN && | 218 if (type != PP_INPUTEVENT_TYPE_MOUSEDOWN && |
| 217 type != PP_INPUTEVENT_TYPE_MOUSEUP && | 219 type != PP_INPUTEVENT_TYPE_MOUSEUP && |
| 218 type != PP_INPUTEVENT_TYPE_MOUSEMOVE && | 220 type != PP_INPUTEVENT_TYPE_MOUSEMOVE && |
| 219 type != PP_INPUTEVENT_TYPE_MOUSEENTER && | 221 type != PP_INPUTEVENT_TYPE_MOUSEENTER && |
| 220 type != PP_INPUTEVENT_TYPE_MOUSELEAVE) | 222 type != PP_INPUTEVENT_TYPE_MOUSELEAVE) |
| 221 return 0; | 223 return 0; |
| 222 | 224 |
| 223 InputEventData data; | 225 InputEventData data; |
| 224 data.event_type = type; | 226 data.event_type = type; |
| 225 data.event_time_stamp = time_stamp; | 227 data.event_time_stamp = time_stamp; |
| 226 data.event_modifiers = modifiers; | 228 data.event_modifiers = modifiers; |
| 227 data.mouse_button = mouse_button; | 229 data.mouse_button = mouse_button; |
| 228 data.mouse_position = *mouse_position; | 230 data.mouse_position = *mouse_position; |
| 229 data.mouse_click_count = click_count; | 231 data.mouse_click_count = click_count; |
| 230 | 232 |
| 231 return (new PPB_InputEvent_Impl(instance, data))->GetReference(); | 233 return (new InputEventImpl(InputEventImpl::InitAsImpl(), |
| 234 instance, data))->GetReference(); |
| 232 } | 235 } |
| 233 | 236 |
| 234 PP_Resource ResourceCreationImpl::CreateScrollbar(PP_Instance instance, | 237 PP_Resource ResourceCreationImpl::CreateScrollbar(PP_Instance instance, |
| 235 PP_Bool vertical) { | 238 PP_Bool vertical) { |
| 236 return PPB_Scrollbar_Impl::Create(instance, PP_ToBool(vertical)); | 239 return PPB_Scrollbar_Impl::Create(instance, PP_ToBool(vertical)); |
| 237 } | 240 } |
| 238 | 241 |
| 239 PP_Resource ResourceCreationImpl::CreateSurface3D( | 242 PP_Resource ResourceCreationImpl::CreateSurface3D( |
| 240 PP_Instance instance, | 243 PP_Instance instance, |
| 241 PP_Config3D_Dev config, | 244 PP_Config3D_Dev config, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 const PP_FloatPoint* wheel_ticks, | 288 const PP_FloatPoint* wheel_ticks, |
| 286 PP_Bool scroll_by_page) { | 289 PP_Bool scroll_by_page) { |
| 287 InputEventData data; | 290 InputEventData data; |
| 288 data.event_type = PP_INPUTEVENT_TYPE_WHEEL; | 291 data.event_type = PP_INPUTEVENT_TYPE_WHEEL; |
| 289 data.event_time_stamp = time_stamp; | 292 data.event_time_stamp = time_stamp; |
| 290 data.event_modifiers = modifiers; | 293 data.event_modifiers = modifiers; |
| 291 data.wheel_delta = *wheel_delta; | 294 data.wheel_delta = *wheel_delta; |
| 292 data.wheel_ticks = *wheel_ticks; | 295 data.wheel_ticks = *wheel_ticks; |
| 293 data.wheel_scroll_by_page = PP_ToBool(scroll_by_page); | 296 data.wheel_scroll_by_page = PP_ToBool(scroll_by_page); |
| 294 | 297 |
| 295 return (new PPB_InputEvent_Impl(instance, data))->GetReference(); | 298 return (new InputEventImpl(InputEventImpl::InitAsImpl(), |
| 299 instance, data))->GetReference(); |
| 296 } | 300 } |
| 297 | 301 |
| 298 } // namespace ppapi | 302 } // namespace ppapi |
| 299 } // namespace webkit | 303 } // namespace webkit |
| OLD | NEW |