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