Index: ui/events/event.h |
diff --git a/ui/events/event.h b/ui/events/event.h |
index b01c12d3e303aacd6bec1c75a5b9e911a0c8a028..e0961d1365f828d7d191c80ce6f89469f6645d0f 100644 |
--- a/ui/events/event.h |
+++ b/ui/events/event.h |
@@ -318,6 +318,13 @@ class EVENTS_EXPORT CancelModeEvent : public Event { |
class EVENTS_EXPORT LocatedEvent : public Event { |
public: |
+ // Convenience function that casts |event| to a LocatedEvent if it is one, |
+ // otherwise returns null. |
+ static const ui::LocatedEvent* AsLocatedEventIfLocatedEvent( |
+ const ui::Event* event) { |
+ return event && event->IsLocatedEvent() ? event->AsLocatedEvent() : nullptr; |
+ } |
+ |
~LocatedEvent() override; |
float x() const { return location_.x(); } |