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.
5 #ifndef BASE_MESSAGE_PUMP_LINUX_H_
6 #define BASE_MESSAGE_PUMP_LINUX_H_
9 #include "base/message_pump.h"
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"
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
{
26 virtual ~MessagePumpLinux();
28 // Returns the UI message pump.
29 static MessagePumpLinux
* Current();
31 // Add/Remove the root window dispatcher.
32 void AddDispatcherForRootWindow(MessagePumpDispatcher
* dispatcher
);
33 void RemoveDispatcherForRootWindow(MessagePumpDispatcher
* dispatcher
);
35 void RunWithDispatcher(Delegate
* delegate
, MessagePumpDispatcher
* dispatcher
);
37 // Add / remove an Observer, which will start receiving notifications
39 void AddObserver(MessagePumpObserver
* observer
);
40 void RemoveObserver(MessagePumpObserver
* observer
);
42 // Overridden from MessagePumpDispatcher.
43 virtual bool Dispatch(const base::NativeEvent
& event
) OVERRIDE
;
46 std::vector
<MessagePumpDispatcher
*> dispatcher_
;
48 DISALLOW_COPY_AND_ASSIGN(MessagePumpLinux
);
51 typedef MessagePumpLinux MessagePumpForUI
;
55 #endif // BASE_MESSAGE_PUMP_LINUX_H_