Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "ui/events/event_dispatcher.h" | 8 #include "ui/events/event_dispatcher.h" |
| 9 #include "ui/events/events_export.h" | 9 #include "ui/events/events_export.h" |
| 10 | 10 |
| 11 namespace ui { | 11 namespace ui { |
| 12 | 12 |
| 13 class Event; | 13 class Event; |
| 14 class EventProcessor; | 14 class EventProcessor; |
| 15 class EventRewriter; | |
| 15 | 16 |
| 16 // EventSource receives events from the native platform (e.g. X11, win32 etc.) | 17 // EventSource receives events from the native platform (e.g. X11, win32 etc.) |
| 17 // and sends the events to an EventProcessor. | 18 // and sends the events to an EventProcessor. |
| 18 class EVENTS_EXPORT EventSource { | 19 class EVENTS_EXPORT EventSource { |
| 19 public: | 20 public: |
| 20 virtual ~EventSource() {} | 21 virtual ~EventSource() {} |
| 21 | 22 |
| 22 virtual EventProcessor* GetEventProcessor() = 0; | 23 virtual EventProcessor* GetEventProcessor() = 0; |
| 23 | 24 |
| 25 // Adds a rewriter to modify events before they are sent to the | |
| 26 // EventProcessor. The rewriter must be explicitly removed from the | |
| 27 // EventSource before the rewriter is destroyed. The EventSource | |
| 28 // does not take ownership of the rewriter. | |
| 29 void AddEventRewriter(EventRewriter* rewriter); | |
| 30 void RemoveEventRewriter(EventRewriter* rewriter); | |
| 31 | |
| 24 protected: | 32 protected: |
| 25 EventDispatchDetails SendEventToProcessor(Event* event); | 33 EventDispatchDetails SendEventToProcessor(Event* event); |
| 34 | |
| 35 private: | |
| 36 typedef std::vector<EventRewriter*> EventRewriterList; | |
| 37 EventDispatchDetails DeliverEventToProcessor(Event* event); | |
| 38 EventRewriterList rewriter_list_; | |
|
sadrul
2014/03/24 21:15:38
DISALLOW_COPY_AND_ASSIGN
| |
| 26 }; | 39 }; |
| 27 | 40 |
| 28 } // namespace ui | 41 } // namespace ui |
| 29 | 42 |
| 30 #endif // UI_EVENTS_EVENT_SOURCE_H_ | 43 #endif // UI_EVENTS_EVENT_SOURCE_H_ |
| OLD | NEW |