| 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/ppb_testing_proxy.h" | 5 #include "ppapi/proxy/ppb_testing_proxy.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "ppapi/c/dev/ppb_testing_dev.h" | 8 #include "ppapi/c/dev/ppb_testing_dev.h" |
| 9 #include "ppapi/proxy/enter_proxy.h" | 9 #include "ppapi/proxy/enter_proxy.h" |
| 10 #include "ppapi/proxy/plugin_dispatcher.h" | 10 #include "ppapi/proxy/plugin_dispatcher.h" |
| 11 #include "ppapi/proxy/ppapi_messages.h" | 11 #include "ppapi/proxy/ppapi_messages.h" |
| 12 #include "ppapi/shared_impl/ppapi_globals.h" | 12 #include "ppapi/shared_impl/ppapi_globals.h" |
| 13 #include "ppapi/shared_impl/resource.h" | 13 #include "ppapi/shared_impl/resource.h" |
| 14 #include "ppapi/shared_impl/resource_tracker.h" | 14 #include "ppapi/shared_impl/resource_tracker.h" |
| 15 #include "ppapi/thunk/enter.h" | 15 #include "ppapi/thunk/enter.h" |
| 16 #include "ppapi/thunk/ppb_input_event_api.h" | 16 #include "ppapi/thunk/ppb_input_event_api.h" |
| 17 | 17 |
| 18 using ppapi::thunk::EnterInstance; |
| 18 using ppapi::thunk::EnterResource; | 19 using ppapi::thunk::EnterResource; |
| 19 using ppapi::thunk::PPB_InputEvent_API; | 20 using ppapi::thunk::PPB_InputEvent_API; |
| 20 | 21 |
| 21 namespace ppapi { | 22 namespace ppapi { |
| 22 namespace proxy { | 23 namespace proxy { |
| 23 | 24 |
| 24 namespace { | 25 namespace { |
| 25 | 26 |
| 26 PP_Bool ReadImageData(PP_Resource graphics_2d, | 27 PP_Bool ReadImageData(PP_Resource graphics_2d, |
| 27 PP_Resource image, | 28 PP_Resource image, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 return; | 81 return; |
| 81 EnterResource<PPB_InputEvent_API> enter(input_event, false); | 82 EnterResource<PPB_InputEvent_API> enter(input_event, false); |
| 82 if (enter.failed()) | 83 if (enter.failed()) |
| 83 return; | 84 return; |
| 84 | 85 |
| 85 const InputEventData& input_event_data = enter.object()->GetInputEventData(); | 86 const InputEventData& input_event_data = enter.object()->GetInputEventData(); |
| 86 dispatcher->Send(new PpapiHostMsg_PPBTesting_SimulateInputEvent( | 87 dispatcher->Send(new PpapiHostMsg_PPBTesting_SimulateInputEvent( |
| 87 API_ID_PPB_TESTING, instance_id, input_event_data)); | 88 API_ID_PPB_TESTING, instance_id, input_event_data)); |
| 88 } | 89 } |
| 89 | 90 |
| 91 PP_Var GetDocumentURL(PP_Instance instance, PP_URLComponents_Dev* components) { |
| 92 EnterInstance enter(instance); |
| 93 if (enter.failed()) |
| 94 return PP_MakeUndefined(); |
| 95 return enter.functions()->GetDocumentURL(instance, components); |
| 96 } |
| 97 |
| 90 const PPB_Testing_Dev testing_interface = { | 98 const PPB_Testing_Dev testing_interface = { |
| 91 &ReadImageData, | 99 &ReadImageData, |
| 92 &RunMessageLoop, | 100 &RunMessageLoop, |
| 93 &QuitMessageLoop, | 101 &QuitMessageLoop, |
| 94 &GetLiveObjectsForInstance, | 102 &GetLiveObjectsForInstance, |
| 95 &IsOutOfProcess, | 103 &IsOutOfProcess, |
| 96 &SimulateInputEvent | 104 &SimulateInputEvent, |
| 105 &GetDocumentURL |
| 97 }; | 106 }; |
| 98 | 107 |
| 99 InterfaceProxy* CreateTestingProxy(Dispatcher* dispatcher) { | 108 InterfaceProxy* CreateTestingProxy(Dispatcher* dispatcher) { |
| 100 return new PPB_Testing_Proxy(dispatcher); | 109 return new PPB_Testing_Proxy(dispatcher); |
| 101 } | 110 } |
| 102 | 111 |
| 103 } // namespace | 112 } // namespace |
| 104 | 113 |
| 105 PPB_Testing_Proxy::PPB_Testing_Proxy(Dispatcher* dispatcher) | 114 PPB_Testing_Proxy::PPB_Testing_Proxy(Dispatcher* dispatcher) |
| 106 : InterfaceProxy(dispatcher), | 115 : InterfaceProxy(dispatcher), |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 scoped_refptr<PPB_InputEvent_Shared> input_event_impl( | 177 scoped_refptr<PPB_InputEvent_Shared> input_event_impl( |
| 169 new PPB_InputEvent_Shared(PPB_InputEvent_Shared::InitAsProxy(), | 178 new PPB_InputEvent_Shared(PPB_InputEvent_Shared::InitAsProxy(), |
| 170 instance, | 179 instance, |
| 171 input_event)); | 180 input_event)); |
| 172 ppb_testing_impl_->SimulateInputEvent(instance, | 181 ppb_testing_impl_->SimulateInputEvent(instance, |
| 173 input_event_impl->pp_resource()); | 182 input_event_impl->pp_resource()); |
| 174 } | 183 } |
| 175 | 184 |
| 176 } // namespace proxy | 185 } // namespace proxy |
| 177 } // namespace ppapi | 186 } // namespace ppapi |
| OLD | NEW |