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_PROCESSOR_H_ | 5 #ifndef UI_EVENTS_EVENT_PROCESSOR_H_ |
6 #define UI_EVENTS_EVENT_PROCESSOR_H_ | 6 #define UI_EVENTS_EVENT_PROCESSOR_H_ |
7 | 7 |
8 #include "ui/events/event_dispatcher.h" | 8 #include "ui/events/event_dispatcher.h" |
9 #include "ui/events/event_source.h" | 9 #include "ui/events/event_source.h" |
10 | 10 |
11 namespace ui { | 11 namespace ui { |
12 | 12 |
13 // EventProcessor receives an event from an EventSource and dispatches it to a | 13 // EventProcessor receives an event from an EventSource and dispatches it to a |
14 // tree of EventTargets. | 14 // tree of EventTargets. |
15 class EVENTS_EXPORT EventProcessor : public EventDispatcherDelegate { | 15 class EVENTS_EXPORT EventProcessor : public EventDispatcherDelegate { |
16 public: | 16 public: |
17 virtual ~EventProcessor() {} | 17 virtual ~EventProcessor() {} |
18 | 18 |
19 // Returns the root of the tree this event processor owns. | 19 // Returns the root of the tree this event processor owns. |
20 virtual EventTarget* GetRootTarget() = 0; | 20 virtual EventTarget* GetRootTarget() = 0; |
21 | 21 |
22 // Dispatches an event received from the EventSource to the tree of | 22 // Dispatches an event received from the EventSource to the tree of |
23 // EventTargets (whose root is returned by GetRootTarget()). | 23 // EventTargets (whose root is returned by GetRootTarget()). |
24 virtual EventDispatchDetails OnEventFromSource(Event* event) | 24 virtual EventDispatchDetails OnEventFromSource(Event* event) |
25 WARN_UNUSED_RESULT; | 25 WARN_UNUSED_RESULT; |
| 26 |
| 27 protected: |
| 28 // Prepares the event so that it can be dispatched. This is invoked before |
| 29 // an EventTargeter is used to find the target of the event. So this can be |
| 30 // used to update the event so that the targeter can operate correctly (e.g. |
| 31 // it can be used to updated the location of the event when disptaching from |
| 32 // an EventSource in high-DPI). |
| 33 virtual void PrepareEventForDispatch(Event* event); |
26 }; | 34 }; |
27 | 35 |
28 } // namespace ui | 36 } // namespace ui |
29 | 37 |
30 #endif // UI_EVENTS_EVENT_PROCESSOR_H_ | 38 #endif // UI_EVENTS_EVENT_PROCESSOR_H_ |
OLD | NEW |