Index: ui/events/event.h |
diff --git a/ui/events/event.h b/ui/events/event.h |
index a617760b3b4727c0903ed77feef9345ae9284aef..84f11439b64d4fc2681f175351ac1223ae2a0568 100644 |
--- a/ui/events/event.h |
+++ b/ui/events/event.h |
@@ -318,6 +318,12 @@ 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* FromIfValid(const ui::Event* event) { |
+ return event && event->IsLocatedEvent() ? event->AsLocatedEvent() : nullptr; |
+ } |
+ |
~LocatedEvent() override; |
float x() const { return location_.x(); } |