Chromium Code Reviews| Index: ui/events/event.h |
| diff --git a/ui/events/event.h b/ui/events/event.h |
| index da7cc98b423776fba47822b47cf8378684f14055..a1e379884af0a1fa368875812588cfa593edb73f 100644 |
| --- a/ui/events/event.h |
| +++ b/ui/events/event.h |
| @@ -6,7 +6,6 @@ |
| #define UI_EVENTS_EVENT_H_ |
| #include <stdint.h> |
| - |
| #include "base/compiler_specific.h" |
| #include "base/event_types.h" |
| #include "base/gtest_prod_util.h" |
| @@ -14,6 +13,7 @@ |
| #include "base/macros.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "base/time/time.h" |
| +#include "ipc/ipc_message_utils.h" |
| #include "ui/events/event_constants.h" |
| #include "ui/events/gesture_event_details.h" |
| #include "ui/events/gestures/gesture_types.h" |
| @@ -30,6 +30,9 @@ class Transform; |
| namespace ui { |
| class EventTarget; |
| enum class DomCode; |
| +class Event; |
| + |
| +typedef scoped_ptr<Event> ScopedEvent; |
| class EVENTS_EXPORT Event { |
| public: |
| @@ -234,6 +237,9 @@ class EVENTS_EXPORT Event { |
| private: |
| friend class EventTestApi; |
| + // For mojo native implementation of (de)serialization. |
| + friend struct IPC::ParamTraits<ui::ScopedEvent>; |
|
Ken Rockot(use gerrit already)
2016/02/17 22:05:21
This is really for Chrome IPC serialization. Here
Mark Dittmer
2016/02/18 14:51:05
Done.
|
| + |
| EventType type_; |
| std::string name_; |
| base::TimeDelta time_stamp_; |
| @@ -255,8 +261,19 @@ class EVENTS_EXPORT CancelModeEvent : public Event { |
| public: |
| CancelModeEvent(); |
| ~CancelModeEvent() override; |
| + |
| + private: |
| + // For mojo native implementation of (de)serialization. |
| + explicit CancelModeEvent(EventType type, |
| + base::TimeDelta time_stamp, |
| + int flags) |
| + : Event(type, time_stamp, flags) {} |
| + friend struct IPC::ParamTraits<ui::ScopedEvent>; |
| + friend struct IPC::ParamTraits<ui::CancelModeEvent>; |
| }; |
| +class MouseWheelEvent; |
| + |
| class EVENTS_EXPORT LocatedEvent : public Event { |
| public: |
| ~LocatedEvent() override; |
| @@ -298,6 +315,13 @@ class EVENTS_EXPORT LocatedEvent : public Event { |
| protected: |
| friend class LocatedEventTestApi; |
| + |
| + // For mojo native implementation of (de)serialization. |
| + explicit LocatedEvent(EventType type, base::TimeDelta time_stamp, int flags) |
| + : Event(type, time_stamp, flags) {} |
| + friend struct IPC::ParamTraits<ui::ScopedEvent>; |
| + friend struct IPC::ParamTraits<ui::LocatedEvent>; |
| + |
| explicit LocatedEvent(const base::NativeEvent& native_event); |
| // Create a new LocatedEvent which is identical to the provided model. |
| @@ -466,6 +490,13 @@ class EVENTS_EXPORT MouseEvent : public LocatedEvent { |
| pointer_details_ = details; |
| } |
| + protected: |
| + // For mojo native implementation of (de)serialization. |
| + explicit MouseEvent(EventType type, base::TimeDelta time_stamp, int flags) |
| + : LocatedEvent(type, time_stamp, flags) {} |
| + friend struct IPC::ParamTraits<ui::ScopedEvent>; |
| + friend struct IPC::ParamTraits<ui::MouseEvent>; |
| + |
| private: |
| FRIEND_TEST_ALL_PREFIXES(EventTest, DoubleClickRequiresRelease); |
| FRIEND_TEST_ALL_PREFIXES(EventTest, SingleClickRightLeft); |
| @@ -526,6 +557,14 @@ class EVENTS_EXPORT MouseWheelEvent : public MouseEvent { |
| const gfx::Vector2d& offset() const { return offset_; } |
| private: |
| + // For mojo native implementation of (de)serialization. |
| + explicit MouseWheelEvent(EventType type, |
| + base::TimeDelta time_stamp, |
| + int flags) |
| + : MouseEvent(type, time_stamp, flags) {} |
| + friend struct IPC::ParamTraits<ui::ScopedEvent>; |
| + friend struct IPC::ParamTraits<ui::MouseWheelEvent>; |
| + |
| gfx::Vector2d offset_; |
| }; |
| @@ -600,15 +639,22 @@ class EVENTS_EXPORT TouchEvent : public LocatedEvent { |
| const PointerDetails& pointer_details() const { return pointer_details_; } |
| private: |
| + // For mojo native implementation of (de)serialization. |
| + explicit TouchEvent(EventType type, base::TimeDelta time_stamp, int flags) |
| + : LocatedEvent(type, time_stamp, flags), |
| + should_remove_native_touch_id_mapping_(false) {} |
| + friend struct IPC::ParamTraits<ui::ScopedEvent>; |
| + friend struct IPC::ParamTraits<ui::TouchEvent>; |
| + |
| // Adjusts rotation_angle_ to within the acceptable range. |
| void FixRotationAngle(); |
| // The identity (typically finger) of the touch starting at 0 and incrementing |
| // for each separable additional touch that the hardware can detect. |
| - const int touch_id_; |
| + int touch_id_; |
| // A unique identifier for the touch event. |
| - const uint32_t unique_event_id_; |
| + uint32_t unique_event_id_; |
| // Clockwise angle (in degrees) of the major axis from the X axis. Must be |
| // less than 180 and non-negative. |
| @@ -794,6 +840,11 @@ class EVENTS_EXPORT KeyEvent : public Event { |
| void set_is_char(bool is_char) { is_char_ = is_char; } |
| private: |
| + // For mojo native implementation of (de)serialization. |
| + explicit KeyEvent(EventType type, base::TimeDelta time_stamp, int flags); |
| + friend struct IPC::ParamTraits<ui::ScopedEvent>; |
| + friend struct IPC::ParamTraits<ui::KeyEvent>; |
| + |
| // Determine key_ on a keystroke event from code_ and flags(). |
| void ApplyLayout() const; |
| @@ -872,6 +923,12 @@ class EVENTS_EXPORT ScrollEvent : public MouseEvent { |
| int finger_count() const { return finger_count_; } |
| private: |
| + // For mojo native implementation of (de)serialization. |
| + explicit ScrollEvent(EventType type, base::TimeDelta time_stamp, int flags) |
| + : MouseEvent(type, time_stamp, flags) {} |
| + friend struct IPC::ParamTraits<ui::ScopedEvent>; |
| + friend struct IPC::ParamTraits<ui::ScrollEvent>; |
| + |
| // Potential accelerated offsets. |
| float x_offset_; |
| float y_offset_; |
| @@ -904,6 +961,12 @@ class EVENTS_EXPORT GestureEvent : public LocatedEvent { |
| const GestureEventDetails& details() const { return details_; } |
| private: |
| + // For mojo native implementation of (de)serialization. |
| + explicit GestureEvent(EventType type, base::TimeDelta time_stamp, int flags) |
| + : LocatedEvent(type, time_stamp, flags) {} |
| + friend struct IPC::ParamTraits<ui::ScopedEvent>; |
| + friend struct IPC::ParamTraits<ui::GestureEvent>; |
| + |
| GestureEventDetails details_; |
| }; |