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/ppb_input_event_proxy.h" | 5 #include "ppapi/proxy/ppb_input_event_proxy.h" |
6 | 6 |
7 #include "ppapi/c/ppb_audio_config.h" | 7 #include "ppapi/c/ppb_audio_config.h" |
8 #include "ppapi/proxy/plugin_dispatcher.h" | 8 #include "ppapi/proxy/plugin_dispatcher.h" |
9 #include "ppapi/proxy/plugin_var_tracker.h" | 9 #include "ppapi/proxy/plugin_var_tracker.h" |
10 #include "ppapi/proxy/ppapi_messages.h" | 10 #include "ppapi/proxy/ppapi_messages.h" |
11 #include "ppapi/shared_impl/input_event_impl.h" | 11 #include "ppapi/shared_impl/input_event_impl.h" |
12 #include "ppapi/shared_impl/resource.h" | 12 #include "ppapi/shared_impl/resource.h" |
13 #include "ppapi/shared_impl/var.h" | 13 #include "ppapi/shared_impl/var.h" |
14 #include "ppapi/thunk/thunk.h" | 14 #include "ppapi/thunk/thunk.h" |
15 | 15 |
16 using ppapi::thunk::PPB_InputEvent_API; | 16 using ppapi::thunk::PPB_InputEvent_API; |
17 | 17 |
18 namespace ppapi { | 18 namespace ppapi { |
19 namespace proxy { | 19 namespace proxy { |
20 | 20 |
21 // The implementation is actually in InputEventImpl. | |
22 class InputEvent : public Resource, public InputEventImpl { | |
23 public: | |
24 InputEvent(const HostResource& resource, const InputEventData& data); | |
25 virtual ~InputEvent(); | |
26 | |
27 // Resource overrides. | |
28 virtual PPB_InputEvent_API* AsPPB_InputEvent_API() OVERRIDE; | |
29 | |
30 // InputEventImpl overrides. | |
31 virtual PP_Var StringToPPVar(const std::string& str) OVERRIDE; | |
32 | |
33 private: | |
34 DISALLOW_COPY_AND_ASSIGN(InputEvent); | |
35 }; | |
36 | |
37 InputEvent::InputEvent(const HostResource& resource, const InputEventData& data) | |
38 : Resource(resource), | |
39 InputEventImpl(data) { | |
40 } | |
41 | |
42 InputEvent::~InputEvent() { | |
43 } | |
44 | |
45 PPB_InputEvent_API* InputEvent::AsPPB_InputEvent_API() { | |
46 return this; | |
47 } | |
48 | |
49 PP_Var InputEvent::StringToPPVar(const std::string& str) { | |
50 return StringVar::StringToPPVar(0, str); | |
51 } | |
52 | |
53 namespace { | 21 namespace { |
54 | 22 |
55 InterfaceProxy* CreateInputEventProxy(Dispatcher* dispatcher, | 23 InterfaceProxy* CreateInputEventProxy(Dispatcher* dispatcher, |
56 const void* target_interface) { | 24 const void* target_interface) { |
57 return new PPB_InputEvent_Proxy(dispatcher, target_interface); | 25 return new PPB_InputEvent_Proxy(dispatcher, target_interface); |
58 } | 26 } |
59 | 27 |
60 } // namespace | 28 } // namespace |
61 | 29 |
62 PPB_InputEvent_Proxy::PPB_InputEvent_Proxy(Dispatcher* dispatcher, | 30 PPB_InputEvent_Proxy::PPB_InputEvent_Proxy(Dispatcher* dispatcher, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 static const Info info = { | 76 static const Info info = { |
109 thunk::GetPPB_WheelInputEvent_Thunk(), | 77 thunk::GetPPB_WheelInputEvent_Thunk(), |
110 PPB_WHEEL_INPUT_EVENT_INTERFACE, | 78 PPB_WHEEL_INPUT_EVENT_INTERFACE, |
111 INTERFACE_ID_NONE, | 79 INTERFACE_ID_NONE, |
112 false, | 80 false, |
113 &CreateInputEventProxy, | 81 &CreateInputEventProxy, |
114 }; | 82 }; |
115 return &info; | 83 return &info; |
116 } | 84 } |
117 | 85 |
118 // static | |
119 PP_Resource PPB_InputEvent_Proxy::CreateProxyResource( | |
120 PP_Instance instance, | |
121 const InputEventData& data) { | |
122 return (new InputEvent(HostResource::MakeInstanceOnly(instance), data))-> | |
123 GetReference(); | |
124 } | |
125 | |
126 bool PPB_InputEvent_Proxy::OnMessageReceived(const IPC::Message& msg) { | 86 bool PPB_InputEvent_Proxy::OnMessageReceived(const IPC::Message& msg) { |
127 // There are no IPC messages for this interface. | 87 // There are no IPC messages for this interface. |
128 NOTREACHED(); | 88 NOTREACHED(); |
129 return false; | 89 return false; |
130 } | 90 } |
131 | 91 |
132 } // namespace proxy | 92 } // namespace proxy |
133 } // namespace ppapi | 93 } // namespace ppapi |
OLD | NEW |