| 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/ppb_audio_config_shared.h" |
| 9 #include "ppapi/shared_impl/input_event_impl.h" | 9 #include "ppapi/shared_impl/ppb_input_event_shared.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_transport_impl.h" | 28 #include "webkit/plugins/ppapi/ppb_transport_impl.h" |
| 29 #include "webkit/plugins/ppapi/ppb_url_loader_impl.h" | 29 #include "webkit/plugins/ppapi/ppb_url_loader_impl.h" |
| 30 #include "webkit/plugins/ppapi/ppb_url_request_info_impl.h" | 30 #include "webkit/plugins/ppapi/ppb_url_request_info_impl.h" |
| 31 #include "webkit/plugins/ppapi/ppb_video_capture_impl.h" | 31 #include "webkit/plugins/ppapi/ppb_video_capture_impl.h" |
| 32 #include "webkit/plugins/ppapi/ppb_video_decoder_impl.h" | 32 #include "webkit/plugins/ppapi/ppb_video_decoder_impl.h" |
| 33 #include "webkit/plugins/ppapi/ppb_video_layer_impl.h" | 33 #include "webkit/plugins/ppapi/ppb_video_layer_impl.h" |
| 34 #include "webkit/plugins/ppapi/ppb_websocket_impl.h" | 34 #include "webkit/plugins/ppapi/ppb_websocket_impl.h" |
| 35 | 35 |
| 36 using ppapi::InputEventData; | 36 using ppapi::InputEventData; |
| 37 using ppapi::InputEventImpl; | 37 using ppapi::PPB_InputEvent_Shared; |
| 38 using ppapi::StringVar; | 38 using ppapi::StringVar; |
| 39 | 39 |
| 40 namespace webkit { | 40 namespace webkit { |
| 41 namespace ppapi { | 41 namespace ppapi { |
| 42 | 42 |
| 43 ResourceCreationImpl::ResourceCreationImpl(PluginInstance* instance) { | 43 ResourceCreationImpl::ResourceCreationImpl(PluginInstance* instance) { |
| 44 } | 44 } |
| 45 | 45 |
| 46 ResourceCreationImpl::~ResourceCreationImpl() { | 46 ResourceCreationImpl::~ResourceCreationImpl() { |
| 47 } | 47 } |
| 48 | 48 |
| 49 ::ppapi::thunk::ResourceCreationAPI* | 49 ::ppapi::thunk::ResourceCreationAPI* |
| 50 ResourceCreationImpl::AsResourceCreationAPI() { | 50 ResourceCreationImpl::AsResourceCreationAPI() { |
| 51 return this; | 51 return this; |
| 52 } | 52 } |
| 53 | 53 |
| 54 PP_Resource ResourceCreationImpl::CreateAudio( | 54 PP_Resource ResourceCreationImpl::CreateAudio( |
| 55 PP_Instance instance, | 55 PP_Instance instance, |
| 56 PP_Resource config_id, | 56 PP_Resource config_id, |
| 57 PPB_Audio_Callback audio_callback, | 57 PPB_Audio_Callback audio_callback, |
| 58 void* user_data) { | 58 void* user_data) { |
| 59 return PPB_Audio_Impl::Create(instance, config_id, audio_callback, | 59 return PPB_Audio_Impl::Create(instance, config_id, audio_callback, |
| 60 user_data); | 60 user_data); |
| 61 } | 61 } |
| 62 | 62 |
| 63 PP_Resource ResourceCreationImpl::CreateAudioConfig( | 63 PP_Resource ResourceCreationImpl::CreateAudioConfig( |
| 64 PP_Instance instance, | 64 PP_Instance instance, |
| 65 PP_AudioSampleRate sample_rate, | 65 PP_AudioSampleRate sample_rate, |
| 66 uint32_t sample_frame_count) { | 66 uint32_t sample_frame_count) { |
| 67 return ::ppapi::AudioConfigImpl::CreateAsImpl(instance, sample_rate, | 67 return ::ppapi::PPB_AudioConfig_Shared::CreateAsImpl(instance, sample_rate, |
| 68 sample_frame_count); | 68 sample_frame_count); |
| 69 } | 69 } |
| 70 | 70 |
| 71 PP_Resource ResourceCreationImpl::CreateAudioTrusted( | 71 PP_Resource ResourceCreationImpl::CreateAudioTrusted( |
| 72 PP_Instance instance) { | 72 PP_Instance instance) { |
| 73 return (new PPB_Audio_Impl(instance))->GetReference(); | 73 return (new PPB_Audio_Impl(instance))->GetReference(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 PP_Resource ResourceCreationImpl::CreateAudioInput( | 76 PP_Resource ResourceCreationImpl::CreateAudioInput( |
| 77 PP_Instance instance, | 77 PP_Instance instance, |
| 78 PP_Resource config_id, | 78 PP_Resource config_id, |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 data.event_time_stamp = time_stamp; | 187 data.event_time_stamp = time_stamp; |
| 188 data.event_modifiers = modifiers; | 188 data.event_modifiers = modifiers; |
| 189 data.key_code = key_code; | 189 data.key_code = key_code; |
| 190 if (character_text.type == PP_VARTYPE_STRING) { | 190 if (character_text.type == PP_VARTYPE_STRING) { |
| 191 StringVar* string_var = StringVar::FromPPVar(character_text); | 191 StringVar* string_var = StringVar::FromPPVar(character_text); |
| 192 if (!string_var) | 192 if (!string_var) |
| 193 return 0; | 193 return 0; |
| 194 data.character_text = string_var->value(); | 194 data.character_text = string_var->value(); |
| 195 } | 195 } |
| 196 | 196 |
| 197 return (new InputEventImpl(InputEventImpl::InitAsImpl(), | 197 return (new PPB_InputEvent_Shared(PPB_InputEvent_Shared::InitAsImpl(), |
| 198 instance, data))->GetReference(); | 198 instance, data))->GetReference(); |
| 199 } | 199 } |
| 200 | 200 |
| 201 PP_Resource ResourceCreationImpl::CreateMouseInputEvent( | 201 PP_Resource ResourceCreationImpl::CreateMouseInputEvent( |
| 202 PP_Instance instance, | 202 PP_Instance instance, |
| 203 PP_InputEvent_Type type, | 203 PP_InputEvent_Type type, |
| 204 PP_TimeTicks time_stamp, | 204 PP_TimeTicks time_stamp, |
| 205 uint32_t modifiers, | 205 uint32_t modifiers, |
| 206 PP_InputEvent_MouseButton mouse_button, | 206 PP_InputEvent_MouseButton mouse_button, |
| 207 const PP_Point* mouse_position, | 207 const PP_Point* mouse_position, |
| 208 int32_t click_count, | 208 int32_t click_count, |
| 209 const PP_Point* mouse_movement) { | 209 const PP_Point* mouse_movement) { |
| 210 if (type != PP_INPUTEVENT_TYPE_MOUSEDOWN && | 210 if (type != PP_INPUTEVENT_TYPE_MOUSEDOWN && |
| 211 type != PP_INPUTEVENT_TYPE_MOUSEUP && | 211 type != PP_INPUTEVENT_TYPE_MOUSEUP && |
| 212 type != PP_INPUTEVENT_TYPE_MOUSEMOVE && | 212 type != PP_INPUTEVENT_TYPE_MOUSEMOVE && |
| 213 type != PP_INPUTEVENT_TYPE_MOUSEENTER && | 213 type != PP_INPUTEVENT_TYPE_MOUSEENTER && |
| 214 type != PP_INPUTEVENT_TYPE_MOUSELEAVE) | 214 type != PP_INPUTEVENT_TYPE_MOUSELEAVE) |
| 215 return 0; | 215 return 0; |
| 216 | 216 |
| 217 InputEventData data; | 217 InputEventData data; |
| 218 data.event_type = type; | 218 data.event_type = type; |
| 219 data.event_time_stamp = time_stamp; | 219 data.event_time_stamp = time_stamp; |
| 220 data.event_modifiers = modifiers; | 220 data.event_modifiers = modifiers; |
| 221 data.mouse_button = mouse_button; | 221 data.mouse_button = mouse_button; |
| 222 data.mouse_position = *mouse_position; | 222 data.mouse_position = *mouse_position; |
| 223 data.mouse_click_count = click_count; | 223 data.mouse_click_count = click_count; |
| 224 data.mouse_movement = *mouse_movement; | 224 data.mouse_movement = *mouse_movement; |
| 225 | 225 |
| 226 return (new InputEventImpl(InputEventImpl::InitAsImpl(), | 226 return (new PPB_InputEvent_Shared(PPB_InputEvent_Shared::InitAsImpl(), |
| 227 instance, data))->GetReference(); | 227 instance, data))->GetReference(); |
| 228 } | 228 } |
| 229 | 229 |
| 230 PP_Resource ResourceCreationImpl::CreateScrollbar(PP_Instance instance, | 230 PP_Resource ResourceCreationImpl::CreateScrollbar(PP_Instance instance, |
| 231 PP_Bool vertical) { | 231 PP_Bool vertical) { |
| 232 return PPB_Scrollbar_Impl::Create(instance, PP_ToBool(vertical)); | 232 return PPB_Scrollbar_Impl::Create(instance, PP_ToBool(vertical)); |
| 233 } | 233 } |
| 234 | 234 |
| 235 PP_Resource ResourceCreationImpl::CreateTCPSocketPrivate(PP_Instance instance) { | 235 PP_Resource ResourceCreationImpl::CreateTCPSocketPrivate(PP_Instance instance) { |
| 236 // Creating TCP socket resource at the renderer side is not supported. | 236 // Creating TCP socket resource at the renderer side is not supported. |
| 237 return 0; | 237 return 0; |
| (...skipping 54 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 InputEventImpl(InputEventImpl::InitAsImpl(), | 302 return (new PPB_InputEvent_Shared(PPB_InputEvent_Shared::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 |