| 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_X_H | 5 #ifndef BASE_MESSAGE_PUMP_X_H |
| 6 #define BASE_MESSAGE_PUMP_X_H | 6 #define BASE_MESSAGE_PUMP_X_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 12 matching lines...) Expand all Loading... |
| 23 // The nested loop is exited by either posting a quit, or returning EVENT_QUIT | 23 // The nested loop is exited by either posting a quit, or returning EVENT_QUIT |
| 24 // from Dispatch. | 24 // from Dispatch. |
| 25 class MessagePumpDispatcher { | 25 class MessagePumpDispatcher { |
| 26 public: | 26 public: |
| 27 enum DispatchStatus { | 27 enum DispatchStatus { |
| 28 EVENT_IGNORED, // The event was not processed. | 28 EVENT_IGNORED, // The event was not processed. |
| 29 EVENT_PROCESSED, // The event has been processed. | 29 EVENT_PROCESSED, // The event has been processed. |
| 30 EVENT_QUIT // The event was processed and the message-loop should | 30 EVENT_QUIT // The event was processed and the message-loop should |
| 31 // terminate. | 31 // terminate. |
| 32 }; | 32 }; |
| 33 virtual ~MessagePumpDispatcher() {} |
| 33 | 34 |
| 34 // Dispatches the event. EVENT_IGNORED is returned if the event was ignored | 35 // Dispatches the event. EVENT_IGNORED is returned if the event was ignored |
| 35 // (i.e. not processed). EVENT_PROCESSED is returned if the event was | 36 // (i.e. not processed). EVENT_PROCESSED is returned if the event was |
| 36 // processed. The nested loop exits immediately if EVENT_QUIT is returned. | 37 // processed. The nested loop exits immediately if EVENT_QUIT is returned. |
| 37 virtual DispatchStatus Dispatch(XEvent* xevent) = 0; | 38 virtual DispatchStatus Dispatch(XEvent* xevent) = 0; |
| 38 | |
| 39 protected: | |
| 40 virtual ~MessagePumpDispatcher() {} | |
| 41 }; | 39 }; |
| 42 | 40 |
| 43 // This class implements a message-pump for dispatching X events. | 41 // This class implements a message-pump for dispatching X events. |
| 44 class BASE_EXPORT MessagePumpX : public MessagePumpGlib { | 42 class BASE_EXPORT MessagePumpX : public MessagePumpGlib { |
| 45 public: | 43 public: |
| 46 MessagePumpX(); | 44 MessagePumpX(); |
| 47 virtual ~MessagePumpX(); | 45 virtual ~MessagePumpX(); |
| 48 | 46 |
| 49 // Returns default X Display. | 47 // Returns default X Display. |
| 50 static Display* GetDefaultXDisplay(); | 48 static Display* GetDefaultXDisplay(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 80 scoped_ptr<GPollFD> x_poll_; | 78 scoped_ptr<GPollFD> x_poll_; |
| 81 | 79 |
| 82 DISALLOW_COPY_AND_ASSIGN(MessagePumpX); | 80 DISALLOW_COPY_AND_ASSIGN(MessagePumpX); |
| 83 }; | 81 }; |
| 84 | 82 |
| 85 typedef MessagePumpX MessagePumpForUI; | 83 typedef MessagePumpX MessagePumpForUI; |
| 86 | 84 |
| 87 } // namespace base | 85 } // namespace base |
| 88 | 86 |
| 89 #endif // BASE_MESSAGE_PUMP_X_H | 87 #endif // BASE_MESSAGE_PUMP_X_H |
| OLD | NEW |