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