OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ppapi/c/ppp_input_event.h" | 7 #include "ppapi/c/ppp_input_event.h" |
8 #include "ppapi/proxy/host_dispatcher.h" | 8 #include "ppapi/proxy/host_dispatcher.h" |
9 #include "ppapi/proxy/plugin_dispatcher.h" | 9 #include "ppapi/proxy/plugin_dispatcher.h" |
10 #include "ppapi/proxy/ppapi_messages.h" | 10 #include "ppapi/proxy/ppapi_messages.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 } | 47 } |
48 | 48 |
49 static const PPP_InputEvent input_event_interface = { | 49 static const PPP_InputEvent input_event_interface = { |
50 &HandleInputEvent | 50 &HandleInputEvent |
51 }; | 51 }; |
52 #else | 52 #else |
53 // The NaCl plugin doesn't need the host side interface - stub it out. | 53 // The NaCl plugin doesn't need the host side interface - stub it out. |
54 static const PPP_InputEvent input_event_interface = {}; | 54 static const PPP_InputEvent input_event_interface = {}; |
55 #endif // !defined(OS_NACL) | 55 #endif // !defined(OS_NACL) |
56 | 56 |
57 InterfaceProxy* CreateInputEventProxy(Dispatcher* dispatcher) { | |
58 return new PPP_InputEvent_Proxy(dispatcher); | |
59 } | |
60 | |
61 } // namespace | 57 } // namespace |
62 | 58 |
63 PPP_InputEvent_Proxy::PPP_InputEvent_Proxy(Dispatcher* dispatcher) | 59 PPP_InputEvent_Proxy::PPP_InputEvent_Proxy(Dispatcher* dispatcher) |
64 : InterfaceProxy(dispatcher), | 60 : InterfaceProxy(dispatcher), |
65 ppp_input_event_impl_(NULL) { | 61 ppp_input_event_impl_(NULL) { |
66 if (dispatcher->IsPlugin()) { | 62 if (dispatcher->IsPlugin()) { |
67 ppp_input_event_impl_ = static_cast<const PPP_InputEvent*>( | 63 ppp_input_event_impl_ = static_cast<const PPP_InputEvent*>( |
68 dispatcher->local_get_interface()(PPP_INPUT_EVENT_INTERFACE)); | 64 dispatcher->local_get_interface()(PPP_INPUT_EVENT_INTERFACE)); |
69 } | 65 } |
70 } | 66 } |
71 | 67 |
72 PPP_InputEvent_Proxy::~PPP_InputEvent_Proxy() { | 68 PPP_InputEvent_Proxy::~PPP_InputEvent_Proxy() { |
73 } | 69 } |
74 | 70 |
75 // static | 71 // static |
76 const InterfaceProxy::Info* PPP_InputEvent_Proxy::GetInfo() { | 72 const PPP_InputEvent* PPP_InputEvent_Proxy::GetProxyInterface() { |
77 static const Info info = { | 73 return &input_event_interface; |
78 &input_event_interface, | |
79 PPP_INPUT_EVENT_INTERFACE, | |
80 API_ID_PPP_INPUT_EVENT, | |
81 false, | |
82 &CreateInputEventProxy, | |
83 }; | |
84 return &info; | |
85 } | 74 } |
86 | 75 |
87 bool PPP_InputEvent_Proxy::OnMessageReceived(const IPC::Message& msg) { | 76 bool PPP_InputEvent_Proxy::OnMessageReceived(const IPC::Message& msg) { |
88 if (!dispatcher()->IsPlugin()) | 77 if (!dispatcher()->IsPlugin()) |
89 return false; | 78 return false; |
90 | 79 |
91 bool handled = true; | 80 bool handled = true; |
92 IPC_BEGIN_MESSAGE_MAP(PPP_InputEvent_Proxy, msg) | 81 IPC_BEGIN_MESSAGE_MAP(PPP_InputEvent_Proxy, msg) |
93 IPC_MESSAGE_HANDLER(PpapiMsg_PPPInputEvent_HandleInputEvent, | 82 IPC_MESSAGE_HANDLER(PpapiMsg_PPPInputEvent_HandleInputEvent, |
94 OnMsgHandleInputEvent) | 83 OnMsgHandleInputEvent) |
(...skipping 19 matching lines...) Expand all Loading... |
114 PP_Bool* result) { | 103 PP_Bool* result) { |
115 scoped_refptr<PPB_InputEvent_Shared> resource(new PPB_InputEvent_Shared( | 104 scoped_refptr<PPB_InputEvent_Shared> resource(new PPB_InputEvent_Shared( |
116 OBJECT_IS_PROXY, instance, data)); | 105 OBJECT_IS_PROXY, instance, data)); |
117 *result = CallWhileUnlocked(ppp_input_event_impl_->HandleInputEvent, | 106 *result = CallWhileUnlocked(ppp_input_event_impl_->HandleInputEvent, |
118 instance, | 107 instance, |
119 resource->pp_resource()); | 108 resource->pp_resource()); |
120 } | 109 } |
121 | 110 |
122 } // namespace proxy | 111 } // namespace proxy |
123 } // namespace ppapi | 112 } // namespace ppapi |
OLD | NEW |