Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Unified Diff: ui/events/event.h

Issue 2374213003: Refactored static_cast'ing of events to use the AsXXXEvent() methods. (Closed)
Patch Set: Added IsCancelModeEvent() & AsCancelModeEvent() methods to Event Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/events/event.cc » ('j') | ui/events/event.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/event.h
diff --git a/ui/events/event.h b/ui/events/event.h
index 84305a70882abf28ed829d6b87340c3a4ab7aba3..4a1295772905999c48acbad986f076e8f7e110bd 100644
--- a/ui/events/event.h
+++ b/ui/events/event.h
@@ -30,6 +30,7 @@ class Transform;
}
namespace ui {
+class CancelModeEvent;
class EventTarget;
class KeyEvent;
class LocatedEvent;
@@ -107,6 +108,10 @@ class EVENTS_EXPORT Event {
bool IsAltGrDown() const { return (flags_ & EF_ALTGR_DOWN) != 0; }
bool IsCapsLockOn() const { return (flags_ & EF_CAPS_LOCK_ON) != 0; }
+ bool IsCancelModeEvent() const {
+ return type_ == ET_CANCEL_MODE;
+ }
+
bool IsKeyEvent() const {
return type_ == ET_KEY_PRESSED || type_ == ET_KEY_RELEASED;
}
@@ -220,6 +225,12 @@ class EVENTS_EXPORT Event {
IsGestureEvent() || IsPointerEvent();
}
+ // Convenience methods to cast |this| to a CancelModeEvent.
+ // IsCancelModeEvent() must be true as a precondition to calling these
+ // methods.
+ CancelModeEvent* AsCancelModeEvent();
+ const CancelModeEvent* AsCancelModeEvent() const;
+
// Convenience methods to cast |this| to a GestureEvent. IsGestureEvent()
// must be true as a precondition to calling these methods.
GestureEvent* AsGestureEvent();
« no previous file with comments | « no previous file | ui/events/event.cc » ('j') | ui/events/event.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698