| 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_FACTORY_OZONE_H_ | 5 #ifndef UI_EVENTS_OZONE_EVENT_FACTORY_OZONE_H_ | 
| 6 #define UI_EVENTS_OZONE_EVENT_FACTORY_OZONE_H_ | 6 #define UI_EVENTS_OZONE_EVENT_FACTORY_OZONE_H_ | 
| 7 | 7 | 
| 8 #include <map> | 8 #include <map> | 
| 9 | 9 | 
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" | 
| 11 #include "base/message_loop/message_pump_libevent.h" | 11 #include "base/message_loop/message_pump_libevent.h" | 
| 12 #include "ui/events/events_export.h" | 12 #include "ui/events/events_export.h" | 
| 13 #include "ui/events/ozone/event_converter_ozone.h" |  | 
| 14 | 13 | 
| 15 namespace ui { | 14 namespace ui { | 
| 16 | 15 | 
|  | 16 class Event; | 
|  | 17 | 
| 17 // Creates and dispatches |ui.Event|'s. Ozone assumes that events arrive on file | 18 // Creates and dispatches |ui.Event|'s. Ozone assumes that events arrive on file | 
| 18 // descriptors with one  |EventConverterOzone| instance for each descriptor. | 19 // descriptors with one  |EventConverterOzone| instance for each descriptor. | 
| 19 // Ozone presumes that the set of file desctiprtors can vary at runtime so this | 20 // Ozone presumes that the set of file desctiprtors can vary at runtime so this | 
| 20 // class supports dynamically adding and removing |EventConverterOzone| | 21 // class supports dynamically adding and removing |EventConverterOzone| | 
| 21 // instances as necessary. | 22 // instances as necessary. | 
| 22 class EVENTS_EXPORT EventFactoryOzone { | 23 class EVENTS_EXPORT EventFactoryOzone { | 
| 23  public: | 24  public: | 
| 24   EventFactoryOzone(); | 25   EventFactoryOzone(); | 
| 25   virtual ~EventFactoryOzone(); | 26   virtual ~EventFactoryOzone(); | 
| 26 | 27 | 
| 27   // Called from WindowTreeHostOzone to initialize and start processing events. | 28   // Called from WindowTreeHostOzone to initialize and start processing events. | 
| 28   // This should create the initial set of converters, and potentially arrange | 29   // This should create the initial set of converters, and potentially arrange | 
| 29   // for more converters to be created as new event sources become available. | 30   // for more converters to be created as new event sources become available. | 
| 30   // No events processing should happen until this is called. All processes have | 31   // No events processing should happen until this is called. All processes have | 
| 31   // an EventFactoryOzone but not all of them should process events. In chrome, | 32   // an EventFactoryOzone but not all of them should process events. In chrome, | 
| 32   // events are dispatched in the browser process on the UI thread. | 33   // events are dispatched in the browser process on the UI thread. | 
| 33   virtual void StartProcessingEvents(); | 34   virtual void StartProcessingEvents(); | 
| 34 | 35 | 
| 35   // Returns the static instance last set using SetInstance(). | 36   // Returns the static instance last set using SetInstance(). | 
| 36   static EventFactoryOzone* GetInstance(); | 37   static EventFactoryOzone* GetInstance(); | 
| 37 | 38 | 
| 38   // Sets the implementation delegate. Ownership is retained by the caller. | 39   // Sets the implementation delegate. Ownership is retained by the caller. | 
| 39   static void SetInstance(EventFactoryOzone*); | 40   static void SetInstance(EventFactoryOzone*); | 
| 40 | 41 | 
|  | 42   // Subclasses should use this method to post a task that will dispatch | 
|  | 43   // |event| from the UI message loop. This method takes ownership of | 
|  | 44   // |event|. |event| will be deleted at the end of the posted task. | 
|  | 45   static void DispatchEvent(scoped_ptr<ui::Event> event); | 
|  | 46 | 
| 41  private: | 47  private: | 
| 42   static EventFactoryOzone* impl_;  // not owned | 48   static EventFactoryOzone* impl_;  // not owned | 
| 43 | 49 | 
| 44   DISALLOW_COPY_AND_ASSIGN(EventFactoryOzone); | 50   DISALLOW_COPY_AND_ASSIGN(EventFactoryOzone); | 
| 45 }; | 51 }; | 
| 46 | 52 | 
| 47 }  // namespace ui | 53 }  // namespace ui | 
| 48 | 54 | 
| 49 #endif  // UI_EVENTS_OZONE_EVENT_FACTORY_OZONE_H_ | 55 #endif  // UI_EVENTS_OZONE_EVENT_FACTORY_OZONE_H_ | 
| OLD | NEW | 
|---|