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 "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/proxy/host_resource.h" | 9 #include "ppapi/proxy/host_resource.h" |
10 #include "ppapi/proxy/interface_id.h" | 10 #include "ppapi/proxy/interface_id.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "ppapi/proxy/ppb_image_data_proxy.h" | 29 #include "ppapi/proxy/ppb_image_data_proxy.h" |
30 #include "ppapi/proxy/ppb_input_event_proxy.h" | 30 #include "ppapi/proxy/ppb_input_event_proxy.h" |
31 #include "ppapi/proxy/ppb_surface_3d_proxy.h" | 31 #include "ppapi/proxy/ppb_surface_3d_proxy.h" |
32 #include "ppapi/proxy/ppb_url_loader_proxy.h" | 32 #include "ppapi/proxy/ppb_url_loader_proxy.h" |
33 #include "ppapi/proxy/ppb_url_request_info_proxy.h" | 33 #include "ppapi/proxy/ppb_url_request_info_proxy.h" |
34 #include "ppapi/proxy/ppb_video_capture_proxy.h" | 34 #include "ppapi/proxy/ppb_video_capture_proxy.h" |
35 #include "ppapi/proxy/ppb_video_decoder_proxy.h" | 35 #include "ppapi/proxy/ppb_video_decoder_proxy.h" |
36 #include "ppapi/shared_impl/font_impl.h" | 36 #include "ppapi/shared_impl/font_impl.h" |
37 #include "ppapi/shared_impl/function_group_base.h" | 37 #include "ppapi/shared_impl/function_group_base.h" |
38 #include "ppapi/shared_impl/input_event_impl.h" | 38 #include "ppapi/shared_impl/input_event_impl.h" |
| 39 #include "ppapi/shared_impl/var.h" |
39 #include "ppapi/thunk/enter.h" | 40 #include "ppapi/thunk/enter.h" |
40 #include "ppapi/thunk/ppb_image_data_api.h" | 41 #include "ppapi/thunk/ppb_image_data_api.h" |
41 | 42 |
42 using ppapi::InputEventData; | 43 using ppapi::InputEventData; |
| 44 using ppapi::StringVar; |
43 using ppapi::thunk::ResourceCreationAPI; | 45 using ppapi::thunk::ResourceCreationAPI; |
44 | 46 |
45 namespace pp { | 47 namespace pp { |
46 namespace proxy { | 48 namespace proxy { |
47 | 49 |
48 ResourceCreationProxy::ResourceCreationProxy(Dispatcher* dispatcher) | 50 ResourceCreationProxy::ResourceCreationProxy(Dispatcher* dispatcher) |
49 : dispatcher_(dispatcher) { | 51 : dispatcher_(dispatcher) { |
50 } | 52 } |
51 | 53 |
52 ResourceCreationProxy::~ResourceCreationProxy() { | 54 ResourceCreationProxy::~ResourceCreationProxy() { |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 PP_InputEvent_Type type, | 201 PP_InputEvent_Type type, |
200 PP_TimeTicks time_stamp, | 202 PP_TimeTicks time_stamp, |
201 uint32_t modifiers, | 203 uint32_t modifiers, |
202 uint32_t key_code, | 204 uint32_t key_code, |
203 struct PP_Var character_text) { | 205 struct PP_Var character_text) { |
204 if (type != PP_INPUTEVENT_TYPE_RAWKEYDOWN && | 206 if (type != PP_INPUTEVENT_TYPE_RAWKEYDOWN && |
205 type != PP_INPUTEVENT_TYPE_KEYDOWN && | 207 type != PP_INPUTEVENT_TYPE_KEYDOWN && |
206 type != PP_INPUTEVENT_TYPE_KEYUP && | 208 type != PP_INPUTEVENT_TYPE_KEYUP && |
207 type != PP_INPUTEVENT_TYPE_CHAR) | 209 type != PP_INPUTEVENT_TYPE_CHAR) |
208 return 0; | 210 return 0; |
209 PluginVarTracker* tracker = PluginVarTracker::GetInstance(); | |
210 | |
211 ppapi::InputEventData data; | 211 ppapi::InputEventData data; |
212 data.event_type = type; | 212 data.event_type = type; |
213 data.event_time_stamp = time_stamp; | 213 data.event_time_stamp = time_stamp; |
214 data.event_modifiers = modifiers; | 214 data.event_modifiers = modifiers; |
215 data.key_code = key_code; | 215 data.key_code = key_code; |
216 if (character_text.type == PP_VARTYPE_STRING) | 216 if (character_text.type == PP_VARTYPE_STRING) { |
217 data.character_text = *tracker->GetExistingString(character_text); | 217 scoped_refptr<StringVar> text_str(StringVar::FromPPVar(character_text)); |
| 218 if (!text_str) |
| 219 return 0; |
| 220 data.character_text = text_str->value(); |
| 221 } |
218 | 222 |
219 return PPB_InputEvent_Proxy::CreateProxyResource(instance, data); | 223 return PPB_InputEvent_Proxy::CreateProxyResource(instance, data); |
220 } | 224 } |
221 | 225 |
222 PP_Resource ResourceCreationProxy::CreateMouseInputEvent( | 226 PP_Resource ResourceCreationProxy::CreateMouseInputEvent( |
223 PP_Instance instance, | 227 PP_Instance instance, |
224 PP_InputEvent_Type type, | 228 PP_InputEvent_Type type, |
225 PP_TimeTicks time_stamp, | 229 PP_TimeTicks time_stamp, |
226 uint32_t modifiers, | 230 uint32_t modifiers, |
227 PP_InputEvent_MouseButton mouse_button, | 231 PP_InputEvent_MouseButton mouse_button, |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 *result_image_handle = dispatcher_->ShareHandleWithRemote(ih, false); | 403 *result_image_handle = dispatcher_->ShareHandleWithRemote(ih, false); |
400 #else | 404 #else |
401 *result_image_handle = ImageData::HandleFromInt(handle); | 405 *result_image_handle = ImageData::HandleFromInt(handle); |
402 #endif | 406 #endif |
403 } | 407 } |
404 } | 408 } |
405 } | 409 } |
406 | 410 |
407 } // namespace proxy | 411 } // namespace proxy |
408 } // namespace pp | 412 } // namespace pp |
OLD | NEW |