OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Native Client Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can |
| 3 // be found in the LICENSE file. |
| 4 |
| 5 #ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_INPUT_EVENT_H_ |
| 6 #define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_INPUT_EVENT_H_ |
| 7 |
| 8 #include "native_client/src/include/nacl_macros.h" |
| 9 #include "native_client/src/shared/ppapi_proxy/input_event_data.h" |
| 10 #include "native_client/src/shared/ppapi_proxy/plugin_resource.h" |
| 11 #include "native_client/src/third_party/ppapi/c/ppb_input_event.h" |
| 12 |
| 13 namespace ppapi_proxy { |
| 14 |
| 15 // Implements the untrusted side of the PPB_InputEvent interface. |
| 16 class PluginInputEvent : public PluginResource { |
| 17 public: |
| 18 PluginInputEvent(); |
| 19 // Init the PluginInputEvent resource with the given data. Assumes |
| 20 // character_text has been AddRefed if it's a string, and takes ownership. |
| 21 void Init(const InputEventData& input_event_data, PP_Var character_text); |
| 22 virtual ~PluginInputEvent(); |
| 23 |
| 24 // PluginResource implementation. |
| 25 virtual bool InitFromBrowserResource(PP_Resource /*resource*/) { |
| 26 return true; |
| 27 } |
| 28 |
| 29 static const PPB_InputEvent* GetInterface(); |
| 30 static const PPB_MouseInputEvent* GetMouseInterface(); |
| 31 static const PPB_WheelInputEvent* GetWheelInterface(); |
| 32 static const PPB_KeyboardInputEvent* GetKeyboardInterface(); |
| 33 |
| 34 PP_InputEvent_Type GetType() const; |
| 35 PP_TimeTicks GetTimeStamp() const; |
| 36 uint32_t GetModifiers() const; |
| 37 |
| 38 PP_InputEvent_MouseButton GetMouseButton() const; |
| 39 PP_Point GetMousePosition() const; |
| 40 int32_t GetMouseClickCount() const; |
| 41 |
| 42 PP_FloatPoint GetWheelDelta() const; |
| 43 PP_FloatPoint GetWheelTicks() const; |
| 44 PP_Bool GetWheelScrollByPage() const; |
| 45 |
| 46 uint32_t GetKeyCode() const; |
| 47 PP_Var GetCharacterText() const; |
| 48 |
| 49 private: |
| 50 IMPLEMENT_RESOURCE(PluginInputEvent); |
| 51 NACL_DISALLOW_COPY_AND_ASSIGN(PluginInputEvent); |
| 52 |
| 53 InputEventData input_event_data_; |
| 54 PP_Var character_text_; // Undefined if this is not a character event. |
| 55 }; |
| 56 |
| 57 } // namespace ppapi_proxy |
| 58 |
| 59 #endif // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_INPUT_EVENT_H_ |
OLD | NEW |