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