| OLD | NEW |
| (Empty) |
| 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 BASE_MESSAGE_PUMP_LINUX_H_ | |
| 6 #define BASE_MESSAGE_PUMP_LINUX_H_ | |
| 7 | |
| 8 | |
| 9 #include "base/message_pump.h" | |
| 10 | |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "base/memory/scoped_vector.h" | |
| 13 #include "base/message_pump_dispatcher.h" | |
| 14 #include "base/message_pump_libevent.h" | |
| 15 #include "base/message_pump_observer.h" | |
| 16 #include "base/observer_list.h" | |
| 17 | |
| 18 namespace base { | |
| 19 | |
| 20 // This class implements a message-pump for processing events from input devices | |
| 21 // Refer to MessagePump for further documentation. | |
| 22 class BASE_EXPORT MessagePumpLinux : public MessagePumpLibevent, | |
| 23 public MessagePumpDispatcher { | |
| 24 public: | |
| 25 MessagePumpLinux(); | |
| 26 | |
| 27 // Returns the UI message pump. | |
| 28 static MessagePumpLinux* Current(); | |
| 29 | |
| 30 // Add/Remove the root window dispatcher. | |
| 31 void AddDispatcherForRootWindow(MessagePumpDispatcher* dispatcher); | |
| 32 void RemoveDispatcherForRootWindow(MessagePumpDispatcher* dispatcher); | |
| 33 | |
| 34 void RunWithDispatcher(Delegate* delegate, MessagePumpDispatcher* dispatcher); | |
| 35 | |
| 36 // Add / remove an Observer, which will start receiving notifications | |
| 37 // immediately. | |
| 38 void AddObserver(MessagePumpObserver* observer); | |
| 39 void RemoveObserver(MessagePumpObserver* observer); | |
| 40 | |
| 41 // Overridden from MessagePumpDispatcher. | |
| 42 virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; | |
| 43 | |
| 44 private: | |
| 45 virtual ~MessagePumpLinux(); | |
| 46 std::vector<MessagePumpDispatcher*> dispatcher_; | |
| 47 | |
| 48 DISALLOW_COPY_AND_ASSIGN(MessagePumpLinux); | |
| 49 }; | |
| 50 | |
| 51 typedef MessagePumpLinux MessagePumpForUI; | |
| 52 | |
| 53 } // namespace base | |
| 54 | |
| 55 #endif // BASE_MESSAGE_PUMP_LINUX_H_ | |
| OLD | NEW |