Chromium Code Reviews| 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_PUMP_AURAX11_H |
| 6 #define BASE_MESSAGE_PUMP_AURAX11_H | 6 #define BASE_MESSAGE_PUMP_AURAX11_H |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_pump.h" | 9 #include "base/message_pump.h" |
| 10 #include "base/message_pump_glib.h" | 10 #include "base/message_pump_glib.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 70 // dropped on the floor. This method exists because mapping a window is | 70 // dropped on the floor. This method exists because mapping a window is |
| 71 // asynchronous (and we receive an XEvent when mapped), while there are also | 71 // asynchronous (and we receive an XEvent when mapped), while there are also |
| 72 // functions which require a mapped window. | 72 // functions which require a mapped window. |
| 73 void BlockUntilWindowMapped(unsigned long xid); | 73 void BlockUntilWindowMapped(unsigned long xid); |
| 74 | 74 |
| 75 protected: | 75 protected: |
| 76 virtual ~MessagePumpAuraX11(); | 76 virtual ~MessagePumpAuraX11(); |
| 77 | 77 |
| 78 private: | 78 private: |
| 79 typedef std::map<unsigned long, MessagePumpDispatcher*> DispatchersMap; | 79 typedef std::map<unsigned long, MessagePumpDispatcher*> DispatchersMap; |
| 80 typedef std::vector<MessagePumpDispatcher*> Dispatchers; | |
| 81 | 80 |
| 82 // Initializes the glib event source for X. | 81 // Initializes the glib event source for X. |
| 83 void InitXSource(); | 82 void InitXSource(); |
| 84 | 83 |
| 85 // Dispatches the XEvent and returns true if we should exit the current loop | 84 // Dispatches the XEvent and returns true if we should exit the current loop |
| 86 // of message processing. | 85 // of message processing. |
| 87 bool ProcessXEvent(MessagePumpDispatcher* dispatcher, XEvent* event); | 86 bool ProcessXEvent(MessagePumpDispatcher* dispatcher, XEvent* event); |
| 88 | 87 |
| 89 // 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 |
| 90 // 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 |
| 91 // if no observer returns true. | 90 // if no observer returns true. |
| 92 bool WillProcessXEvent(XEvent* xevent); | 91 bool WillProcessXEvent(XEvent* xevent); |
| 93 void DidProcessXEvent(XEvent* xevent); | 92 void DidProcessXEvent(XEvent* xevent); |
| 94 | 93 |
| 95 // Returns the Dispatcher based on the event's target window. | 94 // Returns the Dispatcher based on the event's target window. |
| 96 MessagePumpDispatcher* GetDispatcherForXEvent( | 95 MessagePumpDispatcher* GetDispatcherForXEvent( |
| 97 const base::NativeEvent& xev) const; | 96 const base::NativeEvent& xev) const; |
| 98 | 97 |
| 99 // Overridden from MessagePumpDispatcher: | 98 // Overridden from MessagePumpDispatcher: |
| 100 virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; | 99 virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; |
| 101 | 100 |
| 102 // The event source for X events. | 101 // The event source for X events. |
| 103 GSource* x_source_; | 102 GSource* x_source_; |
| 104 | 103 |
| 105 // The poll attached to |x_source_|. | 104 // The poll attached to |x_source_|. |
| 106 scoped_ptr<GPollFD> x_poll_; | 105 scoped_ptr<GPollFD> x_poll_; |
| 107 | 106 |
| 108 DispatchersMap dispatchers_; | 107 DispatchersMap dispatchers_; |
| 109 Dispatchers root_window_dispatchers_; | 108 ObserverList<MessagePumpDispatcher> root_window_dispatchers_; |
|
oshima
2012/12/18 20:38:33
Please add comment why we're using ObserverList fo
| |
| 110 | 109 |
| 111 unsigned long x_root_window_; | 110 unsigned long x_root_window_; |
| 112 | 111 |
| 113 DISALLOW_COPY_AND_ASSIGN(MessagePumpAuraX11); | 112 DISALLOW_COPY_AND_ASSIGN(MessagePumpAuraX11); |
| 114 }; | 113 }; |
| 115 | 114 |
| 116 typedef MessagePumpAuraX11 MessagePumpForUI; | 115 typedef MessagePumpAuraX11 MessagePumpForUI; |
| 117 | 116 |
| 118 } // namespace base | 117 } // namespace base |
| 119 | 118 |
| 120 #endif // BASE_MESSAGE_PUMP_AURAX11_H | 119 #endif // BASE_MESSAGE_PUMP_AURAX11_H |
| OLD | NEW |