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

Side by Side Diff: ui/events/event_rewriter.h

Issue 2712963003: mustash: Use ui::chromeos::EventRewriter in mus (Closed)
Patch Set: Fix build issues. Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « ui/events/event_processor.h ('k') | ui/events/event_rewriter_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_EVENTS_EVENT_REWRITER_H_ 5 #ifndef UI_EVENTS_EVENT_REWRITER_H_
6 #define UI_EVENTS_EVENT_REWRITER_H_ 6 #define UI_EVENTS_EVENT_REWRITER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "ui/events/events_export.h" 10 #include "ui/events/events_export.h"
11 11
12 namespace ui { 12 namespace ui {
13 13
14 class Event; 14 class Event;
15 15
16 // Return status of EventRewriter operations; see that class below. 16 // Return status of EventRewriter operations; see that class below.
17 enum EventRewriteStatus { 17 enum EventRewriteStatus {
18 // Nothing was done; no rewritten event returned. Pass the original 18 // Nothing was done; no rewritten event returned. Pass the original
19 // event to later rewriters, or send it to the EventProcessor if this 19 // event to later rewriters, or send it to the EventSink if this
20 // was the final rewriter. 20 // was the final rewriter.
21 EVENT_REWRITE_CONTINUE, 21 EVENT_REWRITE_CONTINUE,
22 22
23 // The event has been rewritten. Send the rewritten event to the 23 // The event has been rewritten. Send the rewritten event to the
24 // EventProcessor instead of the original event (without sending 24 // EventSink instead of the original event (without sending
25 // either to any later rewriters). 25 // either to any later rewriters).
26 EVENT_REWRITE_REWRITTEN, 26 EVENT_REWRITE_REWRITTEN,
27 27
28 // The event should be discarded, neither passing it to any later 28 // The event should be discarded, neither passing it to any later
29 // rewriters nor sending it to the EventProcessor. 29 // rewriters nor sending it to the EventSink.
30 EVENT_REWRITE_DISCARD, 30 EVENT_REWRITE_DISCARD,
31 31
32 // The event has been rewritten. As for EVENT_REWRITE_REWRITTEN, 32 // The event has been rewritten. As for EVENT_REWRITE_REWRITTEN,
33 // send the rewritten event to the EventProcessor instead of the 33 // send the rewritten event to the EventSink instead of the original
34 // original event (without sending either to any later rewriters). 34 // event (without sending either to any later rewriters).
35 // In addition the rewriter has one or more additional new events 35 // In addition the rewriter has one or more additional new events
36 // to be retrieved using |NextDispatchEvent()| and sent to the 36 // to be retrieved using |NextDispatchEvent()| and sent to the
37 // EventProcessor. 37 // EventSink.
38 EVENT_REWRITE_DISPATCH_ANOTHER, 38 EVENT_REWRITE_DISPATCH_ANOTHER,
39 }; 39 };
40 40
41 // EventRewriter provides a mechanism for Events to be rewritten 41 // EventRewriter provides a mechanism for Events to be rewritten
42 // before being dispatched from EventSource to EventProcessor. 42 // before being dispatched from EventSource to EventSink.
43 class EVENTS_EXPORT EventRewriter { 43 class EVENTS_EXPORT EventRewriter {
44 public: 44 public:
45 virtual ~EventRewriter() {} 45 virtual ~EventRewriter() {}
46 46
47 // Potentially rewrites (replaces) an event, or requests it be discarded. 47 // Potentially rewrites (replaces) an event, or requests it be discarded.
48 // or discards an event. If the rewriter wants to rewrite an event, and 48 // or discards an event. If the rewriter wants to rewrite an event, and
49 // dispatch another event once the rewritten event is dispatched, it should 49 // dispatch another event once the rewritten event is dispatched, it should
50 // return EVENT_REWRITE_DISPATCH_ANOTHER, and return the next event to 50 // return EVENT_REWRITE_DISPATCH_ANOTHER, and return the next event to
51 // dispatch from |NextDispatchEvent()|. 51 // dispatch from |NextDispatchEvent()|.
52 virtual EventRewriteStatus RewriteEvent( 52 virtual EventRewriteStatus RewriteEvent(
53 const Event& event, 53 const Event& event,
54 std::unique_ptr<Event>* rewritten_event) = 0; 54 std::unique_ptr<Event>* rewritten_event) = 0;
55 55
56 // Supplies an additional event to be dispatched. It is only valid to 56 // Supplies an additional event to be dispatched. It is only valid to
57 // call this after the immediately previous call to |RewriteEvent()| 57 // call this after the immediately previous call to |RewriteEvent()|
58 // or |NextDispatchEvent()| has returned EVENT_REWRITE_DISPATCH_ANOTHER. 58 // or |NextDispatchEvent()| has returned EVENT_REWRITE_DISPATCH_ANOTHER.
59 // Should only return either EVENT_REWRITE_REWRITTEN or 59 // Should only return either EVENT_REWRITE_REWRITTEN or
60 // EVENT_REWRITE_DISPATCH_ANOTHER; otherwise the previous call should not 60 // EVENT_REWRITE_DISPATCH_ANOTHER; otherwise the previous call should not
61 // have returned EVENT_REWRITE_DISPATCH_ANOTHER. 61 // have returned EVENT_REWRITE_DISPATCH_ANOTHER.
62 virtual EventRewriteStatus NextDispatchEvent( 62 virtual EventRewriteStatus NextDispatchEvent(
63 const Event& last_event, 63 const Event& last_event,
64 std::unique_ptr<Event>* new_event) = 0; 64 std::unique_ptr<Event>* new_event) = 0;
65 }; 65 };
66 66
67 } // namespace ui 67 } // namespace ui
68 68
69 #endif // UI_EVENTS_EVENT_REWRITER_H_ 69 #endif // UI_EVENTS_EVENT_REWRITER_H_
OLDNEW
« no previous file with comments | « ui/events/event_processor.h ('k') | ui/events/event_rewriter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698