Roll src/third_party/skia 591a2ca:b3fe1b8
[chromium-blink-merge.git] / ui / events / event_source.h
blobf545eea82f417ff3eb9f1802e3a06ed2fc556b82
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
3 // found in the LICENSE file.
5 #ifndef UI_EVENTS_EVENT_SOURCE_H_
6 #define UI_EVENTS_EVENT_SOURCE_H_
8 #include <vector>
10 #include "ui/events/event_dispatcher.h"
11 #include "ui/events/events_export.h"
13 namespace ui {
15 class Event;
16 class EventProcessor;
17 class EventRewriter;
19 // EventSource receives events from the native platform (e.g. X11, win32 etc.)
20 // and sends the events to an EventProcessor.
21 class EVENTS_EXPORT EventSource {
22 public:
23 EventSource();
24 virtual ~EventSource();
26 virtual EventProcessor* GetEventProcessor() = 0;
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);
35 protected:
36 EventDispatchDetails SendEventToProcessor(Event* event);
37 virtual EventDispatchDetails DeliverEventToProcessor(Event* event);
39 private:
40 friend class EventSourceTestApi;
42 typedef std::vector<EventRewriter*> EventRewriterList;
43 EventRewriterList rewriter_list_;
44 DISALLOW_COPY_AND_ASSIGN(EventSource);
47 } // namespace ui
49 #endif // UI_EVENTS_EVENT_SOURCE_H_