- add sources.
[platform/framework/web/crosswalk.git] / src / ui / events / ozone / event_converter_ozone.h
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.
4
5 #ifndef UI_EVENTS_OZONE_EVENT_CONVERTER_OZONE_H_
6 #define UI_EVENTS_OZONE_EVENT_CONVERTER_OZONE_H_
7
8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop/message_pump_libevent.h"
10
11 namespace ui {
12 class Event;
13
14 // In ozone, Chrome reads events from file descriptors created from Linux device
15 // drivers. The |MessagePumpLibevent::Watcher| parent class provides the
16 // functionality to watch a file descriptor for the arrival of new data and
17 // notify its subclasses. Device-specific event converters turn bytes read from
18 // the file descriptor into |ui::Event| instances. This class provides the
19 // functionality needed in common across all converters: dispatching the
20 // |ui::Event| to aura.
21 class EventConverterOzone : public base::MessagePumpLibevent::Watcher {
22  public:
23   EventConverterOzone();
24   virtual ~EventConverterOzone();
25
26  protected:
27   // Subclasses should use this method to post a task that will dispatch
28   // |event| from the UI message loop. This method takes ownership of
29   // |event|. |event| will be deleted at the end of the posted task.
30   virtual void DispatchEvent(scoped_ptr<ui::Event> event);
31
32  private:
33   DISALLOW_COPY_AND_ASSIGN(EventConverterOzone);
34 };
35
36 }  // namespace ui
37
38 #endif  // UI_EVENTS_OZONE_EVENT_CONVERTER_OZONE_H_