| 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/ppp_input_event_proxy.h" | 5 #include "ppapi/proxy/ppp_input_event_proxy.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ppapi/c/ppp_input_event.h" | 9 #include "ppapi/c/ppp_input_event.h" |
| 10 #include "ppapi/proxy/host_dispatcher.h" | 10 #include "ppapi/proxy/host_dispatcher.h" |
| 11 #include "ppapi/proxy/plugin_dispatcher.h" | 11 #include "ppapi/proxy/plugin_dispatcher.h" |
| 12 #include "ppapi/proxy/plugin_resource_tracker.h" | 12 #include "ppapi/proxy/plugin_resource_tracker.h" |
| 13 #include "ppapi/proxy/ppapi_messages.h" | 13 #include "ppapi/proxy/ppapi_messages.h" |
| 14 #include "ppapi/proxy/ppb_input_event_proxy.h" |
| 14 #include "ppapi/shared_impl/input_event_impl.h" | 15 #include "ppapi/shared_impl/input_event_impl.h" |
| 15 #include "ppapi/thunk/enter.h" | 16 #include "ppapi/thunk/enter.h" |
| 16 #include "ppapi/thunk/ppb_input_event_api.h" | 17 #include "ppapi/thunk/ppb_input_event_api.h" |
| 17 | 18 |
| 18 using ppapi::thunk::EnterResourceNoLock; | 19 using ppapi::thunk::EnterResourceNoLock; |
| 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 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 45 dispatcher->Send(new PpapiMsg_PPPInputEvent_HandleInputEvent( | 46 dispatcher->Send(new PpapiMsg_PPPInputEvent_HandleInputEvent( |
| 46 INTERFACE_ID_PPP_INPUT_EVENT, instance, data)); | 47 INTERFACE_ID_PPP_INPUT_EVENT, instance, data)); |
| 47 } | 48 } |
| 48 return result; | 49 return result; |
| 49 } | 50 } |
| 50 | 51 |
| 51 static const PPP_InputEvent input_event_interface = { | 52 static const PPP_InputEvent input_event_interface = { |
| 52 &HandleInputEvent | 53 &HandleInputEvent |
| 53 }; | 54 }; |
| 54 | 55 |
| 55 InterfaceProxy* CreateInputEventProxy(Dispatcher* dispatcher) { | 56 InterfaceProxy* CreateInputEventProxy(Dispatcher* dispatcher, |
| 56 return new PPP_InputEvent_Proxy(dispatcher); | 57 const void* target_interface) { |
| 58 return new PPP_InputEvent_Proxy(dispatcher, target_interface); |
| 57 } | 59 } |
| 58 | 60 |
| 59 } // namespace | 61 } // namespace |
| 60 | 62 |
| 61 PPP_InputEvent_Proxy::PPP_InputEvent_Proxy(Dispatcher* dispatcher) | 63 PPP_InputEvent_Proxy::PPP_InputEvent_Proxy(Dispatcher* dispatcher, |
| 62 : InterfaceProxy(dispatcher), | 64 const void* target_interface) |
| 63 ppp_input_event_impl_(NULL) { | 65 : InterfaceProxy(dispatcher, target_interface) { |
| 64 if (dispatcher->IsPlugin()) { | |
| 65 ppp_input_event_impl_ = static_cast<const PPP_InputEvent*>( | |
| 66 dispatcher->local_get_interface()(PPP_INPUT_EVENT_INTERFACE)); | |
| 67 } | |
| 68 } | 66 } |
| 69 | 67 |
| 70 PPP_InputEvent_Proxy::~PPP_InputEvent_Proxy() { | 68 PPP_InputEvent_Proxy::~PPP_InputEvent_Proxy() { |
| 71 } | 69 } |
| 72 | 70 |
| 73 // static | 71 // static |
| 74 const InterfaceProxy::Info* PPP_InputEvent_Proxy::GetInfo() { | 72 const InterfaceProxy::Info* PPP_InputEvent_Proxy::GetInfo() { |
| 75 static const Info info = { | 73 static const Info info = { |
| 76 &input_event_interface, | 74 &input_event_interface, |
| 77 PPP_INPUT_EVENT_INTERFACE, | 75 PPP_INPUT_EVENT_INTERFACE, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 91 OnMsgHandleFilteredInputEvent) | 89 OnMsgHandleFilteredInputEvent) |
| 92 IPC_MESSAGE_UNHANDLED(handled = false) | 90 IPC_MESSAGE_UNHANDLED(handled = false) |
| 93 IPC_END_MESSAGE_MAP() | 91 IPC_END_MESSAGE_MAP() |
| 94 return handled; | 92 return handled; |
| 95 } | 93 } |
| 96 | 94 |
| 97 void PPP_InputEvent_Proxy::OnMsgHandleInputEvent(PP_Instance instance, | 95 void PPP_InputEvent_Proxy::OnMsgHandleInputEvent(PP_Instance instance, |
| 98 const InputEventData& data) { | 96 const InputEventData& data) { |
| 99 scoped_refptr<InputEventImpl> resource(new InputEventImpl( | 97 scoped_refptr<InputEventImpl> resource(new InputEventImpl( |
| 100 InputEventImpl::InitAsProxy(), instance, data)); | 98 InputEventImpl::InitAsProxy(), instance, data)); |
| 101 ppp_input_event_impl_->HandleInputEvent(instance, resource->pp_resource()); | 99 ppp_input_event_target()->HandleInputEvent(instance, resource->pp_resource()); |
| 102 } | 100 } |
| 103 | 101 |
| 104 void PPP_InputEvent_Proxy::OnMsgHandleFilteredInputEvent( | 102 void PPP_InputEvent_Proxy::OnMsgHandleFilteredInputEvent( |
| 105 PP_Instance instance, | 103 PP_Instance instance, |
| 106 const InputEventData& data, | 104 const InputEventData& data, |
| 107 PP_Bool* result) { | 105 PP_Bool* result) { |
| 108 scoped_refptr<InputEventImpl> resource(new InputEventImpl( | 106 scoped_refptr<InputEventImpl> resource(new InputEventImpl( |
| 109 InputEventImpl::InitAsProxy(), instance, data)); | 107 InputEventImpl::InitAsProxy(), instance, data)); |
| 110 *result = ppp_input_event_impl_->HandleInputEvent(instance, | 108 *result = ppp_input_event_target()->HandleInputEvent(instance, |
| 111 resource->pp_resource()); | 109 resource->pp_resource()); |
| 112 } | 110 } |
| 113 | 111 |
| 114 } // namespace proxy | 112 } // namespace proxy |
| 115 } // namespace ppapi | 113 } // namespace ppapi |
| OLD | NEW |