| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_WAYLAND_H_ | 5 #ifndef BASE_MESSAGE_PUMP_WAYLAND_H_ |
| 6 #define BASE_MESSAGE_PUMP_WAYLAND_H_ | 6 #define BASE_MESSAGE_PUMP_WAYLAND_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_pump_glib.h" | 10 #include "base/message_pump_glib.h" |
| 11 #include "base/message_pump_observer.h" |
| 11 | 12 |
| 12 typedef struct _GMainContext GMainContext; | 13 typedef struct _GMainContext GMainContext; |
| 13 typedef struct _GPollFD GPollFD; | 14 typedef struct _GPollFD GPollFD; |
| 14 typedef struct _GSource GSource; | 15 typedef struct _GSource GSource; |
| 15 | 16 |
| 16 namespace base { | 17 namespace base { |
| 17 | 18 |
| 18 namespace wayland { | 19 namespace wayland { |
| 19 union WaylandEvent; | 20 union WaylandEvent; |
| 20 } | 21 } |
| 21 | 22 |
| 22 // The documentation for this class is in message_pump_glib.h | 23 // The documentation for this class is in message_pump_glib.h |
| 23 class BASE_EXPORT MessagePumpObserver { | |
| 24 public: | |
| 25 enum EventStatus { | |
| 26 EVENT_CONTINUE, // The event should be dispatched as normal. | |
| 27 EVENT_HANDLED // The event should not be processed any farther. | |
| 28 }; | |
| 29 | |
| 30 // This method is called before processing an Event. If the method returns | |
| 31 // EVENT_HANDLED, it indicates the event has already been handled, so the | |
| 32 // event is not processed any farther. If the method returns EVENT_CONTINUE, | |
| 33 // the event dispatching proceeds as normal. | |
| 34 virtual EventStatus WillProcessEvent(wayland::WaylandEvent* event); | |
| 35 | |
| 36 protected: | |
| 37 virtual ~MessagePumpObserver() {} | |
| 38 }; | |
| 39 | |
| 40 // The documentation for this class is in message_pump_glib.h | |
| 41 // | 24 // |
| 42 // The nested loop is exited by either posting a quit, or returning false | 25 // The nested loop is exited by either posting a quit, or returning false |
| 43 // from Dispatch. | 26 // from Dispatch. |
| 44 class MessagePumpDispatcher { | 27 class MessagePumpDispatcher { |
| 45 public: | 28 public: |
| 46 enum DispatchStatus { | 29 enum DispatchStatus { |
| 47 EVENT_IGNORED, // The event was not processed. | 30 EVENT_IGNORED, // The event was not processed. |
| 48 EVENT_PROCESSED, // The event has been processed. | 31 EVENT_PROCESSED, // The event has been processed. |
| 49 EVENT_QUIT // The event was processed and the message-loop should | 32 EVENT_QUIT // The event was processed and the message-loop should |
| 50 // terminate. | 33 // terminate. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 72 GMainContext* context_; | 55 GMainContext* context_; |
| 73 | 56 |
| 74 DISALLOW_COPY_AND_ASSIGN(MessagePumpWayland); | 57 DISALLOW_COPY_AND_ASSIGN(MessagePumpWayland); |
| 75 }; | 58 }; |
| 76 | 59 |
| 77 typedef MessagePumpWayland MessagePumpForUI; | 60 typedef MessagePumpWayland MessagePumpForUI; |
| 78 | 61 |
| 79 } // namespace base | 62 } // namespace base |
| 80 | 63 |
| 81 #endif // BASE_MESSAGE_PUMP_WAYLAND_H_ | 64 #endif // BASE_MESSAGE_PUMP_WAYLAND_H_ |
| OLD | NEW |