| 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" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); | 33 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); |
| 34 if (!dispatcher) { | 34 if (!dispatcher) { |
| 35 NOTREACHED(); | 35 NOTREACHED(); |
| 36 return PP_FALSE; | 36 return PP_FALSE; |
| 37 } | 37 } |
| 38 | 38 |
| 39 // Need to send different messages depending on whether filtering is needed. | 39 // Need to send different messages depending on whether filtering is needed. |
| 40 PP_Bool result = PP_FALSE; | 40 PP_Bool result = PP_FALSE; |
| 41 if (data.is_filtered) { | 41 if (data.is_filtered) { |
| 42 dispatcher->Send(new PpapiMsg_PPPInputEvent_HandleFilteredInputEvent( | 42 dispatcher->Send(new PpapiMsg_PPPInputEvent_HandleFilteredInputEvent( |
| 43 INTERFACE_ID_PPP_INPUT_EVENT, instance, data, &result)); | 43 API_ID_PPP_INPUT_EVENT, instance, data, &result)); |
| 44 } else { | 44 } else { |
| 45 dispatcher->Send(new PpapiMsg_PPPInputEvent_HandleInputEvent( | 45 dispatcher->Send(new PpapiMsg_PPPInputEvent_HandleInputEvent( |
| 46 INTERFACE_ID_PPP_INPUT_EVENT, instance, data)); | 46 API_ID_PPP_INPUT_EVENT, instance, data)); |
| 47 } | 47 } |
| 48 return result; | 48 return result; |
| 49 } | 49 } |
| 50 | 50 |
| 51 static const PPP_InputEvent input_event_interface = { | 51 static const PPP_InputEvent input_event_interface = { |
| 52 &HandleInputEvent | 52 &HandleInputEvent |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 InterfaceProxy* CreateInputEventProxy(Dispatcher* dispatcher) { | 55 InterfaceProxy* CreateInputEventProxy(Dispatcher* dispatcher) { |
| 56 return new PPP_InputEvent_Proxy(dispatcher); | 56 return new PPP_InputEvent_Proxy(dispatcher); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 68 } | 68 } |
| 69 | 69 |
| 70 PPP_InputEvent_Proxy::~PPP_InputEvent_Proxy() { | 70 PPP_InputEvent_Proxy::~PPP_InputEvent_Proxy() { |
| 71 } | 71 } |
| 72 | 72 |
| 73 // static | 73 // static |
| 74 const InterfaceProxy::Info* PPP_InputEvent_Proxy::GetInfo() { | 74 const InterfaceProxy::Info* PPP_InputEvent_Proxy::GetInfo() { |
| 75 static const Info info = { | 75 static const Info info = { |
| 76 &input_event_interface, | 76 &input_event_interface, |
| 77 PPP_INPUT_EVENT_INTERFACE, | 77 PPP_INPUT_EVENT_INTERFACE, |
| 78 INTERFACE_ID_PPP_INPUT_EVENT, | 78 API_ID_PPP_INPUT_EVENT, |
| 79 false, | 79 false, |
| 80 &CreateInputEventProxy, | 80 &CreateInputEventProxy, |
| 81 }; | 81 }; |
| 82 return &info; | 82 return &info; |
| 83 } | 83 } |
| 84 | 84 |
| 85 bool PPP_InputEvent_Proxy::OnMessageReceived(const IPC::Message& msg) { | 85 bool PPP_InputEvent_Proxy::OnMessageReceived(const IPC::Message& msg) { |
| 86 bool handled = true; | 86 bool handled = true; |
| 87 IPC_BEGIN_MESSAGE_MAP(PPP_InputEvent_Proxy, msg) | 87 IPC_BEGIN_MESSAGE_MAP(PPP_InputEvent_Proxy, msg) |
| 88 IPC_MESSAGE_HANDLER(PpapiMsg_PPPInputEvent_HandleInputEvent, | 88 IPC_MESSAGE_HANDLER(PpapiMsg_PPPInputEvent_HandleInputEvent, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 106 const InputEventData& data, | 106 const InputEventData& data, |
| 107 PP_Bool* result) { | 107 PP_Bool* result) { |
| 108 scoped_refptr<InputEventImpl> resource(new InputEventImpl( | 108 scoped_refptr<InputEventImpl> resource(new InputEventImpl( |
| 109 InputEventImpl::InitAsProxy(), instance, data)); | 109 InputEventImpl::InitAsProxy(), instance, data)); |
| 110 *result = ppp_input_event_impl_->HandleInputEvent(instance, | 110 *result = ppp_input_event_impl_->HandleInputEvent(instance, |
| 111 resource->pp_resource()); | 111 resource->pp_resource()); |
| 112 } | 112 } |
| 113 | 113 |
| 114 } // namespace proxy | 114 } // namespace proxy |
| 115 } // namespace ppapi | 115 } // namespace ppapi |
| OLD | NEW |