Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(341)

Side by Side Diff: ppapi/proxy/ppp_input_event_proxy.cc

Issue 7874002: This patch tries to remove most of the manual registration for Pepper interfaces, and replaces it... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/proxy/ppp_input_event_proxy.h ('k') | ppapi/proxy/ppp_instance_private_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
15 #include "ppapi/shared_impl/input_event_impl.h" 14 #include "ppapi/shared_impl/input_event_impl.h"
16 #include "ppapi/thunk/enter.h" 15 #include "ppapi/thunk/enter.h"
17 #include "ppapi/thunk/ppb_input_event_api.h" 16 #include "ppapi/thunk/ppb_input_event_api.h"
18 17
19 using ppapi::thunk::EnterResourceNoLock; 18 using ppapi::thunk::EnterResourceNoLock;
20 using ppapi::thunk::PPB_InputEvent_API; 19 using ppapi::thunk::PPB_InputEvent_API;
21 20
22 namespace ppapi { 21 namespace ppapi {
23 namespace proxy { 22 namespace proxy {
24 23
(...skipping 21 matching lines...) Expand all
46 dispatcher->Send(new PpapiMsg_PPPInputEvent_HandleInputEvent( 45 dispatcher->Send(new PpapiMsg_PPPInputEvent_HandleInputEvent(
47 INTERFACE_ID_PPP_INPUT_EVENT, instance, data)); 46 INTERFACE_ID_PPP_INPUT_EVENT, instance, data));
48 } 47 }
49 return result; 48 return result;
50 } 49 }
51 50
52 static const PPP_InputEvent input_event_interface = { 51 static const PPP_InputEvent input_event_interface = {
53 &HandleInputEvent 52 &HandleInputEvent
54 }; 53 };
55 54
56 InterfaceProxy* CreateInputEventProxy(Dispatcher* dispatcher, 55 InterfaceProxy* CreateInputEventProxy(Dispatcher* dispatcher) {
57 const void* target_interface) { 56 return new PPP_InputEvent_Proxy(dispatcher);
58 return new PPP_InputEvent_Proxy(dispatcher, target_interface);
59 } 57 }
60 58
61 } // namespace 59 } // namespace
62 60
63 PPP_InputEvent_Proxy::PPP_InputEvent_Proxy(Dispatcher* dispatcher, 61 PPP_InputEvent_Proxy::PPP_InputEvent_Proxy(Dispatcher* dispatcher)
64 const void* target_interface) 62 : InterfaceProxy(dispatcher),
65 : InterfaceProxy(dispatcher, target_interface) { 63 ppp_input_event_impl_(NULL) {
64 if (dispatcher->IsPlugin()) {
65 ppp_input_event_impl_ = static_cast<const PPP_InputEvent*>(
66 dispatcher->local_get_interface()(PPP_INPUT_EVENT_INTERFACE));
67 }
66 } 68 }
67 69
68 PPP_InputEvent_Proxy::~PPP_InputEvent_Proxy() { 70 PPP_InputEvent_Proxy::~PPP_InputEvent_Proxy() {
69 } 71 }
70 72
71 // static 73 // static
72 const InterfaceProxy::Info* PPP_InputEvent_Proxy::GetInfo() { 74 const InterfaceProxy::Info* PPP_InputEvent_Proxy::GetInfo() {
73 static const Info info = { 75 static const Info info = {
74 &input_event_interface, 76 &input_event_interface,
75 PPP_INPUT_EVENT_INTERFACE, 77 PPP_INPUT_EVENT_INTERFACE,
(...skipping 13 matching lines...) Expand all
89 OnMsgHandleFilteredInputEvent) 91 OnMsgHandleFilteredInputEvent)
90 IPC_MESSAGE_UNHANDLED(handled = false) 92 IPC_MESSAGE_UNHANDLED(handled = false)
91 IPC_END_MESSAGE_MAP() 93 IPC_END_MESSAGE_MAP()
92 return handled; 94 return handled;
93 } 95 }
94 96
95 void PPP_InputEvent_Proxy::OnMsgHandleInputEvent(PP_Instance instance, 97 void PPP_InputEvent_Proxy::OnMsgHandleInputEvent(PP_Instance instance,
96 const InputEventData& data) { 98 const InputEventData& data) {
97 scoped_refptr<InputEventImpl> resource(new InputEventImpl( 99 scoped_refptr<InputEventImpl> resource(new InputEventImpl(
98 InputEventImpl::InitAsProxy(), instance, data)); 100 InputEventImpl::InitAsProxy(), instance, data));
99 ppp_input_event_target()->HandleInputEvent(instance, resource->pp_resource()); 101 ppp_input_event_impl_->HandleInputEvent(instance, resource->pp_resource());
100 } 102 }
101 103
102 void PPP_InputEvent_Proxy::OnMsgHandleFilteredInputEvent( 104 void PPP_InputEvent_Proxy::OnMsgHandleFilteredInputEvent(
103 PP_Instance instance, 105 PP_Instance instance,
104 const InputEventData& data, 106 const InputEventData& data,
105 PP_Bool* result) { 107 PP_Bool* result) {
106 scoped_refptr<InputEventImpl> resource(new InputEventImpl( 108 scoped_refptr<InputEventImpl> resource(new InputEventImpl(
107 InputEventImpl::InitAsProxy(), instance, data)); 109 InputEventImpl::InitAsProxy(), instance, data));
108 *result = ppp_input_event_target()->HandleInputEvent(instance, 110 *result = ppp_input_event_impl_->HandleInputEvent(instance,
109 resource->pp_resource()); 111 resource->pp_resource());
110 } 112 }
111 113
112 } // namespace proxy 114 } // namespace proxy
113 } // namespace ppapi 115 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppp_input_event_proxy.h ('k') | ppapi/proxy/ppp_instance_private_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698