OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef PPAPI_SHARED_IMPL_INPUT_EVENT_IMPL_H_ |
| 6 #define PPAPI_SHARED_IMPL_INPUT_EVENT_IMPL_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/compiler_specific.h" |
| 11 #include "ppapi/thunk/ppb_input_event_api.h" |
| 12 |
| 13 namespace ppapi { |
| 14 |
| 15 // IF YOU ADD STUFF TO THIS CLASS |
| 16 // ============================== |
| 17 // Be sure to add it to the STRUCT_TRAITS at the top of ppapi_messages.h |
| 18 struct InputEventData { |
| 19 InputEventData(); |
| 20 ~InputEventData(); |
| 21 |
| 22 // Internal-only value. Set to true when this input event is filtered, that |
| 23 // is, should be delivered synchronously. This is used by the proxy. |
| 24 bool is_filtered; |
| 25 |
| 26 PP_InputEvent_Type event_type; |
| 27 PP_TimeTicks event_time_stamp; |
| 28 uint32_t event_modifiers; |
| 29 |
| 30 PP_InputEvent_MouseButton mouse_button; |
| 31 PP_Point mouse_position; |
| 32 int32_t mouse_click_count; |
| 33 |
| 34 PP_FloatPoint wheel_delta; |
| 35 PP_FloatPoint wheel_ticks; |
| 36 bool wheel_scroll_by_page; |
| 37 |
| 38 uint32_t key_code; |
| 39 |
| 40 std::string character_text; |
| 41 }; |
| 42 |
| 43 // This simple class implements the PPB_InputEvent_API in terms of the |
| 44 class InputEventImpl : public thunk::PPB_InputEvent_API { |
| 45 public: |
| 46 InputEventImpl(const InputEventData& data); |
| 47 |
| 48 // PPB_InputEvent_API implementation. |
| 49 virtual const InputEventData& GetInputEventData() const OVERRIDE; |
| 50 virtual PP_InputEvent_Type GetEventType() OVERRIDE; |
| 51 virtual PP_TimeTicks GetEventTimeStamp() OVERRIDE; |
| 52 virtual uint32_t GetEventModifiers() OVERRIDE; |
| 53 virtual PP_InputEvent_MouseButton GetMouseButton() OVERRIDE; |
| 54 virtual PP_Point GetMousePosition() OVERRIDE; |
| 55 virtual int32_t GetMouseClickCount() OVERRIDE; |
| 56 virtual PP_FloatPoint GetWheelDelta() OVERRIDE; |
| 57 virtual PP_FloatPoint GetWheelTicks() OVERRIDE; |
| 58 virtual PP_Bool GetWheelScrollByPage() OVERRIDE; |
| 59 virtual uint32_t GetKeyCode() OVERRIDE; |
| 60 virtual PP_Var GetCharacterText() OVERRIDE; |
| 61 |
| 62 protected: |
| 63 // Derived classes override this to convert a string to a PP_Var in either |
| 64 // the proxy or the impl. |
| 65 virtual PP_Var StringToPPVar(const std::string& str) = 0; |
| 66 |
| 67 private: |
| 68 InputEventData data_; |
| 69 }; |
| 70 |
| 71 } // namespace ppapi |
| 72 |
| 73 #endif // PPAPI_SHARED_IMPL_INPUT_EVENT_IMPL_H_ |
| 74 |
OLD | NEW |