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

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

Issue 210203002: events: Introduce EventRewriter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix missing 'virtual' 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 unified diff | Download patch
« no previous file with comments | « ui/events/event_rewriter_unittest.cc ('k') | ui/events/event_source.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_SOURCE_H_ 5 #ifndef UI_EVENTS_EVENT_SOURCE_H_
6 #define UI_EVENTS_EVENT_SOURCE_H_ 6 #define UI_EVENTS_EVENT_SOURCE_H_
7 7
8 #include <vector>
9
8 #include "ui/events/event_dispatcher.h" 10 #include "ui/events/event_dispatcher.h"
9 #include "ui/events/events_export.h" 11 #include "ui/events/events_export.h"
10 12
11 namespace ui { 13 namespace ui {
12 14
13 class Event; 15 class Event;
14 class EventProcessor; 16 class EventProcessor;
17 class EventRewriter;
15 18
16 // EventSource receives events from the native platform (e.g. X11, win32 etc.) 19 // EventSource receives events from the native platform (e.g. X11, win32 etc.)
17 // and sends the events to an EventProcessor. 20 // and sends the events to an EventProcessor.
18 class EVENTS_EXPORT EventSource { 21 class EVENTS_EXPORT EventSource {
19 public: 22 public:
20 virtual ~EventSource() {} 23 EventSource();
24 virtual ~EventSource();
21 25
22 virtual EventProcessor* GetEventProcessor() = 0; 26 virtual EventProcessor* GetEventProcessor() = 0;
23 27
28 // Adds a rewriter to modify events before they are sent to the
29 // EventProcessor. The rewriter must be explicitly removed from the
30 // EventSource before the rewriter is destroyed. The EventSource
31 // does not take ownership of the rewriter.
32 void AddEventRewriter(EventRewriter* rewriter);
33 void RemoveEventRewriter(EventRewriter* rewriter);
34
24 protected: 35 protected:
25 EventDispatchDetails SendEventToProcessor(Event* event); 36 EventDispatchDetails SendEventToProcessor(Event* event);
37
38 private:
39 typedef std::vector<EventRewriter*> EventRewriterList;
40 EventDispatchDetails DeliverEventToProcessor(Event* event);
41 EventRewriterList rewriter_list_;
42 DISALLOW_COPY_AND_ASSIGN(EventSource);
26 }; 43 };
27 44
28 } // namespace ui 45 } // namespace ui
29 46
30 #endif // UI_EVENTS_EVENT_SOURCE_H_ 47 #endif // UI_EVENTS_EVENT_SOURCE_H_
OLDNEW
« no previous file with comments | « ui/events/event_rewriter_unittest.cc ('k') | ui/events/event_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698