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