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