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

Unified Diff: ui/events/event_rewriter.h

Issue 237363005: Convert chromeos::EventRewriter to a ui::EventRewriter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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
Index: ui/events/event_rewriter.h
diff --git a/ui/events/event_rewriter.h b/ui/events/event_rewriter.h
index f948725709a86a08b3ea138eaf9f2a6232289c03..82e87505a725f2b40260de554719e9624d403098 100644
--- a/ui/events/event_rewriter.h
+++ b/ui/events/event_rewriter.h
@@ -19,9 +19,9 @@ enum EventRewriteStatus {
// was the final rewriter.
EVENT_REWRITE_CONTINUE,
- // The event has been rewritten. Send the rewritten event to the
- // EventProcessor instead of the original event (without sending
- // either to any later rewriters).
+ // The event has been rewritten. Send the rewritten event (which may
+ // be either the modified original event, or a newly allocated event)
+ // to the EventProcessor, without sending it to any later rewriters.
EVENT_REWRITE_REWRITTEN,
// The event should be discarded, neither passing it to any later
@@ -29,11 +29,10 @@ enum EventRewriteStatus {
EVENT_REWRITE_DISCARD,
// The event has been rewritten. As for EVENT_REWRITE_REWRITTEN,
- // send the rewritten event to the EventProcessor instead of the
- // original event (without sending either to any later rewriters).
- // In addition the rewriter has one or more additional new events
- // to be retrieved using |NextDispatchEvent()| and sent to the
- // EventProcessor.
+ // send the rewritten event to the EventProcessor without invoking
+ // any later rewriters. In addition the rewriter has one or more
+ // additional new events to be retrieved using |NextDispatchEvent()|
+ // and sent to the EventProcessor.
EVENT_REWRITE_DISPATCH_ANOTHER,
};
@@ -43,13 +42,15 @@ class EVENTS_EXPORT EventRewriter {
public:
virtual ~EventRewriter() {}
- // Potentially rewrites (replaces) an event, or requests it be discarded.
- // or discards an event. If the rewriter wants to rewrite an event, and
- // dispatch another event once the rewritten event is dispatched, it should
- // return EVENT_REWRITE_DISPATCH_ANOTHER, and return the next event to
+ // Potentially rewrites or replaces an event, or requests it be discarded.
+ // A rewritten event may either be the modified original |event|, or a
+ // newly allocated event returned through |rewritten_event| (but not both).
+ // If the rewriter wants to rewrite an event, and dispatch another
+ // event once the rewritten event is dispatched, it should return
+ // EVENT_REWRITE_DISPATCH_ANOTHER, and return the next event to
// dispatch from |NextDispatchEvent()|.
virtual EventRewriteStatus RewriteEvent(
- const Event& event,
+ Event* event,
scoped_ptr<Event>* rewritten_event) = 0;
// Supplies an additional event to be dispatched. It is only valid to
@@ -57,7 +58,9 @@ class EVENTS_EXPORT EventRewriter {
// or |NextDispatchEvent()| has returned EVENT_REWRITE_DISPATCH_ANOTHER.
// Should only return either EVENT_REWRITE_REWRITTEN or
// EVENT_REWRITE_DISPATCH_ANOTHER; otherwise the previous call should not
- // have returned EVENT_REWRITE_DISPATCH_ANOTHER.
+ // have returned EVENT_REWRITE_DISPATCH_ANOTHER. |last_event| must be
+ // the previous rewritten event, and the additional event is returned
+ // through |new_event|.
virtual EventRewriteStatus NextDispatchEvent(
const Event& last_event,
scoped_ptr<Event>* new_event) = 0;

Powered by Google App Engine
This is Rietveld 408576698