| 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/ppb_audio_config_shared.h" | 8 #include "ppapi/shared_impl/audio_config_impl.h" |
| 9 #include "ppapi/shared_impl/ppb_input_event_shared.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_directory_reader_impl.h" | 16 #include "webkit/plugins/ppapi/ppb_directory_reader_impl.h" |
| 17 #include "webkit/plugins/ppapi/ppb_file_chooser_impl.h" | 17 #include "webkit/plugins/ppapi/ppb_file_chooser_impl.h" |
| 18 #include "webkit/plugins/ppapi/ppb_file_io_impl.h" | 18 #include "webkit/plugins/ppapi/ppb_file_io_impl.h" |
| 19 #include "webkit/plugins/ppapi/ppb_file_ref_impl.h" | 19 #include "webkit/plugins/ppapi/ppb_file_ref_impl.h" |
| 20 #include "webkit/plugins/ppapi/ppb_file_system_impl.h" | 20 #include "webkit/plugins/ppapi/ppb_file_system_impl.h" |
| 21 #include "webkit/plugins/ppapi/ppb_flash_menu_impl.h" | 21 #include "webkit/plugins/ppapi/ppb_flash_menu_impl.h" |
| 22 #include "webkit/plugins/ppapi/ppb_flash_net_connector_impl.h" | 22 #include "webkit/plugins/ppapi/ppb_flash_net_connector_impl.h" |
| 23 #include "webkit/plugins/ppapi/ppb_font_impl.h" | 23 #include "webkit/plugins/ppapi/ppb_font_impl.h" |
| 24 #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h" | 24 #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h" |
| 25 #include "webkit/plugins/ppapi/ppb_graphics_3d_impl.h" | 25 #include "webkit/plugins/ppapi/ppb_graphics_3d_impl.h" |
| 26 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" | 26 #include "webkit/plugins/ppapi/ppb_image_data_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_tcp_socket_private_impl.h" | 28 #include "webkit/plugins/ppapi/ppb_tcp_socket_private_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_udp_socket_private_impl.h" | 30 #include "webkit/plugins/ppapi/ppb_udp_socket_private_impl.h" |
| 31 #include "webkit/plugins/ppapi/ppb_url_loader_impl.h" | 31 #include "webkit/plugins/ppapi/ppb_url_loader_impl.h" |
| 32 #include "webkit/plugins/ppapi/ppb_url_request_info_impl.h" | 32 #include "webkit/plugins/ppapi/ppb_url_request_info_impl.h" |
| 33 #include "webkit/plugins/ppapi/ppb_video_capture_impl.h" | 33 #include "webkit/plugins/ppapi/ppb_video_capture_impl.h" |
| 34 #include "webkit/plugins/ppapi/ppb_video_decoder_impl.h" | 34 #include "webkit/plugins/ppapi/ppb_video_decoder_impl.h" |
| 35 #include "webkit/plugins/ppapi/ppb_video_layer_impl.h" | 35 #include "webkit/plugins/ppapi/ppb_video_layer_impl.h" |
| 36 #include "webkit/plugins/ppapi/ppb_websocket_impl.h" | 36 #include "webkit/plugins/ppapi/ppb_websocket_impl.h" |
| 37 | 37 |
| 38 using ppapi::InputEventData; | 38 using ppapi::InputEventData; |
| 39 using ppapi::PPB_InputEvent_Shared; | 39 using ppapi::InputEventImpl; |
| 40 using ppapi::StringVar; | 40 using ppapi::StringVar; |
| 41 | 41 |
| 42 namespace webkit { | 42 namespace webkit { |
| 43 namespace ppapi { | 43 namespace ppapi { |
| 44 | 44 |
| 45 ResourceCreationImpl::ResourceCreationImpl(PluginInstance* instance) { | 45 ResourceCreationImpl::ResourceCreationImpl(PluginInstance* instance) { |
| 46 } | 46 } |
| 47 | 47 |
| 48 ResourceCreationImpl::~ResourceCreationImpl() { | 48 ResourceCreationImpl::~ResourceCreationImpl() { |
| 49 } | 49 } |
| 50 | 50 |
| 51 ::ppapi::thunk::ResourceCreationAPI* | 51 ::ppapi::thunk::ResourceCreationAPI* |
| 52 ResourceCreationImpl::AsResourceCreationAPI() { | 52 ResourceCreationImpl::AsResourceCreationAPI() { |
| 53 return this; | 53 return this; |
| 54 } | 54 } |
| 55 | 55 |
| 56 PP_Resource ResourceCreationImpl::CreateAudio( | 56 PP_Resource ResourceCreationImpl::CreateAudio( |
| 57 PP_Instance instance, | 57 PP_Instance instance, |
| 58 PP_Resource config_id, | 58 PP_Resource config_id, |
| 59 PPB_Audio_Callback audio_callback, | 59 PPB_Audio_Callback audio_callback, |
| 60 void* user_data) { | 60 void* user_data) { |
| 61 return PPB_Audio_Impl::Create(instance, config_id, audio_callback, | 61 return PPB_Audio_Impl::Create(instance, config_id, audio_callback, |
| 62 user_data); | 62 user_data); |
| 63 } | 63 } |
| 64 | 64 |
| 65 PP_Resource ResourceCreationImpl::CreateAudioConfig( | 65 PP_Resource ResourceCreationImpl::CreateAudioConfig( |
| 66 PP_Instance instance, | 66 PP_Instance instance, |
| 67 PP_AudioSampleRate sample_rate, | 67 PP_AudioSampleRate sample_rate, |
| 68 uint32_t sample_frame_count) { | 68 uint32_t sample_frame_count) { |
| 69 return ::ppapi::PPB_AudioConfig_Shared::CreateAsImpl(instance, sample_rate, | 69 return ::ppapi::AudioConfigImpl::CreateAsImpl(instance, sample_rate, |
| 70 sample_frame_count); | 70 sample_frame_count); |
| 71 } | 71 } |
| 72 | 72 |
| 73 PP_Resource ResourceCreationImpl::CreateAudioTrusted( | 73 PP_Resource ResourceCreationImpl::CreateAudioTrusted( |
| 74 PP_Instance instance) { | 74 PP_Instance instance) { |
| 75 return (new PPB_Audio_Impl(instance))->GetReference(); | 75 return (new PPB_Audio_Impl(instance))->GetReference(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 PP_Resource ResourceCreationImpl::CreateAudioInput( | 78 PP_Resource ResourceCreationImpl::CreateAudioInput( |
| 79 PP_Instance instance, | 79 PP_Instance instance, |
| 80 PP_Resource config_id, | 80 PP_Resource config_id, |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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* string_var = StringVar::FromPPVar(character_text); | 193 StringVar* string_var = StringVar::FromPPVar(character_text); |
| 194 if (!string_var) | 194 if (!string_var) |
| 195 return 0; | 195 return 0; |
| 196 data.character_text = string_var->value(); | 196 data.character_text = string_var->value(); |
| 197 } | 197 } |
| 198 | 198 |
| 199 return (new PPB_InputEvent_Shared(PPB_InputEvent_Shared::InitAsImpl(), | 199 return (new InputEventImpl(InputEventImpl::InitAsImpl(), |
| 200 instance, data))->GetReference(); | 200 instance, data))->GetReference(); |
| 201 } | 201 } |
| 202 | 202 |
| 203 PP_Resource ResourceCreationImpl::CreateMouseInputEvent( | 203 PP_Resource ResourceCreationImpl::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 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::InitAsImpl(), | 228 return (new InputEventImpl(InputEventImpl::InitAsImpl(), |
| 229 instance, data))->GetReference(); | 229 instance, data))->GetReference(); |
| 230 } | 230 } |
| 231 | 231 |
| 232 PP_Resource ResourceCreationImpl::CreateScrollbar(PP_Instance instance, | 232 PP_Resource ResourceCreationImpl::CreateScrollbar(PP_Instance instance, |
| 233 PP_Bool vertical) { | 233 PP_Bool vertical) { |
| 234 return PPB_Scrollbar_Impl::Create(instance, PP_ToBool(vertical)); | 234 return PPB_Scrollbar_Impl::Create(instance, PP_ToBool(vertical)); |
| 235 } | 235 } |
| 236 | 236 |
| 237 PP_Resource ResourceCreationImpl::CreateTCPSocketPrivate(PP_Instance instance) { | 237 PP_Resource ResourceCreationImpl::CreateTCPSocketPrivate(PP_Instance instance) { |
| 238 return PPB_TCPSocket_Private_Impl::CreateResource(instance); | 238 return PPB_TCPSocket_Private_Impl::CreateResource(instance); |
| 239 } | 239 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 const PP_FloatPoint* wheel_ticks, | 292 const PP_FloatPoint* wheel_ticks, |
| 293 PP_Bool scroll_by_page) { | 293 PP_Bool scroll_by_page) { |
| 294 InputEventData data; | 294 InputEventData data; |
| 295 data.event_type = PP_INPUTEVENT_TYPE_WHEEL; | 295 data.event_type = PP_INPUTEVENT_TYPE_WHEEL; |
| 296 data.event_time_stamp = time_stamp; | 296 data.event_time_stamp = time_stamp; |
| 297 data.event_modifiers = modifiers; | 297 data.event_modifiers = modifiers; |
| 298 data.wheel_delta = *wheel_delta; | 298 data.wheel_delta = *wheel_delta; |
| 299 data.wheel_ticks = *wheel_ticks; | 299 data.wheel_ticks = *wheel_ticks; |
| 300 data.wheel_scroll_by_page = PP_ToBool(scroll_by_page); | 300 data.wheel_scroll_by_page = PP_ToBool(scroll_by_page); |
| 301 | 301 |
| 302 return (new PPB_InputEvent_Shared(PPB_InputEvent_Shared::InitAsImpl(), | 302 return (new InputEventImpl(InputEventImpl::InitAsImpl(), |
| 303 instance, data))->GetReference(); | 303 instance, data))->GetReference(); |
| 304 } | 304 } |
| 305 | 305 |
| 306 } // namespace ppapi | 306 } // namespace ppapi |
| 307 } // namespace webkit | 307 } // namespace webkit |
| OLD | NEW |