OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_AURAX11_H | 5 #ifndef BASE_MESSAGE_LOOP_MESSAGE_PUMP_AURAX11_H |
6 #define BASE_MESSAGE_PUMP_AURAX11_H | 6 #define BASE_MESSAGE_LOOP_MESSAGE_PUMP_AURAX11_H |
7 | 7 |
8 #include <bitset> | 8 #include <bitset> |
9 #include <map> | 9 #include <map> |
10 | 10 |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/message_pump.h" | 12 #include "base/message_loop/message_pump.h" |
13 #include "base/message_pump_glib.h" | 13 #include "base/message_loop/message_pump_dispatcher.h" |
14 #include "base/message_pump_dispatcher.h" | 14 #include "base/message_loop/message_pump_glib.h" |
15 #include "base/message_pump_observer.h" | 15 #include "base/message_loop/message_pump_observer.h" |
16 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
17 | 17 |
18 // It would be nice to include the X11 headers here so that we use Window | 18 // It would be nice to include the X11 headers here so that we use Window |
19 // instead of its typedef of unsigned long, but we can't because everything in | 19 // instead of its typedef of unsigned long, but we can't because everything in |
20 // chrome includes us through base/message_loop.h, and X11's crappy #define | 20 // chrome includes us through base/message_loop.h, and X11's crappy #define |
21 // heavy headers muck up half of chrome. | 21 // heavy headers muck up half of chrome. |
22 | 22 |
23 typedef struct _GPollFD GPollFD; | 23 typedef struct _GPollFD GPollFD; |
24 typedef struct _GSource GSource; | 24 typedef struct _GSource GSource; |
25 typedef struct _XDisplay Display; | 25 typedef struct _XDisplay Display; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // of message processing. | 85 // of message processing. |
86 bool ProcessXEvent(MessagePumpDispatcher* dispatcher, XEvent* event); | 86 bool ProcessXEvent(MessagePumpDispatcher* dispatcher, XEvent* event); |
87 | 87 |
88 // Sends the event to the observers. If an observer returns true, then it does | 88 // Sends the event to the observers. If an observer returns true, then it does |
89 // not send the event to any other observers and returns true. Returns false | 89 // not send the event to any other observers and returns true. Returns false |
90 // if no observer returns true. | 90 // if no observer returns true. |
91 bool WillProcessXEvent(XEvent* xevent); | 91 bool WillProcessXEvent(XEvent* xevent); |
92 void DidProcessXEvent(XEvent* xevent); | 92 void DidProcessXEvent(XEvent* xevent); |
93 | 93 |
94 // Returns the Dispatcher based on the event's target window. | 94 // Returns the Dispatcher based on the event's target window. |
95 MessagePumpDispatcher* GetDispatcherForXEvent( | 95 MessagePumpDispatcher* GetDispatcherForXEvent(const NativeEvent& xev) const; |
96 const base::NativeEvent& xev) const; | |
97 | 96 |
98 // Overridden from MessagePumpDispatcher: | 97 // Overridden from MessagePumpDispatcher: |
99 virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; | 98 virtual bool Dispatch(const NativeEvent& event) OVERRIDE; |
100 | 99 |
101 // The event source for X events. | 100 // The event source for X events. |
102 GSource* x_source_; | 101 GSource* x_source_; |
103 | 102 |
104 // The poll attached to |x_source_|. | 103 // The poll attached to |x_source_|. |
105 scoped_ptr<GPollFD> x_poll_; | 104 scoped_ptr<GPollFD> x_poll_; |
106 | 105 |
107 DispatchersMap dispatchers_; | 106 DispatchersMap dispatchers_; |
108 | 107 |
109 // Dispatch calls can cause addition of new dispatchers as we iterate | 108 // Dispatch calls can cause addition of new dispatchers as we iterate |
110 // through them. Use ObserverList to ensure the iterator remains valid across | 109 // through them. Use ObserverList to ensure the iterator remains valid across |
111 // additions. | 110 // additions. |
112 ObserverList<MessagePumpDispatcher> root_window_dispatchers_; | 111 ObserverList<MessagePumpDispatcher> root_window_dispatchers_; |
113 | 112 |
114 unsigned long x_root_window_; | 113 unsigned long x_root_window_; |
115 | 114 |
116 DISALLOW_COPY_AND_ASSIGN(MessagePumpAuraX11); | 115 DISALLOW_COPY_AND_ASSIGN(MessagePumpAuraX11); |
117 }; | 116 }; |
118 | 117 |
119 typedef MessagePumpAuraX11 MessagePumpForUI; | 118 typedef MessagePumpAuraX11 MessagePumpForUI; |
120 | 119 |
121 } // namespace base | 120 } // namespace base |
122 | 121 |
123 #endif // BASE_MESSAGE_PUMP_AURAX11_H | 122 #endif // BASE_MESSAGE_LOOP_MESSAGE_PUMP_AURAX11_H |
OLD | NEW |