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