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