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
3 // found in the LICENSE file.
5 #ifndef BASE_MESSAGE_PUMP_WAYLAND_H_
6 #define BASE_MESSAGE_PUMP_WAYLAND_H_
9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_pump_glib.h"
12 typedef struct _GMainContext GMainContext
;
13 typedef struct _GPollFD GPollFD
;
14 typedef struct _GSource GSource
;
22 // The documentation for this class is in message_pump_glib.h
23 class BASE_EXPORT MessagePumpObserver
{
26 EVENT_CONTINUE
, // The event should be dispatched as normal.
27 EVENT_HANDLED
// The event should not be processed any farther.
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(ui::WaylandEvent
* event
);
37 virtual ~MessagePumpObserver() {}
40 // The documentation for this class is in message_pump_glib.h
42 // The nested loop is exited by either posting a quit, or returning false
44 class MessagePumpDispatcher
{
47 EVENT_IGNORED
, // The event was not processed.
48 EVENT_PROCESSED
, // The event has been processed.
49 EVENT_QUIT
// The event was processed and the message-loop should
53 // Dispatches the event. If true is returned processing continues as
54 // normal. If false is returned, the nested loop exits immediately.
55 virtual DispatchStatus
Dispatch(ui::WaylandEvent
* event
) = 0;
58 virtual ~MessagePumpDispatcher() {}
61 class BASE_EXPORT MessagePumpWayland
: public MessagePumpGlib
{
65 virtual ~MessagePumpWayland();
67 // Overridden from MessagePumpGlib
68 virtual bool RunOnce(GMainContext
* context
, bool block
) OVERRIDE
;
71 // This is a GLib structure that we can add event sources to.
72 GMainContext
* context_
;
74 DISALLOW_COPY_AND_ASSIGN(MessagePumpWayland
);
77 typedef MessagePumpWayland MessagePumpForUI
;
81 #endif // BASE_MESSAGE_PUMP_WAYLAND_H_