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::HostResource; | |
17 using ppapi::InputEventData; | |
18 using ppapi::InputEventImpl; | |
19 using ppapi::Resource; | |
20 using ppapi::thunk::PPB_InputEvent_API; | 16 using ppapi::thunk::PPB_InputEvent_API; |
21 | 17 |
22 namespace pp { | 18 namespace ppapi { |
23 namespace proxy { | 19 namespace proxy { |
24 | 20 |
25 // The implementation is actually in InputEventImpl. | 21 // The implementation is actually in InputEventImpl. |
26 class InputEvent : public Resource, public InputEventImpl { | 22 class InputEvent : public Resource, public InputEventImpl { |
27 public: | 23 public: |
28 InputEvent(const HostResource& resource, const InputEventData& data); | 24 InputEvent(const HostResource& resource, const InputEventData& data); |
29 virtual ~InputEvent(); | 25 virtual ~InputEvent(); |
30 | 26 |
31 // Resource overrides. | 27 // Resource overrides. |
32 virtual PPB_InputEvent_API* AsPPB_InputEvent_API() OVERRIDE; | 28 virtual PPB_InputEvent_API* AsPPB_InputEvent_API() OVERRIDE; |
(...skipping 11 matching lines...) Expand all Loading... |
44 } | 40 } |
45 | 41 |
46 InputEvent::~InputEvent() { | 42 InputEvent::~InputEvent() { |
47 } | 43 } |
48 | 44 |
49 PPB_InputEvent_API* InputEvent::AsPPB_InputEvent_API() { | 45 PPB_InputEvent_API* InputEvent::AsPPB_InputEvent_API() { |
50 return this; | 46 return this; |
51 } | 47 } |
52 | 48 |
53 PP_Var InputEvent::StringToPPVar(const std::string& str) { | 49 PP_Var InputEvent::StringToPPVar(const std::string& str) { |
54 return ppapi::StringVar::StringToPPVar(0, str); | 50 return StringVar::StringToPPVar(0, str); |
55 } | 51 } |
56 | 52 |
57 namespace { | 53 namespace { |
58 | 54 |
59 InterfaceProxy* CreateInputEventProxy(Dispatcher* dispatcher, | 55 InterfaceProxy* CreateInputEventProxy(Dispatcher* dispatcher, |
60 const void* target_interface) { | 56 const void* target_interface) { |
61 return new PPB_InputEvent_Proxy(dispatcher, target_interface); | 57 return new PPB_InputEvent_Proxy(dispatcher, target_interface); |
62 } | 58 } |
63 | 59 |
64 } // namespace | 60 } // namespace |
65 | 61 |
66 PPB_InputEvent_Proxy::PPB_InputEvent_Proxy(Dispatcher* dispatcher, | 62 PPB_InputEvent_Proxy::PPB_InputEvent_Proxy(Dispatcher* dispatcher, |
67 const void* target_interface) | 63 const void* target_interface) |
68 : InterfaceProxy(dispatcher, target_interface) { | 64 : InterfaceProxy(dispatcher, target_interface) { |
69 } | 65 } |
70 | 66 |
71 PPB_InputEvent_Proxy::~PPB_InputEvent_Proxy() { | 67 PPB_InputEvent_Proxy::~PPB_InputEvent_Proxy() { |
72 } | 68 } |
73 | 69 |
74 // static | 70 // static |
75 const InterfaceProxy::Info* PPB_InputEvent_Proxy::GetInputEventInfo() { | 71 const InterfaceProxy::Info* PPB_InputEvent_Proxy::GetInputEventInfo() { |
76 static const Info info = { | 72 static const Info info = { |
77 ::ppapi::thunk::GetPPB_InputEvent_Thunk(), | 73 thunk::GetPPB_InputEvent_Thunk(), |
78 PPB_INPUT_EVENT_INTERFACE, | 74 PPB_INPUT_EVENT_INTERFACE, |
79 INTERFACE_ID_NONE, | 75 INTERFACE_ID_NONE, |
80 false, | 76 false, |
81 &CreateInputEventProxy, | 77 &CreateInputEventProxy, |
82 }; | 78 }; |
83 return &info; | 79 return &info; |
84 } | 80 } |
85 | 81 |
86 // static | 82 // static |
87 const InterfaceProxy::Info* PPB_InputEvent_Proxy::GetKeyboardInputEventInfo() { | 83 const InterfaceProxy::Info* PPB_InputEvent_Proxy::GetKeyboardInputEventInfo() { |
88 static const Info info = { | 84 static const Info info = { |
89 ::ppapi::thunk::GetPPB_KeyboardInputEvent_Thunk(), | 85 thunk::GetPPB_KeyboardInputEvent_Thunk(), |
90 PPB_KEYBOARD_INPUT_EVENT_INTERFACE, | 86 PPB_KEYBOARD_INPUT_EVENT_INTERFACE, |
91 INTERFACE_ID_NONE, | 87 INTERFACE_ID_NONE, |
92 false, | 88 false, |
93 &CreateInputEventProxy, | 89 &CreateInputEventProxy, |
94 }; | 90 }; |
95 return &info; | 91 return &info; |
96 } | 92 } |
97 | 93 |
98 // static | 94 // static |
99 const InterfaceProxy::Info* PPB_InputEvent_Proxy::GetMouseInputEventInfo() { | 95 const InterfaceProxy::Info* PPB_InputEvent_Proxy::GetMouseInputEventInfo() { |
100 static const Info info = { | 96 static const Info info = { |
101 ::ppapi::thunk::GetPPB_MouseInputEvent_Thunk(), | 97 thunk::GetPPB_MouseInputEvent_Thunk(), |
102 PPB_MOUSE_INPUT_EVENT_INTERFACE, | 98 PPB_MOUSE_INPUT_EVENT_INTERFACE, |
103 INTERFACE_ID_NONE, | 99 INTERFACE_ID_NONE, |
104 false, | 100 false, |
105 &CreateInputEventProxy, | 101 &CreateInputEventProxy, |
106 }; | 102 }; |
107 return &info; | 103 return &info; |
108 } | 104 } |
109 | 105 |
110 // static | 106 // static |
111 const InterfaceProxy::Info* PPB_InputEvent_Proxy::GetWheelInputEventInfo() { | 107 const InterfaceProxy::Info* PPB_InputEvent_Proxy::GetWheelInputEventInfo() { |
112 static const Info info = { | 108 static const Info info = { |
113 ::ppapi::thunk::GetPPB_WheelInputEvent_Thunk(), | 109 thunk::GetPPB_WheelInputEvent_Thunk(), |
114 PPB_WHEEL_INPUT_EVENT_INTERFACE, | 110 PPB_WHEEL_INPUT_EVENT_INTERFACE, |
115 INTERFACE_ID_NONE, | 111 INTERFACE_ID_NONE, |
116 false, | 112 false, |
117 &CreateInputEventProxy, | 113 &CreateInputEventProxy, |
118 }; | 114 }; |
119 return &info; | 115 return &info; |
120 } | 116 } |
121 | 117 |
122 // static | 118 // static |
123 PP_Resource PPB_InputEvent_Proxy::CreateProxyResource( | 119 PP_Resource PPB_InputEvent_Proxy::CreateProxyResource( |
124 PP_Instance instance, | 120 PP_Instance instance, |
125 const InputEventData& data) { | 121 const InputEventData& data) { |
126 return (new InputEvent(HostResource::MakeInstanceOnly(instance), data))-> | 122 return (new InputEvent(HostResource::MakeInstanceOnly(instance), data))-> |
127 GetReference(); | 123 GetReference(); |
128 } | 124 } |
129 | 125 |
130 bool PPB_InputEvent_Proxy::OnMessageReceived(const IPC::Message& msg) { | 126 bool PPB_InputEvent_Proxy::OnMessageReceived(const IPC::Message& msg) { |
131 // There are no IPC messages for this interface. | 127 // There are no IPC messages for this interface. |
132 NOTREACHED(); | 128 NOTREACHED(); |
133 return false; | 129 return false; |
134 } | 130 } |
135 | 131 |
136 } // namespace proxy | 132 } // namespace proxy |
137 } // namespace pp | 133 } // namespace ppapi |
OLD | NEW |