| 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 const char* path) { | 69 const char* path) { |
| 70 return PPB_FileRef_Proxy::CreateProxyResource(file_system, path); | 70 return PPB_FileRef_Proxy::CreateProxyResource(file_system, path); |
| 71 } | 71 } |
| 72 | 72 |
| 73 PP_Resource ResourceCreationProxy::CreateFileSystem( | 73 PP_Resource ResourceCreationProxy::CreateFileSystem( |
| 74 PP_Instance instance, | 74 PP_Instance instance, |
| 75 PP_FileSystemType type) { | 75 PP_FileSystemType type) { |
| 76 return PPB_FileSystem_Proxy::CreateProxyResource(instance, type); | 76 return PPB_FileSystem_Proxy::CreateProxyResource(instance, type); |
| 77 } | 77 } |
| 78 | 78 |
| 79 PP_Resource ResourceCreationProxy::CreateIMEInputEvent( |
| 80 PP_Instance instance, |
| 81 PP_InputEvent_Type type, |
| 82 PP_TimeTicks time_stamp, |
| 83 struct PP_Var text, |
| 84 uint32_t segment_number, |
| 85 const uint32_t* segment_offsets, |
| 86 int32_t target_segment, |
| 87 uint32_t selection_start, |
| 88 uint32_t selection_end) { |
| 89 return PPB_InputEvent_Shared::CreateIMEInputEvent( |
| 90 OBJECT_IS_PROXY, instance, type, time_stamp, text, segment_number, |
| 91 segment_offsets, target_segment, selection_start, selection_end); |
| 92 } |
| 93 |
| 79 PP_Resource ResourceCreationProxy::CreateKeyboardInputEvent( | 94 PP_Resource ResourceCreationProxy::CreateKeyboardInputEvent( |
| 80 PP_Instance instance, | 95 PP_Instance instance, |
| 81 PP_InputEvent_Type type, | 96 PP_InputEvent_Type type, |
| 82 PP_TimeTicks time_stamp, | 97 PP_TimeTicks time_stamp, |
| 83 uint32_t modifiers, | 98 uint32_t modifiers, |
| 84 uint32_t key_code, | 99 uint32_t key_code, |
| 85 struct PP_Var character_text) { | 100 struct PP_Var character_text) { |
| 86 if (type != PP_INPUTEVENT_TYPE_RAWKEYDOWN && | 101 return PPB_InputEvent_Shared::CreateKeyboardInputEvent( |
| 87 type != PP_INPUTEVENT_TYPE_KEYDOWN && | 102 OBJECT_IS_PROXY, instance, type, time_stamp, modifiers, key_code, |
| 88 type != PP_INPUTEVENT_TYPE_KEYUP && | 103 character_text); |
| 89 type != PP_INPUTEVENT_TYPE_CHAR) | |
| 90 return 0; | |
| 91 InputEventData data; | |
| 92 data.event_type = type; | |
| 93 data.event_time_stamp = time_stamp; | |
| 94 data.event_modifiers = modifiers; | |
| 95 data.key_code = key_code; | |
| 96 if (character_text.type == PP_VARTYPE_STRING) { | |
| 97 StringVar* text_str = StringVar::FromPPVar(character_text); | |
| 98 if (!text_str) | |
| 99 return 0; | |
| 100 data.character_text = text_str->value(); | |
| 101 } | |
| 102 | |
| 103 return (new PPB_InputEvent_Shared(OBJECT_IS_PROXY, | |
| 104 instance, data))->GetReference(); | |
| 105 } | 104 } |
| 106 | 105 |
| 107 PP_Resource ResourceCreationProxy::CreateMouseInputEvent( | 106 PP_Resource ResourceCreationProxy::CreateMouseInputEvent( |
| 108 PP_Instance instance, | 107 PP_Instance instance, |
| 109 PP_InputEvent_Type type, | 108 PP_InputEvent_Type type, |
| 110 PP_TimeTicks time_stamp, | 109 PP_TimeTicks time_stamp, |
| 111 uint32_t modifiers, | 110 uint32_t modifiers, |
| 112 PP_InputEvent_MouseButton mouse_button, | 111 PP_InputEvent_MouseButton mouse_button, |
| 113 const PP_Point* mouse_position, | 112 const PP_Point* mouse_position, |
| 114 int32_t click_count, | 113 int32_t click_count, |
| 115 const PP_Point* mouse_movement) { | 114 const PP_Point* mouse_movement) { |
| 116 if (type != PP_INPUTEVENT_TYPE_MOUSEDOWN && | 115 return PPB_InputEvent_Shared::CreateMouseInputEvent( |
| 117 type != PP_INPUTEVENT_TYPE_MOUSEUP && | 116 OBJECT_IS_PROXY, instance, type, time_stamp, modifiers, |
| 118 type != PP_INPUTEVENT_TYPE_MOUSEMOVE && | 117 mouse_button, mouse_position, click_count, mouse_movement); |
| 119 type != PP_INPUTEVENT_TYPE_MOUSEENTER && | |
| 120 type != PP_INPUTEVENT_TYPE_MOUSELEAVE) | |
| 121 return 0; | |
| 122 | |
| 123 InputEventData data; | |
| 124 data.event_type = type; | |
| 125 data.event_time_stamp = time_stamp; | |
| 126 data.event_modifiers = modifiers; | |
| 127 data.mouse_button = mouse_button; | |
| 128 data.mouse_position = *mouse_position; | |
| 129 data.mouse_click_count = click_count; | |
| 130 data.mouse_movement = *mouse_movement; | |
| 131 | |
| 132 return (new PPB_InputEvent_Shared(OBJECT_IS_PROXY, | |
| 133 instance, data))->GetReference(); | |
| 134 } | 118 } |
| 135 | 119 |
| 136 PP_Resource ResourceCreationProxy::CreateResourceArray( | 120 PP_Resource ResourceCreationProxy::CreateResourceArray( |
| 137 PP_Instance instance, | 121 PP_Instance instance, |
| 138 const PP_Resource elements[], | 122 const PP_Resource elements[], |
| 139 uint32_t size) { | 123 uint32_t size) { |
| 140 PPB_ResourceArray_Shared* object = new PPB_ResourceArray_Shared( | 124 PPB_ResourceArray_Shared* object = new PPB_ResourceArray_Shared( |
| 141 OBJECT_IS_PROXY, instance, elements, size); | 125 OBJECT_IS_PROXY, instance, elements, size); |
| 142 return object->GetReference(); | 126 return object->GetReference(); |
| 143 } | 127 } |
| 144 | 128 |
| 145 PP_Resource ResourceCreationProxy::CreateURLLoader(PP_Instance instance) { | 129 PP_Resource ResourceCreationProxy::CreateURLLoader(PP_Instance instance) { |
| 146 return PPB_URLLoader_Proxy::CreateProxyResource(instance); | 130 return PPB_URLLoader_Proxy::CreateProxyResource(instance); |
| 147 } | 131 } |
| 148 | 132 |
| 149 PP_Resource ResourceCreationProxy::CreateURLRequestInfo( | 133 PP_Resource ResourceCreationProxy::CreateURLRequestInfo( |
| 150 PP_Instance instance, | 134 PP_Instance instance, |
| 151 const PPB_URLRequestInfo_Data& data) { | 135 const PPB_URLRequestInfo_Data& data) { |
| 152 return (new PPB_URLRequestInfo_Shared(OBJECT_IS_PROXY, | 136 return (new PPB_URLRequestInfo_Shared(OBJECT_IS_PROXY, |
| 153 instance, data))->GetReference(); | 137 instance, data))->GetReference(); |
| 154 } | 138 } |
| 155 | 139 |
| 156 PP_Resource ResourceCreationProxy::CreateWheelInputEvent( | 140 PP_Resource ResourceCreationProxy::CreateWheelInputEvent( |
| 157 PP_Instance instance, | 141 PP_Instance instance, |
| 158 PP_TimeTicks time_stamp, | 142 PP_TimeTicks time_stamp, |
| 159 uint32_t modifiers, | 143 uint32_t modifiers, |
| 160 const PP_FloatPoint* wheel_delta, | 144 const PP_FloatPoint* wheel_delta, |
| 161 const PP_FloatPoint* wheel_ticks, | 145 const PP_FloatPoint* wheel_ticks, |
| 162 PP_Bool scroll_by_page) { | 146 PP_Bool scroll_by_page) { |
| 163 InputEventData data; | 147 return PPB_InputEvent_Shared::CreateWheelInputEvent( |
| 164 data.event_type = PP_INPUTEVENT_TYPE_WHEEL; | 148 OBJECT_IS_PROXY, instance, time_stamp, modifiers, |
| 165 data.event_time_stamp = time_stamp; | 149 wheel_delta, wheel_ticks, scroll_by_page); |
| 166 data.event_modifiers = modifiers; | |
| 167 data.wheel_delta = *wheel_delta; | |
| 168 data.wheel_ticks = *wheel_ticks; | |
| 169 data.wheel_scroll_by_page = PP_ToBool(scroll_by_page); | |
| 170 | |
| 171 return (new PPB_InputEvent_Shared(OBJECT_IS_PROXY, | |
| 172 instance, data))->GetReference(); | |
| 173 } | 150 } |
| 174 | 151 |
| 175 PP_Resource ResourceCreationProxy::CreateAudio( | 152 PP_Resource ResourceCreationProxy::CreateAudio( |
| 176 PP_Instance instance, | 153 PP_Instance instance, |
| 177 PP_Resource config_id, | 154 PP_Resource config_id, |
| 178 PPB_Audio_Callback audio_callback, | 155 PPB_Audio_Callback audio_callback, |
| 179 void* user_data) { | 156 void* user_data) { |
| 180 return PPB_Audio_Proxy::CreateProxyResource(instance, config_id, | 157 return PPB_Audio_Proxy::CreateProxyResource(instance, config_id, |
| 181 audio_callback, user_data); | 158 audio_callback, user_data); |
| 182 } | 159 } |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 bool ResourceCreationProxy::Send(IPC::Message* msg) { | 342 bool ResourceCreationProxy::Send(IPC::Message* msg) { |
| 366 return dispatcher()->Send(msg); | 343 return dispatcher()->Send(msg); |
| 367 } | 344 } |
| 368 | 345 |
| 369 bool ResourceCreationProxy::OnMessageReceived(const IPC::Message& msg) { | 346 bool ResourceCreationProxy::OnMessageReceived(const IPC::Message& msg) { |
| 370 return false; | 347 return false; |
| 371 } | 348 } |
| 372 | 349 |
| 373 } // namespace proxy | 350 } // namespace proxy |
| 374 } // namespace ppapi | 351 } // namespace ppapi |
| OLD | NEW |