Index: ui/events/event.h |
diff --git a/ui/events/event.h b/ui/events/event.h |
index 35999bf463bd902c9a421963c83112e990fbda67..ca383d70a33054b0b2e0758c4392ea84ebda61ee 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" |
@@ -27,6 +26,10 @@ namespace gfx { |
class Transform; |
} |
+namespace IPC { |
+template <class P> struct ParamTraits; |
+} |
+ |
namespace ui { |
class EventTarget; |
class KeyEvent; |
@@ -36,6 +39,10 @@ class PointerEvent; |
class ScrollEvent; |
class TouchEvent; |
enum class DomCode; |
+class Event; |
+class MouseWheelEvent; |
+ |
+using ScopedEvent = scoped_ptr<Event>; |
class EVENTS_EXPORT Event { |
public: |
@@ -282,6 +289,9 @@ class EVENTS_EXPORT Event { |
private: |
friend class EventTestApi; |
+ // For (de)serialization. |
+ friend struct IPC::ParamTraits<ui::ScopedEvent>; |
+ |
EventType type_; |
std::string name_; |
base::TimeDelta time_stamp_; |
@@ -303,6 +313,13 @@ class EVENTS_EXPORT CancelModeEvent : public Event { |
public: |
CancelModeEvent(); |
~CancelModeEvent() override; |
+ |
+ private: |
+ // For (de)serialization. |
+ 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 EVENTS_EXPORT LocatedEvent : public Event { |
@@ -346,6 +363,13 @@ class EVENTS_EXPORT LocatedEvent : public Event { |
protected: |
friend class LocatedEventTestApi; |
+ |
+ // For (de)serialization. |
+ 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. |
@@ -406,6 +430,9 @@ struct EVENTS_EXPORT PointerDetails { |
tilt_y == other.tilt_y; |
} |
+ // For serialization. |
+ friend struct IPC::ParamTraits<ui::PointerDetails>; |
+ |
// The type of pointer device. |
EventPointerType pointer_type = EventPointerType::POINTER_TYPE_UNKNOWN; |
@@ -525,6 +552,13 @@ class EVENTS_EXPORT MouseEvent : public LocatedEvent { |
pointer_details_ = details; |
} |
+ protected: |
+ // For (de)serialization. |
+ 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); |
@@ -585,6 +619,12 @@ class EVENTS_EXPORT MouseWheelEvent : public MouseEvent { |
const gfx::Vector2d& offset() const { return offset_; } |
private: |
+ // For (de)serialization. |
+ 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_; |
}; |
@@ -657,15 +697,22 @@ class EVENTS_EXPORT TouchEvent : public LocatedEvent { |
} |
private: |
+ // For (de)serialization. |
+ 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. |
@@ -875,6 +922,11 @@ class EVENTS_EXPORT KeyEvent : public Event { |
void set_is_char(bool is_char) { is_char_ = is_char; } |
private: |
+ // For (de)serialization. |
+ 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; |
@@ -953,6 +1005,12 @@ class EVENTS_EXPORT ScrollEvent : public MouseEvent { |
int finger_count() const { return finger_count_; } |
private: |
+ // For (de)serialization. |
+ 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_; |
@@ -985,6 +1043,12 @@ class EVENTS_EXPORT GestureEvent : public LocatedEvent { |
const GestureEventDetails& details() const { return details_; } |
private: |
+ // For (de)serialization. |
+ 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_; |
}; |