1 // Copyright (c) 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_OZONE_EVENT_CONVERTER_OZONE_H_
6 #define UI_EVENTS_OZONE_EVENT_CONVERTER_OZONE_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop/message_pump_libevent.h"
10 #include "ui/events/events_export.h"
15 // In ozone, Chrome reads events from file descriptors created from Linux device
16 // drivers. The |MessagePumpLibevent::Watcher| parent class provides the
17 // functionality to watch a file descriptor for the arrival of new data and
18 // notify its subclasses. Device-specific event converters turn bytes read from
19 // the file descriptor into |ui::Event| instances. This class provides the
20 // functionality needed in common across all converters: dispatching the
21 // |ui::Event| to aura.
22 class EVENTS_EXPORT EventConverterOzone
23 : public base::MessagePumpLibevent::Watcher {
25 EventConverterOzone();
26 virtual ~EventConverterOzone();
29 // Subclasses should use this method to post a task that will dispatch
30 // |event| from the UI message loop. This method takes ownership of
31 // |event|. |event| will be deleted at the end of the posted task.
32 virtual void DispatchEvent(scoped_ptr<ui::Event> event);
35 DISALLOW_COPY_AND_ASSIGN(EventConverterOzone);
40 #endif // UI_EVENTS_OZONE_EVENT_CONVERTER_OZONE_H_