OLD | NEW |
1 // Copyright (c) 2012 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 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 #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/dev/ppb_keyboard_input_event_dev.h" |
12 #include "ppapi/c/ppb_input_event.h" | 12 #include "ppapi/c/ppb_input_event.h" |
13 | 13 |
14 namespace ppapi_proxy { | 14 namespace ppapi_proxy { |
15 | 15 |
16 // Implements the untrusted side of the PPB_InputEvent interface. | 16 // Implements the untrusted side of the PPB_InputEvent interface. |
17 class PluginInputEvent : public PluginResource { | 17 class PluginInputEvent : public PluginResource { |
18 public: | 18 public: |
19 PluginInputEvent(); | 19 PluginInputEvent(); |
20 // Init the PluginInputEvent resource with the given data. Assumes | 20 // Init the PluginInputEvent resource with the given data. Assumes |
21 // 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. |
22 void Init(const InputEventData& input_event_data, PP_Var character_text); | 22 void Init(const InputEventData& input_event_data, PP_Var character_text); |
23 virtual ~PluginInputEvent(); | |
24 | 23 |
25 // PluginResource implementation. | 24 // PluginResource implementation. |
26 virtual bool InitFromBrowserResource(PP_Resource /*resource*/) { | 25 virtual bool InitFromBrowserResource(PP_Resource /*resource*/) { |
27 return true; | 26 return true; |
28 } | 27 } |
29 | 28 |
30 static const PPB_InputEvent* GetInterface(); | 29 static const PPB_InputEvent* GetInterface(); |
31 static const PPB_MouseInputEvent_1_0* GetMouseInterface1_0(); | 30 static const PPB_MouseInputEvent_1_0* GetMouseInterface1_0(); |
32 static const PPB_MouseInputEvent* GetMouseInterface1_1(); | 31 static const PPB_MouseInputEvent* GetMouseInterface1_1(); |
33 static const PPB_WheelInputEvent* GetWheelInterface(); | 32 static const PPB_WheelInputEvent* GetWheelInterface(); |
(...skipping 12 matching lines...) Expand all Loading... |
46 PP_FloatPoint GetWheelDelta() const; | 45 PP_FloatPoint GetWheelDelta() const; |
47 PP_FloatPoint GetWheelTicks() const; | 46 PP_FloatPoint GetWheelTicks() const; |
48 PP_Bool GetWheelScrollByPage() const; | 47 PP_Bool GetWheelScrollByPage() const; |
49 | 48 |
50 uint32_t GetKeyCode() const; | 49 uint32_t GetKeyCode() const; |
51 PP_Var GetCharacterText() const; | 50 PP_Var GetCharacterText() const; |
52 | 51 |
53 PP_Bool SetUsbKeyCode(uint32_t usb_key_code); | 52 PP_Bool SetUsbKeyCode(uint32_t usb_key_code); |
54 uint32_t GetUsbKeyCode() const; | 53 uint32_t GetUsbKeyCode() const; |
55 | 54 |
| 55 protected: |
| 56 virtual ~PluginInputEvent(); |
| 57 |
56 private: | 58 private: |
| 59 InputEventData input_event_data_; |
| 60 PP_Var character_text_; // Undefined if this is not a character event. |
| 61 |
57 IMPLEMENT_RESOURCE(PluginInputEvent); | 62 IMPLEMENT_RESOURCE(PluginInputEvent); |
58 NACL_DISALLOW_COPY_AND_ASSIGN(PluginInputEvent); | 63 NACL_DISALLOW_COPY_AND_ASSIGN(PluginInputEvent); |
59 | |
60 InputEventData input_event_data_; | |
61 PP_Var character_text_; // Undefined if this is not a character event. | |
62 }; | 64 }; |
63 | 65 |
64 } // namespace ppapi_proxy | 66 } // namespace ppapi_proxy |
65 | 67 |
66 #endif // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_INPUT_EVENT_H_ | 68 #endif // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_INPUT_EVENT_H_ |
OLD | NEW |